diff --git a/app/src/protyle/wysiwyg/input.ts b/app/src/protyle/wysiwyg/input.ts index 549f3b9a2..95927c6d7 100644 --- a/app/src/protyle/wysiwyg/input.ts +++ b/app/src/protyle/wysiwyg/input.ts @@ -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 === "") { + 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