Browse Source

:rotating_light:

Vanessa 1 year ago
parent
commit
2c36af78bc

+ 7 - 7
app/electron/main.js

@@ -20,7 +20,7 @@ const {
 const path = require("path");
 const path = require("path");
 const fs = require("fs");
 const fs = require("fs");
 const gNet = require("net");
 const gNet = require("net");
-const remote = require('@electron/remote/main');
+const remote = require("@electron/remote/main");
 
 
 process.noAsar = true;
 process.noAsar = true;
 const appDir = path.dirname(app.getAppPath());
 const appDir = path.dirname(app.getAppPath());
@@ -657,7 +657,7 @@ app.whenReady().then(() => {
         resetTrayMenu(tray, lang, mainWindow);
         resetTrayMenu(tray, lang, mainWindow);
     };
     };
     const getWindowByContentId = (id) => {
     const getWindowByContentId = (id) => {
-        return BrowserWindow.fromId(BrowserWindow.getAllWindows().find((win) => win.webContents.id === id).id)
+        return BrowserWindow.fromId(BrowserWindow.getAllWindows().find((win) => win.webContents.id === id).id);
     };
     };
 
 
     ipcMain.on("siyuan-open-folder", (event, filePath) => {
     ipcMain.on("siyuan-open-folder", (event, filePath) => {
@@ -702,7 +702,7 @@ app.whenReady().then(() => {
                     return true;
                     return true;
                 }
                 }
             });
             });
-            return hasMatch
+            return hasMatch;
         }
         }
     });
     });
     ipcMain.once("siyuan-event", (event) => {
     ipcMain.once("siyuan-event", (event) => {
@@ -727,14 +727,14 @@ app.whenReady().then(() => {
         currentWindow.on("leave-full-screen", () => {
         currentWindow.on("leave-full-screen", () => {
             event.sender.send("siyuan-event", "leave-full-screen");
             event.sender.send("siyuan-event", "leave-full-screen");
         });
         });
-    })
+    });
     ipcMain.on("siyuan-cmd", (event, data) => {
     ipcMain.on("siyuan-cmd", (event, data) => {
         let cmd = data;
         let cmd = data;
-        let webContentsId = event.sender.id
+        let webContentsId = event.sender.id;
         if (typeof data !== "string") {
         if (typeof data !== "string") {
             cmd = data.cmd;
             cmd = data.cmd;
             if (data.webContentsId) {
             if (data.webContentsId) {
-                webContentsId = data.webContentsId
+                webContentsId = data.webContentsId;
             }
             }
         }
         }
         const currentWindow = getWindowByContentId(webContentsId);
         const currentWindow = getWindowByContentId(webContentsId);
@@ -941,7 +941,7 @@ app.whenReady().then(() => {
             // 系统托盘
             // 系统托盘
             tray = new Tray(path.join(appDir, "stage", "icon-large.png"));
             tray = new Tray(path.join(appDir, "stage", "icon-large.png"));
             tray.setToolTip(`${path.basename(data.workspaceDir)} - SiYuan v${appVer}`);
             tray.setToolTip(`${path.basename(data.workspaceDir)} - SiYuan v${appVer}`);
-            const mainWindow = getWindowByContentId(event.sender.id)
+            const mainWindow = getWindowByContentId(event.sender.id);
             resetTrayMenu(tray, data.languages, mainWindow);
             resetTrayMenu(tray, data.languages, mainWindow);
             tray.on("click", () => {
             tray.on("click", () => {
                 showHideWindow(tray, data.languages, mainWindow);
                 showHideWindow(tray, data.languages, mainWindow);

+ 1 - 1
app/src/boot/globalEvent/click.ts

@@ -41,7 +41,7 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {
 
 
     const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");
     const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");
     if (copyElement) {
     if (copyElement) {
-        let text = copyElement.parentElement.nextElementSibling.textContent.trimEnd()
+        let text = copyElement.parentElement.nextElementSibling.textContent.trimEnd();
         text = text.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382
         text = text.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382
         writeText(text);
         writeText(text);
         showMessage(window.siyuan.languages.copied, 2000);
         showMessage(window.siyuan.languages.copied, 2000);

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

@@ -196,7 +196,7 @@ export const initWindow = async (app: App) => {
         });
         });
     };
     };
 
 
-    ipcRenderer.send(Constants.SIYUAN_EVENT, "onEvent")
+    ipcRenderer.send(Constants.SIYUAN_EVENT, "onEvent");
     ipcRenderer.on(Constants.SIYUAN_EVENT, (event, cmd) => {
     ipcRenderer.on(Constants.SIYUAN_EVENT, (event, cmd) => {
         if (cmd === "focus") {
         if (cmd === "focus") {
             if (getSelection().rangeCount > 0) {
             if (getSelection().rangeCount > 0) {
@@ -227,7 +227,7 @@ export const initWindow = async (app: App) => {
                     document.getElementById("toolbar").style.paddingLeft = "0";
                     document.getElementById("toolbar").style.paddingLeft = "0";
                 }
                 }
             } else {
             } else {
-                winOnMaxRestore()
+                winOnMaxRestore();
             }
             }
         } else if (cmd === "leave-full-screen") {
         } else if (cmd === "leave-full-screen") {
             if ("darwin" === window.siyuan.config.system.os) {
             if ("darwin" === window.siyuan.config.system.os) {

+ 1 - 1
app/src/editor/util.ts

@@ -178,7 +178,7 @@ export const openFile = async (options: IOpenFileOptions) => {
     hasMatch = await ipcRenderer.invoke(Constants.SIYUAN_GET, {
     hasMatch = await ipcRenderer.invoke(Constants.SIYUAN_GET, {
         cmd: Constants.SIYUAN_OPEN_FILE,
         cmd: Constants.SIYUAN_OPEN_FILE,
         options: optionsClone,
         options: optionsClone,
-    })
+    });
     if (hasMatch) {
     if (hasMatch) {
         if (options.afterOpen) {
         if (options.afterOpen) {
             options.afterOpen();
             options.afterOpen();

+ 2 - 2
app/src/emoji/index.ts

@@ -232,7 +232,7 @@ export const openEmojiPanel = (id: string, type: "doc" | "notebook" | "av", posi
 </div>`
 </div>`
     });
     });
     dialog.element.querySelector(".b3-dialog__container").setAttribute("data-menu", "true");
     dialog.element.querySelector(".b3-dialog__container").setAttribute("data-menu", "true");
-    const dialogElement = dialog.element.querySelector(".b3-dialog") as HTMLElement
+    const dialogElement = dialog.element.querySelector(".b3-dialog") as HTMLElement;
     dialogElement.style.justifyContent = "inherit";
     dialogElement.style.justifyContent = "inherit";
     dialogElement.style.alignItems = "inherit";
     dialogElement.style.alignItems = "inherit";
     setPosition(dialog.element.querySelector(".b3-dialog__container"), position.x, position.y, position.h, position.w);
     setPosition(dialog.element.querySelector(".b3-dialog__container"), position.x, position.y, position.h, position.w);
@@ -405,7 +405,7 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
             if (emojiElement) {
             if (emojiElement) {
                 unicode = emojiElement.getAttribute("data-unicode");
                 unicode = emojiElement.getAttribute("data-unicode");
                 if (type !== "av") {
                 if (type !== "av") {
-                    dialog.destroy()
+                    dialog.destroy();
                 }
                 }
             } else {
             } else {
                 // 随机
                 // 随机

+ 1 - 1
app/src/mobile/index.ts

@@ -64,7 +64,7 @@ class App {
             }
             }
             const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");
             const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");
             if (copyElement) {
             if (copyElement) {
-                let text = copyElement.parentElement.nextElementSibling.textContent.trimEnd()
+                let text = copyElement.parentElement.nextElementSibling.textContent.trimEnd();
                 text = text.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382
                 text = text.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382
                 writeText(text);
                 writeText(text);
                 showMessage(window.siyuan.languages.copied, 2000);
                 showMessage(window.siyuan.languages.copied, 2000);

+ 2 - 2
app/src/protyle/breadcrumb/index.ts

@@ -271,12 +271,12 @@ export class Breadcrumb {
                         click: async () => {
                         click: async () => {
                             /// #if !BROWSER
                             /// #if !BROWSER
                             if (window.siyuan.config.system.os === "darwin") {
                             if (window.siyuan.config.system.os === "darwin") {
-                                const status = await ipcRenderer.invoke(Constants.SIYUAN_GET, {cmd: "getMicrophone"})
+                                const status = await ipcRenderer.invoke(Constants.SIYUAN_GET, {cmd: "getMicrophone"});
                                 if (["denied", "restricted", "unknown"].includes(status)) {
                                 if (["denied", "restricted", "unknown"].includes(status)) {
                                     showMessage(window.siyuan.languages.microphoneDenied);
                                     showMessage(window.siyuan.languages.microphoneDenied);
                                     return;
                                     return;
                                 } else if (status === "not-determined") {
                                 } else if (status === "not-determined") {
-                                    const isAccess = await ipcRenderer.invoke(Constants.SIYUAN_GET, {cmd: "askMicrophone"})
+                                    const isAccess = await ipcRenderer.invoke(Constants.SIYUAN_GET, {cmd: "askMicrophone"});
                                     if (!isAccess) {
                                     if (!isAccess) {
                                         showMessage(window.siyuan.languages.microphoneNotAccess);
                                         showMessage(window.siyuan.languages.microphoneNotAccess);
                                         return;
                                         return;

+ 3 - 3
app/src/protyle/render/av/action.ts

@@ -278,15 +278,15 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
     menu.addSeparator();
     menu.addSeparator();
     const editAttrSubmenu: IMenu[] = [];
     const editAttrSubmenu: IMenu[] = [];
     rowElement.parentElement.querySelectorAll(".av__row--header .av__cell").forEach((cellElement: HTMLElement) => {
     rowElement.parentElement.querySelectorAll(".av__row--header .av__cell").forEach((cellElement: HTMLElement) => {
-        let hideBlock = false
-        const selectElements: HTMLElement[] = Array.from(blockElement.querySelectorAll(`.av__row--select:not(.av__row--header) .av__cell[data-col-id="${cellElement.dataset.colId}"]`))
+        let hideBlock = false;
+        const selectElements: HTMLElement[] = Array.from(blockElement.querySelectorAll(`.av__row--select:not(.av__row--header) .av__cell[data-col-id="${cellElement.dataset.colId}"]`));
         if (cellElement.dataset.dtype === "block") {
         if (cellElement.dataset.dtype === "block") {
             selectElements.find(item => {
             selectElements.find(item => {
                 if (!item.dataset.detached) {
                 if (!item.dataset.detached) {
                     hideBlock = true;
                     hideBlock = true;
                     return true;
                     return true;
                 }
                 }
-            })
+            });
         }
         }
         if (!hideBlock) {
         if (!hideBlock) {
             editAttrSubmenu.push({
             editAttrSubmenu.push({

+ 1 - 1
app/src/protyle/render/av/blockAttr.ts

@@ -9,7 +9,7 @@ export const genAVValueHTML = (value: IAVCellValue) => {
     let html = "";
     let html = "";
     switch (value.type) {
     switch (value.type) {
         case "text":
         case "text":
-            html = `<textarea rows="${value.text.content.split('\n').length}" class="b3-text-field b3-text-field--text fn__flex-1">${value.text.content}</textarea>`;
+            html = `<textarea rows="${value.text.content.split("\n").length}" class="b3-text-field b3-text-field--text fn__flex-1">${value.text.content}</textarea>`;
             break;
             break;
         case "number":
         case "number":
             html = `<input value="${value.number.content}" type="number" class="b3-text-field b3-text-field--text fn__flex-1">`;
             html = `<input value="${value.number.content}" type="number" class="b3-text-field b3-text-field--text fn__flex-1">`;

+ 1 - 1
app/src/protyle/render/av/col.ts

@@ -424,7 +424,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
                         data: cellElement.dataset.icon,
                         data: cellElement.dataset.icon,
                     }]);
                     }]);
                     iconElement.setAttribute("data-icon", unicode);
                     iconElement.setAttribute("data-icon", unicode);
-                    iconElement.innerHTML = unicode ? unicode2Emoji(unicode) : `<svg><use xlink:href="#${getColIconByType(type)}"></use></svg>`
+                    iconElement.innerHTML = unicode ? unicode2Emoji(unicode) : `<svg><use xlink:href="#${getColIconByType(type)}"></use></svg>`;
                     updateAttrViewCellAnimation(cellElement);
                     updateAttrViewCellAnimation(cellElement);
                 });
                 });
                 event.preventDefault();
                 event.preventDefault();

+ 2 - 2
app/src/protyle/render/av/openMenuPanel.ts

@@ -522,8 +522,8 @@ export const openMenuPanel = (options: {
                             avID,
                             avID,
                             data: target.dataset.icon,
                             data: target.dataset.icon,
                         }]);
                         }]);
-                        target.innerHTML = unicode ? unicode2Emoji(unicode) : `<svg><use xlink:href="#${getColIconByType(target.dataset.colType as TAVCol)}"></use></svg>`
-                        updateAttrViewCellAnimation(options.blockElement.querySelector(`.av__row--header .av__cell[data-col-id="${colId}"]`))
+                        target.innerHTML = unicode ? unicode2Emoji(unicode) : `<svg><use xlink:href="#${getColIconByType(target.dataset.colType as TAVCol)}"></use></svg>`;
+                        updateAttrViewCellAnimation(options.blockElement.querySelector(`.av__row--header .av__cell[data-col-id="${colId}"]`));
                     });
                     });
                     event.preventDefault();
                     event.preventDefault();
                     event.stopPropagation();
                     event.stopPropagation();

+ 1 - 1
app/src/protyle/util/selection.ts

@@ -534,7 +534,7 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar
             return false;
             return false;
         }
         }
     } else if (element.classList.contains("av")) {
     } else if (element.classList.contains("av")) {
-        const avTitleElement = element.querySelector(".av__title")
+        const avTitleElement = element.querySelector(".av__title");
         if (avTitleElement) {
         if (avTitleElement) {
             const range = document.createRange();
             const range = document.createRange();
             range.selectNodeContents(avTitleElement);
             range.selectNodeContents(avTitleElement);

+ 0 - 1
app/src/protyle/wysiwyg/keydown.ts

@@ -53,7 +53,6 @@ import {
     upSelect
     upSelect
 } from "./commonHotkey";
 } from "./commonHotkey";
 import {enterBack, fileAnnotationRefMenu, linkMenu, refMenu, setFold, tagMenu, zoomOut} from "../../menus/protyle";
 import {enterBack, fileAnnotationRefMenu, linkMenu, refMenu, setFold, tagMenu, zoomOut} from "../../menus/protyle";
-import {removeEmbed} from "./removeEmbed";
 import {openAttr} from "../../menus/commonMenuItem";
 import {openAttr} from "../../menus/commonMenuItem";
 import {Constants} from "../../constants";
 import {Constants} from "../../constants";
 import {fetchPost} from "../../util/fetch";
 import {fetchPost} from "../../util/fetch";

+ 1 - 1
app/src/window/index.ts

@@ -7,7 +7,7 @@ import {addScript, addScriptSync} from "../protyle/util/addScript";
 import {genUUID} from "../util/genID";
 import {genUUID} from "../util/genID";
 import {fetchGet, fetchPost} from "../util/fetch";
 import {fetchGet, fetchPost} from "../util/fetch";
 import {addBaseURL, setNoteBook} from "../util/pathName";
 import {addBaseURL, setNoteBook} from "../util/pathName";
-import {openFile, openFileById} from "../editor/util";
+import {openFileById} from "../editor/util";
 import {
 import {
     processSync, progressBackgroundTask,
     processSync, progressBackgroundTask,
     progressLoading,
     progressLoading,