This commit is contained in:
Vanessa 2022-09-16 10:13:01 +08:00
parent b3bfa5071b
commit 5a4ed2b478
3 changed files with 11 additions and 13 deletions

View file

@ -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) {

View file

@ -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";

View file

@ -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);