mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 07:30:49 +08:00
This commit is contained in:
parent
e09dbb3535
commit
cc0986efc7
@ -611,9 +611,11 @@ export class Toolbar {
|
|||||||
let currentNode = newNodes[i] as HTMLElement;
|
let currentNode = newNodes[i] as HTMLElement;
|
||||||
if (!currentNode) {
|
if (!currentNode) {
|
||||||
currentNode = hasNextSibling(newNodes[i - 1]) as HTMLElement;
|
currentNode = hasNextSibling(newNodes[i - 1]) as HTMLElement;
|
||||||
if (currentNode.nodeType === 3 && currentNode.textContent === Constants.ZWSP) {
|
if (currentNode && currentNode.nodeType === 3 && currentNode.textContent === Constants.ZWSP) {
|
||||||
currentNode = hasNextSibling(currentNode) as HTMLElement;
|
currentNode = hasNextSibling(currentNode) as HTMLElement;
|
||||||
currentNode.previousSibling.remove();
|
if (currentNode) {
|
||||||
|
currentNode.previousSibling.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentNode && currentNode.nodeType !== 3) {
|
if (currentNode && currentNode.nodeType !== 3) {
|
||||||
@ -744,18 +746,19 @@ export class Toolbar {
|
|||||||
focusByRange(this.range);
|
focusByRange(this.range);
|
||||||
|
|
||||||
const showMenuElement = newNodes[0] as HTMLElement;
|
const showMenuElement = newNodes[0] as HTMLElement;
|
||||||
|
const showMenuTypes = (showMenuElement.getAttribute("data-type") || "").split(" ");
|
||||||
if (type === "inline-math") {
|
if (type === "inline-math") {
|
||||||
mathRender(nodeElement);
|
mathRender(nodeElement);
|
||||||
if (selectText === "" && showMenuElement.getAttribute("data-type") === "inline-math") {
|
if (selectText === "" && showMenuTypes.includes("inline-math")) {
|
||||||
protyle.toolbar.showRender(protyle, showMenuElement, undefined, html);
|
protyle.toolbar.showRender(protyle, showMenuElement, undefined, html);
|
||||||
}
|
}
|
||||||
} else if (type === "inline-memo") {
|
} else if (type === "inline-memo") {
|
||||||
if (!showMenuElement.getAttribute("data-inline-memo-content") &&
|
if (!showMenuElement.getAttribute("data-inline-memo-content") &&
|
||||||
showMenuElement.getAttribute("data-type") === "inline-memo") {
|
showMenuTypes.includes("inline-memo")) {
|
||||||
protyle.toolbar.showRender(protyle, showMenuElement, newNodes as Element[], html);
|
protyle.toolbar.showRender(protyle, showMenuElement, newNodes as Element[], html);
|
||||||
}
|
}
|
||||||
} else if (type === "a") {
|
} else if (type === "a") {
|
||||||
if (showMenuElement.getAttribute("data-type") === "a" &&
|
if (showMenuTypes.includes("a") &&
|
||||||
(showMenuElement.textContent.replace(Constants.ZWSP, "") === "" || !showMenuElement.getAttribute("data-href"))) {
|
(showMenuElement.textContent.replace(Constants.ZWSP, "") === "" || !showMenuElement.getAttribute("data-href"))) {
|
||||||
linkMenu(protyle, showMenuElement, showMenuElement.getAttribute("data-href") ? true : false);
|
linkMenu(protyle, showMenuElement, showMenuElement.getAttribute("data-href") ? true : false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user