slate-angular 14.0.0 → 14.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1688,8 +1688,8 @@ class ViewContainerItem {
1688
1688
  }
1689
1689
  if (isComponentType(this.viewType)) {
1690
1690
  const componentRef = this.viewContainerRef.createComponent(this.viewType);
1691
- componentRef.instance.context = context;
1692
1691
  componentRef.instance.viewContext = this.viewContext;
1692
+ componentRef.instance.context = context;
1693
1693
  this.componentRef = componentRef;
1694
1694
  }
1695
1695
  }
@@ -1864,7 +1864,10 @@ class BaseElementComponent extends BaseComponent {
1864
1864
  return this._context && this._context.element.children;
1865
1865
  }
1866
1866
  get isCollapsed() {
1867
- return this.selection && Range.isCollapsed(this.editor.selection);
1867
+ return this.selection && Range.isCollapsed(this.selection);
1868
+ }
1869
+ get isCollapsedAndNonReadonly() {
1870
+ return this.selection && Range.isCollapsed(this.selection) && !this.readonly;
1868
1871
  }
1869
1872
  get readonly() {
1870
1873
  return this._context && this._context.readonly;
@@ -2839,7 +2842,7 @@ class SlateEditableComponent {
2839
2842
  const { activeElement } = root;
2840
2843
  const el = AngularEditor.toDOMNode(this.editor, this.editor);
2841
2844
  const domSelection = root.getSelection();
2842
- if (activeElement === el || hasEditableTarget(this.editor, activeElement)) {
2845
+ if (activeElement === el) {
2843
2846
  this.latestElement = activeElement;
2844
2847
  IS_FOCUSED.set(this.editor, true);
2845
2848
  }
@@ -2873,7 +2876,9 @@ class SlateEditableComponent {
2873
2876
  }
2874
2877
  onDOMBeforeInput(event) {
2875
2878
  const editor = this.editor;
2876
- if (!this.readonly && hasEditableTarget(editor, event.target) && !this.isDOMEventHandled(event, this.beforeInput)) {
2879
+ const root = AngularEditor.findDocumentOrShadowRoot(this.editor);
2880
+ const { activeElement } = root;
2881
+ if (!this.readonly && hasEditableTarget(editor, event.target) && !isTargetInsideVoid(editor, activeElement) && !this.isDOMEventHandled(event, this.beforeInput)) {
2877
2882
  try {
2878
2883
  const { selection } = editor;
2879
2884
  const { inputType: type } = event;
@@ -3157,8 +3162,11 @@ class SlateEditableComponent {
3157
3162
  }
3158
3163
  onDOMKeydown(event) {
3159
3164
  const editor = this.editor;
3165
+ const root = AngularEditor.findDocumentOrShadowRoot(this.editor);
3166
+ const { activeElement } = root;
3160
3167
  if (!this.readonly &&
3161
3168
  hasEditableTarget(editor, event.target) &&
3169
+ !isTargetInsideVoid(editor, activeElement) && // stop fire keydown handle when focus void node
3162
3170
  !this.isComposing &&
3163
3171
  !this.isDOMEventHandled(event, this.keydown)) {
3164
3172
  const nativeEvent = event;