diff --git a/app/src/block/util.ts b/app/src/block/util.ts index 52511dab0..9f3bde19a 100644 --- a/app/src/block/util.ts +++ b/app/src/block/util.ts @@ -53,10 +53,10 @@ export const cancelSB = (protyle: IProtyle, nodeElement: Element) => { doOperations.forEach(item => { const element = protyle.wysiwyg.element.querySelector(`[data-node-id="${item.id}"]`); if (element && element.getAttribute("data-type") === "NodeBlockQueryEmbed") { - element.removeAttribute("data-render") - blockRender(protyle, element) + element.removeAttribute("data-render"); + blockRender(protyle, element); } - }) + }); return { doOperations, undoOperations, previousId }; diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts index 0ac5f9334..fd6343f15 100644 --- a/app/src/mobile/util/keyboardToolbar.ts +++ b/app/src/mobile/util/keyboardToolbar.ts @@ -2,7 +2,7 @@ import {listIndent, listOutdent} from "../../protyle/wysiwyg/list"; import {hasClosestBlock, hasClosestByClassName, hasClosestByMatchTag} from "../../protyle/util/hasClosest"; import {moveToDown, moveToUp} from "../../protyle/wysiwyg/move"; import {Constants} from "../../constants"; -import {focusByRange, getEditorRange, getSelectionPosition} from "../../protyle/util/selection"; +import {focusByRange, getSelectionPosition} from "../../protyle/util/selection"; import {removeBlock} from "../../protyle/wysiwyg/remove"; import {hintSlash} from "../../protyle/hint/extend"; @@ -12,22 +12,22 @@ let showKeyboardToolbarUtil = false; const renderSlashMenu = (protyle: IProtyle, toolbarElement: Element) => { protyle.hint.splitChar = "/"; protyle.hint.lastIndex = -1; - const utilElement = toolbarElement.querySelector(".keyboard__util") as HTMLElement - utilElement.innerHTML = protyle.hint.getHTMLByData(hintSlash("", protyle), false) + const utilElement = toolbarElement.querySelector(".keyboard__util") as HTMLElement; + utilElement.innerHTML = protyle.hint.getHTMLByData(hintSlash("", protyle), false); protyle.hint.bindUploadEvent(protyle, utilElement); -} +}; const renderKeyboardToolbarUtil = () => { const toolbarElement = document.getElementById("keyboardToolbar"); - const keyboardHeight = (parseInt(toolbarElement.getAttribute("data-keyboardheight")) + 42) + "px" - toolbarElement.style.height = keyboardHeight - window.siyuan.mobile.editor.protyle.element.style.marginBottom = keyboardHeight + const keyboardHeight = (parseInt(toolbarElement.getAttribute("data-keyboardheight")) + 42) + "px"; + toolbarElement.style.height = keyboardHeight; + window.siyuan.mobile.editor.protyle.element.style.marginBottom = keyboardHeight; window.siyuan.menus.menu.remove(); showKeyboardToolbarUtil = true; setTimeout(() => { - showKeyboardToolbarUtil = false - }, 1000) -} + showKeyboardToolbarUtil = false; + }, 1000); +}; const renderKeyboardToolbar = () => { clearTimeout(renderKeyboardToolbarTimeout); @@ -36,10 +36,10 @@ const renderKeyboardToolbar = () => { return; } hideKeyboardToolbarUtil(); - if (window.innerHeight + 200 > ((window.orientation === 90 || window.orientation === -90) ? screen.width : screen.height)) { - hideKeyboardToolbar(); - return; - } + // if (window.innerHeight + 200 > ((window.orientation === 90 || window.orientation === -90) ? screen.width : screen.height)) { + // hideKeyboardToolbar(); + // return; + // } const dynamicElements = document.querySelectorAll("#keyboardToolbar .keyboard__dynamic"); const range = getSelection().getRangeAt(0); @@ -62,7 +62,7 @@ const renderKeyboardToolbar = () => { } const nodeElement = hasClosestBlock(range.startContainer); if (nodeElement) { - const indentElement = dynamicElements[0].querySelector('[data-type="indent"]') + const indentElement = dynamicElements[0].querySelector('[data-type="indent"]'); if (nodeElement.parentElement.classList.contains("li")) { indentElement.classList.remove("fn__none"); indentElement.nextElementSibling.classList.remove("fn__none"); @@ -75,7 +75,7 @@ const renderKeyboardToolbar = () => { } } if (selectText && isProtyle) { - dynamicElements[1].querySelectorAll('.protyle-toolbar__item--current').forEach(item => { + dynamicElements[1].querySelectorAll(".protyle-toolbar__item--current").forEach(item => { item.classList.remove("protyle-toolbar__item--current"); }); const types = protyle.toolbar.getCurrentType(); @@ -97,16 +97,16 @@ const renderKeyboardToolbar = () => { }; const hideKeyboardToolbarUtil = () => { - document.getElementById("keyboardToolbar").style.height = "" - window.siyuan.mobile.editor.protyle.element.style.marginBottom = "" -} + document.getElementById("keyboardToolbar").style.height = ""; + window.siyuan.mobile.editor.protyle.element.style.marginBottom = ""; +}; export const showKeyboardToolbar = (height: number) => { if (getSelection().rangeCount === 0 || window.siyuan.config.editor.readOnly || window.siyuan.config.readonly) { return; } const toolbarElement = document.getElementById("keyboardToolbar"); - toolbarElement.setAttribute("data-keyboardheight", height.toString()) + toolbarElement.setAttribute("data-keyboardheight", height.toString()); hideKeyboardToolbarUtil(); if (!toolbarElement.classList.contains("fn__none")) { return; diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts index 319955bcf..5b58a43e8 100644 --- a/app/src/protyle/hint/index.ts +++ b/app/src/protyle/hint/index.ts @@ -29,7 +29,6 @@ import {openFileById} from "../../editor/util"; import {openMobileFileById} from "../../mobile/editor"; import {getIconByType} from "../../editor/getIcon"; import {processRender} from "../util/processCode"; -import {getEventName} from "../util/compatibility"; import {Dialog} from "../../dialog"; import {isMobile} from "../../util/functions"; @@ -245,7 +244,7 @@ ${unicode2Emoji(emoji.unicode, true)}`; if (hasSearch) { hintsHTML = hintsHTML + ""; } - return hintsHTML + return hintsHTML; } public genHTML(data: IHintData[], protyle: IProtyle, hide = false, hasSearch = false) { diff --git a/app/src/protyle/markdown/blockRender.ts b/app/src/protyle/markdown/blockRender.ts index afb817fc6..e11f8425b 100644 --- a/app/src/protyle/markdown/blockRender.ts +++ b/app/src/protyle/markdown/blockRender.ts @@ -36,7 +36,7 @@ export const blockRender = (protyle: IProtyle, element: Element, top?: number) = breadcrumb = window.siyuan.config.editor.embedBlockBreadcrumb; } // https://github.com/siyuan-note/siyuan/issues/7575 - const sbElement = hasTopClosestByClassName(item, "sb") + const sbElement = hasTopClosestByClassName(item, "sb"); if (sbElement) { breadcrumb = false; } diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index ebb49705b..1775b597c 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -315,7 +315,7 @@ export class Toolbar { item.replaceWith(spanElement); }); } - const toolbarElement = isMobile() ? document.querySelector("#keyboardToolbar .keyboard__dynamic") : this.element + const toolbarElement = isMobile() ? document.querySelector("#keyboardToolbar .keyboard__dynamic") : this.element; const actionBtn = action === "toolbar" ? toolbarElement.querySelector(`[data-type="${type}"]`) : undefined; const newNodes: Node[] = []; diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts index b6f625732..63a5b6bfa 100644 --- a/app/src/protyle/util/editorCommonEvent.ts +++ b/app/src/protyle/util/editorCommonEvent.ts @@ -825,13 +825,13 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => { // 超级块内嵌入块无面包屑,需重新渲染 https://github.com/siyuan-note/siyuan/issues/7574 sourceElements.forEach(item => { if (item.getAttribute("data-type") === "NodeBlockQueryEmbed") { - item.removeAttribute("data-render") - blockRender(protyle, item) + item.removeAttribute("data-render"); + blockRender(protyle, item); } - }) + }); if (targetElement.getAttribute("data-type") === "NodeBlockQueryEmbed") { - targetElement.removeAttribute("data-render") - blockRender(protyle, targetElement) + targetElement.removeAttribute("data-render"); + blockRender(protyle, targetElement); } } } else if (event.dataTransfer.getData(Constants.SIYUAN_DROP_FILE)?.split("-").length > 1 diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index a7ddc0e3f..a1830fb70 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -1,5 +1,5 @@ import {hideElements} from "../ui/hideElements"; -import {copyPlainText, getEventName, isCtrl, isMac, writeText} from "../util/compatibility"; +import {copyPlainText, isCtrl, isMac, writeText} from "../util/compatibility"; import { focusBlock, focusByRange, diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index a96717283..de1957977 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -730,8 +730,8 @@ export const turnsIntoOneTransaction = (options: { } // 超级块内嵌入块无面包屑,需重新渲染 https://github.com/siyuan-note/siyuan/issues/7574 if (item.getAttribute("data-type") === "NodeBlockQueryEmbed") { - item.removeAttribute("data-render") - blockRender(options.protyle, item) + item.removeAttribute("data-render"); + blockRender(options.protyle, item); } }); transaction(options.protyle, doOperations, undoOperations);