Skip to content

Commit

Permalink
fix(core): stop keydown action when focus node
Browse files Browse the repository at this point in the history
  • Loading branch information
pubuzhixing8 committed Aug 18, 2022
1 parent 3cd4d8a commit 2c3d403
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/wise-yaks-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"slate-angular": patch
---

stop keydown action when focus node
3 changes: 3 additions & 0 deletions packages/src/components/editable/editable.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -868,9 +868,12 @@ export class SlateEditableComponent implements OnInit, OnChanges, OnDestroy, Aft

private onDOMKeydown(event: KeyboardEvent) {
const editor = this.editor;
const root = AngularEditor.findDocumentOrShadowRoot(this.editor)
const { activeElement } = root;
if (
!this.readonly &&
hasEditableTarget(editor, event.target) &&
!isTargetInsideVoid(editor, activeElement) && // stop fire keydown handle when focus void node
!this.isComposing &&
!this.isDOMEventHandled(event, this.keydown)
) {
Expand Down

0 comments on commit 2c3d403

Please sign in to comment.