diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts index 02ee95bda..477c3ecc8 100644 --- a/app/src/editor/util.ts +++ b/app/src/editor/util.ts @@ -45,9 +45,6 @@ export const openFileById = async (options: { showMessage(data.msg); return; } - if (typeof options.removeCurrentTab === "undefined") { - options.removeCurrentTab = true; - } openFile({ app: options.app, fileName: data.data.rootTitle, @@ -80,6 +77,9 @@ export const openAsset = (app: App, assetPath: string, page: number | string, po }; export const openFile = (options: IOpenFileOptions) => { + if (typeof options.removeCurrentTab === "undefined") { + options.removeCurrentTab = true; + } const allModels = getAllModels(); // 文档已打开 if (options.assetPath) { diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts index 447ce2fb9..c0e297257 100644 --- a/app/src/layout/dock/Outline.ts +++ b/app/src/layout/dock/Outline.ts @@ -221,7 +221,7 @@ export class Outline extends Model { if (getSelection().rangeCount > 0) { const blockElement = hasClosestBlock(getSelection().getRangeAt(0).startContainer); if (blockElement && blockElement.getAttribute("data-type") === "NodeHeading") { - this.setCurrent(blockElement) + this.setCurrent(blockElement); } } }); diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts index 0e758cae3..b93c232a7 100644 --- a/app/src/layout/util.ts +++ b/app/src/layout/util.ts @@ -584,43 +584,43 @@ export const resizeTopbar = () => { const dragElement = toolbarElement.querySelector("#drag") as HTMLElement; dragElement.style.padding = ""; - const barMoreElement = toolbarElement.querySelector("#barMore") - barMoreElement.classList.remove("fn__none") - barMoreElement.removeAttribute("data-hideids") + const barMoreElement = toolbarElement.querySelector("#barMore"); + barMoreElement.classList.remove("fn__none"); + barMoreElement.removeAttribute("data-hideids"); Array.from(toolbarElement.querySelectorAll('[data-hide="true"]')).forEach((item) => { - item.classList.remove("fn__none") + item.classList.remove("fn__none"); item.removeAttribute("data-hide"); - }) + }); - let afterDragElement = dragElement.nextElementSibling - const hideIds: string[] = [] + let afterDragElement = dragElement.nextElementSibling; + const hideIds: string[] = []; while (toolbarElement.scrollWidth > toolbarElement.clientWidth + 2) { - hideIds.push(afterDragElement.id) - afterDragElement.classList.add("fn__none") - afterDragElement.setAttribute("data-hide", "true") - afterDragElement = afterDragElement.nextElementSibling + hideIds.push(afterDragElement.id); + afterDragElement.classList.add("fn__none"); + afterDragElement.setAttribute("data-hide", "true"); + afterDragElement = afterDragElement.nextElementSibling; if (afterDragElement.id === "barMore") { break; } } - let beforeDragElement = dragElement.previousElementSibling + let beforeDragElement = dragElement.previousElementSibling; while (toolbarElement.scrollWidth > toolbarElement.clientWidth + 2) { - hideIds.push(beforeDragElement.id) - beforeDragElement.classList.add("fn__none") - beforeDragElement.setAttribute("data-hide", "true") - beforeDragElement = beforeDragElement.previousElementSibling + hideIds.push(beforeDragElement.id); + beforeDragElement.classList.add("fn__none"); + beforeDragElement.setAttribute("data-hide", "true"); + beforeDragElement = beforeDragElement.previousElementSibling; if (beforeDragElement.id === "barWorkspace") { break; } } if (hideIds.length > 0) { - barMoreElement.classList.remove("fn__none") + barMoreElement.classList.remove("fn__none"); } else { - barMoreElement.classList.add("fn__none") + barMoreElement.classList.add("fn__none"); } - barMoreElement.setAttribute("data-hideids", hideIds.join(",")) + barMoreElement.setAttribute("data-hideids", hideIds.join(",")); const width = dragElement.clientWidth; const dragRect = dragElement.getBoundingClientRect(); diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 03f3caebe..233137239 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -1190,16 +1190,16 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement: } }); } - const isPinHead = nodeElement.getAttribute("custom-pinthead") + const isPinHead = nodeElement.getAttribute("custom-pinthead"); menus.push({ icon: "iconPin", label: isPinHead ? window.siyuan.languages.unpinTableHead : window.siyuan.languages.pinTableHead, click: () => { const html = nodeElement.outerHTML; if (isPinHead) { - nodeElement.removeAttribute("custom-pinthead") + nodeElement.removeAttribute("custom-pinthead"); } else { - nodeElement.setAttribute("custom-pinthead", "true") + nodeElement.setAttribute("custom-pinthead", "true"); } updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html); } diff --git a/app/src/plugin/API.ts b/app/src/plugin/API.ts index b57cdf283..4abe6deba 100644 --- a/app/src/plugin/API.ts +++ b/app/src/plugin/API.ts @@ -194,7 +194,7 @@ openTab = (options: { return; } -} +}; /// #endif export const API = { diff --git a/app/src/protyle/util/processCode.ts b/app/src/protyle/util/processCode.ts index 31203b4e3..ba798607c 100644 --- a/app/src/protyle/util/processCode.ts +++ b/app/src/protyle/util/processCode.ts @@ -34,7 +34,7 @@ export const processPasteCode = (html: string, text: string) => { return `
${window.siyuan.storage[Constants.LOCAL_CODELANG]}
${code.replace(/&/g, "&").replace(/
${Constants.ZWSP}
`; } else { // Paste code from IDE no longer escape `<` and `>` https://github.com/siyuan-note/siyuan/issues/8340 - code = code.replace("<", "<").replace('>', ">"); + code = code.replace("<", "<").replace(">", ">"); return "`" + code + "`"; } } diff --git a/app/src/search/index.ts b/app/src/search/index.ts index f63d682f2..e1bcc779f 100644 --- a/app/src/search/index.ts +++ b/app/src/search/index.ts @@ -15,6 +15,9 @@ export class Search extends Model { app: options.app, id: options.tab.id, }); + if (window.siyuan.config.fileTree.openFilesUseCurrentTab) { + options.tab.headElement?.classList.add("item--unupdate"); + } this.element = options.tab.panelElement as HTMLElement; this.config = options.config; this.edit = genSearch(options.app, this.config, this.element); diff --git a/app/src/window/init.ts b/app/src/window/init.ts index f8696bcaf..c2d438823 100644 --- a/app/src/window/init.ts +++ b/app/src/window/init.ts @@ -66,4 +66,4 @@ const afterLayout = (app:App) => { const tab = getInstanceById(item.getAttribute("data-id")) as Tab; tab.parent.switchTab(item, false, false); }); -} +};