This commit is contained in:
Vanessa 2023-09-14 00:01:31 +08:00
parent dfd1cd8327
commit d3d0fbcdcb

View File

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