mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +01:00
✨ https://github.com/siyuan-note/siyuan/issues/3565 transaction insert
This commit is contained in:
parent
44a23b87cf
commit
ead6bc5fa2
3 changed files with 95 additions and 51 deletions
|
|
@ -107,16 +107,22 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false, spl
|
|||
}
|
||||
const spinHTML = protyle.lute.SpinBlockDOM(removeEmbed(blockElement));
|
||||
const scrollLeft = blockElement.firstElementChild.scrollLeft;
|
||||
const blockPreviousElement = blockElement.previousElementSibling
|
||||
blockElement.outerHTML = spinHTML;
|
||||
render = true;
|
||||
// spin 后变成多个块需后续处理 https://github.com/siyuan-note/insider/issues/451
|
||||
tempElement.innerHTML = spinHTML;
|
||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${id}"]`)).find((item) => {
|
||||
if (!hasClosestByAttribute(item, "data-type", "NodeBlockQueryEmbed")) {
|
||||
blockElement = item;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (protyle.options.backlinkData) {
|
||||
// 反链面板
|
||||
blockElement = blockPreviousElement.nextElementSibling;
|
||||
} else {
|
||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${id}"]`)).find((item) => {
|
||||
if (!hasClosestByAttribute(item, "data-type", "NodeBlockQueryEmbed")) {
|
||||
blockElement = item;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (tempElement.content.childElementCount === 1) {
|
||||
if (blockElement.classList.contains("table") && scrollLeft > 0) {
|
||||
blockElement.firstElementChild.scrollLeft = scrollLeft;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue