mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-09 22:22:34 +01:00
🎨 数学公式不允许备注
This commit is contained in:
parent
656a6f966e
commit
d4c8376bb5
3 changed files with 43 additions and 10 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import {ToolbarItem} from "./ToolbarItem";
|
||||
import * as dayjs from "dayjs";
|
||||
import {updateTransaction} from "../wysiwyg/transaction";
|
||||
import {hasClosestBlock} from "../util/hasClosest";
|
||||
import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest";
|
||||
import {hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
|
||||
import {mathRender} from "../markdown/mathRender";
|
||||
import {fixTableRange} from "../util/selection";
|
||||
|
|
@ -20,6 +20,14 @@ export class InlineMath extends ToolbarItem {
|
|||
if (!nodeElement) {
|
||||
return;
|
||||
}
|
||||
let mathElement = hasClosestByAttribute(range.startContainer, "data-type", "inline-math") as Element;
|
||||
if (!mathElement && range.startContainer.nodeType !== 3) {
|
||||
mathElement = (range.startContainer as HTMLElement).querySelector('[data-type="inline-math"]');
|
||||
}
|
||||
if (mathElement) {
|
||||
protyle.toolbar.showRender(protyle, mathElement);
|
||||
return;
|
||||
}
|
||||
fixTableRange(range);
|
||||
if (!["DIV", "TD", "TH", "TR"].includes(range.startContainer.parentElement.tagName) && range.startOffset === 0 && !hasPreviousSibling(range.startContainer)) {
|
||||
range.setStartBefore(range.startContainer.parentElement);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue