Browse Source

:rotating_light:

Vanessa 2 years ago
parent
commit
b2ba9ace07

+ 5 - 5
app/src/config/about.ts

@@ -391,13 +391,13 @@ export const about = {
         });
         about.element.querySelector("#aboutConfirm").addEventListener("click", () => {
             const scheme = (about.element.querySelector("#aboutScheme") as HTMLInputElement).value;
-            const host = (about.element.querySelector("#aboutHost") as HTMLInputElement).value
+            const host = (about.element.querySelector("#aboutHost") as HTMLInputElement).value;
             const port = (about.element.querySelector("#aboutPort") as HTMLInputElement).value;
             fetchPost("/api/system/setNetworkProxy", {scheme, host, port}, () => {
-                window.siyuan.config.system.networkProxy.scheme = scheme
-                window.siyuan.config.system.networkProxy.host = host
-                window.siyuan.config.system.networkProxy.port = port
-                setProxy()
+                window.siyuan.config.system.networkProxy.scheme = scheme;
+                window.siyuan.config.system.networkProxy.host = host;
+                window.siyuan.config.system.networkProxy.port = port;
+                setProxy();
             });
         });
     }

+ 1 - 2
app/src/menus/protyle.ts

@@ -45,7 +45,6 @@ import {exportAsset} from "./util";
 import {removeLink} from "../protyle/toolbar/Link";
 import {alignImgCenter, alignImgLeft} from "../protyle/wysiwyg/commonHotkey";
 import {getEnableHTML} from "../protyle/wysiwyg/removeEmbed";
-import {getContenteditableElement} from "../protyle/wysiwyg/getBlock";
 
 export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
     const nodeElement = hasClosestBlock(element);
@@ -319,7 +318,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
                     }
                 });
                 if (protyle.disabled) {
-                    html = getEnableHTML(html)
+                    html = getEnableHTML(html);
                 }
                 const tempElement = document.createElement("template");
                 tempElement.innerHTML = protyle.lute.BlockDOM2HTML(html);

+ 3 - 3
app/src/protyle/gutter/index.ts

@@ -608,7 +608,7 @@ export class Gutter {
                         html += item.outerHTML;
                     });
                     if (protyle.disabled) {
-                        html = getEnableHTML(html)
+                        html = getEnableHTML(html);
                     }
                     writeText(protyle.lute.BlockDOM2HTML(html));
                 }
@@ -983,9 +983,9 @@ export class Gutter {
             }, {
                 label: window.siyuan.languages.copy + " HTML",
                 click() {
-                    let html = nodeElement.outerHTML
+                    let html = nodeElement.outerHTML;
                     if (protyle.disabled) {
-                        html = getEnableHTML(html)
+                        html = getEnableHTML(html);
                     }
                     writeText(protyle.lute.BlockDOM2HTML(html));
                 }

+ 1 - 3
app/src/protyle/toolbar/index.ts

@@ -21,7 +21,7 @@ import {highlightRender} from "../markdown/highlightRender";
 import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
 import {processRender} from "../util/processCode";
 import {BlockRef} from "./BlockRef";
-import {hintMoveBlock, hintRenderAssets, hintRenderTemplate, hintRenderWidget} from "../hint/extend";
+import {hintRenderAssets, hintRenderTemplate, hintRenderWidget} from "../hint/extend";
 import {blockRender} from "../markdown/blockRender";
 /// #if !BROWSER
 import {clipboard, nativeImage, NativeImage} from "electron";
@@ -33,8 +33,6 @@ import {isArrayEqual, isBrowser, isMobile} from "../../util/functions";
 import * as dayjs from "dayjs";
 import {insertEmptyBlock} from "../../block/util";
 import {matchHotKey} from "../util/hotKey";
-import {unicode2Emoji} from "../../emoji";
-import {escapeHtml} from "../../util/escape";
 import {hideElements} from "../ui/hideElements";
 import {renderAssetsPreview} from "../../asset/renderAssets";
 import {electronUndo} from "../undo";

+ 11 - 11
app/src/protyle/util/editorCommonEvent.ts

@@ -24,7 +24,7 @@ const moveToNew = (protyle: IProtyle, sourceElements: Element[], targetElement:
                    isSameDoc: boolean, isBottom: boolean, isCopy: boolean) => {
     let topSourceElement;
     const targetId = targetElement.getAttribute("data-node-id");
-    const newSourceId = newSourceElement.getAttribute("data-node-id")
+    const newSourceId = newSourceElement.getAttribute("data-node-id");
     const doOperations: IOperation[] = [];
     const undoOperations: IOperation[] = [];
     targetElement.insertAdjacentElement(isBottom ? "afterend" : "beforebegin", newSourceElement);
@@ -34,24 +34,24 @@ const moveToNew = (protyle: IProtyle, sourceElements: Element[], targetElement:
             data: newSourceElement.outerHTML,
             id: newSourceId,
             previousID: targetId,
-        })
+        });
     } else {
         doOperations.push({
             action: "insert",
             data: newSourceElement.outerHTML,
             id: newSourceId,
             nextID: targetId,
-        })
+        });
     }
     sourceElements.reverse().forEach((item, index) => {
-        const itemId = item.getAttribute("data-node-id")
+        const itemId = item.getAttribute("data-node-id");
         if (index === sourceElements.length - 1) {
             topSourceElement = getTopAloneElement(item);
             if (topSourceElement.isSameNode(item)) {
                 topSourceElement = undefined;
             }
         }
-        const copyId = Lute.NewNodeID()
+        const copyId = Lute.NewNodeID();
         if (isCopy) {
             undoOperations.push({
                 action: "delete",
@@ -119,7 +119,7 @@ const moveToNew = (protyle: IProtyle, sourceElements: Element[], targetElement:
         undoOperations,
         topSourceElement,
     };
-}
+};
 
 const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElement: Element,
                       isSameDoc: boolean, position: InsertPosition, isCopy: boolean) => {
@@ -147,8 +147,8 @@ const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElemen
                 foldHeadingIds.push({id, parentID});
             }
         }
-        let copyId
-        let copyElement
+        let copyId;
+        let copyElement;
         if (isCopy) {
             copyId = Lute.NewNodeID();
             undoOperations.push({
@@ -262,7 +262,7 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemen
         parentID: sbElement.parentElement.getAttribute("data-node-id") || protyle.block.parentID || protyle.block.rootID
     }];
     if (newSourceElement) {
-        const newSourceId = newSourceElement.getAttribute("data-node-id")
+        const newSourceId = newSourceElement.getAttribute("data-node-id");
         sbElement.insertAdjacentElement("afterbegin", targetElement);
         doOperations.push({
             action: "move",
@@ -293,7 +293,7 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemen
                     topSourceElement = undefined;
                 }
             }
-            const copyId = Lute.NewNodeID()
+            const copyId = Lute.NewNodeID();
             if (isCopy) {
                 undoOperations.push({
                     action: "delete",
@@ -355,7 +355,7 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemen
                     topSourceElement = undefined;
                 }
             }
-            const copyId = Lute.NewNodeID()
+            const copyId = Lute.NewNodeID();
             if (index === 0) {
                 afterPreviousID = isCopy ? copyId : id;
             }

+ 1 - 1
app/src/protyle/wysiwyg/index.ts

@@ -278,7 +278,7 @@ export class WYSIWYG {
                 }
             }
             if (protyle.disabled) {
-                html = getEnableHTML(html)
+                html = getEnableHTML(html);
             }
             event.clipboardData.setData("text/plain", textPlain || protyle.lute.BlockDOM2StdMd(html).trimEnd());
             event.clipboardData.setData("text/html", html + Constants.ZWSP);

+ 1 - 1
app/src/protyle/wysiwyg/removeEmbed.ts

@@ -23,4 +23,4 @@ export const getEnableHTML = (html: string) => {
         }
     });
     return tempElement.innerHTML;
-}
+};

+ 2 - 2
app/src/util/globalShortcut.ts

@@ -804,9 +804,9 @@ const editKeydown = (event: KeyboardEvent) => {
         if (protyle.title?.editElement.contains(range.startContainer)) {
             movePathTo([protyle.path], range);
         } else if (nodeElement && range && protyle.element.contains(range.startContainer)) {
-            let selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"))
+            let selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
             if (selectElements.length === 0) {
-                selectElements = [nodeElement]
+                selectElements = [nodeElement];
             }
             movePathTo([], undefined, (toPath) => {
                 hintMoveBlock(toPath, selectElements, protyle);

+ 2 - 2
app/src/util/onGetConfig.ts

@@ -92,12 +92,12 @@ export const setProxy = () => {
     /// #if !BROWSER
     if ("" === window.siyuan.config.system.networkProxy.scheme) {
         console.log("network proxy [system]");
-        return
+        return;
     }
 
     const session = getCurrentWindow().webContents.session;
     session.closeAllConnections().then(() => {
-        const proxyURL = `${window.siyuan.config.system.networkProxy.scheme}://${window.siyuan.config.system.networkProxy.host}:${window.siyuan.config.system.networkProxy.port}`
+        const proxyURL = `${window.siyuan.config.system.networkProxy.scheme}://${window.siyuan.config.system.networkProxy.host}:${window.siyuan.config.system.networkProxy.port}`;
         session.setProxy({proxyRules: proxyURL}).then(
             () => console.log("network proxy [" + proxyURL + "]"),
         );

+ 6 - 6
app/src/util/pathName.ts

@@ -119,7 +119,7 @@ export const movePathTo = (paths?: string[], range?: Range, cb?: (toPath:string)
     });
     if (paths.length) {
         fetchPost("/api/filetree/getHPathsByPaths", {paths}, (response) => {
-            dialog.element.querySelector(".b3-dialog__header .ft__smaller").innerHTML = escapeHtml(response.data.join(", "))
+            dialog.element.querySelector(".b3-dialog__header .ft__smaller").innerHTML = escapeHtml(response.data.join(", "));
         });
     }
     const searchListElement = dialog.element.querySelector("#foldList");
@@ -151,7 +151,7 @@ export const movePathTo = (paths?: string[], range?: Range, cb?: (toPath:string)
         }
         searchTreeElement.classList.add("fn__none");
         searchListElement.classList.remove("fn__none");
-        searchListElement.scrollTo(0, 0)
+        searchListElement.scrollTo(0, 0);
         fetchPost("/api/filetree/searchDocs", {
             k: inputElement.value
         }, (data) => {
@@ -352,14 +352,14 @@ export const movePathTo = (paths?: string[], range?: Range, cb?: (toPath:string)
                     return;
                 }
                 currentItemElement.classList.remove("b3-list-item--focus");
-                target.classList.add("b3-list-item--focus")
+                target.classList.add("b3-list-item--focus");
                 event.preventDefault();
                 event.stopPropagation();
                 break;
             }
             target = target.parentElement;
         }
-        inputElement.focus()
+        inputElement.focus();
     });
 };
 
@@ -378,7 +378,7 @@ const getLeaf = (liElement: HTMLElement) => {
         return;
     }
 
-    const notebookId = liElement.getAttribute("data-box")
+    const notebookId = liElement.getAttribute("data-box");
     fetchPost("/api/filetree/listDocsByPath", {
         notebook: notebookId,
         path: liElement.getAttribute("data-path"),
@@ -418,7 +418,7 @@ data-box="${notebookId}" class="b3-list-item" data-path="${item.path}">
             }, 120);
         }, 2);
     });
-}
+};
 
 export const getNotebookName = (id: string) => {
     let rootPath = "";