This commit is contained in:
Vanessa 2022-08-31 21:57:12 +08:00
parent a29e642e83
commit cfe11c944c
2 changed files with 5 additions and 13 deletions

View file

@ -178,18 +178,8 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);
focusByWbr(protyle.wysiwyg.element, range);
} else {
nodeElement.insertAdjacentHTML("afterend", code);
const codeElement = nodeElement.nextElementSibling as HTMLElement;
transaction(protyle, [{
action: "insert",
data: codeElement.outerHTML,
id: codeElement.getAttribute("data-node-id"),
previousID: id
}], [{
action: "delete",
id: codeElement.getAttribute("data-node-id")
}]);
highlightRender(codeElement);
insertHTML(code, protyle, true);
highlightRender(protyle.wysiwyg.element);
}
} else {
let isHTML = false;

View file

@ -507,7 +507,9 @@ export const focusSideBlock = (updateElement: Element) => {
if (updateElement.getAttribute("data-node-id")) {
let sideBlockElement;
let collapse;
if (updateElement.nextElementSibling) {
if (updateElement.nextElementSibling &&
!updateElement.nextElementSibling.classList.contains("protyle-attr") // 用例 https://ld246.com/article/1661928364696
) {
collapse = true;
sideBlockElement = getNextBlock(updateElement) as HTMLElement;
} else if (updateElement.previousElementSibling) {