Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/11160

Vanessa03a6c15d7079
diff --git a/app/src/protyle/wysiwyg/input.ts b/app/src/protyle/wysiwyg/input.ts
index 549f3b9a2c..95927c6d7a 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 === "<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