Skip to content

Commit

Permalink
🎨 #11160
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Apr 27, 2024
1 parent d927e1e commit 03a6c15
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/src/protyle/wysiwyg/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 03a6c15

Please sign in to comment.