Vanessa 2024-11-25 11:15:25 +08:00
parent bef6bc6512
commit 68bbbd134d
2 changed files with 2 additions and 0 deletions

View file

@ -2091,6 +2091,7 @@ export class WYSIWYG {
) {
// 搜狗输入法不走 keydown需重新记录历史状态
if (range.toString() === "" && // windows 下回车新建块输入abc选中 bc ctrl+m 后光标错误
!this.preventKeyup &&
nodeElement && typeof protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] === "undefined") {
range.insertNode(document.createElement("wbr"));
protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] = nodeElement.outerHTML;

View file

@ -175,6 +175,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
// 光标位于引用结尾后 ctrl+b 偶尔会失效
range = cloneRange;
// 会导致 protyle.toolbar.range 和 range 不一致,先在有问题的地方重置一下 https://github.com/siyuan-note/siyuan/issues/10933
protyle.wysiwyg.preventKeyup = true; // 搜狗输入法进入此代码记录的话keyup 就不再记录,否则 transaction 清空后 keyup 再次记录,下一次 keydown 就不会记录 https://github.com/siyuan-note/siyuan/issues/13244
}
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&