Vanessa 2026-04-21 09:47:14 +08:00
parent ed799763d4
commit f4dba03828
2 changed files with 5 additions and 3 deletions

View file

@ -547,13 +547,13 @@ export const setInsertWbrHTML = (nodeElement: HTMLElement, range: Range, protyle
const offset = getSelectionOffset(cellElement, nodeElement, range);
cellElement.classList.add("range");
const cloneNode = nodeElement.cloneNode(true) as HTMLElement;
cellElement.classList.remove("range");
cellElement.removeAttribute("class");
const cloneCellElement = cloneNode.querySelector(".range");
const cloneRange = focusByOffset(cloneCellElement, offset.end, offset.end, false);
if (cloneRange) {
cloneRange.insertNode(document.createElement("wbr"));
}
cloneCellElement.classList.remove("range");
cloneCellElement.removeAttribute("class");
protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] = cloneNode.outerHTML;
}
} else {

View file

@ -241,6 +241,7 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
realElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${tempId}"]`);
}
const realType = realElement.getAttribute("data-type");
let itemHTML = "";
if (realType === "NodeCodeBlock") {
const languageElement = realElement.querySelector(".protyle-action__language");
if (languageElement) {
@ -283,6 +284,7 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
currentWbrElement.insertAdjacentText("beforebegin", Constants.ZWSP);
}
}
itemHTML = realElement.outerHTML;
focusByWbr(protyle.wysiwyg.element, range);
protyle.hint.render(protyle);
// 表格出现滚动条,输入数字会向前滚 https://github.com/siyuan-note/siyuan/issues/3650
@ -292,7 +294,7 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
}
}
// https://github.com/siyuan-note/siyuan/issues/14766
html += realElement.outerHTML;
html += itemHTML || realElement.outerHTML;
});
} else if (blockElement.getAttribute("data-type") === "NodeCodeBlock") {
editElement.parentElement.removeAttribute("data-render");