mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
This commit is contained in:
parent
7735a018f3
commit
980e1bd9d5
3 changed files with 14 additions and 3 deletions
|
|
@ -34,9 +34,8 @@ export const genRenderFrame = (renderElement: Element) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const processClonePHElement = (item: Element) => {
|
export const processClonePHElement = (item: Element) => {
|
||||||
if (item.getAttribute("data-type") === "NodeHTMLBlock") {
|
item.querySelectorAll("protyle-html").forEach((phElement) => {
|
||||||
const phElement = item.querySelector("protyle-html");
|
|
||||||
phElement.setAttribute("data-content", Lute.UnEscapeHTMLStr(phElement.getAttribute("data-content")));
|
phElement.setAttribute("data-content", Lute.UnEscapeHTMLStr(phElement.getAttribute("data-content")));
|
||||||
}
|
});
|
||||||
return item;
|
return item;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import {input} from "../wysiwyg/input";
|
||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost} from "../../util/fetch";
|
||||||
import {isIncludeCell} from "./table";
|
import {isIncludeCell} from "./table";
|
||||||
import {getFieldIdByCellElement} from "../render/av/row";
|
import {getFieldIdByCellElement} from "../render/av/row";
|
||||||
|
import {processClonePHElement} from "../render/util";
|
||||||
|
|
||||||
const processAV = (range: Range, html: string, protyle: IProtyle, blockElement: HTMLElement) => {
|
const processAV = (range: Range, html: string, protyle: IProtyle, blockElement: HTMLElement) => {
|
||||||
const tempElement = document.createElement("template");
|
const tempElement = document.createElement("template");
|
||||||
|
|
@ -492,6 +493,7 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!hasParentHeading) {
|
if (!hasParentHeading) {
|
||||||
|
processClonePHElement(item);
|
||||||
if (insertBefore) {
|
if (insertBefore) {
|
||||||
blockElement.before(item);
|
blockElement.before(item);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,16 @@ export const getContenteditableElement = (element: Element) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isNotEditBlock = (element: Element) => {
|
export const isNotEditBlock = (element: Element) => {
|
||||||
|
if (element.classList.contains("sb")) {
|
||||||
|
let hasEditable = false;
|
||||||
|
Array.from(element.querySelectorAll("[data-node-id]")).find(item => {
|
||||||
|
if (!isNotEditBlock(item)) {
|
||||||
|
hasEditable = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return !hasEditable;
|
||||||
|
}
|
||||||
return ["NodeBlockQueryEmbed", "NodeThematicBreak", "NodeMathBlock", "NodeHTMLBlock", "NodeIFrame", "NodeWidget", "NodeVideo", "NodeAudio"].includes(element.getAttribute("data-type")) ||
|
return ["NodeBlockQueryEmbed", "NodeThematicBreak", "NodeMathBlock", "NodeHTMLBlock", "NodeIFrame", "NodeWidget", "NodeVideo", "NodeAudio"].includes(element.getAttribute("data-type")) ||
|
||||||
(element.getAttribute("data-type") === "NodeCodeBlock" && element.classList.contains("render-node"));
|
(element.getAttribute("data-type") === "NodeCodeBlock" && element.classList.contains("render-node"));
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue