Vanessa 2024-04-27 12:02:05 +08:00
parent d927e1ed9f
commit 03a6c15d70

View file

@ -51,7 +51,7 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
return;
}
blockElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
const wbrElement = document.createElement("wbr");
const wbrElement: HTMLElement = document.createElement("wbr");
range.insertNode(wbrElement);
if (event && event.inputType === "deleteContentForward") {
const wbrNextElement = hasNextSibling(wbrElement) as HTMLElement;
@ -223,6 +223,14 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
});
mathRender(realElement);
if (index === tempElement.content.childElementCount - 1) {
// https://github.com/siyuan-note/siyuan/issues/11156
const currentWbrElement = blockElement.querySelector("wbr")
if (currentWbrElement && currentWbrElement.parentElement.tagName === "SPAN" && currentWbrElement.parentElement.innerHTML === "<wbr>") {
const types = currentWbrElement.parentElement.getAttribute("data-type") || "";
if (types.includes("sup") || types.includes("u") || types.includes("sub")) {
currentWbrElement.insertAdjacentText("beforebegin", Constants.ZWSP);
}
}
focusByWbr(protyle.wysiwyg.element, range);
protyle.hint.render(protyle);
// 表格出现滚动条,输入数字会向前滚 https://github.com/siyuan-note/siyuan/issues/3650