@talrace/ngx-noder 0.0.40 → 0.0.41

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.
@@ -1,10 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Directive, Injectable, inject, ChangeDetectorRef, HostBinding, Input, InjectionToken, createComponent, Component, ChangeDetectionStrategy, ViewChild, EventEmitter, Output, HostListener, signal, NgModule, Inject } from '@angular/core';
3
- import { Subject, BehaviorSubject, fromEvent, throttleTime, take, filter, startWith, takeUntil, catchError, debounceTime, distinctUntilChanged } from 'rxjs';
3
+ import { Subject, BehaviorSubject, fromEvent, throttleTime, take, filter, startWith, takeUntil, distinctUntilChanged, tap, map, catchError, debounceTime } from 'rxjs';
4
4
  import * as i1$1 from '@angular/common/http';
5
5
  import { HttpHeaders } from '@angular/common/http';
6
6
  import * as i3 from '@angular/common';
7
- import { CommonModule, AsyncPipe } from '@angular/common';
7
+ import { AsyncPipe, CommonModule } from '@angular/common';
8
8
  import { ComponentPortal } from '@angular/cdk/portal';
9
9
  import * as i1 from '@angular/cdk/overlay';
10
10
  import { OverlayConfig } from '@angular/cdk/overlay';
@@ -431,6 +431,14 @@ class OperationsHistoryInfoModel {
431
431
  }
432
432
  }
433
433
 
434
+ class PageFormatModel {
435
+ constructor(fields) {
436
+ if (fields) {
437
+ Object.assign(this, fields);
438
+ }
439
+ }
440
+ }
441
+
434
442
  class EditorService {
435
443
  constructor() {
436
444
  this._styles$ = new BehaviorSubject({});
@@ -487,6 +495,10 @@ class EditorService {
487
495
  this._applyDocumentPageFormat$ = new Subject();
488
496
  this._insertPageFormat$ = new Subject();
489
497
  this._applyPageFormat$ = new Subject();
498
+ this._pageFormat$ = new BehaviorSubject(new PageFormatModel());
499
+ this._leftMarginPageFormat$ = new Subject();
500
+ this._rightMarginPageFormat$ = new Subject();
501
+ this._tabParagraph$ = new Subject();
490
502
  }
491
503
  set styles(value) {
492
504
  this._styles$.next({ ...value });
@@ -679,22 +691,43 @@ class EditorService {
679
691
  return this._applyPageFormat$.asObservable();
680
692
  }
681
693
  get pageFormat() {
682
- return this._pageFormat;
694
+ return this._pageFormat$.value;
695
+ }
696
+ get pageFormat$() {
697
+ return this._pageFormat$.asObservable();
698
+ }
699
+ get leftMarginPageFormat$() {
700
+ return this._leftMarginPageFormat$.asObservable();
701
+ }
702
+ get rightMarginPageFormat$() {
703
+ return this._rightMarginPageFormat$.asObservable();
704
+ }
705
+ get tabParagraph$() {
706
+ return this._tabParagraph$.asObservable();
707
+ }
708
+ applyTabParagraph(value) {
709
+ this._tabParagraph$.next(value);
710
+ }
711
+ applyRightMarginPageFormat(value) {
712
+ this._rightMarginPageFormat$.next(value);
713
+ }
714
+ applyLeftMarginPageFormat(value) {
715
+ this._leftMarginPageFormat$.next(value);
683
716
  }
684
717
  applyDocumentPageFormat(value) {
685
- this._pageFormat = value;
718
+ this.setPageFormat(value);
686
719
  this._applyDocumentPageFormat$.next(value);
687
720
  }
688
721
  applyPageFormat(value) {
689
- this._pageFormat = value;
722
+ this.setPageFormat(value);
690
723
  this._applyPageFormat$.next(value);
691
724
  }
692
725
  insertPageFormat(value) {
693
- this._pageFormat = value;
726
+ this.setPageFormat(value);
694
727
  this._insertPageFormat$.next(value);
695
728
  }
696
729
  setPageFormat(value) {
697
- this._pageFormat = value;
730
+ this._pageFormat$.next(value);
698
731
  }
699
732
  setLastPageNumber(value) {
700
733
  if (this.lastPageNumber === value) {
@@ -1037,14 +1070,6 @@ class AddNumberingModel {
1037
1070
  }
1038
1071
  }
1039
1072
 
1040
- class PageFormatModel {
1041
- constructor(fields) {
1042
- if (fields) {
1043
- Object.assign(this, fields);
1044
- }
1045
- }
1046
- }
1047
-
1048
1073
  class ApplyDocumentPageFormatModel {
1049
1074
  constructor(fields) {
1050
1075
  if (fields) {
@@ -7307,7 +7332,7 @@ class Editor {
7307
7332
  this.session.applyToolbarStyles();
7308
7333
  this.search = new Search();
7309
7334
  this.search.set({ wrap: true });
7310
- this.subscriptions.push(this.changedEdgeSizeSubscription(), this.changedEdgeSubscription(), this.changedTableSizeSubscription(), this.clipboardDataSubscription(), this.copySelectedSubscription(), this.createCustomComponentSubscription(), this.cutSelectedSubscription(), this.disableSelectionSubscription(), this.endMousePressSubscription(), this.imageLoadedSubscription(), this.insertBreakSubscription(), this.insertImageSubscription(), this.insertLinkSubscription(), this.insertTableColumnsSubscription(), this.insertTableRowsSubscription(), this.insertTableSubscription(), this.insertTextSubscription(), this.pasteFromClipboardSubscription(), this.printSubscription(), this.redoSubscription(), this.removeLeftSubscription(), this.removeNumberingsSubscription(), this.removeRightSubscription(), this.removeSelectedSubscription(), this.removeTableColumnsSubscription(), this.removeTableRowsSubscription(), this.removeTableSubscription(), this.replaceSubscription(), this.rerenderSubscription(), this.resizeTableColumnsSubscription(), this.searchOptionSubscription(), this.selectAllSubscription(), this.setImageStyleSubscription(), this.setNumberingTemplateTypeSubscription(), this.setParagraphStylesSubscription(), this.setTextStylesSubscription(), this.undoSubscription(), this.updateEdgeSubscription(), this.viewOnlyModeSubscription(), this.applyPageFormatSubscription(), this.insertPageFormatSubscription(), this.applyDocumentPageFormatSubscription(), this.dragMoveSubscription(), this.dragDropSubscription());
7335
+ this.subscriptions.push(this.changedEdgeSizeSubscription(), this.changedEdgeSubscription(), this.changedTableSizeSubscription(), this.clipboardDataSubscription(), this.copySelectedSubscription(), this.createCustomComponentSubscription(), this.cutSelectedSubscription(), this.disableSelectionSubscription(), this.endMousePressSubscription(), this.imageLoadedSubscription(), this.insertBreakSubscription(), this.insertImageSubscription(), this.insertLinkSubscription(), this.insertTableColumnsSubscription(), this.insertTableRowsSubscription(), this.insertTableSubscription(), this.insertTextSubscription(), this.pasteFromClipboardSubscription(), this.printSubscription(), this.redoSubscription(), this.removeLeftSubscription(), this.removeNumberingsSubscription(), this.removeRightSubscription(), this.removeSelectedSubscription(), this.removeTableColumnsSubscription(), this.removeTableRowsSubscription(), this.removeTableSubscription(), this.replaceSubscription(), this.rerenderSubscription(), this.resizeTableColumnsSubscription(), this.searchOptionSubscription(), 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());
7311
7336
  }
7312
7337
  destroy() {
7313
7338
  this.subscriptions.forEach(s => s?.unsubscribe());
@@ -8362,6 +8387,9 @@ class Editor {
8362
8387
  this.renderer.updateCursor();
8363
8388
  }
8364
8389
  this.editorService.setHasSelection(!this.selection.isEmpty);
8390
+ const position = this.mainSession.displayData.positionToIndex(this.selection.selectedRange.start);
8391
+ const pageFormat = this.mainSession.displayData.getPageFormatAtPosition(position);
8392
+ this.editorService.setPageFormat(pageFormat.pageFormatModel);
8365
8393
  this.rerenderMarker();
8366
8394
  }
8367
8395
  enableSelection() {
@@ -8485,6 +8513,24 @@ class Editor {
8485
8513
  }
8486
8514
  return null;
8487
8515
  }
8516
+ applyLeftMarginPageFormat(value) {
8517
+ const position = this.selection.cursor;
8518
+ const startIndex = ContentHelper.paragraphToDocumentIndex(this.session.displayData.paragraphs, position.row, position.column);
8519
+ const oldPageFormat = this.mainSession.displayData.getPageFormatAtPosition(startIndex).pageFormatModel;
8520
+ const newPageFormat = new PageFormatModel({ ...oldPageFormat, marginLeft: value });
8521
+ this.saveApplyPageFormatToHistory(oldPageFormat, newPageFormat);
8522
+ OperationsHelper.updatePageFormat(this.model, newPageFormat);
8523
+ this.recreateMainSession();
8524
+ }
8525
+ applyRightMarginPageFormat(value) {
8526
+ const position = this.selection.cursor;
8527
+ const startIndex = ContentHelper.paragraphToDocumentIndex(this.session.displayData.paragraphs, position.row, position.column);
8528
+ const oldPageFormat = this.mainSession.displayData.getPageFormatAtPosition(startIndex).pageFormatModel;
8529
+ const newPageFormat = new PageFormatModel({ ...oldPageFormat, marginRight: value });
8530
+ this.saveApplyPageFormatToHistory(oldPageFormat, newPageFormat);
8531
+ OperationsHelper.updatePageFormat(this.model, newPageFormat);
8532
+ this.recreateMainSession();
8533
+ }
8488
8534
  applyPageFormat(model) {
8489
8535
  const position = this.selection.cursor;
8490
8536
  const startIndex = ContentHelper.paragraphToDocumentIndex(this.session.displayData.paragraphs, position.row, position.column);
@@ -8525,6 +8571,12 @@ class Editor {
8525
8571
  this.selection?.clearSelection();
8526
8572
  });
8527
8573
  }
8574
+ applyLeftMarginPageFormatSubscription() {
8575
+ return this.editorService.leftMarginPageFormat$.subscribe(value => this.applyLeftMarginPageFormat(value));
8576
+ }
8577
+ applyRightMarginPageFormatSubscription() {
8578
+ return this.editorService.rightMarginPageFormat$.subscribe(value => this.applyRightMarginPageFormat(value));
8579
+ }
8528
8580
  applyPageFormatSubscription() {
8529
8581
  return this.editorService.applyPageFormat$.subscribe(pageFormat => this.applyPageFormat(pageFormat));
8530
8582
  }
@@ -14203,14 +14255,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
14203
14255
 
14204
14256
  class EditorRulerComponent {
14205
14257
  constructor() {
14258
+ this.editorService = inject(EditorService);
14206
14259
  this.pxPerCm = 37.8; // 96dpi / 2.54
14207
14260
  this.snapCm = 0.25;
14208
- this.defaultPadding = 2.5;
14209
- this.offsetPosition = 5;
14261
+ this.defaultPaddingCm = 2.5;
14262
+ this.pageWidth$ = this.editorService.pageFormat$.pipe(distinctUntilChanged(), tap(x => {
14263
+ this.recalcGeometry(x.pageWidth);
14264
+ this.buildTicks();
14265
+ this.rightPx.set(x.pageWidth - x.marginRight);
14266
+ this.leftPx.set(x.marginLeft);
14267
+ }), map(x => x.pageWidth));
14210
14268
  this.containerWidthPx = 0;
14211
14269
  this.ticks = [];
14212
- this.leftPx = signal(this.defaultPadding * this.pxPerCm);
14213
- this.firstLinePx = signal(this.defaultPadding * this.pxPerCm);
14270
+ this.leftPx = signal(this.defaultPaddingCm * this.pxPerCm);
14271
+ this.firstLinePx = signal(this.defaultPaddingCm * this.pxPerCm);
14214
14272
  this.rightPx = signal(0);
14215
14273
  this.guideX = signal(0);
14216
14274
  this.showGuide = signal(false);
@@ -14224,7 +14282,7 @@ class EditorRulerComponent {
14224
14282
  const pointX = this.getClientX(ev);
14225
14283
  const rect = this.rulerContainer.nativeElement.getBoundingClientRect();
14226
14284
  let x = pointX - rect.left - this.dragOffsetX;
14227
- if (x < -1 || x > this.maxRulePosition) {
14285
+ if (x < -1 || x > this.containerWidthPx) {
14228
14286
  return;
14229
14287
  }
14230
14288
  x = this.snapPx(x);
@@ -14240,6 +14298,15 @@ class EditorRulerComponent {
14240
14298
  this.guideX.set(x);
14241
14299
  };
14242
14300
  this.onUp = () => {
14301
+ if (this.dragging === 'left') {
14302
+ this.editorService.applyLeftMarginPageFormat(Math.round(this.leftPx()));
14303
+ }
14304
+ else if (this.dragging === 'first') {
14305
+ this.editorService.applyTabParagraph(Math.round(this.firstLinePx()));
14306
+ }
14307
+ else {
14308
+ this.editorService.applyRightMarginPageFormat(Math.round(this.containerWidthPx - this.rightPx()));
14309
+ }
14243
14310
  this.dragging = null;
14244
14311
  this.showGuide.set(false);
14245
14312
  window.removeEventListener('mousemove', this.onMove);
@@ -14248,7 +14315,7 @@ class EditorRulerComponent {
14248
14315
  window.removeEventListener('touchend', this.onUp);
14249
14316
  };
14250
14317
  }
14251
- ngAfterViewInit() {
14318
+ afterViewInit() {
14252
14319
  this.recalcGeometry();
14253
14320
  this.buildTicks();
14254
14321
  this.rightPx.set(this.containerWidthPx - this.cmToPx(2.5));
@@ -14257,9 +14324,8 @@ class EditorRulerComponent {
14257
14324
  this.recalcGeometry();
14258
14325
  this.buildTicks();
14259
14326
  }
14260
- recalcGeometry() {
14261
- const rect = this.rulerContainer.nativeElement.getBoundingClientRect();
14262
- this.containerWidthPx = rect.width - 10; // because padding 5px
14327
+ recalcGeometry(width = null) {
14328
+ this.containerWidthPx = width ?? this.rulerContainer.nativeElement.getBoundingClientRect().width;
14263
14329
  }
14264
14330
  cmToPx(cm) {
14265
14331
  return cm * this.pxPerCm;
@@ -14274,35 +14340,37 @@ class EditorRulerComponent {
14274
14340
  }
14275
14341
  buildTicks() {
14276
14342
  const totalCm = Math.ceil(this.pxToCm(this.containerWidthPx));
14277
- this.maxRulePosition = (totalCm - 1) * this.pxPerCm;
14278
14343
  const ticks = [
14279
14344
  {
14280
- position: this.cmToPx(0) + this.offsetPosition,
14345
+ position: this.cmToPx(0),
14281
14346
  major: false,
14282
14347
  half: true,
14283
14348
  label: null,
14284
14349
  originalPaddings: -2.5
14285
14350
  },
14286
14351
  {
14287
- position: this.cmToPx(0.25) + this.offsetPosition,
14352
+ position: this.cmToPx(0.25),
14288
14353
  major: false,
14289
14354
  half: false,
14290
14355
  label: null,
14291
14356
  originalPaddings: -2.25
14292
14357
  }
14293
14358
  ];
14294
- for (let cm = 1; cm < totalCm; cm++) {
14295
- const position = this.cmToPx(cm) + this.offsetPosition - this.pxPerCm / 2;
14359
+ for (let cm = 1; cm <= totalCm; cm++) {
14360
+ const position = this.cmToPx(cm) - this.pxPerCm / 2;
14296
14361
  ticks.push({ position, major: true, half: false, label: Math.abs(cm - 3), originalPaddings: cm - 3 }); // -3 because we start the line with 2.5
14297
- if (cm < totalCm) {
14362
+ if (cm <= totalCm) {
14298
14363
  for (let i = 1; i < 4; i++) {
14299
- ticks.push({
14300
- position: this.cmToPx(cm + i * 0.25) + this.offsetPosition - this.pxPerCm / 2,
14301
- major: false,
14302
- half: i === 2,
14303
- label: null,
14304
- originalPaddings: cm - 3 + i * 0.25
14305
- });
14364
+ const tickPosition = position + this.cmToPx(i * 0.25);
14365
+ if (tickPosition < this.containerWidthPx) {
14366
+ ticks.push({
14367
+ position: tickPosition,
14368
+ major: false,
14369
+ half: i === 2,
14370
+ label: null,
14371
+ originalPaddings: cm - 3 + i * 0.25
14372
+ });
14373
+ }
14306
14374
  }
14307
14375
  }
14308
14376
  }
@@ -14346,11 +14414,11 @@ class EditorRulerComponent {
14346
14414
  }
14347
14415
  }
14348
14416
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EditorRulerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
14349
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: EditorRulerComponent, isStandalone: true, selector: "app-nod-editor-ruler", host: { listeners: { "window:resize": "onResize()" } }, viewQueries: [{ propertyName: "rulerContainer", first: true, predicate: ["rulerContainer"], descendants: true, static: true }], ngImport: i0, template: "<div\n class=\"ruler-container\"\n #rulerContainer>\n <div\n class=\"left-area\"\n [style.width.px]=\"defaultPadding * pxPerCm + offsetPosition\"></div>\n <div\n class=\"right-area\"\n [style.width.px]=\"defaultPadding * pxPerCm + offsetPosition\"></div>\n <div class=\"ruler-track\">\n @for (tick of ticks; track tick) {\n <div\n class=\"tick\"\n [style.left.px]=\"tick.position\"\n [class.major]=\"tick.major\"\n [class.half]=\"tick.half\">\n @if (tick.label !== null) {\n <span class=\"label\">\n {{ tick.label }}\n </span>\n }\n </div>\n }\n </div>\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-field-up\"\n class=\"page-marker\"\n [style.left.px]=\"leftPx()\"\n (mousedown)=\"startDrag($event, 'left')\"\n (touchstart)=\"startDrag($event, 'left')\" />\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-field-down\"\n class=\"paragraph-marker\"\n [style.left.px]=\"firstLinePx()\"\n (mousedown)=\"startDrag($event, 'first')\"\n (touchstart)=\"startDrag($event, 'first')\" />\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-field-up\"\n class=\"page-marker\"\n [style.left.px]=\"rightPx()\"\n (mousedown)=\"startDrag($event, 'right')\"\n (touchstart)=\"startDrag($event, 'right')\" />\n @if (showGuide()) {\n <div\n class=\"drag-guide\"\n [style.left.px]=\"guideX() + offsetPosition\"></div>\n }\n</div>\n", styles: [":host{display:flex;width:100%;height:22px;justify-content:center;align-items:center}.ruler-container{position:relative;height:18px;width:804px;padding:0 5px;border-bottom-width:1px;border-bottom-style:solid;border-top-width:1px;border-top-style:solid;-webkit-user-select:none;user-select:none}.ruler-track{position:absolute;left:0;right:0;bottom:0;height:18px;overflow:hidden}.tick{position:absolute;top:50%;transform:translateY(-50%);width:1px;height:4px}.major{height:0}.half{height:8px}.label{position:absolute;top:50%;transform:translate(-50%,-50%);font-size:10px}mat-icon{position:absolute;width:17px;height:17px;font-size:18px;font-weight:700;cursor:ew-resize;z-index:2;transform:translate(-25%)}.drag-guide{position:absolute;height:2000px;top:10px;width:1px;z-index:9999;pointer-events:none;will-change:left}.paragraph-marker{top:-6px}.page-marker{bottom:-6px}.left-area,.right-area{position:absolute;height:18px}.left-area{left:0}.right-area{right:0}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
14417
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: EditorRulerComponent, isStandalone: true, selector: "app-nod-editor-ruler", host: { listeners: { "window:resize": "onResize()" } }, viewQueries: [{ propertyName: "rulerContainer", first: true, predicate: ["rulerContainer"], descendants: true, static: true }], ngImport: i0, template: "<div\n class=\"ruler-container\"\n [style.width.px]=\"pageWidth$ | async\"\n #rulerContainer>\n <div\n class=\"left-area\"\n [style.width.px]=\"defaultPaddingCm * pxPerCm\"></div>\n <div\n class=\"right-area\"\n [style.width.px]=\"defaultPaddingCm * pxPerCm\"></div>\n <div class=\"ruler-track\">\n @for (tick of ticks; track tick) {\n <div\n class=\"tick\"\n [style.left.px]=\"tick.position\"\n [class.major]=\"tick.major\"\n [class.half]=\"tick.half\">\n @if (tick.label !== null) {\n <span class=\"label\">\n {{ tick.label }}\n </span>\n }\n </div>\n }\n </div>\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-field-up\"\n class=\"page-marker\"\n [style.left.px]=\"leftPx()\"\n (mousedown)=\"startDrag($event, 'left')\"\n (touchstart)=\"startDrag($event, 'left')\" />\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-field-down\"\n class=\"paragraph-marker\"\n [style.left.px]=\"firstLinePx()\"\n (mousedown)=\"startDrag($event, 'first')\"\n (touchstart)=\"startDrag($event, 'first')\" />\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-field-up\"\n class=\"page-marker\"\n [style.left.px]=\"rightPx()\"\n (mousedown)=\"startDrag($event, 'right')\"\n (touchstart)=\"startDrag($event, 'right')\" />\n @if (showGuide()) {\n <div\n class=\"drag-guide\"\n [style.left.px]=\"guideX()\"></div>\n }\n</div>\n", styles: [":host{display:flex;width:100%;height:22px;justify-content:center;align-items:center}.ruler-container{position:relative;height:18px;border-bottom-width:1px;border-bottom-style:solid;border-top-width:1px;border-top-style:solid;-webkit-user-select:none;user-select:none}.ruler-track{position:absolute;left:0;right:0;bottom:0;height:18px;overflow:hidden}.tick{position:absolute;top:50%;transform:translateY(-50%);width:1px;height:4px}.major{height:0}.half{height:8px}.label{position:absolute;top:50%;transform:translate(-50%,-50%);font-size:10px}mat-icon{position:absolute;width:17px;height:17px;font-size:18px;font-weight:700;cursor:ew-resize;z-index:2;transform:translate(-50%)}.drag-guide{position:absolute;height:2000px;top:10px;width:1px;z-index:9999;pointer-events:none;will-change:left}.paragraph-marker{top:-6px}.page-marker{bottom:-6px}.left-area,.right-area{position:absolute;height:18px}.left-area{left:0}.right-area{right:0}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
14350
14418
  }
14351
14419
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EditorRulerComponent, decorators: [{
14352
14420
  type: Component,
14353
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'app-nod-editor-ruler', imports: [MatIconModule], template: "<div\n class=\"ruler-container\"\n #rulerContainer>\n <div\n class=\"left-area\"\n [style.width.px]=\"defaultPadding * pxPerCm + offsetPosition\"></div>\n <div\n class=\"right-area\"\n [style.width.px]=\"defaultPadding * pxPerCm + offsetPosition\"></div>\n <div class=\"ruler-track\">\n @for (tick of ticks; track tick) {\n <div\n class=\"tick\"\n [style.left.px]=\"tick.position\"\n [class.major]=\"tick.major\"\n [class.half]=\"tick.half\">\n @if (tick.label !== null) {\n <span class=\"label\">\n {{ tick.label }}\n </span>\n }\n </div>\n }\n </div>\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-field-up\"\n class=\"page-marker\"\n [style.left.px]=\"leftPx()\"\n (mousedown)=\"startDrag($event, 'left')\"\n (touchstart)=\"startDrag($event, 'left')\" />\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-field-down\"\n class=\"paragraph-marker\"\n [style.left.px]=\"firstLinePx()\"\n (mousedown)=\"startDrag($event, 'first')\"\n (touchstart)=\"startDrag($event, 'first')\" />\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-field-up\"\n class=\"page-marker\"\n [style.left.px]=\"rightPx()\"\n (mousedown)=\"startDrag($event, 'right')\"\n (touchstart)=\"startDrag($event, 'right')\" />\n @if (showGuide()) {\n <div\n class=\"drag-guide\"\n [style.left.px]=\"guideX() + offsetPosition\"></div>\n }\n</div>\n", styles: [":host{display:flex;width:100%;height:22px;justify-content:center;align-items:center}.ruler-container{position:relative;height:18px;width:804px;padding:0 5px;border-bottom-width:1px;border-bottom-style:solid;border-top-width:1px;border-top-style:solid;-webkit-user-select:none;user-select:none}.ruler-track{position:absolute;left:0;right:0;bottom:0;height:18px;overflow:hidden}.tick{position:absolute;top:50%;transform:translateY(-50%);width:1px;height:4px}.major{height:0}.half{height:8px}.label{position:absolute;top:50%;transform:translate(-50%,-50%);font-size:10px}mat-icon{position:absolute;width:17px;height:17px;font-size:18px;font-weight:700;cursor:ew-resize;z-index:2;transform:translate(-25%)}.drag-guide{position:absolute;height:2000px;top:10px;width:1px;z-index:9999;pointer-events:none;will-change:left}.paragraph-marker{top:-6px}.page-marker{bottom:-6px}.left-area,.right-area{position:absolute;height:18px}.left-area{left:0}.right-area{right:0}\n"] }]
14421
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'app-nod-editor-ruler', imports: [MatIconModule, AsyncPipe], template: "<div\n class=\"ruler-container\"\n [style.width.px]=\"pageWidth$ | async\"\n #rulerContainer>\n <div\n class=\"left-area\"\n [style.width.px]=\"defaultPaddingCm * pxPerCm\"></div>\n <div\n class=\"right-area\"\n [style.width.px]=\"defaultPaddingCm * pxPerCm\"></div>\n <div class=\"ruler-track\">\n @for (tick of ticks; track tick) {\n <div\n class=\"tick\"\n [style.left.px]=\"tick.position\"\n [class.major]=\"tick.major\"\n [class.half]=\"tick.half\">\n @if (tick.label !== null) {\n <span class=\"label\">\n {{ tick.label }}\n </span>\n }\n </div>\n }\n </div>\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-field-up\"\n class=\"page-marker\"\n [style.left.px]=\"leftPx()\"\n (mousedown)=\"startDrag($event, 'left')\"\n (touchstart)=\"startDrag($event, 'left')\" />\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-field-down\"\n class=\"paragraph-marker\"\n [style.left.px]=\"firstLinePx()\"\n (mousedown)=\"startDrag($event, 'first')\"\n (touchstart)=\"startDrag($event, 'first')\" />\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-field-up\"\n class=\"page-marker\"\n [style.left.px]=\"rightPx()\"\n (mousedown)=\"startDrag($event, 'right')\"\n (touchstart)=\"startDrag($event, 'right')\" />\n @if (showGuide()) {\n <div\n class=\"drag-guide\"\n [style.left.px]=\"guideX()\"></div>\n }\n</div>\n", styles: [":host{display:flex;width:100%;height:22px;justify-content:center;align-items:center}.ruler-container{position:relative;height:18px;border-bottom-width:1px;border-bottom-style:solid;border-top-width:1px;border-top-style:solid;-webkit-user-select:none;user-select:none}.ruler-track{position:absolute;left:0;right:0;bottom:0;height:18px;overflow:hidden}.tick{position:absolute;top:50%;transform:translateY(-50%);width:1px;height:4px}.major{height:0}.half{height:8px}.label{position:absolute;top:50%;transform:translate(-50%,-50%);font-size:10px}mat-icon{position:absolute;width:17px;height:17px;font-size:18px;font-weight:700;cursor:ew-resize;z-index:2;transform:translate(-50%)}.drag-guide{position:absolute;height:2000px;top:10px;width:1px;z-index:9999;pointer-events:none;will-change:left}.paragraph-marker{top:-6px}.page-marker{bottom:-6px}.left-area,.right-area{position:absolute;height:18px}.left-area{left:0}.right-area{right:0}\n"] }]
14354
14422
  }], propDecorators: { rulerContainer: [{
14355
14423
  type: ViewChild,
14356
14424
  args: ['rulerContainer', { static: true }]