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) => {
|
||||
if (item.getAttribute("data-type") === "NodeHTMLBlock") {
|
||||
const phElement = item.querySelector("protyle-html");
|
||||
item.querySelectorAll("protyle-html").forEach((phElement) => {
|
||||
phElement.setAttribute("data-content", Lute.UnEscapeHTMLStr(phElement.getAttribute("data-content")));
|
||||
}
|
||||
});
|
||||
return item;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import {input} from "../wysiwyg/input";
|
|||
import {fetchPost} from "../../util/fetch";
|
||||
import {isIncludeCell} from "./table";
|
||||
import {getFieldIdByCellElement} from "../render/av/row";
|
||||
import {processClonePHElement} from "../render/util";
|
||||
|
||||
const processAV = (range: Range, html: string, protyle: IProtyle, blockElement: HTMLElement) => {
|
||||
const tempElement = document.createElement("template");
|
||||
|
|
@ -492,6 +493,7 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
|
|||
});
|
||||
}
|
||||
if (!hasParentHeading) {
|
||||
processClonePHElement(item);
|
||||
if (insertBefore) {
|
||||
blockElement.before(item);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,16 @@ export const getContenteditableElement = (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")) ||
|
||||
(element.getAttribute("data-type") === "NodeCodeBlock" && element.classList.contains("render-node"));
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue