slate-angular 16.1.0-next.17 → 16.1.0-next.18

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.
@@ -1836,12 +1836,9 @@ function createEmbeddedViewOrComponent(viewType, context, viewContext, viewConta
1836
1836
  return componentRef;
1837
1837
  }
1838
1838
  }
1839
- function renderView(view) {
1840
- if (view instanceof ComponentRef) {
1841
- view.changeDetectorRef.detectChanges();
1842
- }
1843
- else {
1844
- view.detectChanges();
1839
+ function executeAfterViewInit(view) {
1840
+ if (view instanceof ComponentRef && view.instance.afterViewInit) {
1841
+ view.instance.afterViewInit();
1845
1842
  }
1846
1843
  }
1847
1844
  function updateContext(view, newContext, viewContext) {
@@ -1939,6 +1936,7 @@ class ListRender {
1939
1936
  this.getOutletParent = getOutletParent;
1940
1937
  this.getOutletElement = getOutletElement;
1941
1938
  this.views = [];
1939
+ this.addedViews = [];
1942
1940
  this.blockCards = [];
1943
1941
  this.contexts = [];
1944
1942
  this.viewTypes = [];
@@ -1957,6 +1955,7 @@ class ListRender {
1957
1955
  const view = createEmbeddedViewOrComponent(viewType, context, this.viewContext, this.viewContainerRef);
1958
1956
  const blockCard = createBlockCard(descendant, view, this.viewContainerRef, this.viewContext);
1959
1957
  this.views.push(view);
1958
+ this.addedViews.push(view);
1960
1959
  this.contexts.push(context);
1961
1960
  this.viewTypes.push(viewType);
1962
1961
  this.blockCards.push(blockCard);
@@ -1965,6 +1964,9 @@ class ListRender {
1965
1964
  const newDiffers = this.viewContainerRef.injector.get(IterableDiffers);
1966
1965
  this.differ = newDiffers.find(children).create(trackBy$1(this.viewContext));
1967
1966
  this.differ.diff(children);
1967
+ if (parent === this.viewContext.editor) {
1968
+ this.afterViewInit();
1969
+ }
1968
1970
  }
1969
1971
  update(children, parent, childrenContext) {
1970
1972
  if (!this.initialized || this.children.length === 0) {
@@ -1996,6 +1998,7 @@ class ListRender {
1996
1998
  blockCard = createBlockCard(record.item, view, this.viewContainerRef, this.viewContext);
1997
1999
  newContexts.push(context);
1998
2000
  newViews.push(view);
2001
+ this.addedViews.push(view);
1999
2002
  newBlockCards.push(blockCard);
2000
2003
  mountOnItemChange(record.currentIndex, record.item, newViews, newBlockCards, outletParent, firstRootNode, this.viewContext);
2001
2004
  }
@@ -2006,6 +2009,7 @@ class ListRender {
2006
2009
  const previousBlockCard = this.blockCards[record.previousIndex];
2007
2010
  if (previousViewType !== viewType) {
2008
2011
  view = createEmbeddedViewOrComponent(viewType, context, this.viewContext, this.viewContainerRef);
2012
+ this.addedViews.push(view);
2009
2013
  blockCard = createBlockCard(record.item, view, this.viewContainerRef, this.viewContext);
2010
2014
  const firstRootNode = getRootNodes(previousView, previousBlockCard)[0];
2011
2015
  const newRootNodes = getRootNodes(view, blockCard);
@@ -2048,6 +2052,9 @@ class ListRender {
2048
2052
  this.contexts = newContexts;
2049
2053
  this.children = children;
2050
2054
  this.blockCards = newBlockCards;
2055
+ if (parent === this.viewContext.editor) {
2056
+ this.afterViewInit();
2057
+ }
2051
2058
  }
2052
2059
  else {
2053
2060
  const newContexts = [];
@@ -2065,6 +2072,12 @@ class ListRender {
2065
2072
  this.contexts = newContexts;
2066
2073
  }
2067
2074
  }
2075
+ afterViewInit() {
2076
+ this.addedViews.forEach(view => {
2077
+ executeAfterViewInit(view);
2078
+ });
2079
+ this.addedViews = [];
2080
+ }
2068
2081
  destroy() {
2069
2082
  this.children.forEach((element, index) => {
2070
2083
  if (this.views[index]) {
@@ -2103,7 +2116,7 @@ function getContext$1(index, item, parentPath, childrenContext, viewContext) {
2103
2116
  }
2104
2117
  if (isVoid) {
2105
2118
  elementContext.attributes['data-slate-void'] = true;
2106
- elementContext.attributes.contenteditable = false;
2119
+ elementContext.contentEditable = false;
2107
2120
  }
2108
2121
  return elementContext;
2109
2122
  }
@@ -2477,6 +2490,12 @@ class BaseElementComponent extends BaseComponent {
2477
2490
  this.listRender.initialize(this.children, this.element, this.childrenContext);
2478
2491
  }
2479
2492
  }
2493
+ afterViewInit() {
2494
+ if (this._context.contentEditable !== undefined) {
2495
+ this.nativeElement.setAttribute('contenteditable', this._context.contentEditable + '');
2496
+ }
2497
+ this.listRender.afterViewInit();
2498
+ }
2480
2499
  updateWeakMap() {
2481
2500
  NODE_TO_ELEMENT.set(this.element, this.nativeElement);
2482
2501
  ELEMENT_TO_NODE.set(this.nativeElement, this.element);
@@ -2602,17 +2621,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
2602
2621
 
2603
2622
  class SlateVoidText extends BaseTextComponent {
2604
2623
  ngOnInit() {
2605
- this.isLeafBlock = AngularEditor.isLeafBlock(this.viewContext.editor, this.context.parent);
2606
2624
  super.ngOnInit();
2607
2625
  }
2608
2626
  ngOnChanges() {
2609
2627
  if (!this.initialized) {
2610
2628
  return;
2611
2629
  }
2612
- this.isLeafBlock = AngularEditor.isLeafBlock(this.viewContext.editor, this.context.parent);
2613
2630
  }
2614
2631
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateVoidText, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2615
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateVoidText, isStandalone: true, selector: "span[slateVoidText]", host: { attributes: { "data-slate-spacer": "true", "data-slate-node": "text" }, properties: { "attr.contenteditable": "isLeafBlock" }, classAttribute: "slate-spacer" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2632
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateVoidText, isStandalone: true, selector: "span[slateVoidText]", host: { attributes: { "data-slate-spacer": "true", "data-slate-node": "text" }, classAttribute: "slate-spacer" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2616
2633
  }
2617
2634
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateVoidText, decorators: [{
2618
2635
  type: Component,
@@ -2621,7 +2638,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
2621
2638
  template: ``,
2622
2639
  changeDetection: ChangeDetectionStrategy.OnPush,
2623
2640
  host: {
2624
- '[attr.contenteditable]': 'isLeafBlock',
2625
2641
  'data-slate-spacer': 'true',
2626
2642
  class: 'slate-spacer',
2627
2643
  'data-slate-node': 'text'