Skip to content

Commit

Permalink
🚨
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 10, 2023
1 parent b0e3efa commit 2c36af7
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 26 deletions.
14 changes: 7 additions & 7 deletions app/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const {
const path = require("path");
const fs = require("fs");
const gNet = require("net");
const remote = require('@electron/remote/main');
const remote = require("@electron/remote/main");

process.noAsar = true;
const appDir = path.dirname(app.getAppPath());
Expand Down Expand Up @@ -657,7 +657,7 @@ app.whenReady().then(() => {
resetTrayMenu(tray, lang, mainWindow);
};
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) => {
Expand Down Expand Up @@ -702,7 +702,7 @@ app.whenReady().then(() => {
return true;
}
});
return hasMatch
return hasMatch;
}
});
ipcMain.once("siyuan-event", (event) => {
Expand All @@ -727,14 +727,14 @@ app.whenReady().then(() => {
currentWindow.on("leave-full-screen", () => {
event.sender.send("siyuan-event", "leave-full-screen");
});
})
});
ipcMain.on("siyuan-cmd", (event, data) => {
let cmd = data;
let webContentsId = event.sender.id
let webContentsId = event.sender.id;
if (typeof data !== "string") {
cmd = data.cmd;
if (data.webContentsId) {
webContentsId = data.webContentsId
webContentsId = data.webContentsId;
}
}
const currentWindow = getWindowByContentId(webContentsId);
Expand Down Expand Up @@ -941,7 +941,7 @@ app.whenReady().then(() => {
// 系统托盘
tray = new Tray(path.join(appDir, "stage", "icon-large.png"));
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);
tray.on("click", () => {
showHideWindow(tray, data.languages, mainWindow);
Expand Down
2 changes: 1 addition & 1 deletion app/src/boot/globalEvent/click.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {

const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");
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
writeText(text);
showMessage(window.siyuan.languages.copied, 2000);
Expand Down
4 changes: 2 additions & 2 deletions app/src/boot/onGetConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
if (cmd === "focus") {
if (getSelection().rangeCount > 0) {
Expand Down Expand Up @@ -227,7 +227,7 @@ export const initWindow = async (app: App) => {
document.getElementById("toolbar").style.paddingLeft = "0";
}
} else {
winOnMaxRestore()
winOnMaxRestore();
}
} else if (cmd === "leave-full-screen") {
if ("darwin" === window.siyuan.config.system.os) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/editor/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const openFile = async (options: IOpenFileOptions) => {
hasMatch = await ipcRenderer.invoke(Constants.SIYUAN_GET, {
cmd: Constants.SIYUAN_OPEN_FILE,
options: optionsClone,
})
});
if (hasMatch) {
if (options.afterOpen) {
options.afterOpen();
Expand Down
4 changes: 2 additions & 2 deletions app/src/emoji/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export const openEmojiPanel = (id: string, type: "doc" | "notebook" | "av", posi
</div>`
});
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.alignItems = "inherit";
setPosition(dialog.element.querySelector(".b3-dialog__container"), position.x, position.y, position.h, position.w);
Expand Down Expand Up @@ -405,7 +405,7 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
if (emojiElement) {
unicode = emojiElement.getAttribute("data-unicode");
if (type !== "av") {
dialog.destroy()
dialog.destroy();
}
} else {
// 随机
Expand Down
2 changes: 1 addition & 1 deletion app/src/mobile/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class App {
}
const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");
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
writeText(text);
showMessage(window.siyuan.languages.copied, 2000);
Expand Down
4 changes: 2 additions & 2 deletions app/src/protyle/breadcrumb/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ export class Breadcrumb {
click: async () => {
/// #if !BROWSER
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)) {
showMessage(window.siyuan.languages.microphoneDenied);
return;
} 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) {
showMessage(window.siyuan.languages.microphoneNotAccess);
return;
Expand Down
6 changes: 3 additions & 3 deletions app/src/protyle/render/av/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,15 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
menu.addSeparator();
const editAttrSubmenu: IMenu[] = [];
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") {
selectElements.find(item => {
if (!item.dataset.detached) {
hideBlock = true;
return true;
}
})
});
}
if (!hideBlock) {
editAttrSubmenu.push({
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/render/av/blockAttr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const genAVValueHTML = (value: IAVCellValue) => {
let html = "";
switch (value.type) {
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;
case "number":
html = `<input value="${value.number.content}" type="number" class="b3-text-field b3-text-field--text fn__flex-1">`;
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/render/av/col.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
data: cellElement.dataset.icon,
}]);
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);
});
event.preventDefault();
Expand Down
4 changes: 2 additions & 2 deletions app/src/protyle/render/av/openMenuPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ export const openMenuPanel = (options: {
avID,
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.stopPropagation();
Expand Down
2 changes: 1 addition & 1 deletion app/src/protyle/util/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar
return false;
}
} else if (element.classList.contains("av")) {
const avTitleElement = element.querySelector(".av__title")
const avTitleElement = element.querySelector(".av__title");
if (avTitleElement) {
const range = document.createRange();
range.selectNodeContents(avTitleElement);
Expand Down
1 change: 0 additions & 1 deletion app/src/protyle/wysiwyg/keydown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import {
upSelect
} from "./commonHotkey";
import {enterBack, fileAnnotationRefMenu, linkMenu, refMenu, setFold, tagMenu, zoomOut} from "../../menus/protyle";
import {removeEmbed} from "./removeEmbed";
import {openAttr} from "../../menus/commonMenuItem";
import {Constants} from "../../constants";
import {fetchPost} from "../../util/fetch";
Expand Down
2 changes: 1 addition & 1 deletion app/src/window/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {addScript, addScriptSync} from "../protyle/util/addScript";
import {genUUID} from "../util/genID";
import {fetchGet, fetchPost} from "../util/fetch";
import {addBaseURL, setNoteBook} from "../util/pathName";
import {openFile, openFileById} from "../editor/util";
import {openFileById} from "../editor/util";
import {
processSync, progressBackgroundTask,
progressLoading,
Expand Down

0 comments on commit 2c36af7

Please sign in to comment.