From 6851656c09fce1fc1b0cb4faad66bc92bf7bc77c Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 19 Sep 2022 23:56:47 +0800 Subject: [PATCH] :rotating_light: --- app/src/protyle/toolbar/index.ts | 18 +++++++++--------- app/src/protyle/util/insertHTML.ts | 2 +- app/src/protyle/util/selection.ts | 2 +- app/src/protyle/wysiwyg/index.ts | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index 5452b3a44..930303887 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -11,7 +11,7 @@ import { setFirstNodeRange, setLastNodeRange } from "../util/selection"; -import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName, hasClosestByMatchTag} from "../util/hasClosest"; +import {hasClosestBlock, hasClosestByClassName} from "../util/hasClosest"; import {Link} from "./Link"; import {setPosition} from "../../util/setPosition"; import {updateTransaction} from "../wysiwyg/transaction"; @@ -859,33 +859,33 @@ export class Toolbar { } } if (isInlineMemo) { - let inlineMemoElements + let inlineMemoElements; if (updateElements) { - inlineMemoElements = updateElements + inlineMemoElements = updateElements; } else { - inlineMemoElements = [renderElement] + inlineMemoElements = [renderElement]; } inlineMemoElements.forEach((item, index) => { if (!target.value) { // https://github.com/siyuan-note/insider/issues/1046 - const currentTypes = item.getAttribute("data-type").split(" ") + const currentTypes = item.getAttribute("data-type").split(" "); if (currentTypes.length === 1 && currentTypes[0] === "inline-memo") { item.outerHTML = item.innerHTML + (index === inlineMemoElements.length - 1 ? "" : ""); focusByWbr(nodeElement, this.range); } else { currentTypes.find((typeItem, index) => { if (typeItem === "inline-memo") { - currentTypes.splice(index, 1) - return true + currentTypes.splice(index, 1); + return true; } - }) + }); item.setAttribute("data-type", currentTypes.join(" ")); item.removeAttribute("data-inline-memo-content"); } } else { item.setAttribute("data-inline-memo-content", Lute.EscapeHTMLStr(target.value)); } - }) + }); } else if (type === "NodeBlockQueryEmbed") { blockRender(protyle, renderElement); } diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts index 2d8d0677f..0a0257d58 100644 --- a/app/src/protyle/util/insertHTML.ts +++ b/app/src/protyle/util/insertHTML.ts @@ -1,4 +1,4 @@ -import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName, hasClosestByMatchTag} from "./hasClosest"; +import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "./hasClosest"; import * as dayjs from "dayjs"; import {removeEmbed} from "../wysiwyg/removeEmbed"; import {transaction, updateTransaction} from "../wysiwyg/transaction"; diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts index 1cd361de7..ea5f701fd 100644 --- a/app/src/protyle/util/selection.ts +++ b/app/src/protyle/util/selection.ts @@ -45,7 +45,7 @@ export const fixTableRange = (range:Range) => { } } } -} +}; export const selectAll = (protyle: IProtyle, nodeElement: Element, range: Range) => { const editElement = getContenteditableElement(nodeElement); diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index cfe6aca0c..fc21ab505 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -846,12 +846,12 @@ export class WYSIWYG { let cursorElement = hasClosestBlock(range.startContainer) as Element; if (cursorElement) { if (cursorElement.nextElementSibling?.classList.contains("table")) { - setLastNodeRange(getContenteditableElement(cursorElement), range, false) + setLastNodeRange(getContenteditableElement(cursorElement), range, false); } else if (cursorElement.classList.contains("table")) { const cellElements = cursorElement.querySelectorAll("th, td"); cursorElement = cellElements[cellElements.length - 1]; if (cursorElement.contains(range.startContainer)) { - setLastNodeRange(cursorElement, range, false) + setLastNodeRange(cursorElement, range, false); } } }