Skip to content

Commit

Permalink
fix(core): remove selection when readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
pubuzhixing8 committed Jul 20, 2021
1 parent ee0ac6e commit a9d655d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/src/components/editable/editable.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,10 @@ export class SlateEditableComponent implements OnInit, OnChanges, OnDestroy {
} catch (error) {
this.editor.onError({ code: SlateErrorCode.ToSlateSelectionError, nativeError: error })
}
} else if (this.readonly) {
Transforms.deselect(this.editor);
IS_FOCUSED.delete(this.editor);
window.getSelection().removeAllRanges();
}
}

Expand Down

0 comments on commit a9d655d

Please sign in to comment.