瀏覽代碼

:rotating_light:

Vanessa 2 年之前
父節點
當前提交
5a4ed2b478
共有 3 個文件被更改,包括 11 次插入13 次删除
  1. 8 8
      app/src/protyle/markdown/mathRender.ts
  2. 1 1
      app/src/protyle/toolbar/InlineMath.ts
  3. 2 4
      app/src/protyle/toolbar/index.ts

+ 8 - 8
app/src/protyle/markdown/mathRender.ts

@@ -66,15 +66,15 @@ export const mathRender = (element: Element, cdn = Constants.PROTYLE_CDN, maxWid
                         }
                     } else {
                         if (blockElement && mathElement.getBoundingClientRect().width > blockElement.clientWidth) {
-                            mathElement.style.maxWidth = "100%"
-                            mathElement.style.overflowX = "auto"
-                            mathElement.style.overflowY = "hidden"
-                            mathElement.style.display = "inline-block"
+                            mathElement.style.maxWidth = "100%";
+                            mathElement.style.overflowX = "auto";
+                            mathElement.style.overflowY = "hidden";
+                            mathElement.style.display = "inline-block";
                         } else {
-                            mathElement.style.maxWidth = ""
-                            mathElement.style.overflowX = ""
-                            mathElement.style.overflowY = ""
-                            mathElement.style.display = ""
+                            mathElement.style.maxWidth = "";
+                            mathElement.style.overflowX = "";
+                            mathElement.style.overflowY = "";
+                            mathElement.style.display = "";
                         }
                         const nextSibling = hasNextSibling(mathElement);
                         if (!nextSibling) {

+ 1 - 1
app/src/protyle/toolbar/InlineMath.ts

@@ -1,7 +1,7 @@
 import {ToolbarItem} from "./ToolbarItem";
 import * as dayjs from "dayjs";
 import {updateTransaction} from "../wysiwyg/transaction";
-import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest";
+import {hasClosestBlock} from "../util/hasClosest";
 import {hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
 import {focusByRange, focusByWbr} from "../util/selection";
 import {mathRender} from "../markdown/mathRender";

+ 2 - 4
app/src/protyle/toolbar/index.ts

@@ -6,7 +6,6 @@ import {
     focusByWbr,
     focusSideBlock,
     getEditorRange,
-    getSelectionOffset,
     getSelectionPosition,
     setFirstNodeRange,
     setLastNodeRange
@@ -16,7 +15,6 @@ import {Link} from "./Link";
 import {setPosition} from "../../util/setPosition";
 import {updateTransaction} from "../wysiwyg/transaction";
 import {Constants} from "../../constants";
-import {mathRender} from "../markdown/mathRender";
 import {getEventName} from "../util/compatibility";
 import {upDownHint} from "../../util/upDownHint";
 import {highlightRender} from "../markdown/highlightRender";
@@ -386,7 +384,7 @@ export class Toolbar {
             }
             if (selectText === "") {
                 const inlineElement = document.createElement("span");
-                rangeTypes.push(type)
+                rangeTypes.push(type);
                 inlineElement.setAttribute("data-type", [...new Set(rangeTypes)].join(" "));
                 inlineElement.textContent = Constants.ZWSP;
                 newNodes.push(inlineElement);
@@ -424,7 +422,7 @@ export class Toolbar {
                             hasSameTextStyle(item, nextElement, textObj)) {
                             nextIndex = item.textContent.length;
                             nextElement.innerHTML = item.innerHTML + nextElement.innerHTML;
-                        } else if (item.tagName !== 'BR') {
+                        } else if (item.tagName !== "BR") {
                             item.setAttribute("data-type", types.join(" "));
                             setFontStyle(item, textObj);
                             newNodes.push(item);