diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.ts index 734752006..7855a002a 100644 --- a/app/src/emoji/index.ts +++ b/app/src/emoji/index.ts @@ -8,7 +8,6 @@ import {Files} from "../layout/dock/Files"; import {getDockByType} from "../layout/util"; import {getAllModels} from "../layout/getAll"; /// #endif -import {getEventName} from "../protyle/util/compatibility"; import {setNoteBook} from "../util/pathName"; export const getRandomEmoji = () => { diff --git a/app/src/menus/Menu.ts b/app/src/menus/Menu.ts index 610266bf0..83dbdaa0a 100644 --- a/app/src/menus/Menu.ts +++ b/app/src/menus/Menu.ts @@ -33,7 +33,7 @@ export class Menu { itemElement.classList.add("b3-menu__item--show"); const rect = subMenuElement.getBoundingClientRect(); let style = ""; - const leftPosition = rect.left - this.element.clientWidth - rect.width + const leftPosition = rect.left - this.element.clientWidth - rect.width; if (rect.right > window.innerWidth && ( leftPosition > 0 || Math.abs(leftPosition) < (rect.right - window.innerWidth))) { if (leftPosition >= 0) { diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index c5e7d7c60..5871cab42 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -579,7 +579,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme genImageWidthMenu(window.siyuan.languages.default, assetElement, imgElement, protyle, id, nodeElement, html), ] }).element); - const imgSrc = imgElement.getAttribute("src") + const imgSrc = imgElement.getAttribute("src"); if (imgSrc) { window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element); openMenu(imgSrc); @@ -822,7 +822,7 @@ export const iframeMenu = (protyle: IProtyle, nodeElement: Element) => { if (iframeSrc) { subMenus.push({ type: "separator" - }) + }); return subMenus.concat(openMenu(iframeSrc, true) as IMenu[]); } return subMenus; @@ -848,7 +848,7 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string) if (src.startsWith("assets/")) { subMenus.push({ type: "separator" - }) + }); subMenus.push({ label: window.siyuan.languages.rename, click() { diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts index f1f23f096..348ec0458 100644 --- a/app/src/protyle/wysiwyg/enter.ts +++ b/app/src/protyle/wysiwyg/enter.ts @@ -11,7 +11,6 @@ import {transaction, updateTransaction} from "./transaction"; import {breakList, genListItemElement, listOutdent, updateListOrder} from "./list"; import {hasClosestByMatchTag} from "../util/hasClosest"; import {highlightRender} from "../markdown/highlightRender"; -import {setPosition} from "../../util/setPosition"; import {Constants} from "../../constants"; import {scrollCenter} from "../../util/highlightById"; diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index bc602d323..b27fbd463 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1419,7 +1419,7 @@ export class WYSIWYG { const fileIds = fileElement.getAttribute("data-id").split("/"); const linkAddress = `assets/${fileIds[1]}`; /// #if MOBILE - openByMobile(linkAddress) + openByMobile(linkAddress); /// #else if (window.siyuan.ctrlIsPressed) { openBy(linkAddress, "folder"); @@ -1461,7 +1461,7 @@ export class WYSIWYG { openBy(linkAddress, "app"); } /// #else - openByMobile(linkAddress) + openByMobile(linkAddress); /// #endif } } else { @@ -1470,7 +1470,7 @@ export class WYSIWYG { showMessage(e); }); /// #else - openByMobile(linkAddress) + openByMobile(linkAddress); /// #endif } /// #endif diff --git a/app/src/protyle/wysiwyg/input.ts b/app/src/protyle/wysiwyg/input.ts index e64335650..b0ab97385 100644 --- a/app/src/protyle/wysiwyg/input.ts +++ b/app/src/protyle/wysiwyg/input.ts @@ -79,7 +79,7 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range: } let html = blockElement.outerHTML; let todoOldHTML = ""; - let focusHR = false + let focusHR = false; if (editElement.textContent === "---" && !blockElement.classList.contains("code-block")) { html = `
`; const nextBlockElement = getNextBlock(editElement); diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index a2d4eb7eb..ddab88359 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -554,7 +554,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { protyle.toolbar.isNewEmptyInline = false; protyle.hint.enableEmoji = false; // 需使用 editabled,否则代码块会把语言字数算入 - const nodeEditableElement = getContenteditableElement(nodeElement) || nodeElement + const nodeEditableElement = getContenteditableElement(nodeElement) || nodeElement; const position = getSelectionOffset(nodeEditableElement, protyle.wysiwyg.element, range); const tdElement = hasClosestByMatchTag(range.startContainer, "TD"); if (event.key === "ArrowDown" && nodeEditableElement?.textContent.trimRight().substr(position.start).indexOf("\n") === -1 && ( @@ -594,14 +594,14 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { // 代码块或以软换行结尾的块移动光标 ↑ 会跳过 https://github.com/siyuan-note/siyuan/issues/5498 if (getContenteditableElement(previousElement)?.textContent.endsWith("\n") && !foldElement) { focusBlock(previousElement, undefined, false); - scrollCenter(protyle, previousElement) + scrollCenter(protyle, previousElement); event.stopPropagation(); event.preventDefault(); } else if (foldElement && foldElement.getAttribute("data-type") !== "NodeListItem") { // 遇到折叠块 foldElement.scrollTop = 0; focusBlock(foldElement, undefined, true); - scrollCenter(protyle, foldElement) + scrollCenter(protyle, foldElement); event.stopPropagation(); event.preventDefault(); } @@ -642,7 +642,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { nextElement = getFirstBlock(nextElement) as HTMLElement; } focusBlock(nextElement); - scrollCenter(protyle, nextElement) + scrollCenter(protyle, nextElement); } event.stopPropagation(); event.preventDefault(); @@ -651,7 +651,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { const nextFoldElement = getNextBlock(nodeElement) as HTMLElement; if (nextFoldElement && nextFoldElement.getAttribute("fold") === "1") { focusBlock(nextFoldElement); - scrollCenter(protyle, nextFoldElement) + scrollCenter(protyle, nextFoldElement); event.stopPropagation(); event.preventDefault(); } @@ -1385,7 +1385,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { if (isNotEditBlock(nodeElement) && matchHotKey("⌘X", event)) { let html = ""; nodeElement.classList.add("protyle-wysiwyg--select"); - const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select") + const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"); selectElements.forEach(item => { html += removeEmbed(item); });