Browse Source

fix: safari无法删除标题格式

wanghao 5 years ago
parent
commit
8eb857d09c
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/ts/ir/processKeydown.ts

+ 2 - 1
src/ts/ir/processKeydown.ts

@@ -18,7 +18,7 @@ import {
     hasClosestByMatchTag,
 } from "../util/hasClosest";
 import {hasClosestByHeadings} from "../util/hasClosestByHeadings";
-import {getEditorRange, getSelectPosition} from "../util/selection";
+import {getEditorRange, getSelectPosition, setSelectionFocus} from "../util/selection";
 
 export const processKeydown = (vditor: IVditor, event: KeyboardEvent) => {
     vditor.ir.composingLock = event.isComposing;
@@ -168,6 +168,7 @@ export const processKeydown = (vditor: IVditor, event: KeyboardEvent) => {
             if (getSelectPosition(headingElement, vditor.ir.element).start === headingLength) {
                 range.setStart(headingElement.firstElementChild.firstChild, headingLength - 1);
                 range.collapse(true);
+                setSelectionFocus(range);
             }
         }
     }