🚨
This commit is contained in:
parent
b0e3efa774
commit
2c36af78bc
14 changed files with 25 additions and 26 deletions
|
@ -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());
|
||||
|
@ -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) => {
|
||||
|
@ -702,7 +702,7 @@ app.whenReady().then(() => {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
return hasMatch
|
||||
return hasMatch;
|
||||
}
|
||||
});
|
||||
ipcMain.once("siyuan-event", (event) => {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
@ -405,7 +405,7 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
|
|||
if (emojiElement) {
|
||||
unicode = emojiElement.getAttribute("data-unicode");
|
||||
if (type !== "av") {
|
||||
dialog.destroy()
|
||||
dialog.destroy();
|
||||
}
|
||||
} else {
|
||||
// 随机
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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">`;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue