@talrace/ngx-noder 19.0.53 → 19.0.54

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.
@@ -10250,7 +10250,7 @@ class CommentHighlightLayer extends HighlightLayer {
10250
10250
  }
10251
10251
  update(config) {
10252
10252
  const comments = this.session.model.comments;
10253
- if (!config?.isVisible || !comments?.length || !this.enabled) {
10253
+ if (!comments?.length || !this.enabled) {
10254
10254
  this.element.innerHTML = '';
10255
10255
  return;
10256
10256
  }
@@ -10391,6 +10391,12 @@ class CursorLayer {
10391
10391
  }
10392
10392
  }
10393
10393
 
10394
+ class CustomElementInfo {
10395
+ constructor(init) {
10396
+ Object.assign(this, init);
10397
+ }
10398
+ }
10399
+
10394
10400
  class GrammarHighlightLayer extends HighlightLayer {
10395
10401
  constructor(parentEl, cssClass, session) {
10396
10402
  super(parentEl, cssClass, session);
@@ -10398,7 +10404,7 @@ class GrammarHighlightLayer extends HighlightLayer {
10398
10404
  this.errorsByParagraph = new Map();
10399
10405
  }
10400
10406
  update(config) {
10401
- if (!config?.isVisible || !this.errorsByParagraph.size || this.session.editorService.isViewOnly) {
10407
+ if (!this.errorsByParagraph.size || this.session.editorService.isViewOnly) {
10402
10408
  this.element.innerHTML = '';
10403
10409
  return;
10404
10410
  }
@@ -10456,8 +10462,7 @@ class RenderChangesModel {
10456
10462
  this.scroll ||
10457
10463
  this.size ||
10458
10464
  this.text ||
10459
- this.dragAndDrop ||
10460
- this.visibilityChanged);
10465
+ this.dragAndDrop);
10461
10466
  }
10462
10467
  constructor(fields) {
10463
10468
  this.cursor = false;
@@ -10473,7 +10478,6 @@ class RenderChangesModel {
10473
10478
  this.size = false;
10474
10479
  this.text = false;
10475
10480
  this.dragAndDrop = false;
10476
- this.visibilityChanged = false;
10477
10481
  if (!fields) {
10478
10482
  return;
10479
10483
  }
@@ -10486,12 +10490,6 @@ class RenderChangesModel {
10486
10490
  }
10487
10491
  }
10488
10492
 
10489
- class CustomElementInfo {
10490
- constructor(init) {
10491
- Object.assign(this, init);
10492
- }
10493
- }
10494
-
10495
10493
  class SearchHighlightLayer extends HighlightLayer {
10496
10494
  constructor(parentEl, cssClass, session) {
10497
10495
  super(parentEl, cssClass, session);
@@ -10501,9 +10499,6 @@ class SearchHighlightLayer extends HighlightLayer {
10501
10499
  this.customElementsRanges = [];
10502
10500
  }
10503
10501
  update(config) {
10504
- if (!config?.isVisible) {
10505
- return;
10506
- }
10507
10502
  this.config = config;
10508
10503
  this.selectionIndex = 0;
10509
10504
  this.getVisibleCustomElementResults(config);
@@ -10871,10 +10866,8 @@ class Renderer extends EventEmitting {
10871
10866
  endLine: 0,
10872
10867
  endScreenLine: 0,
10873
10868
  endScreenFullLine: 0
10874
- },
10875
- isVisible: false
10869
+ }
10876
10870
  };
10877
- this.isVisible = false;
10878
10871
  this.changes = new RenderChangesModel();
10879
10872
  this.paragraphsAppeared = new Subject();
10880
10873
  this.visibilitySubject = new Subject();
@@ -10916,8 +10909,7 @@ class Renderer extends EventEmitting {
10916
10909
  changes.scroll ||
10917
10910
  changes.search ||
10918
10911
  changes.grammar ||
10919
- changes.commentHighlights ||
10920
- changes.visibilityChanged) {
10912
+ changes.commentHighlights) {
10921
10913
  changes.apply(this.computeLayerConfig());
10922
10914
  DomHelper.translate(this.content, 0, -this.layerConfig.offset);
10923
10915
  DomHelper.setStyle(this.content.style, 'width', `${this.layerConfig.width}px`);
@@ -10949,12 +10941,6 @@ class Renderer extends EventEmitting {
10949
10941
  if (changes.dragAndDrop) {
10950
10942
  this.renderDragAndDropSelection();
10951
10943
  }
10952
- if (changes.visibilityChanged) {
10953
- this.renderSearchHighlights();
10954
- this.renderGrammarHighlights();
10955
- this.renderCommentHighlights();
10956
- this.visibilitySubject.next(this.isVisible);
10957
- }
10958
10944
  this.session.onRendered();
10959
10945
  }
10960
10946
  /**
@@ -11004,10 +10990,22 @@ class Renderer extends EventEmitting {
11004
10990
  }
11005
10991
  }
11006
10992
  updateCustomElementHighlights(ranges) {
11007
- this.searchHighlightLayer.customElementsRanges = ranges;
11008
- this.scheduleChanges({ search: true });
10993
+ if (this.searchHighlightLayer.customElementsRanges.length !== ranges.length ||
10994
+ !this.searchHighlightLayer.customElementsRanges.every(x => ranges.some(z => x.location.isEqual(z.location)))) {
10995
+ this.searchHighlightLayer.customElementsRanges = ranges;
10996
+ this.scheduleChanges({ search: true });
10997
+ }
11009
10998
  }
11010
10999
  updateActiveSearchHighlight(active) {
11000
+ if (this.searchHighlightLayer.active === active ||
11001
+ (this.searchHighlightLayer.active instanceof Range &&
11002
+ active instanceof Range &&
11003
+ this.searchHighlightLayer.active.isEqual(active)) ||
11004
+ (this.searchHighlightLayer.active instanceof CustomElementInfo &&
11005
+ active instanceof CustomElementInfo &&
11006
+ this.searchHighlightLayer.active.location.isEqual(active.location))) {
11007
+ return;
11008
+ }
11011
11009
  this.searchHighlightLayer.active = active;
11012
11010
  this.scheduleChanges({ search: true });
11013
11011
  }
@@ -11047,15 +11045,6 @@ class Renderer extends EventEmitting {
11047
11045
  this.dragAndDropSelectionLayer.marker = null;
11048
11046
  this.scheduleChanges({ dragAndDrop: true });
11049
11047
  }
11050
- setVisibility(isVisible) {
11051
- if (this.isVisible !== isVisible) {
11052
- this.isVisible = isVisible;
11053
- if (!isVisible) {
11054
- this.commentsLayer.clearSessionComments();
11055
- }
11056
- this.scheduleChanges({ visibilityChanged: true });
11057
- }
11058
- }
11059
11048
  /**
11060
11049
  * Triggers a full update of the text, for all the rows.
11061
11050
  **/
@@ -11154,8 +11143,7 @@ class Renderer extends EventEmitting {
11154
11143
  contentRange: new DistanceModel({ start: 0, end: displayData.paragraphs.filter(x => x.paragraphSettings).length - 1 }),
11155
11144
  maxHeight,
11156
11145
  offset: 0,
11157
- scrollTop: this.session.scrollTop,
11158
- isVisible: this.isVisible
11146
+ scrollTop: this.session.scrollTop
11159
11147
  };
11160
11148
  return changes;
11161
11149
  }
@@ -11626,14 +11614,7 @@ class VirtualRenderer {
11626
11614
  return;
11627
11615
  }
11628
11616
  // text, scrolling and resize changes can cause the view port size to change
11629
- if (changes.full ||
11630
- changes.size ||
11631
- changes.text ||
11632
- changes.lines ||
11633
- changes.scroll ||
11634
- changes.search ||
11635
- changes.grammar ||
11636
- changes.visibilityChanged) {
11617
+ if (changes.full || changes.size || changes.text || changes.lines || changes.scroll || changes.search || changes.grammar) {
11637
11618
  changes.apply(this.computeLayerConfig());
11638
11619
  DomHelper.translate(this.renderer.content, 0, -this.layerConfig.offset);
11639
11620
  DomHelper.setStyle(this.renderer.content.style, 'width', `${this.layerConfig.width}px`);
@@ -11674,9 +11655,6 @@ class VirtualRenderer {
11674
11655
  if (changes.dragAndDrop) {
11675
11656
  this.renderDragAndDropSelection();
11676
11657
  }
11677
- if (changes.visibilityChanged) {
11678
- this.renderSearchHighlights();
11679
- }
11680
11658
  }
11681
11659
  /**
11682
11660
  * Triggers a resize of the editor
@@ -11805,9 +11783,6 @@ class VirtualRenderer {
11805
11783
  updateCursor() {
11806
11784
  this.renderer.updateCursor();
11807
11785
  }
11808
- setVisibility(isVisible) {
11809
- this.renderer.setVisibility(isVisible);
11810
- }
11811
11786
  scheduleChanges(changes) {
11812
11787
  this.loop.schedule(0, changes);
11813
11788
  }
@@ -11867,6 +11842,10 @@ class VirtualRenderer {
11867
11842
  this.renderer.clearGrammarHighlights();
11868
11843
  }
11869
11844
  paragraphsScrolledIntoView() {
11845
+ if (!this.layerConfig.visibleRange) {
11846
+ this.renderer.paragraphsAppeared.next(this.renderer.session.displayData.paragraphs);
11847
+ return;
11848
+ }
11870
11849
  const paragraphs = this.renderer.session.displayData.paragraphs.slice(this.layerConfig.visibleRange.startParagraph, this.layerConfig.visibleRange.endParagraph + 1);
11871
11850
  this.renderer.paragraphsAppeared.next(paragraphs);
11872
11851
  }
@@ -11904,8 +11883,7 @@ class VirtualRenderer {
11904
11883
  offset: 0,
11905
11884
  visibleRange,
11906
11885
  scrollTop: this.scrollBar.scrollTop,
11907
- pages: visibleRange.pages,
11908
- isVisible: true
11886
+ pages: visibleRange.pages
11909
11887
  };
11910
11888
  return changes;
11911
11889
  }
@@ -12182,7 +12160,6 @@ class RegulatorService {
12182
12160
  this.selectedCommentId = null;
12183
12161
  this.renderLoop = new RenderLoop();
12184
12162
  this.grammarChecker = new GrammarChecker(this.grammarService);
12185
- this.observer = this.initializeIntersectionObserver();
12186
12163
  }
12187
12164
  addMainSession(model, scalingRatio, container) {
12188
12165
  const sessionId = ++this.sessionIdIncrement;
@@ -12236,7 +12213,6 @@ class RegulatorService {
12236
12213
  if (this.grammarEnabled) {
12237
12214
  this.grammarChecker.registerSession(newSession);
12238
12215
  }
12239
- this.observer.observe(nativeElement);
12240
12216
  return newSession;
12241
12217
  }
12242
12218
  addEdgeSession(component, nativeElement) {
@@ -12253,14 +12229,12 @@ class RegulatorService {
12253
12229
  if (this.grammarEnabled) {
12254
12230
  this.grammarChecker.registerSession(newSession);
12255
12231
  }
12256
- this.observer.observe(nativeElement);
12257
12232
  return newSession;
12258
12233
  }
12259
12234
  removeSession(sessionId) {
12260
12235
  const index = this.sessions.findIndex(x => x.sessionId === sessionId);
12261
12236
  this.sessions[index].session.destroy();
12262
12237
  this.sessions[index].renderer.destroy();
12263
- this.observer.unobserve(this.sessions[index].nativeElement);
12264
12238
  this.sessions.splice(index, 1);
12265
12239
  this.grammarChecker.unregisterSession(sessionId);
12266
12240
  }
@@ -12518,19 +12492,6 @@ class RegulatorService {
12518
12492
  })
12519
12493
  ];
12520
12494
  }
12521
- initializeIntersectionObserver() {
12522
- const options = {
12523
- root: null,
12524
- rootMargin: '50px',
12525
- threshold: 0.01
12526
- };
12527
- return new IntersectionObserver(entries => {
12528
- entries.forEach(entry => {
12529
- const sessionId = +entry.target.getAttribute('data-session-id');
12530
- this.getSessionModel(sessionId)?.renderer.setVisibility(entry.isIntersecting);
12531
- });
12532
- }, options);
12533
- }
12534
12495
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RegulatorService, deps: [{ token: CustomContentService }, { token: EditorService }, { token: ComponentService }, { token: GrammarService }, { token: CommentRenderService }], target: i0.ɵɵFactoryTarget.Injectable }); }
12535
12496
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RegulatorService }); }
12536
12497
  }
@@ -13996,8 +13957,7 @@ class PrintRenderer {
13996
13957
  maxHeight,
13997
13958
  offset: 0,
13998
13959
  pages,
13999
- scrollTop: 0,
14000
- isVisible: true
13960
+ scrollTop: 0
14001
13961
  };
14002
13962
  }
14003
13963
  createContent() {