From b186398052ed74432f9057ac694b83e97fcf6d69 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 3 Apr 2025 15:13:01 +0800 Subject: [PATCH] :rotating_light: --- app/src/block/util.ts | 2 +- app/src/config/search.ts | 6 +++--- app/src/layout/Tab.ts | 2 +- app/src/protyle/util/editorCommonEvent.ts | 4 ++-- app/src/protyle/wysiwyg/enter.ts | 2 +- app/src/protyle/wysiwyg/transaction.ts | 18 +++++++++--------- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/src/block/util.ts b/app/src/block/util.ts index a2db15249..d55a82eb1 100644 --- a/app/src/block/util.ts +++ b/app/src/block/util.ts @@ -46,7 +46,7 @@ export const cancelSB = async (protyle: IProtyle, nodeElement: Element, range?: id, }); if (range) { - getContenteditableElement(nodeElement).insertAdjacentHTML("afterbegin", "") + getContenteditableElement(nodeElement).insertAdjacentHTML("afterbegin", ""); } nodeElement.lastElementChild.remove(); // 超级块中的 html 块需要反转义再赋值 https://github.com/siyuan-note/siyuan/issues/13155 diff --git a/app/src/config/search.ts b/app/src/config/search.ts index 65f4d05fc..1796c218e 100644 --- a/app/src/config/search.ts +++ b/app/src/config/search.ts @@ -146,18 +146,18 @@ export const initConfigSearch = (element: HTMLElement, app: App) => { keymap.search(searchElement.value, searchKeymapElement.value); } else if (type === "search") { panelElement.querySelectorAll(`.config__tab-container[data-name="${type}"] .b3-label`).forEach((itemElement: HTMLElement) => { - let showItemElement = false + let showItemElement = false; itemElement.querySelectorAll("label > .fn__flex-1").forEach(labelItem => { if (!labelItem.parentElement.classList.contains("fn__none")) { const text = labelItem.textContent.toLowerCase(); if (text.indexOf(inputValue.toLowerCase()) > -1 || inputValue.toLowerCase().indexOf(text) > -1) { labelItem.parentElement.style.display = ""; - showItemElement = true + showItemElement = true; } else { labelItem.parentElement.style.display = "none"; } } - }) + }); if (!itemElement.classList.contains("fn__none")) { if (showItemElement) { itemElement.style.display = ""; diff --git a/app/src/layout/Tab.ts b/app/src/layout/Tab.ts index d0160473c..977d96135 100644 --- a/app/src/layout/Tab.ts +++ b/app/src/layout/Tab.ts @@ -8,7 +8,7 @@ import {escapeGreat, escapeHtml} from "../util/escape"; import {unicode2Emoji} from "../emoji"; import {fetchPost} from "../util/fetch"; import {hideTooltip, showTooltip} from "../dialog/tooltip"; -import {isTouchDevice, isWindow} from "../util/functions"; +import {isTouchDevice} from "../util/functions"; /// #if !BROWSER import {openNewWindow} from "../window/openNewWindow"; import {ipcRenderer} from "electron"; diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts index 4a4ac3548..f422f27b7 100644 --- a/app/src/protyle/util/editorCommonEvent.ts +++ b/app/src/protyle/util/editorCommonEvent.ts @@ -535,7 +535,7 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemen /// #if !MOBILE const otherProtyleElement = hasClosestByClassName(oldSourceParentElement, "protyle", true); if (otherProtyleElement) { - const allEditor = getAllEditor() + const allEditor = getAllEditor(); for (let i = 0; i < allEditor.length; i++) { if (allEditor[i].protyle.element.isSameNode(otherProtyleElement)) { const otherSbData = await cancelSB(allEditor[i].protyle, oldSourceParentElement); @@ -738,7 +738,7 @@ const dragSame = async (protyle: IProtyle, sourceElements: Element[], targetElem /// #if !MOBILE const otherProtyleElement = hasClosestByClassName(oldSourceParentElement, "protyle", true); if (otherProtyleElement) { - const allEditor = getAllEditor() + const allEditor = getAllEditor(); for (let i = 0; i < allEditor.length; i++) { if (allEditor[i].protyle.element.isSameNode(otherProtyleElement)) { const otherSbData = await cancelSB(allEditor[i].protyle, oldSourceParentElement); diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts index 9f25fb432..5659a64c6 100644 --- a/app/src/protyle/wysiwyg/enter.ts +++ b/app/src/protyle/wysiwyg/enter.ts @@ -1,5 +1,5 @@ import {genEmptyElement, insertEmptyBlock} from "../../block/util"; -import {focusBlock, focusByRange, focusByWbr, getSelectionOffset, setLastNodeRange} from "../util/selection"; +import {focusByRange, focusByWbr, getSelectionOffset, setLastNodeRange} from "../util/selection"; import { getContenteditableElement, getTopEmptyElement, diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index 78503bd00..7fadf2f18 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -274,14 +274,14 @@ const updateEmbed = (protyle: IProtyle, operation: IOperation) => { }); tempElement.content.querySelectorAll(".protyle-wysiwyg--select").forEach(selectItem => { selectItem.classList.remove("protyle-wysiwyg--select"); - }) + }); const wbrElement = tempElement.querySelector("wbr"); if (wbrElement) { wbrElement.remove(); } item.outerHTML = tempElement.innerHTML; updatedEmbed = true; - } + }; const allTempElement = document.createElement("template"); allTempElement.innerHTML = operation.data; @@ -290,7 +290,7 @@ const updateEmbed = (protyle: IProtyle, operation: IOperation) => { if (matchElement.length > 0) { matchElement.forEach(embedItem => { updateHTML(embedItem, operation.data); - }) + }); } else { item.querySelectorAll(".protyle-wysiwyg__embed").forEach(embedBlockItem => { const newTempElement = allTempElement.content.querySelector(`[data-node-id="${embedBlockItem.getAttribute("data-id")}"]`); @@ -667,10 +667,10 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: } let hasFind = false; if (operation.previousID && updateElements.length > 0) { - const previousElement = protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.previousID}"]`) + const previousElement = protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.previousID}"]`); if (previousElement.length === 0 && protyle.options.backlinkData && isUndo && getSelection().rangeCount > 0) { // 反链面板删除超级块中的最后一个段落块后撤销重做 - const blockElement = hasTopClosestByAttribute(range.startContainer, "data-node-id", null) + const blockElement = hasTopClosestByAttribute(range.startContainer, "data-node-id", null); if (blockElement) { blockElement.before(processClonePHElement(updateElements[0].cloneNode(true) as Element)); hasFind = true; @@ -684,13 +684,13 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: }); } } else if (updateElements.length > 0) { - const parentElement = protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.parentID}"]`) + const parentElement = protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.parentID}"]`); if (!protyle.options.backlinkData && operation.parentID === protyle.block.parentID) { protyle.wysiwyg.element.prepend(processClonePHElement(updateElements[0].cloneNode(true) as Element)); hasFind = true; } else if (parentElement.length === 0 && protyle.options.backlinkData && isUndo && getSelection().rangeCount > 0) { // 反链面板删除超级块中的段落块后撤销再重做 https://github.com/siyuan-note/siyuan/issues/14496#issuecomment-2771372486 - const topBlockElement = hasTopClosestByAttribute(getSelection().getRangeAt(0).startContainer, "data-node-id", null) + const topBlockElement = hasTopClosestByAttribute(getSelection().getRangeAt(0).startContainer, "data-node-id", null); if (topBlockElement) { topBlockElement.before(processClonePHElement(updateElements[0].cloneNode(true) as Element)); hasFind = true; @@ -749,7 +749,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: const previousElement = protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.previousID}"]`); if (previousElement.length === 0 && protyle.options.backlinkData && isUndo && getSelection().rangeCount > 0) { // 反链面板删除超级块中的最后一个段落块后撤销 - const blockElement = hasClosestBlock(getSelection().getRangeAt(0).startContainer) + const blockElement = hasClosestBlock(getSelection().getRangeAt(0).startContainer); if (blockElement) { blockElement.insertAdjacentHTML("beforebegin", operation.data); cursorElements.push(blockElement.previousElementSibling); @@ -786,7 +786,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: cursorElements.push(protyle.wysiwyg.element.firstElementChild); } else if (parentElement.length === 0 && protyle.options.backlinkData && isUndo && getSelection().rangeCount > 0) { // 反链面板删除超级块中的段落块后撤销 - const blockElement = hasClosestBlock(getSelection().getRangeAt(0).startContainer) + const blockElement = hasClosestBlock(getSelection().getRangeAt(0).startContainer); if (blockElement) { blockElement.insertAdjacentHTML("beforebegin", operation.data); cursorElements.push(blockElement.previousElementSibling);