@talrace/ngx-noder 19.0.33 → 19.0.34

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.
Files changed (54) hide show
  1. package/assets/i18n/noder.en.json +2 -1
  2. package/assets/i18n/noder.es.json +2 -1
  3. package/assets/i18n/noder.ru.json +2 -1
  4. package/fesm2022/talrace-ngx-noder.mjs +1035 -272
  5. package/fesm2022/talrace-ngx-noder.mjs.map +1 -1
  6. package/lib/apart-components/editor-toolbar/components/base-toolbar.component.d.ts +2 -0
  7. package/lib/editor/components/comment-popup/comment-popup.component.d.ts +11 -0
  8. package/lib/editor/display/layers/comment-highlight.layer.d.ts +15 -0
  9. package/lib/editor/display/layers/comment.layer.d.ts +13 -0
  10. package/lib/editor/display/layers/highlight.layer.d.ts +3 -3
  11. package/lib/editor/display/render-changes.interface.d.ts +1 -0
  12. package/lib/editor/display/render-changes.model.d.ts +1 -0
  13. package/lib/editor/display/renderer.d.ts +7 -1
  14. package/lib/editor/display/virtual.renderer.d.ts +7 -1
  15. package/lib/editor/editor.module.d.ts +23 -18
  16. package/lib/editor/execution/edit.session.d.ts +8 -1
  17. package/lib/editor/execution/editor.d.ts +22 -1
  18. package/lib/editor/execution/regulator.service.d.ts +8 -1
  19. package/lib/editor/gadgets/comment/base-comment.component.d.ts +19 -0
  20. package/lib/editor/gadgets/comment/comment-render.service.d.ts +27 -0
  21. package/lib/editor/gadgets/comment/models/remove-comment-dom.model.d.ts +5 -0
  22. package/lib/editor/gadgets/comment/models/remove-comments-dom.model.d.ts +4 -0
  23. package/lib/editor/gadgets/comment/models/render-comment.model.d.ts +10 -0
  24. package/lib/editor/gadgets/comment/models/render-comments.model.d.ts +6 -0
  25. package/lib/editor/gadgets/history/operation-history.d.ts +3 -0
  26. package/lib/editor/gadgets/history/operation.type.d.ts +3 -1
  27. package/lib/editor/gadgets/scrollbar.d.ts +1 -1
  28. package/lib/editor/interaction/editor.service.d.ts +32 -2
  29. package/lib/editor/interaction/mouse.handler.d.ts +2 -1
  30. package/lib/editor/operations/enums/command-type.enum.d.ts +3 -1
  31. package/lib/editor/operations/helpers/range-element-operations.helper.d.ts +9 -0
  32. package/lib/editor/operations/operations-helper.helper.d.ts +5 -2
  33. package/lib/editor/operations/save-commands.helper.d.ts +4 -0
  34. package/lib/editor/positioning/content.helper.d.ts +2 -0
  35. package/lib/editor/positioning/range.interface.d.ts +4 -0
  36. package/lib/models/generated/attach-comment.model.d.ts +5 -0
  37. package/lib/models/generated/cell.model.d.ts +2 -0
  38. package/lib/models/generated/command.model.d.ts +4 -0
  39. package/lib/models/generated/comment.model.d.ts +6 -0
  40. package/lib/models/generated/docx.model.d.ts +2 -0
  41. package/lib/models/generated/edge.model.d.ts +2 -0
  42. package/lib/models/generated/remove-comment.model.d.ts +4 -0
  43. package/lib/models/generated/restore.model.d.ts +2 -0
  44. package/package.json +1 -1
  45. package/public-api.d.ts +1 -0
  46. package/src/_ngx-noder.theme.scss +3 -1
  47. package/src/assets/fonts/nc-iconfont.eot +0 -0
  48. package/src/assets/fonts/nc-iconfont.scss +12 -0
  49. package/src/assets/fonts/nc-iconfont.svg +5 -1
  50. package/src/assets/fonts/nc-iconfont.ttf +0 -0
  51. package/src/assets/fonts/nc-iconfont.woff +0 -0
  52. package/src/lib/apart-components/editor-toolbar/components/toolbar-actions/_toolbar-actions.theme.scss +12 -0
  53. package/src/lib/editor/components/comment-popup/_theme.scss +9 -0
  54. package/src/scss/base-editor.scss +40 -0
@@ -1,21 +1,21 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, Injectable, signal, inject, ChangeDetectorRef, HostBinding, Input, Component, ChangeDetectionStrategy, ViewChild, InjectionToken, createComponent, EventEmitter, Output, HostListener, Inject, input, computed, effect, NgModule } from '@angular/core';
3
- import { Subject, BehaviorSubject, distinctUntilChanged, debounceTime, filter, fromEvent, throttleTime, take, startWith, takeUntil, tap, map, catchError } from 'rxjs';
2
+ import { Directive, Injectable, signal, inject, ChangeDetectorRef, HostBinding, Input, Component, ChangeDetectionStrategy, ViewChild, InjectionToken, createComponent, EventEmitter, Output, HostListener, ApplicationRef, Injector, Inject, input, computed, effect, NgModule } from '@angular/core';
3
+ import { Subject, BehaviorSubject, distinctUntilChanged, debounceTime, filter, fromEvent, take, throttleTime, startWith, takeUntil, tap, map, catchError } from 'rxjs';
4
4
  import * as i1$2 from '@angular/common/http';
5
5
  import { HttpHeaders } from '@angular/common/http';
6
+ import { ComponentPortal } from '@angular/cdk/portal';
7
+ import * as i1 from '@angular/cdk/overlay';
8
+ import { OverlayConfig } from '@angular/cdk/overlay';
6
9
  import * as i4 from '@angular/material/button';
7
10
  import { MatButtonModule } from '@angular/material/button';
11
+ import * as i5 from '@angular/material/icon';
12
+ import { MatIconModule } from '@angular/material/icon';
8
13
  import * as i3 from '@ngx-translate/core';
9
14
  import { TranslateModule } from '@ngx-translate/core';
10
- import { ComponentPortal } from '@angular/cdk/portal';
11
- import * as i1 from '@angular/cdk/overlay';
12
- import { OverlayConfig } from '@angular/cdk/overlay';
13
15
  import * as i3$1 from '@angular/common';
14
16
  import { CommonModule, AsyncPipe } from '@angular/common';
15
17
  import * as i2 from '@angular/forms';
16
18
  import { FormControl, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
17
- import * as i5 from '@angular/material/icon';
18
- import { MatIconModule } from '@angular/material/icon';
19
19
  import * as i6 from '@angular/material/input';
20
20
  import { MatInputModule } from '@angular/material/input';
21
21
  import * as i5$2 from '@angular/material/tooltip';
@@ -32,20 +32,21 @@ import { MatSelectModule } from '@angular/material/select';
32
32
  import * as i3$2 from '@angular/material/core';
33
33
  import * as i10 from '@angular/material/sidenav';
34
34
  import { MatSidenavModule } from '@angular/material/sidenav';
35
- import { TranslateHttpLoader } from '@ngx-translate/http-loader';
36
35
  import * as i4$1 from '@angular/material/menu';
37
36
  import { MatMenuModule } from '@angular/material/menu';
37
+ import { TextFieldModule } from '@angular/cdk/text-field';
38
+ import { TranslateHttpLoader } from '@ngx-translate/http-loader';
38
39
  import * as i4$2 from '@angular/material/expansion';
39
40
  import { MatExpansionModule } from '@angular/material/expansion';
40
41
  import * as i2$1 from '@angular/platform-browser';
41
42
  import * as i2$2 from '@angular/material/autocomplete';
42
43
  import { MatAutocompleteModule } from '@angular/material/autocomplete';
44
+ import * as i3$3 from '@angular/material/button-toggle';
45
+ import { MatButtonToggleModule } from '@angular/material/button-toggle';
43
46
  import * as i2$3 from '@angular/material/divider';
44
47
  import { MatDividerModule } from '@angular/material/divider';
45
48
  import * as i5$3 from 'ngx-colors';
46
49
  import { NgxColorsModule } from 'ngx-colors';
47
- import * as i3$3 from '@angular/material/button-toggle';
48
- import { MatButtonToggleModule } from '@angular/material/button-toggle';
49
50
  import * as i10$1 from '@angular/material/checkbox';
50
51
  import { MatCheckboxModule } from '@angular/material/checkbox';
51
52
  import * as i12 from '@angular/material/radio';
@@ -145,10 +146,10 @@ const DEFAULT_PARAGRAPH_STYLE = new ParagraphStyleModel({
145
146
  alignment: Alignment$1.left,
146
147
  backgroundColor: DEFAULT_BACKGROUND_COLOR,
147
148
  headingStyleId: DEFAULT_HEADING_STYLE_ID,
148
- indentFirstLine: 0,
149
- indentHanging: 0,
150
- indentLeft: 0,
151
- indentRight: 0,
149
+ indentFirstLine: null,
150
+ indentHanging: null,
151
+ indentLeft: null,
152
+ indentRight: null,
152
153
  lineSpacing: 1,
153
154
  spaceAfter: 0,
154
155
  spaceBefore: 0,
@@ -622,6 +623,7 @@ class EditorService {
622
623
  this._changedEdgeSize$ = new Subject();
623
624
  this._imageLoaded$ = new Subject();
624
625
  this._changedEdge$ = new Subject();
626
+ this._addCommentAtSelection$ = new Subject();
625
627
  this._insertTableRows$ = new Subject();
626
628
  this._insertTableColumns$ = new Subject();
627
629
  this._removeTableRows$ = new Subject();
@@ -648,6 +650,8 @@ class EditorService {
648
650
  this._removeLeft$ = new Subject();
649
651
  this._removeCustomElementsData$ = new Subject();
650
652
  this._restoreCustomElementsData$ = new Subject();
653
+ this._removeCommentData$ = new Subject();
654
+ this._restoreCommentData$ = new Subject();
651
655
  this._currentPage$ = new BehaviorSubject(1);
652
656
  this._lastPageNumber$ = new BehaviorSubject(1);
653
657
  this._applyDocumentPageFormat$ = new Subject();
@@ -664,6 +668,12 @@ class EditorService {
664
668
  paragraphStyle: new ParagraphStyleModel(),
665
669
  numberingModel: null
666
670
  });
671
+ this._commentSizeChanged$ = new Subject();
672
+ this._createComment$ = new Subject();
673
+ this._commentCreated$ = new Subject();
674
+ this._removeComment$ = new Subject();
675
+ this._setCommentSelected$ = new Subject();
676
+ this._setCommentsVisibility$ = new Subject();
667
677
  }
668
678
  set styles(value) {
669
679
  this._styles$.next({ ...value });
@@ -788,6 +798,9 @@ class EditorService {
788
798
  get changedEdge$() {
789
799
  return this._changedEdge$.asObservable();
790
800
  }
801
+ get addCommentAtSelection$() {
802
+ return this._addCommentAtSelection$.asObservable();
803
+ }
791
804
  get insertTableRows$() {
792
805
  return this._insertTableRows$.asObservable();
793
806
  }
@@ -873,6 +886,12 @@ class EditorService {
873
886
  get restoreCustomElementsData$() {
874
887
  return this._restoreCustomElementsData$.asObservable();
875
888
  }
889
+ get removeCommentData$() {
890
+ return this._removeCommentData$.asObservable();
891
+ }
892
+ get restoreCommentData$() {
893
+ return this._restoreCommentData$.asObservable();
894
+ }
876
895
  get currentPage() {
877
896
  return this._currentPage$.value;
878
897
  }
@@ -921,6 +940,24 @@ class EditorService {
921
940
  get paragraphStyle$() {
922
941
  return this._paragraphStyle$.asObservable();
923
942
  }
943
+ get commentSizeChanged$() {
944
+ return this._commentSizeChanged$.asObservable();
945
+ }
946
+ get createComment$() {
947
+ return this._createComment$.asObservable();
948
+ }
949
+ get commentCreated$() {
950
+ return this._commentCreated$.asObservable();
951
+ }
952
+ get removeComment$() {
953
+ return this._removeComment$.asObservable();
954
+ }
955
+ get setCommentSelected$() {
956
+ return this._setCommentSelected$.asObservable();
957
+ }
958
+ get setCommentsVisibility$() {
959
+ return this._setCommentsVisibility$.asObservable();
960
+ }
924
961
  tabSettings(value) {
925
962
  this._tabSettings$.next(value);
926
963
  }
@@ -1126,6 +1163,12 @@ class EditorService {
1126
1163
  restoreCustomElementsData(elements) {
1127
1164
  this._restoreCustomElementsData$.next(elements);
1128
1165
  }
1166
+ removeCommentData(commentIds) {
1167
+ this._removeCommentData$.next(commentIds);
1168
+ }
1169
+ restoreCommentData(commentIds) {
1170
+ this._restoreCommentData$.next(commentIds);
1171
+ }
1129
1172
  setNewSearchTerm(term) {
1130
1173
  this._searchTerm$.next(term);
1131
1174
  }
@@ -1162,6 +1205,27 @@ class EditorService {
1162
1205
  ignoreGrammarSuggestion(error) {
1163
1206
  this._ignoreGrammarError$.next(error);
1164
1207
  }
1208
+ addCommentAtSelection() {
1209
+ this._addCommentAtSelection$.next();
1210
+ }
1211
+ commentSizeChanged() {
1212
+ this._commentSizeChanged$.next();
1213
+ }
1214
+ createComment(reqId) {
1215
+ this._createComment$.next(reqId);
1216
+ }
1217
+ commentCreated(commentId, reqId) {
1218
+ this._commentCreated$.next({ commentId, reqId });
1219
+ }
1220
+ removeComment(id) {
1221
+ this._removeComment$.next(id);
1222
+ }
1223
+ setCommentSelected(id) {
1224
+ this._setCommentSelected$.next(id);
1225
+ }
1226
+ setCommentsVisibility(value) {
1227
+ this._setCommentsVisibility$.next(value);
1228
+ }
1165
1229
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1166
1230
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EditorService }); }
1167
1231
  }
@@ -1304,6 +1368,38 @@ class DefaultImageApiService {
1304
1368
  }
1305
1369
  }
1306
1370
 
1371
+ class BaseCommentComponent {
1372
+ constructor(elementRef, editorService) {
1373
+ this.elementRef = elementRef;
1374
+ this.editorService = editorService;
1375
+ this.resizeObserver = new ResizeObserver(entries => {
1376
+ const height = entries[0].borderBoxSize[0].blockSize;
1377
+ if (!height || this.height === height) {
1378
+ return;
1379
+ }
1380
+ this.height = height;
1381
+ this.editorService.commentSizeChanged();
1382
+ });
1383
+ }
1384
+ setSelected(value) {
1385
+ this.selected = value;
1386
+ }
1387
+ setEditing(value) {
1388
+ this.editing = value;
1389
+ }
1390
+ markAsNew() {
1391
+ this.setSelected(true);
1392
+ this.setEditing(true);
1393
+ this.isNew = true;
1394
+ }
1395
+ initialize() {
1396
+ this.resizeObserver.observe(this.elementRef.nativeElement);
1397
+ }
1398
+ destroy() {
1399
+ this.resizeObserver.disconnect();
1400
+ }
1401
+ }
1402
+
1307
1403
  class GrammarService {
1308
1404
  constructor() {
1309
1405
  this.debounceTime = 3000;
@@ -1442,6 +1538,8 @@ var CommandType;
1442
1538
  CommandType[CommandType["RestorePageFormats"] = 35] = "RestorePageFormats";
1443
1539
  CommandType[CommandType["ApplyParagraphs"] = 36] = "ApplyParagraphs";
1444
1540
  CommandType[CommandType["ApplyTableCellsStyles"] = 37] = "ApplyTableCellsStyles";
1541
+ CommandType[CommandType["AttachComment"] = 38] = "AttachComment";
1542
+ CommandType[CommandType["RemoveComment"] = 39] = "RemoveComment";
1445
1543
  })(CommandType || (CommandType = {}));
1446
1544
 
1447
1545
  class PageNumbersModel {
@@ -1539,6 +1637,25 @@ class ApplyTextStyleModel {
1539
1637
  }
1540
1638
  }
1541
1639
 
1640
+ class CommentModel {
1641
+ constructor(fields) {
1642
+ if (fields) {
1643
+ Object.assign(this, fields);
1644
+ }
1645
+ }
1646
+ }
1647
+
1648
+ class AttachCommentModel {
1649
+ constructor(fields) {
1650
+ if (fields) {
1651
+ if (fields.comment) {
1652
+ fields.comment = new CommentModel(fields.comment);
1653
+ }
1654
+ Object.assign(this, fields);
1655
+ }
1656
+ }
1657
+ }
1658
+
1542
1659
  const CUSTOM_ELEMENT_MARKER = '*';
1543
1660
  const TABLE_MARKER = '#';
1544
1661
 
@@ -1558,6 +1675,82 @@ class BreakHelper {
1558
1675
  }
1559
1676
  }
1560
1677
 
1678
+ class OverlayService {
1679
+ constructor(overlay) {
1680
+ this.overlay = overlay;
1681
+ this.overlayResult = new Subject();
1682
+ }
1683
+ open(component, data, xPosition, yPosition) {
1684
+ this.close();
1685
+ this.overlayRef = this.overlay.create(this.getOverlayConfig(xPosition, yPosition));
1686
+ const ref = this.overlayRef.attach(new ComponentPortal(component));
1687
+ Object.assign(ref.instance, data);
1688
+ this.clickSubscription();
1689
+ return this.overlayResult.asObservable();
1690
+ }
1691
+ close(value) {
1692
+ this.overlayResult.next(value);
1693
+ this.openedSubscription?.unsubscribe();
1694
+ if (this.overlayRef) {
1695
+ this.overlayRef.dispose();
1696
+ this.overlayRef = null;
1697
+ }
1698
+ }
1699
+ clickSubscription() {
1700
+ this.openedSubscription = fromEvent(document, 'mousedown')
1701
+ .pipe(filter(event => {
1702
+ const clickTarget = event.target;
1703
+ return (this.overlayRef &&
1704
+ !this.overlayRef.overlayElement.contains(clickTarget) &&
1705
+ this.overlayRef.overlayElement.parentElement.parentElement.children.length === 1);
1706
+ }), take(1))
1707
+ .subscribe(() => this.close());
1708
+ }
1709
+ getOverlayConfig(xPosition, yPosition) {
1710
+ return new OverlayConfig({
1711
+ hasBackdrop: false,
1712
+ backdropClass: 'noder-backdrop',
1713
+ positionStrategy: this.getOverlayPosition(xPosition, yPosition),
1714
+ scrollStrategy: this.overlay.scrollStrategies.reposition()
1715
+ });
1716
+ }
1717
+ getOverlayPosition(xPosition, yPosition) {
1718
+ return this.overlay.position().global().left(`${xPosition}px`).top(`${yPosition}px`);
1719
+ }
1720
+ scroll(deltaY) {
1721
+ // todo: close overlay when out of visible area
1722
+ if (!this.overlayRef) {
1723
+ return;
1724
+ }
1725
+ const x = this.overlayRef.overlayElement.offsetLeft;
1726
+ const y = this.overlayRef.overlayElement.offsetTop - deltaY;
1727
+ const strategy = this.overlay.position().global().left(`${x}px`).top(`${y}px`);
1728
+ this.overlayRef.updatePositionStrategy(strategy);
1729
+ }
1730
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: OverlayService, deps: [{ token: i1.Overlay }], target: i0.ɵɵFactoryTarget.Injectable }); }
1731
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: OverlayService }); }
1732
+ }
1733
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: OverlayService, decorators: [{
1734
+ type: Injectable
1735
+ }], ctorParameters: () => [{ type: i1.Overlay }] });
1736
+
1737
+ class CommentPopupComponent {
1738
+ constructor(editorService, overlayService) {
1739
+ this.editorService = editorService;
1740
+ this.overlayService = overlayService;
1741
+ }
1742
+ addComment() {
1743
+ this.editorService.addCommentAtSelection();
1744
+ this.overlayService.close();
1745
+ }
1746
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: CommentPopupComponent, deps: [{ token: EditorService }, { token: OverlayService }], target: i0.ɵɵFactoryTarget.Component }); }
1747
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: CommentPopupComponent, isStandalone: false, selector: "app-nod-comment-popup", ngImport: i0, template: "<button\n mat-stroked-button\n (click)=\"addComment()\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-comment\"></mat-icon>\n</button>\n", styles: [":host{min-height:30px;border-radius:8px}button{min-width:0}.mat-icon{display:flex;justify-content:center;align-items:center;margin:0}\n"], dependencies: [{ kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1748
+ }
1749
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: CommentPopupComponent, decorators: [{
1750
+ type: Component,
1751
+ args: [{ selector: 'app-nod-comment-popup', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<button\n mat-stroked-button\n (click)=\"addComment()\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-comment\"></mat-icon>\n</button>\n", styles: [":host{min-height:30px;border-radius:8px}button{min-width:0}.mat-icon{display:flex;justify-content:center;align-items:center;margin:0}\n"] }]
1752
+ }], ctorParameters: () => [{ type: EditorService }, { type: OverlayService }] });
1753
+
1561
1754
  class CursorParagraph {
1562
1755
  constructor(row, column) {
1563
1756
  this.row = row;
@@ -1604,6 +1797,9 @@ class ContentHelper {
1604
1797
  }
1605
1798
  });
1606
1799
  }
1800
+ static getCommentsInRange(comments, startIndex, endIndex) {
1801
+ return comments.filter(x => x.startIndex >= startIndex && x.endIndex <= endIndex);
1802
+ }
1607
1803
  }
1608
1804
 
1609
1805
  class CreateEdgesModel {
@@ -1755,65 +1951,6 @@ class FormatHelper {
1755
1951
 
1756
1952
  const POPUP_HEIGHT = 150;
1757
1953
 
1758
- class OverlayService {
1759
- constructor(overlay) {
1760
- this.overlay = overlay;
1761
- this.overlayResult = new Subject();
1762
- }
1763
- open(component, data, xPosition, yPosition) {
1764
- this.close();
1765
- this.overlayRef = this.overlay.create(this.getOverlayConfig(xPosition, yPosition));
1766
- const ref = this.overlayRef.attach(new ComponentPortal(component));
1767
- Object.assign(ref.instance, data);
1768
- this.clickSubscription();
1769
- return this.overlayResult.asObservable();
1770
- }
1771
- close(value) {
1772
- this.overlayResult.next(value);
1773
- this.openedSubscription?.unsubscribe();
1774
- if (this.overlayRef) {
1775
- this.overlayRef.dispose();
1776
- this.overlayRef = null;
1777
- }
1778
- }
1779
- clickSubscription() {
1780
- this.openedSubscription = fromEvent(document, 'mousedown')
1781
- .pipe(filter(event => {
1782
- const clickTarget = event.target;
1783
- return (this.overlayRef &&
1784
- !this.overlayRef.overlayElement.contains(clickTarget) &&
1785
- this.overlayRef.overlayElement.parentElement.parentElement.children.length === 1);
1786
- }), take(1))
1787
- .subscribe(() => this.close());
1788
- }
1789
- getOverlayConfig(xPosition, yPosition) {
1790
- return new OverlayConfig({
1791
- hasBackdrop: false,
1792
- backdropClass: 'noder-backdrop',
1793
- positionStrategy: this.getOverlayPosition(xPosition, yPosition),
1794
- scrollStrategy: this.overlay.scrollStrategies.reposition()
1795
- });
1796
- }
1797
- getOverlayPosition(xPosition, yPosition) {
1798
- return this.overlay.position().global().left(`${xPosition}px`).top(`${yPosition}px`);
1799
- }
1800
- scroll(deltaY) {
1801
- // todo: close overlay when out of visible area
1802
- if (!this.overlayRef) {
1803
- return;
1804
- }
1805
- const x = this.overlayRef.overlayElement.offsetLeft;
1806
- const y = this.overlayRef.overlayElement.offsetTop - deltaY;
1807
- const strategy = this.overlay.position().global().left(`${x}px`).top(`${y}px`);
1808
- this.overlayRef.updatePositionStrategy(strategy);
1809
- }
1810
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: OverlayService, deps: [{ token: i1.Overlay }], target: i0.ɵɵFactoryTarget.Injectable }); }
1811
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: OverlayService }); }
1812
- }
1813
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: OverlayService, decorators: [{
1814
- type: Injectable
1815
- }], ctorParameters: () => [{ type: i1.Overlay }] });
1816
-
1817
1954
  class GrammarPopupComponent {
1818
1955
  constructor(editorService, overlayService) {
1819
1956
  this.editorService = editorService;
@@ -2194,6 +2331,7 @@ var MouseButton;
2194
2331
 
2195
2332
  class MouseHandler {
2196
2333
  constructor(container, editor) {
2334
+ this.clickableElements = ['.noder-comment'];
2197
2335
  this.clicks = 0;
2198
2336
  this.containerWheel$ = fromEvent(container, 'wheel')
2199
2337
  .pipe(throttleTime(20))
@@ -2203,20 +2341,26 @@ class MouseHandler {
2203
2341
  destroy() {
2204
2342
  this.containerWheel$?.unsubscribe();
2205
2343
  this.containerMouseDown$?.unsubscribe();
2206
- this.endMousePress();
2344
+ this.endMousePress(null, null);
2207
2345
  }
2208
2346
  startMousePress(editor) {
2209
- this.endMousePress();
2347
+ this.endMousePress(editor, null);
2210
2348
  this.documentMouseMove$ = fromEvent(document, 'mousemove')
2211
2349
  .pipe(throttleTime(20))
2212
2350
  .subscribe((event) => editor.onMousePressedMove(event));
2213
- this.documentMouseUp$ = fromEvent(document, 'mouseup').subscribe(() => this.endMousePress());
2351
+ this.documentMouseUp$ = fromEvent(document, 'mouseup').subscribe((event) => this.endMousePress(editor, event));
2214
2352
  }
2215
- endMousePress() {
2353
+ endMousePress(editor, event) {
2216
2354
  this.documentMouseMove$?.unsubscribe();
2217
2355
  this.documentMouseUp$?.unsubscribe();
2356
+ editor?.onMousePressEnd(event);
2218
2357
  }
2219
2358
  onMultiMouseDown(event, editor) {
2359
+ for (const element of this.clickableElements) {
2360
+ if (event.target.closest(element)) {
2361
+ return;
2362
+ }
2363
+ }
2220
2364
  if (event.button !== MouseButton.Left) {
2221
2365
  editor.onMouseClick(event);
2222
2366
  return;
@@ -2256,6 +2400,14 @@ let CellDataModel$1 = class CellDataModel {
2256
2400
  }
2257
2401
  };
2258
2402
 
2403
+ class RemoveCommentModel {
2404
+ constructor(fields) {
2405
+ if (fields) {
2406
+ Object.assign(this, fields);
2407
+ }
2408
+ }
2409
+ }
2410
+
2259
2411
  class RemoveEdgesModel {
2260
2412
  constructor(fields) {
2261
2413
  if (fields) {
@@ -2351,6 +2503,16 @@ class OperationHistory {
2351
2503
  this.step = -1;
2352
2504
  this.editorService.historyInfo = new OperationsHistoryInfoModel(this.step, this.storage.length - 1);
2353
2505
  }
2506
+ pushAttachComment(comment) {
2507
+ const redoStep = new AttachCommentModel({ comment: comment });
2508
+ const undoStep = new RemoveCommentModel({ commentId: comment.commentId });
2509
+ this.addToHistory(undoStep, redoStep);
2510
+ }
2511
+ pushRemoveComment(comment) {
2512
+ const redoStep = new RemoveCommentModel({ commentId: comment.commentId });
2513
+ const undoStep = new AttachCommentModel({ comment: comment });
2514
+ this.addToHistory(undoStep, redoStep);
2515
+ }
2354
2516
  pushInsertText(insertIndex, text) {
2355
2517
  const redoStep = new InsertTextModel({ insertIndex, text });
2356
2518
  const undoStep = new DeleteModel({ startIndex: insertIndex, count: text.length });
@@ -2695,6 +2857,67 @@ class ParagraphModel {
2695
2857
  }
2696
2858
  }
2697
2859
 
2860
+ class RangeElementHelper {
2861
+ static removeContent(elements, startIndex, endIndex) {
2862
+ const length = endIndex - startIndex + 1;
2863
+ for (let i = elements.length - 1; i >= 0; i--) {
2864
+ const element = elements[i];
2865
+ if (element.endIndex < startIndex) {
2866
+ continue;
2867
+ }
2868
+ if (element.startIndex < startIndex) {
2869
+ if (element.endIndex > endIndex) {
2870
+ element.endIndex -= length;
2871
+ }
2872
+ else {
2873
+ element.endIndex = startIndex;
2874
+ }
2875
+ continue;
2876
+ }
2877
+ if (element.startIndex >= startIndex && element.startIndex <= endIndex) {
2878
+ if (element.endIndex <= endIndex) {
2879
+ elements.splice(i, 1);
2880
+ continue;
2881
+ }
2882
+ element.startIndex = endIndex;
2883
+ continue;
2884
+ }
2885
+ element.startIndex -= length;
2886
+ element.endIndex -= length;
2887
+ }
2888
+ }
2889
+ static insertContent(elements, index, length) {
2890
+ for (const element of elements) {
2891
+ if (element.startIndex >= index) {
2892
+ element.startIndex += length;
2893
+ element.endIndex += length;
2894
+ }
2895
+ else if (element.endIndex >= index) {
2896
+ element.endIndex += length;
2897
+ }
2898
+ }
2899
+ }
2900
+ static restore(elements, index, contentLength, newElements) {
2901
+ RangeElementHelper.insertContent(elements, index, contentLength);
2902
+ const nextElement = elements.find(x => x.startIndex >= index);
2903
+ const indexInElements = nextElement !== undefined ? elements.indexOf(nextElement) : elements.length;
2904
+ elements.splice(indexInElements, 0, ...newElements);
2905
+ }
2906
+ static replaceContent(elements, startIndex, endIndex, length) {
2907
+ RangeElementHelper.removeContent(elements, startIndex, endIndex);
2908
+ RangeElementHelper.insertContent(elements, startIndex, length);
2909
+ }
2910
+ static shiftIndexes(elements, offset) {
2911
+ for (const element of elements) {
2912
+ element.startIndex += offset;
2913
+ element.endIndex += offset;
2914
+ }
2915
+ }
2916
+ static sliceSection(elements, startIndex, endIndex) {
2917
+ return elements.filter(x => x.startIndex >= startIndex && x.endIndex <= endIndex);
2918
+ }
2919
+ }
2920
+
2698
2921
  class TableModel {
2699
2922
  constructor(fields) {
2700
2923
  if (fields) {
@@ -2723,6 +2946,7 @@ class ContentsOperationsHelper {
2723
2946
  const images = IndexedElementHelper.sliceSection(contents.images, startIndex, endIndex).map(x => new ImageModel(x));
2724
2947
  const tables = IndexedElementHelper.sliceSection(contents.tables, startIndex, endIndex).map(x => new TableModel(x));
2725
2948
  const elements = IndexedElementHelper.sliceSection(contents.elements, startIndex, endIndex).map(x => new ElementModel(x));
2949
+ const comments = RangeElementHelper.sliceSection(contents.comments, startIndex, endIndex);
2726
2950
  const breaks = IndexedElementHelper.sliceSection(contents.breaks, startIndex, endIndex).map(x => new BreakModel(x));
2727
2951
  const tabs = IndexedElementHelper.sliceSection(contents.tabs, startIndex, endIndex).map(x => new TabModel(x));
2728
2952
  const links = LinkHelper.sliceSection(contents.links, startIndex, endIndex).map(x => new LinkModel(x));
@@ -2738,7 +2962,8 @@ class ContentsOperationsHelper {
2738
2962
  breaks,
2739
2963
  tabs,
2740
2964
  links,
2741
- pageFormats
2965
+ pageFormats,
2966
+ comments
2742
2967
  });
2743
2968
  }
2744
2969
  }
@@ -2763,6 +2988,7 @@ class EdgesOperationsHelper {
2763
2988
  paragraphs: [new ParagraphModel({ insertIndex: 0, paragraphStyle: DEFAULT_PARAGRAPH_STYLE })],
2764
2989
  tables: [],
2765
2990
  tabs: [],
2991
+ comments: [],
2766
2992
  links: []
2767
2993
  }));
2768
2994
  }
@@ -4494,6 +4720,7 @@ var VerticalMerge;
4494
4720
  class TableOperationsHelper {
4495
4721
  static insertContent(tables, insertIndex, columnsCount, rowsCount, contentWidth) {
4496
4722
  let rows = [];
4723
+ const columnWidth = Math.round(contentWidth / columnsCount);
4497
4724
  for (let i = 0; i < rowsCount; i++) {
4498
4725
  let cells = [];
4499
4726
  for (let j = 0; j < columnsCount; j++) {
@@ -4507,13 +4734,14 @@ class TableOperationsHelper {
4507
4734
  tables: [],
4508
4735
  tabs: [],
4509
4736
  links: [],
4737
+ comments: [],
4738
+ width: columnWidth,
4510
4739
  widthType: 'dxa'
4511
4740
  });
4512
4741
  cells.push(cell);
4513
4742
  }
4514
4743
  rows.push(new RowModel({ cells: cells }));
4515
4744
  }
4516
- const columnWidth = Math.round(contentWidth / columnsCount);
4517
4745
  const columns = [];
4518
4746
  for (let i = 0; i < columnsCount; i++) {
4519
4747
  const column = new ColumnModel({
@@ -4607,7 +4835,8 @@ class TableOperationsHelper {
4607
4835
  verticalMerge: this.getCellVerticalMerge(matrix[inheritIndex].cells[i].verticalMerge, targetIndex, inheritIndex),
4608
4836
  tables: [],
4609
4837
  tabs: [],
4610
- links: []
4838
+ links: [],
4839
+ comments: []
4611
4840
  });
4612
4841
  newCells.push(newCell);
4613
4842
  }
@@ -5189,7 +5418,7 @@ class OperationsHelper {
5189
5418
  }
5190
5419
  case CommandType.InsertTableColumns: {
5191
5420
  const model = command.insertTableColumns;
5192
- const contentWidth = this.getContentWidth(document, contents);
5421
+ const contentWidth = this.getContentWidth(document, contents, model.insertIndex);
5193
5422
  this.insertTableColumns(contents, model.insertIndex, model.count, model.targetIndex, model.inheritIndex, contentWidth);
5194
5423
  break;
5195
5424
  }
@@ -5200,7 +5429,7 @@ class OperationsHelper {
5200
5429
  }
5201
5430
  case CommandType.RemoveTableColumns: {
5202
5431
  const model = command.removeTableColumns;
5203
- const contentWidth = this.getContentWidth(document, contents);
5432
+ const contentWidth = this.getContentWidth(document, contents, model.insertIndex);
5204
5433
  this.removeTableColumns(contents, model.insertIndex, model.startIndex, model.endIndex, contentWidth);
5205
5434
  break;
5206
5435
  }
@@ -5215,8 +5444,9 @@ class OperationsHelper {
5215
5444
  break;
5216
5445
  }
5217
5446
  case CommandType.InsertTable: {
5218
- const contentWidth = this.getContentWidth(document, contents);
5219
- this.insertTable(contents, command.insertTable, contentWidth);
5447
+ const model = command.insertTable;
5448
+ const contentWidth = this.getContentWidth(document, contents, model.insertIndex);
5449
+ this.insertTable(contents, model, contentWidth);
5220
5450
  break;
5221
5451
  }
5222
5452
  case CommandType.ApplyImageStyle: {
@@ -5235,8 +5465,7 @@ class OperationsHelper {
5235
5465
  break;
5236
5466
  }
5237
5467
  case CommandType.Replace: {
5238
- const contentWidth = this.getContentWidth(document, contents);
5239
- this.replace(contents, command.replace, contentWidth);
5468
+ this.replace(document, contents, command.replace);
5240
5469
  break;
5241
5470
  }
5242
5471
  case CommandType.CreateEdges: {
@@ -5305,6 +5534,16 @@ class OperationsHelper {
5305
5534
  this.applyTableCellsStyles(contents, model);
5306
5535
  break;
5307
5536
  }
5537
+ case CommandType.AttachComment: {
5538
+ const model = command.attachComment;
5539
+ this.addComment(document, model.comment);
5540
+ break;
5541
+ }
5542
+ case CommandType.RemoveComment: {
5543
+ const model = command.removeComment;
5544
+ this.removeComment(document, model.commentId);
5545
+ break;
5546
+ }
5308
5547
  }
5309
5548
  });
5310
5549
  }
@@ -5332,20 +5571,25 @@ class OperationsHelper {
5332
5571
  IndexedElementHelper.shiftIndexes(restore.elements, offset);
5333
5572
  IndexedElementHelper.shiftIndexes(restore.breaks, offset);
5334
5573
  IndexedElementHelper.shiftIndexes(restore.tabs, offset);
5574
+ RangeElementHelper.shiftIndexes(restore.comments, offset);
5335
5575
  LinkHelper.shiftIndexes(restore.links, offset);
5336
5576
  PageFormatHelper.shiftIndexes(restore.pageFormats, offset);
5337
5577
  this.restore(targetContents, restore);
5338
5578
  return moveIndex;
5339
5579
  }
5340
- static getContentWidth(document, contents) {
5341
- let contentWidth = 0;
5342
- const defaultPageFormat = document.pageFormats[document.pageFormats.length - 1];
5580
+ static getContentWidth(document, contents, insertIndex = 0) {
5581
+ let contentWidth;
5343
5582
  if (contents instanceof CellModel) {
5344
5583
  const margins = (contents.margins?.left ?? 0) + (contents.margins?.right ?? 0);
5345
5584
  contentWidth = contents.width - margins;
5346
5585
  }
5586
+ else if (contents instanceof EdgeModel) {
5587
+ const pageFormat = document.pageFormats[document.pageFormats.length - 1];
5588
+ contentWidth = pageFormat.pageWidth - pageFormat.marginLeft - pageFormat.marginRight;
5589
+ }
5347
5590
  else {
5348
- contentWidth = defaultPageFormat.pageWidth - defaultPageFormat.marginLeft - defaultPageFormat.marginRight;
5591
+ const pageFormat = document.pageFormats.findLast(x => x.insertIndex <= insertIndex) ?? document.pageFormats[document.pageFormats.length - 1];
5592
+ contentWidth = pageFormat.pageWidth - pageFormat.marginLeft - pageFormat.marginRight;
5349
5593
  }
5350
5594
  return contentWidth;
5351
5595
  }
@@ -5358,6 +5602,7 @@ class OperationsHelper {
5358
5602
  IndexedElementOperationsHelper.insertContent(document.elements, index, text.length);
5359
5603
  IndexedElementOperationsHelper.insertContent(document.breaks, index, text.length);
5360
5604
  IndexedElementOperationsHelper.insertContent(document.tabs, index, text.length);
5605
+ RangeElementHelper.insertContent(document.comments, index, text.length);
5361
5606
  LinkOperationsHelper.insertContent(document.links, index, text.length);
5362
5607
  PageFormatOperationsHelper.insertContent(document, index, text.length);
5363
5608
  }
@@ -5370,6 +5615,7 @@ class OperationsHelper {
5370
5615
  IndexedElementOperationsHelper.insert(document.elements, element.element);
5371
5616
  IndexedElementOperationsHelper.insertContent(document.breaks, element.element.insertIndex, 1);
5372
5617
  IndexedElementOperationsHelper.insertContent(document.tabs, element.element.insertIndex, 1);
5618
+ RangeElementHelper.insertContent(document.comments, element.element.insertIndex, 1);
5373
5619
  LinkOperationsHelper.insertContent(document.links, element.element.insertIndex, 1);
5374
5620
  PageFormatOperationsHelper.insertContent(document, element.element.insertIndex, 1);
5375
5621
  }
@@ -5382,6 +5628,7 @@ class OperationsHelper {
5382
5628
  IndexedElementOperationsHelper.insertContent(document.elements, index, text.length);
5383
5629
  BreakOperationsHelper.insertContent(document.breaks, index + text.length - 1, breakType, text.length);
5384
5630
  IndexedElementOperationsHelper.insertContent(document.tabs, index, text.length);
5631
+ RangeElementHelper.insertContent(document.comments, index, text.length);
5385
5632
  LinkOperationsHelper.insertContent(document.links, index, text.length);
5386
5633
  PageFormatOperationsHelper.insertContent(document, index, text.length);
5387
5634
  }
@@ -5394,6 +5641,7 @@ class OperationsHelper {
5394
5641
  IndexedElementOperationsHelper.insertContent(document.elements, index, 1);
5395
5642
  IndexedElementOperationsHelper.insertContent(document.breaks, index, 1);
5396
5643
  TabOperationsHelper.insertContent(document.tabs, index);
5644
+ RangeElementHelper.insertContent(document.comments, index, 1);
5397
5645
  LinkOperationsHelper.insertContent(document.links, index, 1);
5398
5646
  PageFormatOperationsHelper.insertContent(document, index, 1);
5399
5647
  }
@@ -5406,6 +5654,7 @@ class OperationsHelper {
5406
5654
  IndexedElementOperationsHelper.insertContent(document.elements, index, text.length);
5407
5655
  IndexedElementOperationsHelper.insertContent(document.breaks, index, text.length);
5408
5656
  IndexedElementOperationsHelper.insertContent(document.tabs, index, text.length);
5657
+ RangeElementHelper.insertContent(document.comments, index, text.length);
5409
5658
  PageFormatOperationsHelper.insertContent(document, index, text.length);
5410
5659
  const formatStyle = FormatStyleHelper.getFormatAtIndex(document.formats, index).textStyle;
5411
5660
  LinkOperationsHelper.insert(document.links, link, index, text.length, {
@@ -5463,6 +5712,7 @@ class OperationsHelper {
5463
5712
  IndexedElementOperationsHelper.insertContent(document.breaks, index, 1);
5464
5713
  ImageOperationsHelper.insertContent(document.images, index, imageData);
5465
5714
  IndexedElementOperationsHelper.insertContent(document.tabs, index, 1);
5715
+ RangeElementHelper.insertContent(document.comments, index, 1);
5466
5716
  LinkOperationsHelper.insertContent(document.links, index, 1);
5467
5717
  PageFormatOperationsHelper.insertContent(document, index, 1);
5468
5718
  }
@@ -5482,6 +5732,7 @@ class OperationsHelper {
5482
5732
  IndexedElementOperationsHelper.insertContent(document.breaks, index, 1);
5483
5733
  TableOperationsHelper.insertContent(document.tables, index, tableModel.columnsCount, tableModel.rowsCount, contentWidth);
5484
5734
  IndexedElementOperationsHelper.insertContent(document.tabs, index, 1);
5735
+ RangeElementHelper.insertContent(document.comments, index, 1);
5485
5736
  LinkOperationsHelper.insertContent(document.links, index, 1);
5486
5737
  PageFormatOperationsHelper.insertContent(document, index, 1);
5487
5738
  if (tableModel.insertParagraphAfter) {
@@ -5506,6 +5757,7 @@ class OperationsHelper {
5506
5757
  IndexedElementOperationsHelper.insertContent(document.elements, index, text.length);
5507
5758
  IndexedElementOperationsHelper.insertContent(document.breaks, index, text.length);
5508
5759
  IndexedElementOperationsHelper.insertContent(document.tabs, index, text.length);
5760
+ RangeElementHelper.insertContent(document.comments, index, text.length);
5509
5761
  LinkOperationsHelper.insertStyledContent(document.links, index, text.length, style);
5510
5762
  PageFormatOperationsHelper.insertContent(document, index, text.length);
5511
5763
  }
@@ -5518,6 +5770,7 @@ class OperationsHelper {
5518
5770
  IndexedElementOperationsHelper.restore(document.elements, model.insertIndex, model.text.length, model.elements);
5519
5771
  IndexedElementOperationsHelper.restore(document.breaks, model.insertIndex, model.text.length, model.breaks);
5520
5772
  IndexedElementOperationsHelper.restore(document.tabs, model.insertIndex, model.text.length, model.tabs);
5773
+ RangeElementHelper.restore(document.comments, model.insertIndex, model.text.length, model.comments);
5521
5774
  PageFormatOperationsHelper.restore(document, model.insertIndex, model.text.length, model.pageFormats);
5522
5775
  LinkOperationsHelper.restore(document.links, model.insertIndex, model.text.length, model.links);
5523
5776
  }
@@ -5531,6 +5784,7 @@ class OperationsHelper {
5531
5784
  IndexedElementOperationsHelper.removeContent(document.elements, startIndex, endIndex);
5532
5785
  IndexedElementOperationsHelper.removeContent(document.breaks, startIndex, endIndex);
5533
5786
  IndexedElementOperationsHelper.removeContent(document.tabs, startIndex, endIndex);
5787
+ RangeElementHelper.removeContent(document.comments, startIndex, endIndex);
5534
5788
  PageFormatOperationsHelper.removeContent(document, startIndex, endIndex);
5535
5789
  LinkOperationsHelper.removeContent(document.links, startIndex, endIndex);
5536
5790
  }
@@ -5543,32 +5797,43 @@ class OperationsHelper {
5543
5797
  IndexedElementOperationsHelper.replaceContent(document.elements, startIndex, endIndex, text.length);
5544
5798
  IndexedElementOperationsHelper.replaceContent(document.breaks, startIndex, endIndex, text.length);
5545
5799
  IndexedElementOperationsHelper.replaceContent(document.tabs, startIndex, endIndex, text.length);
5800
+ RangeElementHelper.replaceContent(document.comments, startIndex, endIndex, text.length);
5546
5801
  PageFormatOperationsHelper.replaceContent(document, startIndex, endIndex, text.length);
5547
5802
  LinkOperationsHelper.replaceContent(document.links, startIndex, endIndex, text.length);
5548
5803
  }
5549
- static replace(document, model, contentWidth) {
5804
+ static addComment(document, comment) {
5805
+ document.comments.push(comment);
5806
+ }
5807
+ static removeComment(document, commentId) {
5808
+ const comment = document.comments.find(x => x.commentId === commentId);
5809
+ document.comments = document.comments.filter(x => x.commentId !== commentId);
5810
+ return comment;
5811
+ }
5812
+ static replace(document, contents, model) {
5550
5813
  this.delete(document, model.delete.startIndex, model.delete.count);
5551
5814
  if (model.insertText) {
5552
- this.insertText(document, model.insertText.text, model.insertText.insertIndex);
5815
+ this.insertText(contents, model.insertText.text, model.insertText.insertIndex);
5553
5816
  }
5554
5817
  else if (model.insertElement) {
5555
- this.insertElement(document, model.insertElement);
5818
+ this.insertElement(contents, model.insertElement);
5556
5819
  }
5557
5820
  else if (model.insertTab) {
5558
- this.insertTab(document, model.insertTab.insertIndex);
5821
+ this.insertTab(contents, model.insertTab.insertIndex);
5559
5822
  }
5560
5823
  else if (model.insertBreak) {
5561
5824
  const text = model.insertBreak.isOnNewParagraph ? `${NEW_LINE_MARKUP}${CUSTOM_ELEMENT_MARKER}` : CUSTOM_ELEMENT_MARKER;
5562
- this.insertBreak(document, text, model.insertBreak.insertIndex, model.insertBreak.breakType);
5825
+ this.insertBreak(contents, text, model.insertBreak.insertIndex, model.insertBreak.breakType);
5563
5826
  }
5564
5827
  else if (model.insertImage) {
5565
- this.insertImage(document, model.insertImage.insertIndex, model.insertImage.imageData);
5828
+ this.insertImage(contents, model.insertImage.insertIndex, model.insertImage.imageData);
5566
5829
  }
5567
5830
  else if (model.insertTable) {
5568
- this.insertTable(document, model.insertTable, contentWidth);
5831
+ const insertTableModel = model.insertTable;
5832
+ const contentWidth = this.getContentWidth(document, contents, insertTableModel.insertIndex);
5833
+ this.insertTable(contents, insertTableModel, contentWidth);
5569
5834
  }
5570
5835
  else if (model.insertLink) {
5571
- this.insertLink(document, model.insertLink.linkDataModel.text, model.insertLink.linkDataModel.link, model.insertLink.insertIndex);
5836
+ this.insertLink(contents, model.insertLink.linkDataModel.text, model.insertLink.linkDataModel.link, model.insertLink.insertIndex);
5572
5837
  }
5573
5838
  }
5574
5839
  static applyTextStyle(document, startIndex, endIndex, style) {
@@ -5910,11 +6175,12 @@ class PositionHelper {
5910
6175
  const numberingOffsetLeft = paragraphSettings.numberingData.numberingId === null
5911
6176
  ? 0
5912
6177
  : paragraphSettings.numberingData.width + paragraphSettings.numberingData.paddingLeft;
5913
- if (lineIndex === 0 &&
5914
- (textLineInfo.indentFirstLine ||
6178
+ if (textLineInfo.isNumbering &&
6179
+ lineIndex === 0 &&
6180
+ (textLineInfo.indentFirstLine !== null ||
5915
6181
  (numberingOffsetLeft - textLineInfo.indentLeft > 0 &&
5916
- numberingOffsetLeft - textLineInfo.indentLeft < textLineInfo.markerWidth))) {
5917
- return DEFAULT_OFFSET_AFTER_NUMBERING_MARKER;
6182
+ numberingOffsetLeft - textLineInfo.indentLeft <= textLineInfo.markerWidth))) {
6183
+ return textLineInfo.markerWidth;
5918
6184
  }
5919
6185
  return 0;
5920
6186
  }
@@ -5991,7 +6257,7 @@ class RenderingHelper {
5991
6257
  lineEl.className = 'noder-line';
5992
6258
  if (lineInfo) {
5993
6259
  const paddingLeft = ScalingHelper.scale(lineInfo.paddingLeft, scalingRatio);
5994
- const marginLeft = numberingOffsetLeft > 0 ? -numberingOffsetLeft : 0;
6260
+ const marginLeft = numberingOffsetLeft !== null ? -numberingOffsetLeft : 0;
5995
6261
  // eslint-disable-next-line prettier/prettier
5996
6262
  let styleString = `padding-left:${paddingLeft}px;height:${lineInfo.height + lineInfo.offsetAfter}px;margin-top:${lineInfo.offsetBefore}px;margin-bottom:${lineInfo.endPageOffset}px;margin-left:${marginLeft}px;background-color:${lineInfo.backgroundColor};`;
5997
6263
  if (lineInfo.wordSpacing) {
@@ -6021,10 +6287,11 @@ class RenderingHelper {
6021
6287
  ? 0
6022
6288
  : currentParagraph.numberingData.width + currentParagraph.numberingData.paddingLeft;
6023
6289
  let markerWidth = 0;
6024
- if (currentParagraph.textLinesInfo[0].indentFirstLine ||
6025
- (numberingOffsetLeft - currentParagraph.textLinesInfo[0].indentLeft > 0 &&
6026
- numberingOffsetLeft - currentParagraph.textLinesInfo[0].indentLeft < currentParagraph.textLinesInfo[0].markerWidth)) {
6027
- markerWidth = DEFAULT_OFFSET_AFTER_NUMBERING_MARKER;
6290
+ if (currentParagraph.textLinesInfo[0].isNumbering &&
6291
+ (currentParagraph.textLinesInfo[0].indentFirstLine !== null ||
6292
+ (numberingOffsetLeft - currentParagraph.textLinesInfo[0].indentLeft > 0 &&
6293
+ numberingOffsetLeft - currentParagraph.textLinesInfo[0].indentLeft < currentParagraph.textLinesInfo[0].markerWidth))) {
6294
+ markerWidth = currentParagraph.textLinesInfo[0].markerWidth;
6028
6295
  }
6029
6296
  let lineEl = RenderingHelper.createLineElement(currentParagraph.textLinesInfo[splitIndex], numberingOffsetLeft - markerWidth, scalingRatio);
6030
6297
  domContent.parentNode.appendChild(lineEl);
@@ -6896,9 +7163,10 @@ class TextLayer {
6896
7163
  ? 0
6897
7164
  : paragraphSettings.numberingData.width + paragraphSettings.numberingData.paddingLeft - markerWidth;
6898
7165
  let offset = 0;
6899
- if (numberingOffsetLeft - paragraphSettings.textLinesInfo[0].indentLeft > 0 &&
7166
+ if (paragraphSettings.textLinesInfo[0].isNumbering &&
7167
+ numberingOffsetLeft - paragraphSettings.textLinesInfo[0].indentLeft > 0 &&
6900
7168
  numberingOffsetLeft - paragraphSettings.textLinesInfo[0].indentLeft < paragraphSettings.textLinesInfo[0].markerWidth) {
6901
- offset = DEFAULT_OFFSET_AFTER_NUMBERING_MARKER;
7169
+ offset = paragraphSettings.textLinesInfo[0].markerWidth;
6902
7170
  }
6903
7171
  const lineInfo = paragraphSettings.textLinesInfo[0];
6904
7172
  const lastLineEl = this.renderingHelper.createLineElement(lineInfo, numberingOffsetLeft - offset, this.session.generalProperties.scalingRatio);
@@ -7221,6 +7489,9 @@ class CommandModel {
7221
7489
  if (fields.applyTextStyle) {
7222
7490
  fields.applyTextStyle = new ApplyTextStyleModel(fields.applyTextStyle);
7223
7491
  }
7492
+ if (fields.attachComment) {
7493
+ fields.attachComment = new AttachCommentModel(fields.attachComment);
7494
+ }
7224
7495
  if (fields.createEdges) {
7225
7496
  fields.createEdges = new CreateEdgesModel(fields.createEdges);
7226
7497
  }
@@ -7263,6 +7534,9 @@ class CommandModel {
7263
7534
  if (fields.moveRange) {
7264
7535
  fields.moveRange = new MoveRangeModel(fields.moveRange);
7265
7536
  }
7537
+ if (fields.removeComment) {
7538
+ fields.removeComment = new RemoveCommentModel(fields.removeComment);
7539
+ }
7266
7540
  if (fields.removeEdges) {
7267
7541
  fields.removeEdges = new RemoveEdgesModel(fields.removeEdges);
7268
7542
  }
@@ -7441,6 +7715,12 @@ class SaveCommandsHelper {
7441
7715
  static getRestorePageFormatsCommand(restorePageFormats, targets) {
7442
7716
  return new CommandModel({ commandType: CommandType.RestorePageFormats, restorePageFormats, targets });
7443
7717
  }
7718
+ static getAttachCommentCommand(attachComment, targets) {
7719
+ return new CommandModel({ commandType: CommandType.AttachComment, attachComment, targets });
7720
+ }
7721
+ static getRemoveCommentCommand(removeComment, targets) {
7722
+ return new CommandModel({ commandType: CommandType.RemoveComment, removeComment, targets });
7723
+ }
7444
7724
  static getApplyDocumentPageFormatCommand(applyDocumentPageFormat, targets) {
7445
7725
  return new CommandModel({ commandType: CommandType.ApplyDocumentPageFormat, applyDocumentPageFormat, targets });
7446
7726
  }
@@ -8255,6 +8535,7 @@ class Editor {
8255
8535
  this.edgeElementTagName = 'APP-NOD-EDGE';
8256
8536
  this.imageTagName = 'APP-NOD-IMAGE';
8257
8537
  this.subscriptions = [];
8538
+ this.commentCreateRequests = [];
8258
8539
  this.emojiRegex = /\p{Extended_Pictographic}(?:\p{Emoji_Modifier}|\u{200D}\p{Extended_Pictographic})*/gu;
8259
8540
  this.isRerenderSubscriptionOpen = true;
8260
8541
  this.rerenderResize = () => {
@@ -8283,7 +8564,7 @@ class Editor {
8283
8564
  this.focus();
8284
8565
  this.session.applyToolbarStyles();
8285
8566
  this.search = new Search(editorService);
8286
- this.subscriptions.push(this.changedEdgeSizeSubscription(), this.changedEdgeSubscription(), this.changedTableSizeSubscription(), this.clipboardDataSubscription(), this.copySelectedSubscription(), this.createCustomComponentSubscription(), this.replaceByCustomComponentSubscription(), this.cutSelectedSubscription(), this.disableSelectionSubscription(), this.endMousePressSubscription(), this.imageLoadedSubscription(), this.insertBreakSubscription(), this.insertImageSubscription(), this.insertLinkSubscription(), this.insertTableColumnsSubscription(), this.insertTableRowsSubscription(), this.insertTableSubscription(), this.updateTableBorderStyleSubscription(), this.updateTableBorderWidthSubscription(), this.updateTableBordersSubscription(), this.insertTextSubscription(), this.pasteFromClipboardSubscription(), this.printSubscription(), this.redoSubscription(), this.removeLeftSubscription(), this.removeNumberingsSubscription(), this.removeRightSubscription(), this.removeSelectedSubscription(), this.removeTableColumnsSubscription(), this.removeTableRowsSubscription(), this.removeTableSubscription(), this.rerenderSubscription(), this.resizeTableColumnsSubscription(), ...this.searchOptionSubscriptions(), ...this.replaceSubscription(), this.grammarReplaceSubscription(), this.ignoreGrammarErrorSubscription(), this.selectAllSubscription(), this.setImageStyleSubscription(), this.setNumberingTemplateTypeSubscription(), this.setParagraphStylesSubscription(), this.setTextStylesSubscription(), this.undoSubscription(), this.updateEdgeSubscription(), this.viewOnlyModeSubscription(), this.applyPageFormatSubscription(), this.applyRightMarginPageFormatSubscription(), this.applyLeftMarginPageFormatSubscription(), this.insertPageFormatSubscription(), this.applyDocumentPageFormatSubscription(), this.dragMoveSubscription(), this.dragDropSubscription(), this.applyFirstLinePositionSubscription(), this.applyRightIndentParagraphSubscription(), this.applyLeftIndentParagraphSubscription(), this.applyTabSettingsSubscription(), this.commandCreatedForEdges());
8567
+ this.subscriptions.push(this.changedEdgeSizeSubscription(), this.changedEdgeSubscription(), this.changedTableSizeSubscription(), this.clipboardDataSubscription(), this.copySelectedSubscription(), this.createCustomComponentSubscription(), this.replaceByCustomComponentSubscription(), this.cutSelectedSubscription(), this.disableSelectionSubscription(), this.endMousePressSubscription(), this.imageLoadedSubscription(), this.insertBreakSubscription(), this.insertImageSubscription(), this.insertLinkSubscription(), this.insertTableColumnsSubscription(), this.insertTableRowsSubscription(), this.insertTableSubscription(), this.updateTableBorderStyleSubscription(), this.updateTableBorderWidthSubscription(), this.updateTableBordersSubscription(), this.insertTextSubscription(), this.pasteFromClipboardSubscription(), this.printSubscription(), this.redoSubscription(), this.removeLeftSubscription(), this.removeNumberingsSubscription(), this.removeRightSubscription(), this.removeSelectedSubscription(), this.removeTableColumnsSubscription(), this.removeTableRowsSubscription(), this.removeTableSubscription(), this.rerenderSubscription(), this.resizeTableColumnsSubscription(), ...this.searchOptionSubscriptions(), ...this.replaceSubscription(), this.grammarReplaceSubscription(), this.ignoreGrammarErrorSubscription(), this.selectAllSubscription(), this.setImageStyleSubscription(), this.setNumberingTemplateTypeSubscription(), this.setParagraphStylesSubscription(), this.setTextStylesSubscription(), this.undoSubscription(), this.updateEdgeSubscription(), this.viewOnlyModeSubscription(), this.applyPageFormatSubscription(), this.applyRightMarginPageFormatSubscription(), this.applyLeftMarginPageFormatSubscription(), this.insertPageFormatSubscription(), this.applyDocumentPageFormatSubscription(), this.dragMoveSubscription(), this.dragDropSubscription(), this.applyFirstLinePositionSubscription(), this.applyRightIndentParagraphSubscription(), this.applyLeftIndentParagraphSubscription(), this.applyTabSettingsSubscription(), this.commandCreatedForEdges(), ...this.commentCreationSubscriptions(), this.removeCommentSubscription(), this.rerenderCommentsSubscription(), this.selectCommentSubscription(), this.setComentsVisibilitySubscription());
8287
8568
  }
8288
8569
  destroy() {
8289
8570
  this.subscriptions.forEach(s => s?.unsubscribe());
@@ -8431,9 +8712,9 @@ class Editor {
8431
8712
  if (paragraph.paragraphSettings.numberingData.numberingId && paragraph.paragraphSettings.numberingData.level <= 6) {
8432
8713
  this.applyParagraphStyles(new ParagraphStyleModel({
8433
8714
  numberingLevel: paragraph.paragraphSettings.numberingData.level + 1,
8434
- indentLeft: 0,
8435
- indentFirstLine: 0,
8436
- indentHanging: 0
8715
+ indentLeft: null,
8716
+ indentFirstLine: null,
8717
+ indentHanging: null
8437
8718
  }));
8438
8719
  return;
8439
8720
  }
@@ -8459,9 +8740,9 @@ class Editor {
8459
8740
  }
8460
8741
  this.applyParagraphStyles(new ParagraphStyleModel({
8461
8742
  numberingLevel: paragraph.paragraphSettings.numberingData.level - 1,
8462
- indentLeft: 0,
8463
- indentFirstLine: 0,
8464
- indentHanging: 0
8743
+ indentLeft: null,
8744
+ indentFirstLine: null,
8745
+ indentHanging: null
8465
8746
  }));
8466
8747
  return;
8467
8748
  }
@@ -8563,7 +8844,7 @@ class Editor {
8563
8844
  const partIndexes = ContentHelper.getSelectedPartDocumentIndexes(this.session.displayData.paragraphs, this.selection.range);
8564
8845
  model.delete = new DeleteModel({ startIndex: partIndexes.startIndex, count: partIndexes.endIndex - partIndexes.startIndex + 1 });
8565
8846
  this.saveReplaceToHistory(this.selection.range, model);
8566
- this.removeCustomElementsData();
8847
+ this.removeExternalData();
8567
8848
  const endPosition = this.session.replace(model);
8568
8849
  this.onDocumentChange(new Range(this.selection.cursor, endPosition));
8569
8850
  this.onSelectionChange();
@@ -8770,6 +9051,7 @@ class Editor {
8770
9051
  const deepCopy = structuredClone(operation);
8771
9052
  this.editorService.restoreCustomElementsData(deepCopy.elements);
8772
9053
  this.session.restore(deepCopy);
9054
+ this.editorService.restoreCommentData(operation.comments.map(x => x.commentId));
8773
9055
  command = SaveCommandsHelper.getRestoreCommand(deepCopy, this.targets);
8774
9056
  }
8775
9057
  else if (operation instanceof ApplyTextStyleModel) {
@@ -8885,6 +9167,7 @@ class Editor {
8885
9167
  const deepCopy = structuredClone(operation);
8886
9168
  this.editorService.restoreCustomElementsData(deepCopy.restore.elements);
8887
9169
  this.session.restoreWithParagraph(deepCopy);
9170
+ this.editorService.restoreCommentData(operation.restore.comments.map(x => x.commentId));
8888
9171
  command = SaveCommandsHelper.getRestoreWithParagraphCommand(deepCopy, this.targets);
8889
9172
  }
8890
9173
  else if (operation instanceof MoveRangeModel) {
@@ -8920,9 +9203,20 @@ class Editor {
8920
9203
  const deepCopy = structuredClone(operation);
8921
9204
  this.editorService.restoreCustomElementsData(deepCopy.restore.elements);
8922
9205
  this.session.replaceByRestore(structuredClone(deepCopy));
9206
+ this.editorService.restoreCommentData(operation.restore.comments.map(x => x.commentId));
8923
9207
  command = SaveCommandsHelper.getReplaceByRestoreCommand(structuredClone(deepCopy), this.targets);
8924
9208
  }
8925
- else if (operation instanceof ApplyParagraphsModel) {
9209
+ else if (operation instanceof AttachCommentModel) {
9210
+ this.session.addComment(operation.comment);
9211
+ this.editorService.restoreCommentData([operation.comment.commentId]);
9212
+ command = SaveCommandsHelper.getAttachCommentCommand(operation, this.targets);
9213
+ }
9214
+ else if (operation instanceof RemoveCommentModel) {
9215
+ this.session.removeComment(operation.commentId);
9216
+ this.editorService.removeCommentData([operation.commentId]);
9217
+ command = SaveCommandsHelper.getRemoveCommentCommand(operation, this.targets);
9218
+ }
9219
+ else if (operation instanceof ApplyParagraphsModel) {
8926
9220
  const deepCopy = structuredClone(operation);
8927
9221
  this.session.applyParagraphs(deepCopy.paragraphs);
8928
9222
  command = SaveCommandsHelper.getApplyParagraphsCommand(deepCopy.paragraphs, this.targets);
@@ -8938,6 +9232,14 @@ class Editor {
8938
9232
  this.commandsService.createCommand(command);
8939
9233
  this.renderer.updateCursor();
8940
9234
  }
9235
+ saveAttachCommentToHistory(commentModel) {
9236
+ this.history.pushAttachComment(commentModel);
9237
+ this.commandsService.createCommand(SaveCommandsHelper.getAttachCommentCommand(new AttachCommentModel({ comment: commentModel }), this.targets));
9238
+ }
9239
+ saveRemoveCommentToHistory(comment, target) {
9240
+ this.history.pushRemoveComment(comment);
9241
+ this.commandsService.createCommand(SaveCommandsHelper.getRemoveCommentCommand(new RemoveCommentModel({ commentId: comment.commentId }), [target]));
9242
+ }
8941
9243
  saveRemoveToHistory(range) {
8942
9244
  const restore = this.session.createRestoreFromSlice(range.start, range.end);
8943
9245
  this.history.pushDelete(restore);
@@ -9114,7 +9416,7 @@ class Editor {
9114
9416
  }
9115
9417
  else {
9116
9418
  this.saveRemoveToHistory(range);
9117
- this.removeCustomElementsData();
9419
+ this.removeExternalData();
9118
9420
  this.session.remove(range);
9119
9421
  this.onSelectionChange();
9120
9422
  this.onContentChange();
@@ -9135,18 +9437,22 @@ class Editor {
9135
9437
  paragraphStyle: new ParagraphStyleModel({ ...lastParagraph.paragraphStyle })
9136
9438
  });
9137
9439
  this.saveRemoveWithParagraphToHistory(operation, reversed);
9138
- this.removeCustomElementsData();
9440
+ this.removeExternalData();
9139
9441
  this.session.removeWithParagraph(operation);
9140
9442
  this.onSelectionChange();
9141
9443
  this.onContentChange();
9142
9444
  }
9143
- removeCustomElementsData() {
9445
+ removeExternalData() {
9144
9446
  const startIndex = ContentHelper.paragraphPositionToDocumentIndex(this.session.displayData.paragraphs, this.selection.range.start);
9145
9447
  const endIndex = ContentHelper.paragraphPositionToDocumentIndex(this.session.displayData.paragraphs, this.selection.range.end) - 1;
9146
9448
  const elements = IndexedElementHelper.sliceSection(this.session.model.elements, startIndex, endIndex).slice();
9147
9449
  if (elements.length) {
9148
9450
  this.editorService.removeCustomElementsData(elements);
9149
9451
  }
9452
+ const comments = ContentHelper.getCommentsInRange(this.session.model.comments, startIndex, endIndex);
9453
+ if (comments.length) {
9454
+ this.editorService.removeCommentData(comments.map(x => x.commentId));
9455
+ }
9150
9456
  }
9151
9457
  removeOrLowerNestingNumbering(paragraph) {
9152
9458
  if (paragraph.paragraphSettings.numberingData.level > 0) {
@@ -9190,6 +9496,39 @@ class Editor {
9190
9496
  const data = this.textInput.getClipboardData(event);
9191
9497
  this.pasteData(data);
9192
9498
  }
9499
+ onCreateComment() {
9500
+ const startIndex = ContentHelper.paragraphPositionToDocumentIndex(this.session.displayData.paragraphs, this.selection.range.start);
9501
+ const endIndex = ContentHelper.paragraphPositionToDocumentIndex(this.session.displayData.paragraphs, this.selection.range.end);
9502
+ const reqId = Date.now();
9503
+ const comment = new CommentModel({ startIndex, endIndex });
9504
+ this.commentCreateRequests.push({ sessionId: this.session.sessionId, reqId, comment });
9505
+ this.editorService.createComment(reqId);
9506
+ }
9507
+ onCommentCreated(reqId, commentId) {
9508
+ const request = this.commentCreateRequests.find(x => x.reqId === reqId);
9509
+ const commentModel = request.comment;
9510
+ if (!commentModel) {
9511
+ return;
9512
+ }
9513
+ const sessionModel = this.regulatorService.getSessionModel(request.sessionId);
9514
+ this.commentCreateRequests = this.commentCreateRequests.filter(x => x.reqId !== reqId);
9515
+ commentModel.commentId = commentId;
9516
+ sessionModel.session.addComment(commentModel);
9517
+ sessionModel.renderer.setSelectedComment(commentModel.commentId);
9518
+ sessionModel.renderer.loop.schedule({ comments: true });
9519
+ this.saveAttachCommentToHistory(commentModel);
9520
+ }
9521
+ onCommentRemoved(id) {
9522
+ const { session, target } = this.regulatorService.getCommentTarget(id);
9523
+ const comment = session.session.removeComment(id);
9524
+ this.saveRemoveCommentToHistory(comment, target);
9525
+ this.editorService.removeCommentData([id]);
9526
+ session.renderer.loop.schedule({ comments: true });
9527
+ }
9528
+ onSetCommentsVisibility(value) {
9529
+ this.commentsVisible = value;
9530
+ this.regulatorService.setCommentsVisibility(value);
9531
+ }
9193
9532
  initResizeListener() {
9194
9533
  window.addEventListener('resize', this.rerenderResize);
9195
9534
  }
@@ -9312,6 +9651,7 @@ class Editor {
9312
9651
  const range = this.session.getWordRange(position.row, position.column);
9313
9652
  this.selection.placeSelection(range.start, range.end);
9314
9653
  }
9654
+ this.setCommentPopup(event);
9315
9655
  this.onSelectionChange();
9316
9656
  }
9317
9657
  onTripleClick(event) {
@@ -9325,6 +9665,7 @@ class Editor {
9325
9665
  const start = new CursorParagraph(position.row, 0);
9326
9666
  const end = new CursorParagraph(position.row, this.session.displayData.getParagraphContent(position.row).length);
9327
9667
  this.selection.placeSelection(start, end);
9668
+ this.setCommentPopup(event);
9328
9669
  this.onSelectionChange();
9329
9670
  }
9330
9671
  onQuadClick(event) {
@@ -9335,19 +9676,31 @@ class Editor {
9335
9676
  }
9336
9677
  event.preventDefault();
9337
9678
  this.selection.selectAll(this.session.model);
9679
+ this.setCommentPopup(event);
9338
9680
  this.onSelectionChange();
9339
9681
  }
9340
9682
  onMouseWheel(event) {
9341
9683
  if (event.ctrlKey) {
9342
9684
  return;
9343
9685
  }
9686
+ event.stopPropagation();
9687
+ event.preventDefault();
9344
9688
  const factor = 0.35;
9345
9689
  const scrollSpeed = 4;
9346
- const deltaY = event.deltaY * factor * scrollSpeed;
9690
+ let deltaY = event.deltaY * factor * scrollSpeed;
9691
+ const scrollTop = this.mainRenderer.scrollBar.scrollTop;
9692
+ const maxScroll = this.mainSession.displayData.allPagesHeight - this.mainRenderer.size.scrollerHeight;
9693
+ if (scrollTop + deltaY < 0) {
9694
+ deltaY = -scrollTop;
9695
+ }
9696
+ else if (scrollTop + deltaY > maxScroll) {
9697
+ deltaY = maxScroll - scrollTop;
9698
+ }
9699
+ if (deltaY === 0) {
9700
+ return;
9701
+ }
9347
9702
  this.onScroll(deltaY);
9348
9703
  this.overlayService.scroll(deltaY);
9349
- event.stopPropagation();
9350
- event.preventDefault();
9351
9704
  }
9352
9705
  onScroll(deltaY) {
9353
9706
  this.mainRenderer.scrollBy(deltaY);
@@ -9505,8 +9858,18 @@ class Editor {
9505
9858
  this.editorService.paragraphStyle(paragraphStyle, numbering);
9506
9859
  this.editorService.setPageFormat(pageFormat.pageFormatModel);
9507
9860
  this.rerenderMarker();
9861
+ this.updateSelectedComment();
9862
+ if (!this.selection.isEmpty && this.commentsVisible) {
9863
+ const cursor = PositionHelper.documentToPixel(this.session, this.session.selection.cursor);
9864
+ const mainRect = this.mainRenderer.container.getBoundingClientRect();
9865
+ const rect = this.renderer.container.getBoundingClientRect();
9866
+ const hintX = mainRect.right - 20;
9867
+ const hintY = rect.top + cursor.pageY + cursor.lineHeight / 2 - 20;
9868
+ this.overlayService.open(CommentPopupComponent, {}, hintX, hintY);
9869
+ }
9508
9870
  }
9509
9871
  onContentChange() {
9872
+ this.renderer.loop.schedule({ comments: true });
9510
9873
  if (this.search.term) {
9511
9874
  this.find(this.search.term);
9512
9875
  }
@@ -9616,6 +9979,9 @@ class Editor {
9616
9979
  }
9617
9980
  this.scrollCursorIntoMainView();
9618
9981
  }
9982
+ onMousePressEnd(event) {
9983
+ this.setCommentPopup(event);
9984
+ }
9619
9985
  provideTextStyle(component) {
9620
9986
  const session = this.regulatorService.getSession(component.sessionId);
9621
9987
  const format = session.model.formats.find(x => x.startIndex <= component.insertIndex && x.endIndex >= component.insertIndex);
@@ -9776,7 +10142,7 @@ class Editor {
9776
10142
  }
9777
10143
  applyFirstLinePositionSubscription() {
9778
10144
  return this.editorService.firstLinePosition$.subscribe(x => {
9779
- const value = x > 0 ? { indentFirstLine: x, indentHanging: 0 } : { indentHanging: Math.abs(x), indentFirstLine: 0 };
10145
+ const value = x > 0 ? { indentFirstLine: x, indentHanging: null } : { indentHanging: Math.abs(x), indentFirstLine: null };
9780
10146
  this.applyParagraphsMargin(value);
9781
10147
  });
9782
10148
  }
@@ -9829,7 +10195,7 @@ class Editor {
9829
10195
  }
9830
10196
  endMousePressSubscription() {
9831
10197
  return this.editorService.endMousePress$.subscribe(() => {
9832
- this.mouseHandler.endMousePress();
10198
+ this.mouseHandler.endMousePress(this, null);
9833
10199
  });
9834
10200
  }
9835
10201
  disableSelectionSubscription() {
@@ -10025,6 +10391,28 @@ class Editor {
10025
10391
  }
10026
10392
  });
10027
10393
  }
10394
+ commentCreationSubscriptions() {
10395
+ return [
10396
+ this.editorService.addCommentAtSelection$.subscribe(() => this.onCreateComment()),
10397
+ this.editorService.commentCreated$.subscribe(x => this.onCommentCreated(x.reqId, x.commentId))
10398
+ ];
10399
+ }
10400
+ rerenderCommentsSubscription() {
10401
+ return this.editorService.commentSizeChanged$.subscribe(() => this.mainRenderer.loop.schedule({ comments: true }));
10402
+ }
10403
+ selectCommentSubscription() {
10404
+ return this.editorService.setCommentSelected$.subscribe(x => {
10405
+ for (const session of this.regulatorService.sessions) {
10406
+ session.renderer.setSelectedComment(x);
10407
+ }
10408
+ });
10409
+ }
10410
+ removeCommentSubscription() {
10411
+ return this.editorService.removeComment$.subscribe(x => this.onCommentRemoved(x));
10412
+ }
10413
+ setComentsVisibilitySubscription() {
10414
+ return this.editorService.setCommentsVisibility$.subscribe(x => this.onSetCommentsVisibility(x));
10415
+ }
10028
10416
  recreateMainSession() {
10029
10417
  while (this.regulatorService.sessions.length > 0) {
10030
10418
  const session = this.regulatorService.sessions[0];
@@ -10070,6 +10458,28 @@ class Editor {
10070
10458
  sessionModel.session.selection.placeCursor(this.search.currentMatch.range.start);
10071
10459
  this.renderer.updateCursor();
10072
10460
  }
10461
+ setCommentPopup(event) {
10462
+ if (this.selection.range.isEmpty || !this.commentsVisible) {
10463
+ return;
10464
+ }
10465
+ const cursor = PositionHelper.documentToPixel(this.session, this.session.selection.cursor);
10466
+ const mainRect = this.mainRenderer.container.getBoundingClientRect();
10467
+ const rect = this.renderer.container.getBoundingClientRect();
10468
+ const hintX = mainRect.right - 20;
10469
+ const hintY = rect.top + cursor.pageY + cursor.lineHeight / 2 - 20;
10470
+ this.overlayService.open(CommentPopupComponent, {}, hintX, hintY);
10471
+ event?.stopPropagation();
10472
+ }
10473
+ updateSelectedComment() {
10474
+ for (const session of this.regulatorService.sessions) {
10475
+ if (!this.selection.range.isEmpty || session.session !== this.session) {
10476
+ session.renderer.setSelectedComment(null);
10477
+ continue;
10478
+ }
10479
+ const comment = session.session.getCommentAtCursor();
10480
+ session.renderer.setSelectedComment(comment?.commentId);
10481
+ }
10482
+ }
10073
10483
  }
10074
10484
 
10075
10485
  const EDITOR_VERSION = '2';
@@ -11692,13 +12102,13 @@ class NumberingHelper {
11692
12102
  paragraph.numberingData.markerTextStyle = markerTextStyle;
11693
12103
  paragraph.numberingData.width = markerSizes.width;
11694
12104
  paragraph.numberingData.height = markerSizes.height;
11695
- const indentLeft = paragraphStyle.indentLeft ? paragraphStyle.indentLeft : numberingLevel.indentLeft;
12105
+ const indentLeft = paragraphStyle.indentLeft !== null ? paragraphStyle.indentLeft : numberingLevel.indentLeft;
11696
12106
  let indent = 0;
11697
- if (!paragraphStyle.indentHanging && !paragraphStyle.indentFirstLine) {
12107
+ if (paragraphStyle.indentHanging === null && paragraphStyle.indentFirstLine === null) {
11698
12108
  indent = -numberingLevel.indentHanging;
11699
12109
  }
11700
12110
  else {
11701
- indent = paragraphStyle.indentHanging ? -paragraphStyle.indentHanging : paragraphStyle.indentFirstLine;
12111
+ indent = paragraphStyle.indentHanging !== null ? -paragraphStyle.indentHanging : paragraphStyle.indentFirstLine;
11702
12112
  }
11703
12113
  paragraph.numberingData.paddingLeft = indentLeft + indent;
11704
12114
  }
@@ -12468,7 +12878,7 @@ class DisplayData extends EventEmitting {
12468
12878
  const isLastLineOfParagraph = !wrapLimit || prevToken.isLineBreak;
12469
12879
  if (paragraphStyle.alignment === Alignment$1.justify && !isLastLineOfParagraph && wrapTokens.length > 1) {
12470
12880
  let currentLineWidth = 0;
12471
- let spaceCount = 0;
12881
+ let spaceCount = wrapTokens[0].markerWidth ? 1 : 0;
12472
12882
  for (let i = 0; i < wrapTokens.length; i++) {
12473
12883
  const token = wrapTokens[i];
12474
12884
  currentLineWidth += token.width;
@@ -12483,7 +12893,7 @@ class DisplayData extends EventEmitting {
12483
12893
  }
12484
12894
  const { left, right, firstLine, hanging } = lineInfo.indent;
12485
12895
  const indent = left + right + firstLine - hanging || 0;
12486
- const availableWidth = pageFormat.contentWidth - indent;
12896
+ const availableWidth = pageFormat.contentWidth - indent - wrapTokens[0].markerWidth;
12487
12897
  const whitespaceDeficit = availableWidth - currentLineWidth;
12488
12898
  if (spaceCount > 0 && whitespaceDeficit > 0) {
12489
12899
  lineInfo.wordSpacing = whitespaceDeficit / spaceCount;
@@ -12550,7 +12960,7 @@ class DisplayData extends EventEmitting {
12550
12960
  indentBefore: lineInfo.offsetBefore,
12551
12961
  indentAfter: lineInfo.offsetAfter,
12552
12962
  lineSpacing: lineInfo.lineSpacing,
12553
- markerWidth: lineInfo.markerWidth,
12963
+ markerWidth: isFirstCharacter && lineInfo.isNumbering ? lineInfo.markerWidth : 0,
12554
12964
  isNumbering: lineInfo.isNumbering,
12555
12965
  isPageBreak: breakType === BreakTypes.Page,
12556
12966
  isLineBreak: breakType === BreakTypes.TextWrapping,
@@ -12681,7 +13091,7 @@ class DisplayData extends EventEmitting {
12681
13091
  indentBefore: lineInfo.offsetBefore,
12682
13092
  indentAfter: lineInfo.offsetAfter,
12683
13093
  lineSpacing: lineInfo.lineSpacing,
12684
- markerWidth: lineInfo.markerWidth,
13094
+ markerWidth: isFirstCharacter && lineInfo.isNumbering ? lineInfo.markerWidth : 0,
12685
13095
  isPageBreak: breakType === BreakTypes.Page,
12686
13096
  isLineBreak: breakType === BreakTypes.TextWrapping,
12687
13097
  isTab: false,
@@ -12804,16 +13214,17 @@ class DisplayData extends EventEmitting {
12804
13214
  markerWidth = markerSizes.width;
12805
13215
  let indentHanging = levelModel.indentHanging;
12806
13216
  let indentFirstLine = DEFAULT_PARAGRAPH_STYLE.indentFirstLine;
12807
- if (paragraph.paragraphStyle.indentFirstLine || paragraph.paragraphStyle.indentHanging) {
12808
- if (paragraph.paragraphStyle.indentFirstLine) {
13217
+ if (paragraph.paragraphStyle.indentFirstLine !== null || paragraph.paragraphStyle.indentHanging !== null) {
13218
+ if (paragraph.paragraphStyle.indentFirstLine !== null) {
12809
13219
  indentFirstLine = paragraph.paragraphStyle.indentFirstLine;
12810
- indentHanging = 0;
13220
+ indentHanging = null;
12811
13221
  }
12812
13222
  else {
12813
- indentHanging = paragraph.paragraphStyle.indentHanging ? paragraph.paragraphStyle.indentHanging : levelModel.indentHanging;
13223
+ indentHanging =
13224
+ paragraph.paragraphStyle.indentHanging !== null ? paragraph.paragraphStyle.indentHanging : levelModel.indentHanging;
12814
13225
  }
12815
13226
  }
12816
- const indent = new IndentModel(indentFirstLine, indentHanging, paragraph.paragraphStyle.indentLeft ? paragraph.paragraphStyle.indentLeft : levelModel.indentLeft, paragraph.paragraphStyle.indentRight ?? DEFAULT_PARAGRAPH_STYLE.indentRight);
13227
+ const indent = new IndentModel(indentFirstLine, indentHanging, paragraph.paragraphStyle.indentLeft !== null ? paragraph.paragraphStyle.indentLeft : levelModel.indentLeft, paragraph.paragraphStyle.indentRight ?? DEFAULT_PARAGRAPH_STYLE.indentRight);
12817
13228
  return { indent, markerWidth: markerWidth + markerWidth / marker.length };
12818
13229
  }
12819
13230
  getLineInfoFromTextLine(index) {
@@ -12883,7 +13294,7 @@ class DisplayData extends EventEmitting {
12883
13294
  if (displayTokens[0].isTable || (displayTokens[0].breaksLine && displayTokens.length === 1)) {
12884
13295
  return 1;
12885
13296
  }
12886
- const maxRowWidth = contentWidth - displayTokens[0].indentRight;
13297
+ const maxRowWidth = contentWidth - displayTokens[0].indentRight - displayTokens[0].markerWidth;
12887
13298
  let sum = displayTokens[0].indentLeft + displayTokens[0].indentFirstLine - displayTokens[0].indentHanging || 0;
12888
13299
  let prevTabIndex = null;
12889
13300
  let tabCenter = null;
@@ -13775,10 +14186,11 @@ class EditSession {
13775
14186
  get paragraphInfoChanges$() {
13776
14187
  return this.displayData.ParagraphInfoChanges$;
13777
14188
  }
13778
- constructor(displayData, sessionId, customContentService, model, selection, generalProperties, editorService, customComponents, type, scrollBar, edgeType) {
14189
+ constructor(displayData, sessionId, customContentService, commentRenderService, model, selection, generalProperties, editorService, customComponents, type, scrollBar, edgeType, pageType) {
13779
14190
  this.displayData = displayData;
13780
14191
  this.sessionId = sessionId;
13781
14192
  this.customContentService = customContentService;
14193
+ this.commentRenderService = commentRenderService;
13782
14194
  this.model = model;
13783
14195
  this.selection = selection;
13784
14196
  this.generalProperties = generalProperties;
@@ -13787,6 +14199,7 @@ class EditSession {
13787
14199
  this.type = type;
13788
14200
  this.scrollBar = scrollBar;
13789
14201
  this.edgeType = edgeType;
14202
+ this.pageType = pageType;
13790
14203
  this.tokenRe = new RegExp('^[' + UnicodeHelper.wordChars + '\\$_]+', 'g');
13791
14204
  this.nonTokenRe = new RegExp('^(?:[^' + UnicodeHelper.wordChars + '\\$_]|\\s])+', 'g');
13792
14205
  }
@@ -14135,6 +14548,17 @@ class EditSession {
14135
14548
  this.selection.placeCursor(endPosition);
14136
14549
  return endPosition;
14137
14550
  }
14551
+ addComment(comment) {
14552
+ OperationsHelper.addComment(this.model, comment);
14553
+ this.commentRenderService.createNewComment(comment.commentId);
14554
+ }
14555
+ removeComment(commentId) {
14556
+ return OperationsHelper.removeComment(this.model, commentId);
14557
+ }
14558
+ getCommentAtCursor() {
14559
+ const index = ContentHelper.paragraphPositionToDocumentIndex(this.displayData.paragraphs, this.selection.cursor);
14560
+ return this.model.comments.find(x => index >= x.startIndex && index <= x.endIndex);
14561
+ }
14138
14562
  insertElement(position, element) {
14139
14563
  const insertIndex = ContentHelper.paragraphPositionToDocumentIndex(this.displayData.paragraphs, position);
14140
14564
  const insertElement = new InsertElementModel({ element: new ElementModel({ insertIndex, ...element }) });
@@ -14605,108 +15029,6 @@ class MainSessionSourceModel {
14605
15029
  }
14606
15030
  }
14607
15031
 
14608
- class CursorLayer {
14609
- constructor(parentElement, session) {
14610
- this.session = session;
14611
- this.blinkInterval = 1000;
14612
- this.layer = document.createElement('div');
14613
- this.layer.className = 'noder-layer noder-cursor-layer';
14614
- parentElement.appendChild(this.layer);
14615
- this.cursor = document.createElement('div');
14616
- this.cursor.className = 'noder-cursor';
14617
- this.layer.appendChild(this.cursor);
14618
- this.hideCursor();
14619
- }
14620
- hideCursor() {
14621
- this.isVisible = false;
14622
- DomHelper.addCssClass(this.layer, 'noder-hidden-cursors');
14623
- this.removeAnimationClass();
14624
- }
14625
- showCursor() {
14626
- this.isVisible = true;
14627
- DomHelper.removeCssClass(this.layer, 'noder-hidden-cursors');
14628
- this.addAnimationClass();
14629
- }
14630
- showStaticCursor() {
14631
- this.isVisible = true;
14632
- DomHelper.removeCssClass(this.layer, 'noder-hidden-cursors');
14633
- this.removeAnimationClass();
14634
- }
14635
- detectVisibility() {
14636
- const selectionRange = this.session.selection.selectedRange;
14637
- if (selectionRange.isEmpty) {
14638
- DomHelper.removeCssClass(this.layer, 'selecting');
14639
- return;
14640
- }
14641
- DomHelper.addCssClass(this.layer, 'selecting');
14642
- }
14643
- update(config) {
14644
- this.cursorPosition = this.getPixelPosition();
14645
- this.drawCursor(config.maxHeight);
14646
- this.detectVisibility();
14647
- this.restartAnimation();
14648
- }
14649
- getPixelPosition(position) {
14650
- if (!position) {
14651
- position = this.session.selection.cursor;
14652
- }
14653
- return PositionHelper.documentToPixel(this.session, position);
14654
- }
14655
- addTextStylesToCursor() {
14656
- const textStyle = this.session.editorService.styles;
14657
- DomHelper.setStyle(this.cursor.style, 'border-color', textStyle.fontColor);
14658
- DomHelper.setStyle(this.cursor.style, 'fontSize', `${textStyle.fontSize}px`);
14659
- if (textStyle.italic) {
14660
- DomHelper.setStyle(this.cursor.style, '-webkit-transform', 'skewX(-13deg)');
14661
- }
14662
- else {
14663
- DomHelper.setStyle(this.cursor.style, '-webkit-transform', 'skewX(0)');
14664
- }
14665
- const metricSize = FontMetrics.measureCharSize('EMPTY_LINE', ContentStyleHelper.getFontStylesString(new TextStyleModel({
14666
- italic: textStyle.italic,
14667
- bold: textStyle.bold,
14668
- fontSize: textStyle.fontSize,
14669
- fontFamily: textStyle.fontFamily
14670
- })));
14671
- const fontMetricHeight = metricSize.ascent + metricSize.descent;
14672
- const maxHeight = this.cursorPosition.sizeMax.ascent + this.cursorPosition.sizeMax.descent;
14673
- const fontShoulders = fontMetricHeight - metricSize.font;
14674
- const offset = metricSize.descent - fontShoulders;
14675
- let top = this.cursorPosition.pageY + this.cursorPosition.sizeMax.ascent - metricSize.font + offset;
14676
- if (fontMetricHeight !== maxHeight && maxHeight >= this.cursorPosition.lineHeight) {
14677
- top -= maxHeight - this.cursorPosition.lineHeight;
14678
- }
14679
- DomHelper.setStyle(this.cursor.style, 'top', `${top < 0 ? 0 : top}px`);
14680
- DomHelper.setStyle(this.cursor.style, 'height', `${fontMetricHeight}px`);
14681
- }
14682
- restartAnimation() {
14683
- this.removeAnimationClass();
14684
- if (!this.isVisible) {
14685
- return;
14686
- }
14687
- this.addAnimationClass();
14688
- }
14689
- drawCursor(maxLayerHeight) {
14690
- const isCursorInView = this.cursorPosition.pageY >= 0 && this.cursorPosition.pageY < maxLayerHeight;
14691
- if (!isCursorInView) {
14692
- DomHelper.setStyle(this.cursor.style, 'display', 'none');
14693
- return;
14694
- }
14695
- DomHelper.setStyle(this.cursor.style, 'display', 'block');
14696
- const currentSize = this.cursorPosition.sizeCurrent;
14697
- DomHelper.setStyle(this.cursor.style, 'left', `${this.cursorPosition.pageX}px`);
14698
- DomHelper.setStyle(this.cursor.style, 'width', `${currentSize.width}px`);
14699
- this.addTextStylesToCursor();
14700
- }
14701
- removeAnimationClass() {
14702
- DomHelper.removeCssClass(this.layer, 'noder-animate-blinking');
14703
- }
14704
- addAnimationClass() {
14705
- this.cursor.style.animationDuration = `${this.blinkInterval}ms`;
14706
- DomHelper.addCssClass(this.layer, 'noder-animate-blinking');
14707
- }
14708
- }
14709
-
14710
15032
  class HighlightLayer {
14711
15033
  constructor(parentEl, cssClass, session) {
14712
15034
  this.session = session;
@@ -14726,6 +15048,7 @@ class HighlightLayer {
14726
15048
  }
14727
15049
  selectionElement.style.cssText = cssPosition;
14728
15050
  selectionElement.className = cssClass;
15051
+ return selectionElement;
14729
15052
  }
14730
15053
  getTop(row) {
14731
15054
  const paragraphs = this.session.displayData.paragraphs;
@@ -14751,6 +15074,7 @@ class HighlightLayer {
14751
15074
  paragraphInfo.lineTopOffset -
14752
15075
  this.session.scrollTop;
14753
15076
  const padding = this.session.displayData.pagesFormat[this.session.displayData.pagesFormat.length - 1].pageFormatModel.marginLeft;
15077
+ const results = [];
14754
15078
  for (let i = 0; i < textLinesInfo.length; i++) {
14755
15079
  const lineInfo = textLinesInfo[i].textLinesInfo;
14756
15080
  const paragraphLineIndex = textLinesInfo[i].paragraphSettings.textLinesInfo.findIndex(x => x === textLinesInfo[i].textLinesInfo);
@@ -14763,9 +15087,10 @@ class HighlightLayer {
14763
15087
  ? 0
14764
15088
  : textLinesInfo[i].paragraphSettings.numberingData.width + textLinesInfo[i].paragraphSettings.numberingData.paddingLeft;
14765
15089
  if (paragraphLineIndex === 0 &&
15090
+ lineInfo.isNumbering &&
14766
15091
  (lineInfo.indentFirstLine ||
14767
- (numberingOffsetLeft - lineInfo.indentLeft > 0 && numberingOffsetLeft - lineInfo.indentLeft < lineInfo.markerWidth))) {
14768
- markerWidth = lineInfo.markerWidth ?? 0;
15092
+ (numberingOffsetLeft - lineInfo.indentLeft > 0 && numberingOffsetLeft - lineInfo.indentLeft <= lineInfo.markerWidth))) {
15093
+ markerWidth = lineInfo.markerWidth;
14769
15094
  }
14770
15095
  const left = lineInfo.paddingLeft + padding + lineInfo.offsetMargin + markerWidth;
14771
15096
  let style;
@@ -14783,9 +15108,11 @@ class HighlightLayer {
14783
15108
  let width = lineInfo.width + (lineInfo.wordSpacingWidth ?? 0);
14784
15109
  style = this.getMarkerStyle(lineInfo.height, width, top, left);
14785
15110
  }
14786
- this.renderHighlight(style, cssClass);
15111
+ const result = this.renderHighlight(style, cssClass);
14787
15112
  top += lineInfo.height + lineInfo.offsetAfter + lineInfo.endPageOffset;
15113
+ results.push(result);
14788
15114
  }
15115
+ return results;
14789
15116
  }
14790
15117
  // Draws a marker which covers part or whole width of a single screen line
14791
15118
  drawSingleLineMarker(range, cssClass) {
@@ -14795,7 +15122,7 @@ class HighlightLayer {
14795
15122
  const width = rangeInfo.screenWidth;
14796
15123
  const top = this.getTop(range.start.row);
14797
15124
  const left = rangeInfo.leftPos;
14798
- this.renderHighlight(this.getMarkerStyle(height, width, top, left), cssClass);
15125
+ return this.renderHighlight(this.getMarkerStyle(height, width, top, left), cssClass);
14799
15126
  }
14800
15127
  drawCustomElementHighlight(elementInfo, cssClass, screenParentRange) {
14801
15128
  const elementIndex = this.session.displayData.paragraphs[elementInfo.parentRange.start.row].startIndex + elementInfo.parentRange.start.column;
@@ -14823,6 +15150,167 @@ class HighlightLayer {
14823
15150
  }
14824
15151
  }
14825
15152
 
15153
+ class CommentHighlightLayer extends HighlightLayer {
15154
+ constructor(parentEl, cssClass, session, commentService) {
15155
+ super(parentEl, cssClass, session);
15156
+ this.commentService = commentService;
15157
+ this.className = 'noder-highlight';
15158
+ this.selectedCommentClassName = 'noder-selected-highlight';
15159
+ this.selectedCommentId = null;
15160
+ }
15161
+ update(config) {
15162
+ const comments = this.session.model.comments;
15163
+ if (!config?.isVisible || !comments?.length || !this.enabled) {
15164
+ this.element.innerHTML = '';
15165
+ this.commentService.removeCommentsFromRender(this.session.sessionId);
15166
+ return;
15167
+ }
15168
+ this.config = config;
15169
+ this.selectionIndex = 0;
15170
+ const commentRenderRequests = [];
15171
+ for (const comment of comments) {
15172
+ const startPosition = ContentHelper.documentIndexToParagraphIndex(this.session.displayData.paragraphs, comment.startIndex);
15173
+ const endPosition = ContentHelper.documentIndexToParagraphIndex(this.session.displayData.paragraphs, comment.endIndex);
15174
+ const range = new Range(startPosition, endPosition);
15175
+ const screenRange = range.toScreenRange(this.session);
15176
+ if (config.visibleRange &&
15177
+ (screenRange.end.row < config.visibleRange.startScreenLine || screenRange.start.row > config.visibleRange.endScreenLine)) {
15178
+ this.commentService.removeCommentFromRender(this.session.sessionId, comment.commentId);
15179
+ continue;
15180
+ }
15181
+ if (!screenRange.isEmpty) {
15182
+ const className = comment.commentId === this.selectedCommentId ? this.selectedCommentClassName : this.className;
15183
+ const result = screenRange.isSingleLine
15184
+ ? this.drawSingleLineMarker(screenRange, className)
15185
+ : this.drawMultiLineMarker(screenRange, className);
15186
+ commentRenderRequests.push(this.requestCommentRender(result, comment.commentId));
15187
+ }
15188
+ }
15189
+ this.commentService.requestCommentsRender(this.session.sessionId, commentRenderRequests);
15190
+ if (this.selectionIndex !== -1) {
15191
+ while (this.selectionIndex < this.element.childElementCount) {
15192
+ this.element.removeChild(this.element.lastChild);
15193
+ }
15194
+ }
15195
+ }
15196
+ setSelectedComment(id) {
15197
+ if (this.selectedCommentId) {
15198
+ this.commentService.setCommentSelected(this.selectedCommentId, false);
15199
+ }
15200
+ this.selectedCommentId = id;
15201
+ if (id) {
15202
+ this.commentService.setCommentSelected(id);
15203
+ }
15204
+ }
15205
+ requestCommentRender(highlight, id) {
15206
+ const element = Array.isArray(highlight) ? highlight[0] : highlight;
15207
+ const rect = element.getBoundingClientRect();
15208
+ return { commentId: id, top: rect.top, left: rect.left };
15209
+ }
15210
+ }
15211
+
15212
+ class CursorLayer {
15213
+ constructor(parentElement, session) {
15214
+ this.session = session;
15215
+ this.blinkInterval = 1000;
15216
+ this.layer = document.createElement('div');
15217
+ this.layer.className = 'noder-layer noder-cursor-layer';
15218
+ parentElement.appendChild(this.layer);
15219
+ this.cursor = document.createElement('div');
15220
+ this.cursor.className = 'noder-cursor';
15221
+ this.layer.appendChild(this.cursor);
15222
+ this.hideCursor();
15223
+ }
15224
+ hideCursor() {
15225
+ this.isVisible = false;
15226
+ DomHelper.addCssClass(this.layer, 'noder-hidden-cursors');
15227
+ this.removeAnimationClass();
15228
+ }
15229
+ showCursor() {
15230
+ this.isVisible = true;
15231
+ DomHelper.removeCssClass(this.layer, 'noder-hidden-cursors');
15232
+ this.addAnimationClass();
15233
+ }
15234
+ showStaticCursor() {
15235
+ this.isVisible = true;
15236
+ DomHelper.removeCssClass(this.layer, 'noder-hidden-cursors');
15237
+ this.removeAnimationClass();
15238
+ }
15239
+ detectVisibility() {
15240
+ const selectionRange = this.session.selection.selectedRange;
15241
+ if (selectionRange.isEmpty) {
15242
+ DomHelper.removeCssClass(this.layer, 'selecting');
15243
+ return;
15244
+ }
15245
+ DomHelper.addCssClass(this.layer, 'selecting');
15246
+ }
15247
+ update(config) {
15248
+ this.cursorPosition = this.getPixelPosition();
15249
+ this.drawCursor(config.maxHeight);
15250
+ this.detectVisibility();
15251
+ this.restartAnimation();
15252
+ }
15253
+ getPixelPosition(position) {
15254
+ if (!position) {
15255
+ position = this.session.selection.cursor;
15256
+ }
15257
+ return PositionHelper.documentToPixel(this.session, position);
15258
+ }
15259
+ addTextStylesToCursor() {
15260
+ const textStyle = this.session.editorService.styles;
15261
+ DomHelper.setStyle(this.cursor.style, 'border-color', textStyle.fontColor);
15262
+ DomHelper.setStyle(this.cursor.style, 'fontSize', `${textStyle.fontSize}px`);
15263
+ if (textStyle.italic) {
15264
+ DomHelper.setStyle(this.cursor.style, '-webkit-transform', 'skewX(-13deg)');
15265
+ }
15266
+ else {
15267
+ DomHelper.setStyle(this.cursor.style, '-webkit-transform', 'skewX(0)');
15268
+ }
15269
+ const metricSize = FontMetrics.measureCharSize('EMPTY_LINE', ContentStyleHelper.getFontStylesString(new TextStyleModel({
15270
+ italic: textStyle.italic,
15271
+ bold: textStyle.bold,
15272
+ fontSize: textStyle.fontSize,
15273
+ fontFamily: textStyle.fontFamily
15274
+ })));
15275
+ const fontMetricHeight = metricSize.ascent + metricSize.descent;
15276
+ const maxHeight = this.cursorPosition.sizeMax.ascent + this.cursorPosition.sizeMax.descent;
15277
+ const fontShoulders = fontMetricHeight - metricSize.font;
15278
+ const offset = metricSize.descent - fontShoulders;
15279
+ let top = this.cursorPosition.pageY + this.cursorPosition.sizeMax.ascent - metricSize.font + offset;
15280
+ if (fontMetricHeight !== maxHeight && maxHeight >= this.cursorPosition.lineHeight) {
15281
+ top -= maxHeight - this.cursorPosition.lineHeight;
15282
+ }
15283
+ DomHelper.setStyle(this.cursor.style, 'top', `${top < 0 ? 0 : top}px`);
15284
+ DomHelper.setStyle(this.cursor.style, 'height', `${fontMetricHeight}px`);
15285
+ }
15286
+ restartAnimation() {
15287
+ this.removeAnimationClass();
15288
+ if (!this.isVisible) {
15289
+ return;
15290
+ }
15291
+ this.addAnimationClass();
15292
+ }
15293
+ drawCursor(maxLayerHeight) {
15294
+ const isCursorInView = this.cursorPosition.pageY >= 0 && this.cursorPosition.pageY < maxLayerHeight;
15295
+ if (!isCursorInView) {
15296
+ DomHelper.setStyle(this.cursor.style, 'display', 'none');
15297
+ return;
15298
+ }
15299
+ DomHelper.setStyle(this.cursor.style, 'display', 'block');
15300
+ const currentSize = this.cursorPosition.sizeCurrent;
15301
+ DomHelper.setStyle(this.cursor.style, 'left', `${this.cursorPosition.pageX}px`);
15302
+ DomHelper.setStyle(this.cursor.style, 'width', `${currentSize.width}px`);
15303
+ this.addTextStylesToCursor();
15304
+ }
15305
+ removeAnimationClass() {
15306
+ DomHelper.removeCssClass(this.layer, 'noder-animate-blinking');
15307
+ }
15308
+ addAnimationClass() {
15309
+ this.cursor.style.animationDuration = `${this.blinkInterval}ms`;
15310
+ DomHelper.addCssClass(this.layer, 'noder-animate-blinking');
15311
+ }
15312
+ }
15313
+
14826
15314
  class GrammarHighlightLayer extends HighlightLayer {
14827
15315
  constructor(parentEl, cssClass, session) {
14828
15316
  super(parentEl, cssClass, session);
@@ -14880,6 +15368,7 @@ class RenderChangesModel {
14880
15368
  this.selection ||
14881
15369
  this.search ||
14882
15370
  this.grammar ||
15371
+ this.comments ||
14883
15372
  this.scroll ||
14884
15373
  this.size ||
14885
15374
  this.text ||
@@ -14894,6 +15383,7 @@ class RenderChangesModel {
14894
15383
  this.selection = false;
14895
15384
  this.search = false;
14896
15385
  this.grammar = false;
15386
+ this.comments = false;
14897
15387
  this.scroll = false;
14898
15388
  this.size = false;
14899
15389
  this.text = false;
@@ -15119,7 +15609,7 @@ class Renderer extends EventEmitting {
15119
15609
  get ParagraphsAppeared$() {
15120
15610
  return this.ParagraphsAppeared.asObservable();
15121
15611
  }
15122
- constructor(parentContainer, session) {
15612
+ constructor(parentContainer, commentsService, session) {
15123
15613
  super();
15124
15614
  this.session = session;
15125
15615
  this.layerConfig = {
@@ -15160,6 +15650,7 @@ class Renderer extends EventEmitting {
15160
15650
  this.selectionLayer = new SelectionLayer(this.content, 'text-selection', this.session);
15161
15651
  this.searchHighlightLayer = new SearchHighlightLayer(this.content, 'text-search-highlight', this.session);
15162
15652
  this.grammarHighlightLayer = new GrammarHighlightLayer(this.content, 'grammar-highlight', this.session);
15653
+ this.commentsLayer = new CommentHighlightLayer(this.content, 'comments-highlight', this.session, commentsService);
15163
15654
  this.cursorLayer = new CursorLayer(this.content, this.session);
15164
15655
  this.dragAndDropSelectionLayer = new SelectionLayer(this.content, 'drag-and-drop-selection', this.session);
15165
15656
  this.loop = new RenderLoop(changes => this.renderChanges(changes));
@@ -15182,6 +15673,8 @@ class Renderer extends EventEmitting {
15182
15673
  changes.lines ||
15183
15674
  changes.scroll ||
15184
15675
  changes.search ||
15676
+ changes.grammar ||
15677
+ changes.comments ||
15185
15678
  changes.visibilityChanged) {
15186
15679
  changes.apply(this.computeLayerConfig());
15187
15680
  DomHelper.translate(this.content, 0, -this.layerConfig.offset);
@@ -15208,12 +15701,16 @@ class Renderer extends EventEmitting {
15208
15701
  if (changes.grammar) {
15209
15702
  this.renderGrammarHighlights();
15210
15703
  }
15704
+ if (changes.comments) {
15705
+ this.renderComments();
15706
+ }
15211
15707
  if (changes.dragAndDrop) {
15212
15708
  this.renderDragAndDropSelection();
15213
15709
  }
15214
15710
  if (changes.visibilityChanged) {
15215
15711
  this.renderSearchHighlights();
15216
15712
  this.renderGrammarHighlights();
15713
+ this.renderComments();
15217
15714
  this.visibilitySubject.next(this.isVisible);
15218
15715
  }
15219
15716
  this.session.onRendered();
@@ -15354,6 +15851,8 @@ class Renderer extends EventEmitting {
15354
15851
  this.textLayer.updateLines(this.layerConfig);
15355
15852
  this.selectionLayer.update(this.layerConfig);
15356
15853
  this.searchHighlightLayer.update(this.layerConfig);
15854
+ this.grammarHighlightLayer.update(this.layerConfig);
15855
+ this.commentsLayer.update(this.layerConfig);
15357
15856
  this.cursorLayer.update(this.layerConfig);
15358
15857
  this.moveTextAreaToCursor();
15359
15858
  this.session.onRendered();
@@ -15376,6 +15875,16 @@ class Renderer extends EventEmitting {
15376
15875
  renderGrammarHighlights() {
15377
15876
  this.grammarHighlightLayer.update(this.layerConfig);
15378
15877
  }
15878
+ renderComments() {
15879
+ this.commentsLayer.update(this.layerConfig);
15880
+ }
15881
+ setSelectedComment(comment) {
15882
+ this.commentsLayer.setSelectedComment(comment);
15883
+ this.commentsLayer.update(this.layerConfig);
15884
+ }
15885
+ setCommentsVisibility(value) {
15886
+ this.commentsLayer.enabled = value;
15887
+ }
15379
15888
  renderDragAndDropSelection() {
15380
15889
  this.dragAndDropSelectionLayer.update(this.layerConfig);
15381
15890
  }
@@ -15467,12 +15976,13 @@ class ScrollBar {
15467
15976
  }
15468
15977
  onScroll() {
15469
15978
  if (!this.skipEvent) {
15979
+ const prevTop = this._scrollTop;
15470
15980
  this._scrollTop = this.element.scrollTop;
15471
15981
  if (this.coeff !== 1) {
15472
15982
  const height = this.element.clientHeight / this.scrollHeight;
15473
15983
  this._scrollTop = (this._scrollTop * (1 - height)) / (this.coeff - height);
15474
15984
  }
15475
- this._scrolled$.next();
15985
+ this._scrolled$.next(this._scrollTop - prevTop);
15476
15986
  }
15477
15987
  this.skipEvent = false;
15478
15988
  }
@@ -15499,6 +16009,127 @@ class ScrollBar {
15499
16009
  }
15500
16010
  }
15501
16011
 
16012
+ class RemoveCommentFromDom {
16013
+ constructor(sessionId, id) {
16014
+ this.sessionId = sessionId;
16015
+ this.id = id;
16016
+ }
16017
+ }
16018
+
16019
+ class RemoveCommentsFromDom {
16020
+ constructor(sessionId) {
16021
+ this.sessionId = sessionId;
16022
+ }
16023
+ }
16024
+
16025
+ class RenderComments {
16026
+ constructor(sessionId, renderRequests) {
16027
+ this.sessionId = sessionId;
16028
+ this.renderRequests = renderRequests;
16029
+ }
16030
+ }
16031
+
16032
+ class CommentLayer {
16033
+ constructor(parentEl, commentService) {
16034
+ this.commentPadding = 8;
16035
+ this.rendersBySession = new Map();
16036
+ this.element = document.createElement('div');
16037
+ this.element.className = `noder-comments-layer`;
16038
+ parentEl.appendChild(this.element);
16039
+ this.commentSubscription = commentService.commentRenderRequests$.subscribe(x => {
16040
+ this.applyChanges(x);
16041
+ this.renderComments();
16042
+ });
16043
+ }
16044
+ destroy() {
16045
+ this.commentSubscription.unsubscribe();
16046
+ }
16047
+ scrollComments(offsetY) {
16048
+ for (const [sessionId, comments] of this.rendersBySession) {
16049
+ if (sessionId === 1) {
16050
+ continue;
16051
+ }
16052
+ for (const comment of comments) {
16053
+ comment.highlightTop -= offsetY;
16054
+ }
16055
+ }
16056
+ }
16057
+ renderComments() {
16058
+ this.element.innerHTML = '';
16059
+ const topOffset = this.element.getBoundingClientRect().top;
16060
+ const sortedComments = Array.from(this.rendersBySession.values())
16061
+ .reduce((acc, x) => acc.concat(x), [])
16062
+ .toSorted((x, y) => (x.highlightTop !== y.highlightTop ? x.highlightTop - y.highlightTop : x.highlightLeft - y.highlightLeft));
16063
+ const selectedIndex = sortedComments.findIndex(x => x.commentRef.instance.selected);
16064
+ if (selectedIndex >= 0) {
16065
+ const selectedComment = sortedComments[selectedIndex];
16066
+ const selectedCommentRange = this.drawCommentComponent(selectedComment.commentRef, selectedComment.highlightTop - topOffset);
16067
+ let lastCommentBounds = selectedCommentRange;
16068
+ for (let i = selectedIndex - 1; i >= 0; i--) {
16069
+ const comment = sortedComments[i];
16070
+ const height = comment.commentRef.instance.height;
16071
+ let top = comment.highlightTop - topOffset;
16072
+ if (top + height >= lastCommentBounds.from) {
16073
+ top = lastCommentBounds.from - height;
16074
+ }
16075
+ lastCommentBounds = this.drawCommentComponent(comment.commentRef, top);
16076
+ }
16077
+ lastCommentBounds = selectedCommentRange;
16078
+ for (let i = selectedIndex + 1; i < sortedComments.length; i++) {
16079
+ const comment = sortedComments[i];
16080
+ let top = comment.highlightTop - topOffset;
16081
+ if (top <= lastCommentBounds.to) {
16082
+ top = lastCommentBounds.to;
16083
+ }
16084
+ lastCommentBounds = this.drawCommentComponent(comment.commentRef, top);
16085
+ }
16086
+ return;
16087
+ }
16088
+ let lastCommentBounds = { from: 0, to: 0 };
16089
+ for (let i = selectedIndex + 1; i < sortedComments.length; i++) {
16090
+ const comment = sortedComments[i];
16091
+ let top = comment.highlightTop - topOffset;
16092
+ if (top <= lastCommentBounds.to) {
16093
+ top = lastCommentBounds.to;
16094
+ }
16095
+ lastCommentBounds = this.drawCommentComponent(comment.commentRef, top);
16096
+ }
16097
+ }
16098
+ applyChanges(changes) {
16099
+ if (changes instanceof RemoveCommentsFromDom) {
16100
+ this.rendersBySession.delete(changes.sessionId);
16101
+ return;
16102
+ }
16103
+ if (changes instanceof RenderComments) {
16104
+ this.rendersBySession.set(changes.sessionId, changes.renderRequests);
16105
+ return;
16106
+ }
16107
+ if (changes instanceof RemoveCommentFromDom) {
16108
+ const requests = this.rendersBySession.get(changes.sessionId);
16109
+ if (!requests) {
16110
+ return;
16111
+ }
16112
+ const index = requests.findIndex(x => x.commentId === changes.id);
16113
+ if (index > -1) {
16114
+ requests.splice(index, 1);
16115
+ }
16116
+ return;
16117
+ }
16118
+ }
16119
+ drawCommentComponent(commentRef, top) {
16120
+ const domElem = commentRef.hostView.rootNodes[0];
16121
+ this.element.appendChild(domElem);
16122
+ const cssPosition = `top:${top}px;left:20px`;
16123
+ domElem.style.cssText = cssPosition;
16124
+ const selected = commentRef.instance.selected ? 'selected' : '';
16125
+ domElem.className = `noder-comment ${selected}`;
16126
+ if (commentRef.instance.editing && commentRef.instance.selected) {
16127
+ commentRef.instance.focusTextArea();
16128
+ }
16129
+ return { from: top - this.commentPadding, to: top + commentRef.instance.height + this.commentPadding };
16130
+ }
16131
+ }
16132
+
15502
16133
  class VirtualRenderer {
15503
16134
  get cursorLayer() {
15504
16135
  return this.renderer.cursorLayer;
@@ -15524,7 +16155,7 @@ class VirtualRenderer {
15524
16155
  get ParagraphsAppeared$() {
15525
16156
  return this.renderer.ParagraphsAppeared.asObservable();
15526
16157
  }
15527
- constructor(parentContainer, mainSession, scrollBar) {
16158
+ constructor(parentContainer, mainSession, commentService, scrollBar) {
15528
16159
  this.scrollBar = scrollBar;
15529
16160
  this.changes = new RenderChangesModel();
15530
16161
  this.size = {
@@ -15537,10 +16168,14 @@ class VirtualRenderer {
15537
16168
  this.paragraphsScrolledIntoViewSubject = new Subject();
15538
16169
  this.container = parentContainer;
15539
16170
  this.createScroller();
15540
- this.renderer = new Renderer(parentContainer, mainSession);
16171
+ this.renderer = new Renderer(parentContainer, commentService, mainSession);
15541
16172
  this.pagesLayer = new PagesLayer(this.renderer.content, mainSession);
15542
16173
  this.edgesLayer = new EdgesLayer(this.renderer.content, mainSession);
15543
- this.scrollSubscription = this.scrollBar.scrolled$.subscribe(() => this.loop.schedule({ scroll: true }));
16174
+ this.commentLayer = new CommentLayer(this.renderer.content, commentService);
16175
+ this.scrollSubscription = this.scrollBar.scrolled$.subscribe(x => {
16176
+ this.loop.schedule({ scroll: true });
16177
+ this.commentLayer.scrollComments(x);
16178
+ });
15544
16179
  this.createRenderLoop();
15545
16180
  this.paragraphsScrolledIntoViewSubscription = this.paragraphsScrolledIntoViewSubject
15546
16181
  .pipe(debounceTime(3000))
@@ -15587,6 +16222,7 @@ class VirtualRenderer {
15587
16222
  }
15588
16223
  if (changes.cursor) {
15589
16224
  this.renderCursor();
16225
+ this.renderComments();
15590
16226
  }
15591
16227
  if (changes.marker || changes.selection) {
15592
16228
  this.renderSelection();
@@ -15597,6 +16233,9 @@ class VirtualRenderer {
15597
16233
  if (changes.grammar) {
15598
16234
  this.renderGrammarHighlights();
15599
16235
  }
16236
+ if (changes.comments) {
16237
+ this.renderComments();
16238
+ }
15600
16239
  if (changes.dragAndDrop) {
15601
16240
  this.renderDragAndDropSelection();
15602
16241
  }
@@ -15646,6 +16285,12 @@ class VirtualRenderer {
15646
16285
  this.size.dirty = !width || !height;
15647
16286
  return changes;
15648
16287
  }
16288
+ setSelectedComment(commentId) {
16289
+ this.renderer.setSelectedComment(commentId);
16290
+ }
16291
+ setCommentsVisibility(value) {
16292
+ this.renderer.setCommentsVisibility(value);
16293
+ }
15649
16294
  moveTextAreaToCursor() {
15650
16295
  if (!this.textarea) {
15651
16296
  return;
@@ -15741,6 +16386,7 @@ class VirtualRenderer {
15741
16386
  }
15742
16387
  const scrollTop = this.scrollBar.scrollTop + deltaY;
15743
16388
  this.scrollBar.setScrollTop(scrollTop);
16389
+ this.commentLayer.scrollComments(deltaY);
15744
16390
  this.loop.schedule({ scroll: true });
15745
16391
  }
15746
16392
  screenToTextCoordinatesUsingMidpoint(x, y, rect) {
@@ -15762,6 +16408,7 @@ class VirtualRenderer {
15762
16408
  DomHelper.removeElement(this.scrollBar.element);
15763
16409
  this.pagesLayer.destroy();
15764
16410
  this.renderer.destroy();
16411
+ this.commentLayer.destroy();
15765
16412
  this.scrollSubscription?.unsubscribe();
15766
16413
  this.paragraphsScrolledIntoViewSubscription?.unsubscribe();
15767
16414
  }
@@ -15815,8 +16462,10 @@ class VirtualRenderer {
15815
16462
  this.renderer.textLayer.scrollLines(this.layerConfig);
15816
16463
  }
15817
16464
  this.renderer.selectionLayer.update(this.layerConfig);
16465
+ this.renderer.dragAndDropSelectionLayer.update(this.layerConfig);
15818
16466
  this.renderer.searchHighlightLayer.update(this.layerConfig);
15819
16467
  this.renderer.grammarHighlightLayer.update(this.layerConfig);
16468
+ this.renderer.commentsLayer.update(this.layerConfig);
15820
16469
  if (!this.renderer.cursorLayer.isVisible) {
15821
16470
  return;
15822
16471
  }
@@ -15827,6 +16476,7 @@ class VirtualRenderer {
15827
16476
  this.pagesLayer.update(this.layerConfig);
15828
16477
  this.edgesLayer.update(this.layerConfig);
15829
16478
  this.paragraphsScrolledIntoViewSubject.next();
16479
+ this.commentLayer.renderComments();
15830
16480
  this.renderer.renderFull();
15831
16481
  }
15832
16482
  renderText() {
@@ -15848,6 +16498,9 @@ class VirtualRenderer {
15848
16498
  renderDragAndDropSelection() {
15849
16499
  this.renderer.renderDragAndDropSelection();
15850
16500
  }
16501
+ renderComments() {
16502
+ this.renderer.renderComments();
16503
+ }
15851
16504
  paragraphsScrolledIntoView() {
15852
16505
  const paragraphs = this.renderer.session.displayData.paragraphs.slice(this.layerConfig.visibleRange.startParagraph, this.layerConfig.visibleRange.endParagraph);
15853
16506
  this.renderer.ParagraphsAppeared.next(paragraphs);
@@ -15938,7 +16591,7 @@ class CustomContentService {
15938
16591
  indentRight: lineInfo.indent.right,
15939
16592
  indentBefore: lineInfo.offsetBefore,
15940
16593
  indentAfter: lineInfo.offsetAfter,
15941
- markerWidth: lineInfo.markerWidth,
16594
+ markerWidth: isFirst && lineInfo.isNumbering ? lineInfo.markerWidth : 0,
15942
16595
  isNumbering: lineInfo.isNumbering,
15943
16596
  isPageBreak: false,
15944
16597
  isLineBreak: false,
@@ -15966,12 +16619,86 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
15966
16619
  type: Injectable
15967
16620
  }], ctorParameters: () => [{ type: ComponentService }, { type: i0.Injector }] });
15968
16621
 
16622
+ class RenderComment {
16623
+ constructor(comment, sessionId, top, left) {
16624
+ this.commentRef = comment;
16625
+ this.commentId = comment.instance.id;
16626
+ this.sessionId = sessionId;
16627
+ this.highlightTop = top;
16628
+ this.highlightLeft = left;
16629
+ }
16630
+ }
16631
+
16632
+ class CommentRenderService {
16633
+ get commentRenderRequests$() {
16634
+ return this.commentRenderRequests.asObservable();
16635
+ }
16636
+ constructor(componentType) {
16637
+ this.componentType = componentType;
16638
+ this.componentInstances = [];
16639
+ this.applicationRef = inject(ApplicationRef);
16640
+ this.injector = inject(Injector);
16641
+ this.commentRenderRequests = new Subject();
16642
+ }
16643
+ requestCommentsRender(sessionId, renderRequests) {
16644
+ const requests = [];
16645
+ for (const request of renderRequests) {
16646
+ let componentRef;
16647
+ const existingComponentRef = this.componentInstances.find(x => x.instance.id === request.commentId);
16648
+ if (existingComponentRef) {
16649
+ componentRef = existingComponentRef;
16650
+ }
16651
+ else {
16652
+ componentRef = this.createComponentRef(request.commentId);
16653
+ componentRef.instance.initialize();
16654
+ this.componentInstances.push(componentRef);
16655
+ }
16656
+ requests.push(new RenderComment(componentRef, sessionId, request.top, request.left));
16657
+ }
16658
+ this.commentRenderRequests.next(new RenderComments(sessionId, requests));
16659
+ }
16660
+ createNewComment(id) {
16661
+ const componentRef = this.createComponentRef(id);
16662
+ componentRef.instance.markAsNew();
16663
+ componentRef.instance.initialize();
16664
+ this.componentInstances.push(componentRef);
16665
+ }
16666
+ removeCommentFromRender(sessionId, id) {
16667
+ if (!this.componentInstances.some(x => x.instance.id === id)) {
16668
+ return;
16669
+ }
16670
+ this.commentRenderRequests.next(new RemoveCommentFromDom(sessionId, id));
16671
+ }
16672
+ removeCommentsFromRender(sessionId) {
16673
+ this.commentRenderRequests.next(new RemoveCommentsFromDom(sessionId));
16674
+ }
16675
+ setCommentSelected(id, selected = true) {
16676
+ const componentRef = this.componentInstances.find(x => x.instance.id === id);
16677
+ componentRef?.instance.setSelected(selected);
16678
+ }
16679
+ createComponentRef(id) {
16680
+ const ref = createComponent(this.componentType, {
16681
+ environmentInjector: this.applicationRef.injector,
16682
+ elementInjector: this.injector
16683
+ });
16684
+ this.applicationRef.attachView(ref.hostView);
16685
+ ref.instance.id = id;
16686
+ return ref;
16687
+ }
16688
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: CommentRenderService, deps: [{ token: i0.Type }], target: i0.ɵɵFactoryTarget.Injectable }); }
16689
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: CommentRenderService }); }
16690
+ }
16691
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: CommentRenderService, decorators: [{
16692
+ type: Injectable
16693
+ }], ctorParameters: () => [{ type: i0.Type }] });
16694
+
15969
16695
  class RegulatorService {
15970
- constructor(customContentService, editorService, componentService, grammarService) {
16696
+ constructor(customContentService, editorService, componentService, grammarService, commentRenderService) {
15971
16697
  this.customContentService = customContentService;
15972
16698
  this.editorService = editorService;
15973
16699
  this.componentService = componentService;
15974
16700
  this.grammarService = grammarService;
16701
+ this.commentRenderService = commentRenderService;
15975
16702
  this.sessions = [];
15976
16703
  this.sessionIdIncrement = 0;
15977
16704
  this.grammarChecker = new GrammarChecker(this.grammarService);
@@ -16000,8 +16727,8 @@ class RegulatorService {
16000
16727
  const customComponents = { images: [], tables: [], tabs: [], customElements: [], edges: edges };
16001
16728
  const displayData = new DisplayData(model, properties, sessionId, model.pageFormats, DocumentInfo.pagesSpace, customComponents, this.customContentService, this.editorService);
16002
16729
  const scrollBar = new ScrollBar(container.nativeElement.parentElement);
16003
- const mainSession = new EditSession(displayData, sessionId, this.customContentService, model, this.selection, properties, this.editorService, customComponents, 'main', scrollBar);
16004
- const virtualRenderer = new VirtualRenderer(container.nativeElement, mainSession, scrollBar);
16730
+ const mainSession = new EditSession(displayData, sessionId, this.customContentService, this.commentRenderService, model, this.selection, properties, this.editorService, customComponents, 'main', scrollBar);
16731
+ const virtualRenderer = new VirtualRenderer(container.nativeElement, mainSession, this.commentRenderService, scrollBar);
16005
16732
  this.editorService.styles = DEFAULT_TOOLBAR_STYLES();
16006
16733
  this.mainSession = new SessionModel(mainSession, virtualRenderer, sessionId, null, new MainSessionSourceModel());
16007
16734
  this.sessions.push(this.mainSession);
@@ -16014,10 +16741,10 @@ class RegulatorService {
16014
16741
  const customComponents = { images: [], tables: [], tabs: [], customElements: [], edges: null };
16015
16742
  const displayData = new DisplayData(component.cell, properties, sessionId, this.getPageFormats(margins, component.width), 0, customComponents, this.customContentService, this.editorService);
16016
16743
  const sessionType = this.isWithinEdge(component.parentSessionId) ? 'cellWithinEdge' : 'cell';
16017
- const session = new EditSession(displayData, sessionId, this.customContentService, component.cell, this.selection, properties, this.editorService, customComponents, sessionType);
16744
+ const session = new EditSession(displayData, sessionId, this.customContentService, this.commentRenderService, component.cell, this.selection, properties, this.editorService, customComponents, sessionType);
16018
16745
  displayData.pagesFormat[0].contentWidth =
16019
16746
  displayData.pagesFormat[0].contentWidth === 0 ? 1 : displayData.pagesFormat[0].contentWidth;
16020
- const renderer = new Renderer(component.container.nativeElement, session);
16747
+ const renderer = new Renderer(component.container.nativeElement, this.commentRenderService, session);
16021
16748
  const source = new CellSessionSourceModel(table, component);
16022
16749
  const newSession = new SessionModel(session, renderer, sessionId, component.parentSessionId, source);
16023
16750
  this.sessions.push(newSession);
@@ -16030,8 +16757,8 @@ class RegulatorService {
16030
16757
  const sessionId = ++this.sessionIdIncrement;
16031
16758
  const customComponents = { images: [], tables: [], tabs: [], customElements: [], edges: null };
16032
16759
  const displayData = new DisplayData(component.model, component.generalProperties, sessionId, this.getPageFormats(component.margins, component.width), 0, customComponents, this.customContentService, this.editorService);
16033
- const session = new EditSession(displayData, sessionId, this.customContentService, component.model, this.selection, component.generalProperties, this.editorService, customComponents, 'edge', null, component.type);
16034
- const renderer = new Renderer(component.container.nativeElement, session);
16760
+ const session = new EditSession(displayData, sessionId, this.customContentService, this.commentRenderService, component.model, this.selection, component.generalProperties, this.editorService, customComponents, 'edge', null, component.type, component.model.pageType);
16761
+ const renderer = new Renderer(component.container.nativeElement, this.commentRenderService, session);
16035
16762
  const source = new EdgeSessionSourceModel(component.model.pageType, component.type);
16036
16763
  const newSession = new SessionModel(session, renderer, sessionId, component.parentSessionId, source);
16037
16764
  this.sessions.push(newSession);
@@ -16076,7 +16803,8 @@ class RegulatorService {
16076
16803
  this.selection.clearSelection();
16077
16804
  if (this.currentSession.session.isEdge()) {
16078
16805
  this.sessions.forEach(x => {
16079
- if (x.session.edgeType === this.currentSession.session.edgeType) {
16806
+ if (x.session.edgeType === this.currentSession.session.edgeType &&
16807
+ x.session.pageType === this.currentSession.session.pageType) {
16080
16808
  x.renderer.hideCursor();
16081
16809
  }
16082
16810
  });
@@ -16088,7 +16816,7 @@ class RegulatorService {
16088
16816
  this.currentSession = session;
16089
16817
  if (session.session.isEdge()) {
16090
16818
  this.sessions.forEach(x => {
16091
- if (x.session.edgeType === session.session.edgeType) {
16819
+ if (x.session.edgeType === session.session.edgeType && x.session.pageType === this.currentSession.session.pageType) {
16092
16820
  x.renderer.showCursor();
16093
16821
  this.arrangeEdgesForSessionChange(previous.session, x.session);
16094
16822
  }
@@ -16105,7 +16833,8 @@ class RegulatorService {
16105
16833
  return;
16106
16834
  }
16107
16835
  this.sessions.forEach(x => {
16108
- if (x.session.edgeType === this.currentSession.session.edgeType) {
16836
+ if (x.session.edgeType === this.currentSession.session.edgeType &&
16837
+ x.session.pageType === this.currentSession.session.pageType) {
16109
16838
  x.renderer.updateSelection(this.selection.selectedRange);
16110
16839
  if (this.selection.isEmpty) {
16111
16840
  x.renderer.updateCursor();
@@ -16164,6 +16893,20 @@ class RegulatorService {
16164
16893
  }
16165
16894
  return result;
16166
16895
  }
16896
+ getCommentTarget(commentId) {
16897
+ for (const session of this.sessions) {
16898
+ if (session.session.model.comments.some(x => x.commentId === commentId)) {
16899
+ return { session, target: session.source.getTarget() };
16900
+ }
16901
+ }
16902
+ return null;
16903
+ }
16904
+ setCommentsVisibility(value) {
16905
+ for (const sessionModel of this.sessions) {
16906
+ sessionModel.renderer.setCommentsVisibility(value);
16907
+ sessionModel.renderer.loop.schedule({ comments: true });
16908
+ }
16909
+ }
16167
16910
  isWithinEdge(sessionId) {
16168
16911
  return !!this.getEdgeSessionId(sessionId);
16169
16912
  }
@@ -16177,7 +16920,9 @@ class RegulatorService {
16177
16920
  return;
16178
16921
  }
16179
16922
  this.sessions.forEach(x => {
16180
- if (x.session.isEdge() && x.session.edgeType === this.currentSession.session.edgeType) {
16923
+ if (x.session.isEdge() &&
16924
+ x.session.edgeType === this.currentSession.session.edgeType &&
16925
+ x.session.pageType === this.currentSession.session.pageType) {
16181
16926
  x.session.updateDisplayData();
16182
16927
  x.renderer.updateTextAndCursor();
16183
16928
  }
@@ -16218,12 +16963,12 @@ class RegulatorService {
16218
16963
  })
16219
16964
  ];
16220
16965
  }
16221
- 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 }], target: i0.ɵɵFactoryTarget.Injectable }); }
16966
+ 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 }); }
16222
16967
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RegulatorService }); }
16223
16968
  }
16224
16969
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RegulatorService, decorators: [{
16225
16970
  type: Injectable
16226
- }], ctorParameters: () => [{ type: CustomContentService }, { type: EditorService }, { type: ComponentService }, { type: GrammarService }] });
16971
+ }], ctorParameters: () => [{ type: CustomContentService }, { type: EditorService }, { type: ComponentService }, { type: GrammarService }, { type: CommentRenderService }] });
16227
16972
 
16228
16973
  class CommandsService {
16229
16974
  constructor() {
@@ -16432,9 +17177,9 @@ class EditorRulerComponent {
16432
17177
  this.editorService.paragraphStyle$.pipe(takeUntilDestroyed()).subscribe(({ paragraphStyle, numberingModel }) => {
16433
17178
  const numberingIndentLeft = numberingModel?.levels[paragraphStyle.numberingLevel].indentLeft ?? 0;
16434
17179
  const numberingIndentHanging = numberingModel?.levels[paragraphStyle.numberingLevel].indentHanging ?? 0;
16435
- const indentLeft = paragraphStyle.indentLeft === 0 ? numberingIndentLeft : paragraphStyle.indentLeft;
16436
- const firstLine = paragraphStyle.indentHanging ? -paragraphStyle.indentHanging : paragraphStyle.indentFirstLine;
16437
- this.firstLine.set(firstLine === 0 ? -numberingIndentHanging : firstLine);
17180
+ const indentLeft = paragraphStyle.indentLeft === null ? numberingIndentLeft : paragraphStyle.indentLeft;
17181
+ const firstLine = paragraphStyle.indentHanging !== null ? -paragraphStyle.indentHanging : paragraphStyle.indentFirstLine;
17182
+ this.firstLine.set(firstLine === null ? -numberingIndentHanging : firstLine);
16438
17183
  this.leftIndent.set(indentLeft);
16439
17184
  this.rightIndent.set(paragraphStyle.indentRight);
16440
17185
  });
@@ -16781,12 +17526,17 @@ class EditorModule {
16781
17526
  { provide: EXTERNAL_ELEMENT_SIDENAV, useValue: new ExternalSidenavModel(options?.sidenav) },
16782
17527
  { provide: EXTERNAL_ELEMENT_SERVICE, useClass: options?.elementService ?? ExternalElementService },
16783
17528
  { provide: InsertOverlays, useValue: new InsertOverlays(options?.insertOverlays) },
16784
- { provide: ImageApiService, useClass: options?.imageApiService ?? DefaultImageApiService }
17529
+ { provide: ImageApiService, useClass: options?.imageApiService ?? DefaultImageApiService },
17530
+ {
17531
+ provide: CommentRenderService,
17532
+ useFactory: () => new CommentRenderService(options?.commentComponent)
17533
+ }
16785
17534
  ]
16786
17535
  };
16787
17536
  }
16788
17537
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
16789
17538
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: EditorModule, declarations: [EditorComponent,
17539
+ CommentPopupComponent,
16790
17540
  NoderEdgeComponent,
16791
17541
  NoderImageComponent,
16792
17542
  NoderTabComponent,
@@ -16796,9 +17546,11 @@ class EditorModule {
16796
17546
  TableOverlayMenuComponent], imports: [CommonModule,
16797
17547
  EditorRulerComponent,
16798
17548
  EditorSearchBarComponent,
17549
+ TextFieldModule,
16799
17550
  MatButtonModule,
16800
17551
  MatDialogModule,
16801
17552
  MatIconModule,
17553
+ MatMenuModule,
16802
17554
  MatSidenavModule,
16803
17555
  MatTooltipModule,
16804
17556
  ReactiveFormsModule,
@@ -16806,9 +17558,11 @@ class EditorModule {
16806
17558
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EditorModule, providers: [ComponentService, CustomContentService, OverlayService, RegulatorService, ExternalElementService, CommandsService], imports: [CommonModule,
16807
17559
  EditorRulerComponent,
16808
17560
  EditorSearchBarComponent,
17561
+ TextFieldModule,
16809
17562
  MatButtonModule,
16810
17563
  MatDialogModule,
16811
17564
  MatIconModule,
17565
+ MatMenuModule,
16812
17566
  MatSidenavModule,
16813
17567
  MatTooltipModule,
16814
17568
  ReactiveFormsModule,
@@ -16819,6 +17573,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
16819
17573
  args: [{
16820
17574
  declarations: [
16821
17575
  EditorComponent,
17576
+ CommentPopupComponent,
16822
17577
  NoderEdgeComponent,
16823
17578
  NoderImageComponent,
16824
17579
  NoderTabComponent,
@@ -16831,9 +17586,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
16831
17586
  CommonModule,
16832
17587
  EditorRulerComponent,
16833
17588
  EditorSearchBarComponent,
17589
+ TextFieldModule,
16834
17590
  MatButtonModule,
16835
17591
  MatDialogModule,
16836
17592
  MatIconModule,
17593
+ MatMenuModule,
16837
17594
  MatSidenavModule,
16838
17595
  MatTooltipModule,
16839
17596
  ReactiveFormsModule,
@@ -17298,6 +18055,7 @@ class BaseToolbarComponent extends DestroyComponent {
17298
18055
  this.updateTableBorderStyle = new EventEmitter();
17299
18056
  this.updateTableBorderWidth = new EventEmitter();
17300
18057
  this.updateTableBorders = new EventEmitter();
18058
+ this.commentsVisibile = false;
17301
18059
  this.elements = this.injector.get(EXTERNAL_ELEMENT_SERVICE).elements;
17302
18060
  this.customIconService.register();
17303
18061
  this.historyInfoSubscription();
@@ -17315,6 +18073,10 @@ class BaseToolbarComponent extends DestroyComponent {
17315
18073
  const italic = !this.styles.italic;
17316
18074
  this.checkFontLoadedAndApplyStyle(new TextStyleModel({ italic }));
17317
18075
  }
18076
+ onSwitchCommentsVisibility() {
18077
+ this.commentsVisibile = !this.commentsVisibile;
18078
+ this.editorService.setCommentsVisibility(this.commentsVisibile);
18079
+ }
17318
18080
  async onCreateElement(model) {
17319
18081
  const data = await model.factoryMethod();
17320
18082
  const element = new ElementDataModel(data.id, data.guid, data.type);
@@ -17960,11 +18722,11 @@ class ToolbarActionsComponent extends BaseToolbarComponent {
17960
18722
  });
17961
18723
  }
17962
18724
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ToolbarActionsComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: CustomIconService }, { token: i0.Injector }, { token: EditorService }], target: i0.ɵɵFactoryTarget.Component }); }
17963
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ToolbarActionsComponent, isStandalone: false, selector: "app-nod-toolbar-actions", viewQueries: [{ propertyName: "tableInsertMenu", first: true, predicate: ["tableInsert"], descendants: true }], usesInheritance: true, ngImport: i0, template: "@let isViewOnly = editorService.isViewOnly$ | async;\n@let isTableSelected = editorService.isTableSelected$ | async;\n<app-nod-undo-redo\n [canUndo]=\"canUndo\"\n [canRedo]=\"canRedo\"\n (undo)=\"undo.emit()\"\n (redo)=\"redo.emit()\" />\n<app-nod-print\n class=\"hidden\"\n (print)=\"print.emit()\" />\n<div class=\"separator\"></div>\n<app-nod-font\n [isDisabled]=\"isViewOnly\"\n [styles]=\"styles\"\n (selectFont)=\"onApplyFontFamily($event)\" />\n<div class=\"separator\"></div>\n<app-nod-font-size\n [isDisabled]=\"isViewOnly\"\n [fontSize]=\"styles.fontSize\"\n (selectFontSize)=\"onApplyFontSize($event)\" />\n<div class=\"separator\"></div>\n<app-nod-font-style\n [isDisabled]=\"isViewOnly\"\n [bold]=\"styles.bold\"\n [italic]=\"styles.italic\"\n [underline]=\"styles.underline\"\n [fontColor]=\"styles.fontColor\"\n [highlightColor]=\"styles.highlightColor\"\n (selectFontColor)=\"onApplyFontColor($event)\"\n (toggleBold)=\"onApplyBold()\"\n (toggleItalic)=\"onApplyItalic()\"\n (toggleUnderline)=\"onApplyUnderline()\"\n (selectHighlightColor)=\"onApplyHighlightColor($event)\" />\n<div class=\"separator\"></div>\n<app-nod-format\n [isDisabled]=\"isViewOnly\"\n [alignment]=\"styles.alignment\"\n (selectAlignment)=\"onApplyAlignment($event)\" />\n<div class=\"separator\"></div>\n<app-nod-numbering\n [isDisabled]=\"isViewOnly\"\n [selectedNumberingType]=\"numberingType\"\n [selectedNumberingTemplate]=\"numberingTemplateType\"\n (selectNumberingTemplate)=\"onSetNumberingTemplateType($event)\"\n (removeNumberings)=\"removeNumberings.emit()\" />\n<div class=\"separator\"></div>\n<div class=\"insert-buttons\">\n <button\n mat-button\n id=\"toolbar-actions-menu-item-insert-image\"\n [disabled]=\"isViewOnly\"\n (click)=\"insertImage.emit()\"\n [matTooltip]=\"'NODER.TOOLTIP.INSERT_IMAGE' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-image\" />\n </button>\n <button\n mat-button\n id=\"toolbar-actions-menu-item-insert-table\"\n [class.active-button]=\"showInsertTableMenu\"\n [disabled]=\"isViewOnly\"\n [matMenuTriggerFor]=\"tableInsert\"\n (menuOpened)=\"showInsertTableMenu = true\"\n (menuClosed)=\"onTableInsertMenuClosed()\"\n [matTooltip]=\"'NODER.TOOLTIP.INSERT_TABLE' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-table\" />\n </button>\n <button\n mat-button\n id=\"toolbar-actions-menu-item-insert-link\"\n [disabled]=\"isViewOnly\"\n (click)=\"insertLink.emit()\"\n [matTooltip]=\"'NODER.TOOLTIP.INSERT_LINK' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-link-on\" />\n </button>\n</div>\n@if (isTableSelected) {\n <div class=\"separator\"></div>\n <app-nod-table-borders\n [isDisabled]=\"isViewOnly\"\n (updateTableBorders)=\"updateTableBorders.emit($event)\" />\n <app-nod-table-border-width\n [isDisabled]=\"isViewOnly\"\n (updateTableBorderWidth)=\"updateTableBorderWidth.emit($event)\" />\n <app-nod-table-border-style\n [isDisabled]=\"isViewOnly\"\n (updateTableBorderStyle)=\"updateTableBorderStyle.emit($event)\" />\n}\n<div\n *ngIf=\"elements.length\"\n class=\"separator\"></div>\n<div\n *ngIf=\"elements.length\"\n class=\"custom-elements\">\n <button\n *ngFor=\"let element of elements\"\n mat-button\n [disabled]=\"isViewOnly\"\n (click)=\"onCreateElement(element)\"\n [matTooltip]=\"element.tooltip | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"{{ element.icon }}\"></mat-icon>\n </button>\n</div>\n<mat-menu\n #tableInsert=\"matMenu\"\n class=\"insert-table noder-modal\">\n <app-nod-insert-table\n *ngIf=\"showInsertTableMenu\"\n (selectSizes)=\"insertTable.emit($event)\" />\n</mat-menu>\n", styles: [":host::ng-deep mat-button-toggle,:host::ng-deep .mat-button-toggle-button{height:32px;width:32px;display:flex;align-items:center;justify-content:center;border-radius:4px}:host::ng-deep mat-button-toggle mat-icon,:host::ng-deep .mat-button-toggle-button mat-icon{font-size:24px;height:24px;width:24px;border-radius:4px}:host::ng-deep mat-button-toggle .mat-button-toggle-label-content,:host::ng-deep .mat-button-toggle-button .mat-button-toggle-label-content{padding:0 2px}.separator{border-left:2px solid;height:24px;margin:0 8px}.mdc-button{width:28px;height:28px;padding:0}.mat-mdc-button>.mat-icon{margin-right:0}.do-action{padding-right:1px;justify-content:center;display:flex}.custom-elements,.insert-buttons{display:flex;align-items:center;height:100%}.custom-elements .mdc-button,.insert-buttons .mdc-button{min-width:32px;min-height:32px;width:32px;height:32px;padding:0}.custom-elements .mdc-button>.mat-icon,.insert-buttons .mdc-button>.mat-icon{margin-right:0;font-size:24px;height:24px;width:24px}.hidden{display:none}\n"], dependencies: [{ kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FontComponent, selector: "app-nod-font", inputs: ["isDisabled", "styles"], outputs: ["selectFont"] }, { kind: "component", type: FontSizeComponent, selector: "app-nod-font-size", inputs: ["isDisabled", "fontSize"], outputs: ["selectFontSize"] }, { kind: "component", type: InsertTableComponent, selector: "app-nod-insert-table", outputs: ["selectSizes"] }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4$1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "directive", type: i4$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: i5$2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: TableBordersComponent, selector: "app-nod-table-borders", inputs: ["isDisabled"], outputs: ["updateTableBorders"] }, { kind: "component", type: TableBorderStyleComponent, selector: "app-nod-table-border-style", inputs: ["isDisabled"], outputs: ["updateTableBorderStyle"] }, { kind: "component", type: TableBorderWidthComponent, selector: "app-nod-table-border-width", inputs: ["isDisabled"], outputs: ["updateTableBorderWidth"] }, { kind: "component", type: FontStyleComponent, selector: "app-nod-font-style", inputs: ["isDisabled", "bold", "italic", "underline", "fontColor", "highlightColor"], outputs: ["toggleBold", "toggleItalic", "toggleUnderline", "selectFontColor", "selectHighlightColor"] }, { kind: "component", type: FormatComponent, selector: "app-nod-format", inputs: ["isDisabled", "alignment"], outputs: ["selectAlignment"] }, { kind: "component", type: NumberingComponent, selector: "app-nod-numbering", inputs: ["isDisabled", "selectedNumberingType", "selectedNumberingTemplate"], outputs: ["selectNumberingTemplate", "removeNumberings"] }, { kind: "component", type: PrintComponent, selector: "app-nod-print", outputs: ["print"] }, { kind: "component", type: UndoRedoComponent, selector: "app-nod-undo-redo", inputs: ["canUndo", "canRedo"], outputs: ["undo", "redo"] }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
18725
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: ToolbarActionsComponent, isStandalone: false, selector: "app-nod-toolbar-actions", viewQueries: [{ propertyName: "tableInsertMenu", first: true, predicate: ["tableInsert"], descendants: true }], usesInheritance: true, ngImport: i0, template: "@let isViewOnly = editorService.isViewOnly$ | async;\n@let isTableSelected = editorService.isTableSelected$ | async;\n<app-nod-undo-redo\n [canUndo]=\"canUndo\"\n [canRedo]=\"canRedo\"\n (undo)=\"undo.emit()\"\n (redo)=\"redo.emit()\" />\n<app-nod-print\n class=\"hidden\"\n (print)=\"print.emit()\" />\n<div class=\"separator\"></div>\n<app-nod-font\n [isDisabled]=\"isViewOnly\"\n [styles]=\"styles\"\n (selectFont)=\"onApplyFontFamily($event)\" />\n<div class=\"separator\"></div>\n<app-nod-font-size\n [isDisabled]=\"isViewOnly\"\n [fontSize]=\"styles.fontSize\"\n (selectFontSize)=\"onApplyFontSize($event)\" />\n<div class=\"separator\"></div>\n<app-nod-font-style\n [isDisabled]=\"isViewOnly\"\n [bold]=\"styles.bold\"\n [italic]=\"styles.italic\"\n [underline]=\"styles.underline\"\n [fontColor]=\"styles.fontColor\"\n [highlightColor]=\"styles.highlightColor\"\n (selectFontColor)=\"onApplyFontColor($event)\"\n (toggleBold)=\"onApplyBold()\"\n (toggleItalic)=\"onApplyItalic()\"\n (toggleUnderline)=\"onApplyUnderline()\"\n (selectHighlightColor)=\"onApplyHighlightColor($event)\" />\n<div class=\"separator\"></div>\n<app-nod-format\n [isDisabled]=\"isViewOnly\"\n [alignment]=\"styles.alignment\"\n (selectAlignment)=\"onApplyAlignment($event)\" />\n<div class=\"separator\"></div>\n<app-nod-numbering\n [isDisabled]=\"isViewOnly\"\n [selectedNumberingType]=\"numberingType\"\n [selectedNumberingTemplate]=\"numberingTemplateType\"\n (selectNumberingTemplate)=\"onSetNumberingTemplateType($event)\"\n (removeNumberings)=\"removeNumberings.emit()\" />\n<div class=\"separator\"></div>\n<div class=\"insert-buttons\">\n <button\n mat-button\n id=\"toolbar-actions-menu-item-insert-image\"\n [disabled]=\"isViewOnly\"\n (click)=\"insertImage.emit()\"\n [matTooltip]=\"'NODER.TOOLTIP.INSERT_IMAGE' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-image\" />\n </button>\n <button\n mat-button\n id=\"toolbar-actions-menu-item-insert-table\"\n [class.active-button]=\"showInsertTableMenu\"\n [disabled]=\"isViewOnly\"\n [matMenuTriggerFor]=\"tableInsert\"\n (menuOpened)=\"showInsertTableMenu = true\"\n (menuClosed)=\"onTableInsertMenuClosed()\"\n [matTooltip]=\"'NODER.TOOLTIP.INSERT_TABLE' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-table\" />\n </button>\n <button\n mat-button\n id=\"toolbar-actions-menu-item-insert-link\"\n [disabled]=\"isViewOnly\"\n (click)=\"insertLink.emit()\"\n [matTooltip]=\"'NODER.TOOLTIP.INSERT_LINK' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-link-on\" />\n </button>\n</div>\n@if (isTableSelected) {\n <div class=\"separator\"></div>\n <app-nod-table-borders\n [isDisabled]=\"isViewOnly\"\n (updateTableBorders)=\"updateTableBorders.emit($event)\" />\n <app-nod-table-border-width\n [isDisabled]=\"isViewOnly\"\n (updateTableBorderWidth)=\"updateTableBorderWidth.emit($event)\" />\n <app-nod-table-border-style\n [isDisabled]=\"isViewOnly\"\n (updateTableBorderStyle)=\"updateTableBorderStyle.emit($event)\" />\n}\n<div\n *ngIf=\"elements.length\"\n class=\"separator\"></div>\n<div\n *ngIf=\"elements.length\"\n class=\"custom-elements\">\n <button\n *ngFor=\"let element of elements\"\n mat-button\n [disabled]=\"isViewOnly\"\n (click)=\"onCreateElement(element)\"\n [matTooltip]=\"element.tooltip | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"{{ element.icon }}\"></mat-icon>\n </button>\n</div>\n<div class=\"separator\"></div>\n<mat-button-toggle\n (click)=\"onSwitchCommentsVisibility()\"\n [matTooltip]=\"'NODER.TOOLTIP.COMMENTS' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-comment\" />\n</mat-button-toggle>\n<mat-menu\n #tableInsert=\"matMenu\"\n class=\"insert-table noder-modal\">\n <app-nod-insert-table\n *ngIf=\"showInsertTableMenu\"\n (selectSizes)=\"insertTable.emit($event)\" />\n</mat-menu>\n", styles: [":host::ng-deep mat-button-toggle,:host::ng-deep .mat-button-toggle-button{height:32px;width:32px;display:flex;align-items:center;justify-content:center;border-radius:4px}:host::ng-deep mat-button-toggle mat-icon,:host::ng-deep .mat-button-toggle-button mat-icon{font-size:24px;height:24px;width:24px;border-radius:4px}:host::ng-deep mat-button-toggle .mat-button-toggle-label-content,:host::ng-deep .mat-button-toggle-button .mat-button-toggle-label-content{padding:0 2px}.mat-button-toggle-group-appearance-standard .mat-button-toggle+.mat-button-toggle{border-left:0}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{border:0}.separator{border-left:2px solid;height:24px;margin:0 8px}.mdc-button{width:28px;height:28px;padding:0}.mat-mdc-button>.mat-icon{margin-right:0}.do-action{padding-right:1px;justify-content:center;display:flex}.custom-elements,.insert-buttons{display:flex;align-items:center;height:100%}.custom-elements .mdc-button,.insert-buttons .mdc-button{min-width:32px;min-height:32px;width:32px;height:32px;padding:0}.custom-elements .mdc-button>.mat-icon,.insert-buttons .mdc-button>.mat-icon{margin-right:0;font-size:24px;height:24px;width:24px}.hidden{display:none}\n"], dependencies: [{ kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FontComponent, selector: "app-nod-font", inputs: ["isDisabled", "styles"], outputs: ["selectFont"] }, { kind: "component", type: FontSizeComponent, selector: "app-nod-font-size", inputs: ["isDisabled", "fontSize"], outputs: ["selectFontSize"] }, { kind: "component", type: InsertTableComponent, selector: "app-nod-insert-table", outputs: ["selectSizes"] }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3$3.MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4$1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "directive", type: i4$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: i5$2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: TableBordersComponent, selector: "app-nod-table-borders", inputs: ["isDisabled"], outputs: ["updateTableBorders"] }, { kind: "component", type: TableBorderStyleComponent, selector: "app-nod-table-border-style", inputs: ["isDisabled"], outputs: ["updateTableBorderStyle"] }, { kind: "component", type: TableBorderWidthComponent, selector: "app-nod-table-border-width", inputs: ["isDisabled"], outputs: ["updateTableBorderWidth"] }, { kind: "component", type: FontStyleComponent, selector: "app-nod-font-style", inputs: ["isDisabled", "bold", "italic", "underline", "fontColor", "highlightColor"], outputs: ["toggleBold", "toggleItalic", "toggleUnderline", "selectFontColor", "selectHighlightColor"] }, { kind: "component", type: FormatComponent, selector: "app-nod-format", inputs: ["isDisabled", "alignment"], outputs: ["selectAlignment"] }, { kind: "component", type: NumberingComponent, selector: "app-nod-numbering", inputs: ["isDisabled", "selectedNumberingType", "selectedNumberingTemplate"], outputs: ["selectNumberingTemplate", "removeNumberings"] }, { kind: "component", type: PrintComponent, selector: "app-nod-print", outputs: ["print"] }, { kind: "component", type: UndoRedoComponent, selector: "app-nod-undo-redo", inputs: ["canUndo", "canRedo"], outputs: ["undo", "redo"] }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
17964
18726
  }
17965
18727
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ToolbarActionsComponent, decorators: [{
17966
18728
  type: Component,
17967
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'app-nod-toolbar-actions', standalone: false, template: "@let isViewOnly = editorService.isViewOnly$ | async;\n@let isTableSelected = editorService.isTableSelected$ | async;\n<app-nod-undo-redo\n [canUndo]=\"canUndo\"\n [canRedo]=\"canRedo\"\n (undo)=\"undo.emit()\"\n (redo)=\"redo.emit()\" />\n<app-nod-print\n class=\"hidden\"\n (print)=\"print.emit()\" />\n<div class=\"separator\"></div>\n<app-nod-font\n [isDisabled]=\"isViewOnly\"\n [styles]=\"styles\"\n (selectFont)=\"onApplyFontFamily($event)\" />\n<div class=\"separator\"></div>\n<app-nod-font-size\n [isDisabled]=\"isViewOnly\"\n [fontSize]=\"styles.fontSize\"\n (selectFontSize)=\"onApplyFontSize($event)\" />\n<div class=\"separator\"></div>\n<app-nod-font-style\n [isDisabled]=\"isViewOnly\"\n [bold]=\"styles.bold\"\n [italic]=\"styles.italic\"\n [underline]=\"styles.underline\"\n [fontColor]=\"styles.fontColor\"\n [highlightColor]=\"styles.highlightColor\"\n (selectFontColor)=\"onApplyFontColor($event)\"\n (toggleBold)=\"onApplyBold()\"\n (toggleItalic)=\"onApplyItalic()\"\n (toggleUnderline)=\"onApplyUnderline()\"\n (selectHighlightColor)=\"onApplyHighlightColor($event)\" />\n<div class=\"separator\"></div>\n<app-nod-format\n [isDisabled]=\"isViewOnly\"\n [alignment]=\"styles.alignment\"\n (selectAlignment)=\"onApplyAlignment($event)\" />\n<div class=\"separator\"></div>\n<app-nod-numbering\n [isDisabled]=\"isViewOnly\"\n [selectedNumberingType]=\"numberingType\"\n [selectedNumberingTemplate]=\"numberingTemplateType\"\n (selectNumberingTemplate)=\"onSetNumberingTemplateType($event)\"\n (removeNumberings)=\"removeNumberings.emit()\" />\n<div class=\"separator\"></div>\n<div class=\"insert-buttons\">\n <button\n mat-button\n id=\"toolbar-actions-menu-item-insert-image\"\n [disabled]=\"isViewOnly\"\n (click)=\"insertImage.emit()\"\n [matTooltip]=\"'NODER.TOOLTIP.INSERT_IMAGE' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-image\" />\n </button>\n <button\n mat-button\n id=\"toolbar-actions-menu-item-insert-table\"\n [class.active-button]=\"showInsertTableMenu\"\n [disabled]=\"isViewOnly\"\n [matMenuTriggerFor]=\"tableInsert\"\n (menuOpened)=\"showInsertTableMenu = true\"\n (menuClosed)=\"onTableInsertMenuClosed()\"\n [matTooltip]=\"'NODER.TOOLTIP.INSERT_TABLE' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-table\" />\n </button>\n <button\n mat-button\n id=\"toolbar-actions-menu-item-insert-link\"\n [disabled]=\"isViewOnly\"\n (click)=\"insertLink.emit()\"\n [matTooltip]=\"'NODER.TOOLTIP.INSERT_LINK' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-link-on\" />\n </button>\n</div>\n@if (isTableSelected) {\n <div class=\"separator\"></div>\n <app-nod-table-borders\n [isDisabled]=\"isViewOnly\"\n (updateTableBorders)=\"updateTableBorders.emit($event)\" />\n <app-nod-table-border-width\n [isDisabled]=\"isViewOnly\"\n (updateTableBorderWidth)=\"updateTableBorderWidth.emit($event)\" />\n <app-nod-table-border-style\n [isDisabled]=\"isViewOnly\"\n (updateTableBorderStyle)=\"updateTableBorderStyle.emit($event)\" />\n}\n<div\n *ngIf=\"elements.length\"\n class=\"separator\"></div>\n<div\n *ngIf=\"elements.length\"\n class=\"custom-elements\">\n <button\n *ngFor=\"let element of elements\"\n mat-button\n [disabled]=\"isViewOnly\"\n (click)=\"onCreateElement(element)\"\n [matTooltip]=\"element.tooltip | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"{{ element.icon }}\"></mat-icon>\n </button>\n</div>\n<mat-menu\n #tableInsert=\"matMenu\"\n class=\"insert-table noder-modal\">\n <app-nod-insert-table\n *ngIf=\"showInsertTableMenu\"\n (selectSizes)=\"insertTable.emit($event)\" />\n</mat-menu>\n", styles: [":host::ng-deep mat-button-toggle,:host::ng-deep .mat-button-toggle-button{height:32px;width:32px;display:flex;align-items:center;justify-content:center;border-radius:4px}:host::ng-deep mat-button-toggle mat-icon,:host::ng-deep .mat-button-toggle-button mat-icon{font-size:24px;height:24px;width:24px;border-radius:4px}:host::ng-deep mat-button-toggle .mat-button-toggle-label-content,:host::ng-deep .mat-button-toggle-button .mat-button-toggle-label-content{padding:0 2px}.separator{border-left:2px solid;height:24px;margin:0 8px}.mdc-button{width:28px;height:28px;padding:0}.mat-mdc-button>.mat-icon{margin-right:0}.do-action{padding-right:1px;justify-content:center;display:flex}.custom-elements,.insert-buttons{display:flex;align-items:center;height:100%}.custom-elements .mdc-button,.insert-buttons .mdc-button{min-width:32px;min-height:32px;width:32px;height:32px;padding:0}.custom-elements .mdc-button>.mat-icon,.insert-buttons .mdc-button>.mat-icon{margin-right:0;font-size:24px;height:24px;width:24px}.hidden{display:none}\n"] }]
18729
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'app-nod-toolbar-actions', standalone: false, template: "@let isViewOnly = editorService.isViewOnly$ | async;\n@let isTableSelected = editorService.isTableSelected$ | async;\n<app-nod-undo-redo\n [canUndo]=\"canUndo\"\n [canRedo]=\"canRedo\"\n (undo)=\"undo.emit()\"\n (redo)=\"redo.emit()\" />\n<app-nod-print\n class=\"hidden\"\n (print)=\"print.emit()\" />\n<div class=\"separator\"></div>\n<app-nod-font\n [isDisabled]=\"isViewOnly\"\n [styles]=\"styles\"\n (selectFont)=\"onApplyFontFamily($event)\" />\n<div class=\"separator\"></div>\n<app-nod-font-size\n [isDisabled]=\"isViewOnly\"\n [fontSize]=\"styles.fontSize\"\n (selectFontSize)=\"onApplyFontSize($event)\" />\n<div class=\"separator\"></div>\n<app-nod-font-style\n [isDisabled]=\"isViewOnly\"\n [bold]=\"styles.bold\"\n [italic]=\"styles.italic\"\n [underline]=\"styles.underline\"\n [fontColor]=\"styles.fontColor\"\n [highlightColor]=\"styles.highlightColor\"\n (selectFontColor)=\"onApplyFontColor($event)\"\n (toggleBold)=\"onApplyBold()\"\n (toggleItalic)=\"onApplyItalic()\"\n (toggleUnderline)=\"onApplyUnderline()\"\n (selectHighlightColor)=\"onApplyHighlightColor($event)\" />\n<div class=\"separator\"></div>\n<app-nod-format\n [isDisabled]=\"isViewOnly\"\n [alignment]=\"styles.alignment\"\n (selectAlignment)=\"onApplyAlignment($event)\" />\n<div class=\"separator\"></div>\n<app-nod-numbering\n [isDisabled]=\"isViewOnly\"\n [selectedNumberingType]=\"numberingType\"\n [selectedNumberingTemplate]=\"numberingTemplateType\"\n (selectNumberingTemplate)=\"onSetNumberingTemplateType($event)\"\n (removeNumberings)=\"removeNumberings.emit()\" />\n<div class=\"separator\"></div>\n<div class=\"insert-buttons\">\n <button\n mat-button\n id=\"toolbar-actions-menu-item-insert-image\"\n [disabled]=\"isViewOnly\"\n (click)=\"insertImage.emit()\"\n [matTooltip]=\"'NODER.TOOLTIP.INSERT_IMAGE' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-image\" />\n </button>\n <button\n mat-button\n id=\"toolbar-actions-menu-item-insert-table\"\n [class.active-button]=\"showInsertTableMenu\"\n [disabled]=\"isViewOnly\"\n [matMenuTriggerFor]=\"tableInsert\"\n (menuOpened)=\"showInsertTableMenu = true\"\n (menuClosed)=\"onTableInsertMenuClosed()\"\n [matTooltip]=\"'NODER.TOOLTIP.INSERT_TABLE' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-table\" />\n </button>\n <button\n mat-button\n id=\"toolbar-actions-menu-item-insert-link\"\n [disabled]=\"isViewOnly\"\n (click)=\"insertLink.emit()\"\n [matTooltip]=\"'NODER.TOOLTIP.INSERT_LINK' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-link-on\" />\n </button>\n</div>\n@if (isTableSelected) {\n <div class=\"separator\"></div>\n <app-nod-table-borders\n [isDisabled]=\"isViewOnly\"\n (updateTableBorders)=\"updateTableBorders.emit($event)\" />\n <app-nod-table-border-width\n [isDisabled]=\"isViewOnly\"\n (updateTableBorderWidth)=\"updateTableBorderWidth.emit($event)\" />\n <app-nod-table-border-style\n [isDisabled]=\"isViewOnly\"\n (updateTableBorderStyle)=\"updateTableBorderStyle.emit($event)\" />\n}\n<div\n *ngIf=\"elements.length\"\n class=\"separator\"></div>\n<div\n *ngIf=\"elements.length\"\n class=\"custom-elements\">\n <button\n *ngFor=\"let element of elements\"\n mat-button\n [disabled]=\"isViewOnly\"\n (click)=\"onCreateElement(element)\"\n [matTooltip]=\"element.tooltip | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"{{ element.icon }}\"></mat-icon>\n </button>\n</div>\n<div class=\"separator\"></div>\n<mat-button-toggle\n (click)=\"onSwitchCommentsVisibility()\"\n [matTooltip]=\"'NODER.TOOLTIP.COMMENTS' | translate\"\n matTooltipPosition=\"below\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-comment\" />\n</mat-button-toggle>\n<mat-menu\n #tableInsert=\"matMenu\"\n class=\"insert-table noder-modal\">\n <app-nod-insert-table\n *ngIf=\"showInsertTableMenu\"\n (selectSizes)=\"insertTable.emit($event)\" />\n</mat-menu>\n", styles: [":host::ng-deep mat-button-toggle,:host::ng-deep .mat-button-toggle-button{height:32px;width:32px;display:flex;align-items:center;justify-content:center;border-radius:4px}:host::ng-deep mat-button-toggle mat-icon,:host::ng-deep .mat-button-toggle-button mat-icon{font-size:24px;height:24px;width:24px;border-radius:4px}:host::ng-deep mat-button-toggle .mat-button-toggle-label-content,:host::ng-deep .mat-button-toggle-button .mat-button-toggle-label-content{padding:0 2px}.mat-button-toggle-group-appearance-standard .mat-button-toggle+.mat-button-toggle{border-left:0}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{border:0}.separator{border-left:2px solid;height:24px;margin:0 8px}.mdc-button{width:28px;height:28px;padding:0}.mat-mdc-button>.mat-icon{margin-right:0}.do-action{padding-right:1px;justify-content:center;display:flex}.custom-elements,.insert-buttons{display:flex;align-items:center;height:100%}.custom-elements .mdc-button,.insert-buttons .mdc-button{min-width:32px;min-height:32px;width:32px;height:32px;padding:0}.custom-elements .mdc-button>.mat-icon,.insert-buttons .mdc-button>.mat-icon{margin-right:0;font-size:24px;height:24px;width:24px}.hidden{display:none}\n"] }]
17968
18730
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: CustomIconService }, { type: i0.Injector }, { type: EditorService }], propDecorators: { tableInsertMenu: [{
17969
18731
  type: ViewChild,
17970
18732
  args: ['tableInsert']
@@ -18999,6 +19761,7 @@ class RevisionHelper {
18999
19761
  tabs: [],
19000
19762
  headers: [],
19001
19763
  footers: [],
19764
+ comments: [],
19002
19765
  defaultTabWidth: DEFAULT_TAB_WIDTH
19003
19766
  });
19004
19767
  }
@@ -19190,5 +19953,5 @@ class OperationModel {
19190
19953
  * Generated bundle index. Do not edit.
19191
19954
  */
19192
19955
 
19193
- export { AddLinkDialogComponent, AddLinkMobileComponent, Alignment, BaseNoderComponent, Borders, BreakTypes, CommandModel, CommandType, CommandsService, ConfirmDialogComponent, DEFAULT_BACKGROUND_COLOR, DEFAULT_EDGE_MAX_HEIGHT_MULTIPLIER, DEFAULT_FONT_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_HEADINGS, DEFAULT_HEADING_STYLE_ID, DEFAULT_OFFSET_AFTER_NUMBERING_MARKER, DEFAULT_PARAGRAPH_STYLE, DEFAULT_TAB_WIDTH, DEFAULT_TEXT_STYLE, DEFAULT_TOOLBAR_STYLES, DefaultImageApiService, DestroyComponent, DocumentInfo, DocumentModel, DocumentNameModel, DocxModel, DomHelper, EditorComponent, EditorMobileToolbarComponent, EditorModule, EditorService, EditorTitleComponent, EditorTitleMobileComponent, EditorToolbarComponent, EditorToolbarMode, EditorToolbarModule, EditorToolbarService, ElementDataModel, ElementModel, ExternalComponent, ExternalElementModel, ExternalElementService, FileSourceModel, FontMetrics, FormatStyleHelper, GrammarService, HYPERLINK_FONT_COLOR, HYPERLINK_HEADING_STYLE_ID, ImageApiService, ImageDataModel, LastDocumentRevisionModel, LineStyles, MenuDropdownsComponent, MenuDropdownsMobileComponent, Mode, NEW_LINE_MARKUP, NoderTranslateLoader, NumberingLevelModel, OperationModel, OperationsHistoryInfoModel, PageSetupComponent, PageType, ParagraphStyleModel, RevisionHelper, RevisionModel, SearchResultLocation, TextFormatMobileComponent, TextStyleModel, ToolbarActionsComponent };
19956
+ export { AddLinkDialogComponent, AddLinkMobileComponent, Alignment, BaseCommentComponent, BaseNoderComponent, Borders, BreakTypes, CommandModel, CommandType, CommandsService, ConfirmDialogComponent, DEFAULT_BACKGROUND_COLOR, DEFAULT_EDGE_MAX_HEIGHT_MULTIPLIER, DEFAULT_FONT_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_HEADINGS, DEFAULT_HEADING_STYLE_ID, DEFAULT_OFFSET_AFTER_NUMBERING_MARKER, DEFAULT_PARAGRAPH_STYLE, DEFAULT_TAB_WIDTH, DEFAULT_TEXT_STYLE, DEFAULT_TOOLBAR_STYLES, DefaultImageApiService, DestroyComponent, DocumentInfo, DocumentModel, DocumentNameModel, DocxModel, DomHelper, EditorComponent, EditorMobileToolbarComponent, EditorModule, EditorService, EditorTitleComponent, EditorTitleMobileComponent, EditorToolbarComponent, EditorToolbarMode, EditorToolbarModule, EditorToolbarService, ElementDataModel, ElementModel, ExternalComponent, ExternalElementModel, ExternalElementService, FileSourceModel, FontMetrics, FormatStyleHelper, GrammarService, HYPERLINK_FONT_COLOR, HYPERLINK_HEADING_STYLE_ID, ImageApiService, ImageDataModel, LastDocumentRevisionModel, LineStyles, MenuDropdownsComponent, MenuDropdownsMobileComponent, Mode, NEW_LINE_MARKUP, NoderTranslateLoader, NumberingLevelModel, OperationModel, OperationsHistoryInfoModel, PageSetupComponent, PageType, ParagraphStyleModel, RevisionHelper, RevisionModel, SearchResultLocation, TextFormatMobileComponent, TextStyleModel, ToolbarActionsComponent };
19194
19957
  //# sourceMappingURL=talrace-ngx-noder.mjs.map