This commit is contained in:
Vanessa 2023-03-21 09:25:52 +08:00
parent 9cae635647
commit 4bc21c493b
8 changed files with 12 additions and 13 deletions

View file

@ -57,7 +57,7 @@ const exitApp = (port, errorWindowId) => {
// 关闭端口相同的所有非主窗口
BrowserWindow.getAllWindows().forEach((item) => {
try {
const currentURL = new URL(item.getURL())
const currentURL = new URL(item.getURL());
if (port.toString() === currentURL.port.toString()) {
if (currentURL.href.indexOf("/stage/build/app/?v=") > -1) {
mainWindow = item;
@ -114,7 +114,7 @@ const exitApp = (port, errorWindowId) => {
globalShortcut.unregisterAll();
writeLog("exited ui");
}
}
};
const getServer = (port = kernelPort) => {
return "http://127.0.0.1:" + port;

View file

@ -119,7 +119,7 @@ export const exitSiYuan = () => {
});
};
export const transactionError = (data: { code: number, data: string }) => {
export const transactionError = () => {
if (document.getElementById("transactionError")) {
return;
}

View file

@ -136,14 +136,14 @@ export const workspaceMenu = (rect: DOMRect) => {
showMessage(window.siyuan.languages.duplicate);
return true;
}
})
});
if (hadName) {
return;
}
window.siyuan.storage[Constants.LOCAL_LAYOUTS].push({
name: value,
layout: exportLayout(false, undefined, true)
})
});
setStorageVal(Constants.LOCAL_LAYOUTS, window.siyuan.storage[Constants.LOCAL_LAYOUTS]);
saveDialog.destroy();
});
@ -169,7 +169,7 @@ export const workspaceMenu = (rect: DOMRect) => {
setStorageVal(Constants.LOCAL_LAYOUTS, window.siyuan.storage[Constants.LOCAL_LAYOUTS]);
return true;
}
})
});
return;
}
fetchPost("/api/system/setUILayout", {layout: item.layout}, () => {

View file

@ -959,7 +959,7 @@ export class Toolbar {
const msgId = showMessage(window.siyuan.languages.exporting, 0);
if (renderElement.getAttribute("data-subtype") === "plantuml") {
fetch(renderElement.querySelector("img").getAttribute("src")).then(function (response) {
return response.blob()
return response.blob();
}).then(function (blob) {
const formData = new FormData();
formData.append("file", blob);

View file

@ -460,7 +460,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if ((event.shiftKey && !event.altKey && !isCtrl(event) && (event.key === "Home" || event.key === "End") && isMac()) ||
(event.shiftKey && !event.altKey && isCtrl(event) && (event.key === "Home" || event.key === "End") && !isMac())) {
const topElement = hasTopClosestByAttribute(nodeElement, "data-node-id", null)
const topElement = hasTopClosestByAttribute(nodeElement, "data-node-id", null);
if (topElement) {
topElement.classList.add("protyle-wysiwyg--select");
let nextElement = event.key === "Home" ? topElement.previousElementSibling : topElement.nextElementSibling;
@ -469,9 +469,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
nextElement = event.key === "Home" ? nextElement.previousElementSibling : nextElement.nextElementSibling;
}
if (event.key === "Home") {
protyle.wysiwyg.element.firstElementChild.scrollIntoView()
protyle.wysiwyg.element.firstElementChild.scrollIntoView();
} else {
protyle.wysiwyg.element.lastElementChild.scrollIntoView(false)
protyle.wysiwyg.element.lastElementChild.scrollIntoView(false);
}
}
event.stopPropagation();

View file

@ -1,7 +1,6 @@
import {Constants} from "../constants";
/// #if !BROWSER
import {ipcRenderer} from "electron";
import {getCurrentWindow} from "@electron/remote";
/// #endif
import {processMessage} from "./processMessage";
import {kernelError} from "../dialog/processSystem";

View file

@ -42,7 +42,7 @@ export const scrollCenter = (protyle: IProtyle, nodeElement?: Element, top = fal
if (!top && getSelection().rangeCount > 0 && hasClosestBlock(getSelection().getRangeAt(0).startContainer)) {
const editorElement = protyle.contentElement;
const cursorTop = getSelectionPosition(editorElement).top - editorElement.getBoundingClientRect().top;
let top = 0
let top = 0;
if (cursorTop < 0) {
top = editorElement.scrollTop + cursorTop;
} else if (cursorTop > editorElement.clientHeight - 74) { // 74 = 移动端底部 + 段落块高度

View file

@ -150,7 +150,7 @@ export const onGetConfig = (isStart: boolean) => {
try {
JSONToLayout(isStart);
if (window.JSAndroid) {
window.openFileByURL(window.JSAndroid.getBlockURL())
window.openFileByURL(window.JSAndroid.getBlockURL());
}
} catch (e) {
resetLayout();