Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/9179

Vanessad3d0fbcdcb35
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index f5d7020b8e..4b63ac309b 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -1488,6 +1488,7 @@ export class WYSIWYG {
}
});
+ let timeout: number
this.element.addEventListener("input", (event: InputEvent) => {
const target = event.target as HTMLElement;
if (target.tagName === "VIDEO" || target.tagName === "AUDIO" || event.inputType === "historyRedo") {
@@ -1500,7 +1501,7 @@ export class WYSIWYG {
window.siyuan.menus.menu.remove();
return;
}
- let range = getEditorRange(this.element);
+ const range = getEditorRange(this.element);
const blockElement = hasClosestBlock(range.startContainer);
if (!blockElement) {
return;
@@ -1519,12 +1520,9 @@ export class WYSIWYG {
return;
}
this.escapeInline(protyle, range, event);
- if (/^\d{1}$/.test(event.data) || event.data === "‘" || event.data === "“") {
- setTimeout(() => {
- // https://github.com/siyuan-note/siyuan/issues/9179
- if (range.startOffset === 0) {
- range = getEditorRange(this.element);
- }
+ if ((/^\d{1}$/.test(event.data) || event.data === "‘" || event.data === "“")) {
+ clearTimeout(timeout); // https://github.com/siyuan-note/siyuan/issues/9179
+ timeout = window.setTimeout(() => {
input(protyle, blockElement, range, true); // 搜狗拼音数字后面句号变为点;Mac 反向双引号无法输入
});
} else {