@talrace/ngx-noder 0.0.38 → 0.0.39

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.
@@ -476,6 +476,7 @@ class EditorService {
476
476
  this._updateEdges$ = new Subject();
477
477
  this._insertText$ = new Subject();
478
478
  this._removeLeft$ = new Subject();
479
+ this._removeCustomElementsData$ = new Subject();
479
480
  this._currentPage$ = new BehaviorSubject(1);
480
481
  this._lastPageNumber$ = new BehaviorSubject(1);
481
482
  this._applyDocumentPageFormat$ = new Subject();
@@ -647,6 +648,10 @@ class EditorService {
647
648
  get removeLeft$() {
648
649
  return this._removeLeft$.asObservable();
649
650
  }
651
+ // Will be used by Project which use Library. To manage the delete of the external custom elements associated with the local custom elements
652
+ get removeCustomElementsData$() {
653
+ return this._removeCustomElementsData$.asObservable();
654
+ }
650
655
  get currentPage() {
651
656
  return this._currentPage$.value;
652
657
  }
@@ -831,6 +836,9 @@ class EditorService {
831
836
  removeLeft() {
832
837
  this._removeLeft$.next();
833
838
  }
839
+ removeCustomElementsData(elements) {
840
+ this._removeCustomElementsData$.next(elements);
841
+ }
834
842
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
835
843
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EditorService }); }
836
844
  }
@@ -7479,6 +7487,7 @@ class Editor {
7479
7487
  const partIndexes = ContentHelper.getSelectedPartDocumentIndexes(this.session.displayData.paragraphs, this.selection.range);
7480
7488
  model.delete = new DeleteModel({ startIndex: partIndexes.startIndex, count: partIndexes.endIndex - partIndexes.startIndex + 1 });
7481
7489
  this.saveReplaceToHistory(this.selection.range, model);
7490
+ this.removeCustomElementsData();
7482
7491
  const endPosition = this.session.replace(model);
7483
7492
  this.onDocumentChange(new Range(this.selection.cursor, endPosition));
7484
7493
  this.onSelectionChange();
@@ -7991,6 +8000,7 @@ class Editor {
7991
8000
  }
7992
8001
  else {
7993
8002
  this.saveRemoveToHistory(range);
8003
+ this.removeCustomElementsData();
7994
8004
  this.session.remove(range);
7995
8005
  this.onSelectionChange();
7996
8006
  }
@@ -8010,9 +8020,18 @@ class Editor {
8010
8020
  paragraphStyle: new ParagraphStyleModel({ ...lastParagraph.paragraphStyle })
8011
8021
  });
8012
8022
  this.saveRemoveWithParagraphToHistory(operation, reversed);
8023
+ this.removeCustomElementsData();
8013
8024
  this.session.removeWithParagraph(operation);
8014
8025
  this.onSelectionChange();
8015
8026
  }
8027
+ removeCustomElementsData() {
8028
+ const startIndex = ContentHelper.paragraphPositionToDocumentIndex(this.session.displayData.paragraphs, this.selection.range.start);
8029
+ const endIndex = ContentHelper.paragraphPositionToDocumentIndex(this.session.displayData.paragraphs, this.selection.range.end) - 1;
8030
+ const elements = IndexedElementHelper.sliceSection(this.session.model.elements, startIndex, endIndex).slice();
8031
+ if (elements.length) {
8032
+ this.editorService.removeCustomElementsData(elements);
8033
+ }
8034
+ }
8016
8035
  onInput() {
8017
8036
  const text = this.textInput.getInsertText();
8018
8037
  if (!text) {