This commit is contained in:
Vanessa 2023-03-05 14:18:23 +08:00
parent 67014d2ada
commit 184949dd69
3 changed files with 25 additions and 1 deletions

View file

@ -6,6 +6,7 @@ import {transaction, updateTransaction} from "../protyle/wysiwyg/transaction";
import {scrollCenter} from "../util/highlightById";
import {Constants} from "../constants";
import {hideElements} from "../protyle/ui/hideElements";
import {blockRender} from "../protyle/markdown/blockRender";
export const cancelSB = (protyle: IProtyle, nodeElement: Element) => {
const doOperations: IOperation[] = [];
@ -48,7 +49,14 @@ export const cancelSB = (protyle: IProtyle, nodeElement: Element) => {
});
previousId = item.getAttribute("data-node-id");
});
// 超级块内嵌入块无面包屑,需重新渲染 https://github.com/siyuan-note/siyuan/issues/7574
doOperations.forEach(item => {
const element = protyle.wysiwyg.element.querySelector(`[data-node-id="${item.id}"]`);
if (element && element.getAttribute("data-type") === "NodeBlockQueryEmbed") {
element.removeAttribute("data-render")
blockRender(protyle, element)
}
})
return {
doOperations, undoOperations, previousId
};

View file

@ -822,6 +822,17 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
dragSame(protyle, sourceElements, targetElement, targetClass.includes("dragover__bottom"), event.ctrlKey);
}
}
// 超级块内嵌入块无面包屑,需重新渲染 https://github.com/siyuan-note/siyuan/issues/7574
sourceElements.forEach(item => {
if (item.getAttribute("data-type") === "NodeBlockQueryEmbed") {
item.removeAttribute("data-render")
blockRender(protyle, item)
}
})
if (targetElement.getAttribute("data-type") === "NodeBlockQueryEmbed") {
targetElement.removeAttribute("data-render")
blockRender(protyle, targetElement)
}
}
} else if (event.dataTransfer.getData(Constants.SIYUAN_DROP_FILE)?.split("-").length > 1
&& targetElement && !protyle.options.backlinkData) {

View file

@ -728,6 +728,11 @@ export const turnsIntoOneTransaction = (options: {
id,
});
}
// 超级块内嵌入块无面包屑,需重新渲染 https://github.com/siyuan-note/siyuan/issues/7574
if (item.getAttribute("data-type") === "NodeBlockQueryEmbed") {
item.removeAttribute("data-render")
blockRender(options.protyle, item)
}
});
transaction(options.protyle, doOperations, undoOperations);
focusBlock(options.protyle.wysiwyg.element.querySelector(`[data-node-id="${options.selectsElement[0].getAttribute("data-node-id")}"]`));