@phuong-tran-redoc/document-engine-angular 0.0.23 → 0.0.25

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,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { HostBinding, Input, Directive, inject, Injectable, ChangeDetectorRef, ElementRef, ViewEncapsulation, ChangeDetectionStrategy, Component, EventEmitter, Output, InjectionToken, HostListener, forwardRef, ContentChildren, ViewChild, ViewChildren, ViewContainerRef, EnvironmentInjector, NgZone, NgModule, ApplicationRef, createComponent, Renderer2 } from '@angular/core';
2
+ import { HostBinding, Input, Directive, inject, Injectable, ChangeDetectorRef, ElementRef, ViewEncapsulation, ChangeDetectionStrategy, Component, EventEmitter, Output, InjectionToken, HostListener, forwardRef, ContentChildren, ViewChild, ViewChildren, NgZone, ViewContainerRef, EnvironmentInjector, NgModule, ApplicationRef, createComponent, Renderer2 } from '@angular/core';
3
3
  import { Extension, Editor } from '@tiptap/core';
4
4
  import Blockquote from '@tiptap/extension-blockquote';
5
5
  import Bold from '@tiptap/extension-bold';
@@ -837,7 +837,7 @@ class ColorPickerViewComponent {
837
837
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: ColorPickerViewComponent, isStandalone: true, selector: "document-engine-color-picker-view", ngImport: i0, template: `
838
838
  <div class="color-picker-view">
839
839
  <!-- Title -->
840
- <div class="color-picker-view__title">{{ colorType === 'text' ? 'Text Color' : 'Background Color' }}noôi</div>
840
+ <div class="color-picker-view__title">{{ colorType === 'text' ? 'Text Color' : 'Background Color' }}</div>
841
841
 
842
842
  <!-- Color Picker Component -->
843
843
  <document-engine-color-picker
@@ -861,7 +861,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
861
861
  args: [{ selector: 'document-engine-color-picker-view', standalone: true, imports: [CommonModule, ButtonDirective, ColorPickerComponent], template: `
862
862
  <div class="color-picker-view">
863
863
  <!-- Title -->
864
- <div class="color-picker-view__title">{{ colorType === 'text' ? 'Text Color' : 'Background Color' }}noôi</div>
864
+ <div class="color-picker-view__title">{{ colorType === 'text' ? 'Text Color' : 'Background Color' }}</div>
865
865
 
866
866
  <!-- Color Picker Component -->
867
867
  <document-engine-color-picker
@@ -4776,6 +4776,7 @@ class EditorBubbleMenuComponent {
4776
4776
  viewContainer;
4777
4777
  bubbleElement;
4778
4778
  cdr = inject(ChangeDetectorRef);
4779
+ ngZone = inject(NgZone);
4779
4780
  document = inject(DOCUMENT);
4780
4781
  focusTrap = inject(FocusTrapService);
4781
4782
  currentViewRef = null;
@@ -4812,8 +4813,8 @@ class EditorBubbleMenuComponent {
4812
4813
  this.cleanupSelection = selectionChangeHandler({
4813
4814
  editor,
4814
4815
  target: config.target,
4815
- onActive: (attrs) => this.handleActivate(attrs),
4816
- onInactive: () => this.handleDeactivate(),
4816
+ onActive: (attrs) => this.ngZone.run(() => this.handleActivate(attrs)),
4817
+ onInactive: () => this.ngZone.run(() => this.handleDeactivate()),
4817
4818
  });
4818
4819
  this.addDocumentClickHandler();
4819
4820
  }
@@ -5397,12 +5398,11 @@ class ToolbarBubbleMenuComponent {
5397
5398
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: ToolbarBubbleMenuComponent, isStandalone: true, selector: "document-engine-toolbar-bubble-menu", inputs: { editor: "editor", config: "config" }, viewQueries: [{ propertyName: "bubbleElement", first: true, predicate: ["bubbleElement"], descendants: true }, { propertyName: "viewContainer", first: true, predicate: ["viewContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: `
5398
5399
  <div
5399
5400
  #bubbleElement
5400
- class="toolbar-bubble-menu rounded border bg-card text-card-foreground border-border shadow-elevation-2 absolute z-50"
5401
+ class="toolbar-bubble-menu rounded border bg-card text-card-foreground border-border shadow-elevation-2 z-50"
5401
5402
  [class.hidden]="!isVisible"
5402
5403
  [style.width]="config.width || 'auto'"
5403
5404
  [style.maxWidth]="config.maxWidth || '320px'"
5404
5405
  >
5405
- <!-- View component will be dynamically inserted here -->
5406
5406
  <ng-container #viewContainer></ng-container>
5407
5407
  </div>
5408
5408
  `, isInline: true, styles: [".toolbar-bubble-menu{opacity:0;transform:translateY(-10px);transition:opacity .2s ease-out,transform .2s ease-out;pointer-events:none}.toolbar-bubble-menu:not(.hidden){opacity:1;transform:translateY(0);pointer-events:auto}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -5412,12 +5412,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
5412
5412
  args: [{ selector: 'document-engine-toolbar-bubble-menu', standalone: true, imports: [CommonModule], template: `
5413
5413
  <div
5414
5414
  #bubbleElement
5415
- class="toolbar-bubble-menu rounded border bg-card text-card-foreground border-border shadow-elevation-2 absolute z-50"
5415
+ class="toolbar-bubble-menu rounded border bg-card text-card-foreground border-border shadow-elevation-2 z-50"
5416
5416
  [class.hidden]="!isVisible"
5417
5417
  [style.width]="config.width || 'auto'"
5418
5418
  [style.maxWidth]="config.maxWidth || '320px'"
5419
5419
  >
5420
- <!-- View component will be dynamically inserted here -->
5421
5420
  <ng-container #viewContainer></ng-container>
5422
5421
  </div>
5423
5422
  `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".toolbar-bubble-menu{opacity:0;transform:translateY(-10px);transition:opacity .2s ease-out,transform .2s ease-out;pointer-events:none}.toolbar-bubble-menu:not(.hidden){opacity:1;transform:translateY(0);pointer-events:auto}\n"] }]
@@ -5530,6 +5529,7 @@ function buildToolbarState(editor, config) {
5530
5529
  */
5531
5530
  class ToolbarComponent {
5532
5531
  cdr = inject(ChangeDetectorRef);
5532
+ ngZone = inject(NgZone);
5533
5533
  toolbarService = inject(ToolbarService);
5534
5534
  editor;
5535
5535
  capabilities;
@@ -5567,30 +5567,32 @@ class ToolbarComponent {
5567
5567
  trailing: false,
5568
5568
  });
5569
5569
  updateToolbarState = () => {
5570
- if (!this.editor)
5571
- return;
5572
- // Update toolbar state (can* properties)
5573
- this.toolbarState = buildToolbarState(this.editor, this.config);
5574
- // Update active font size and line height
5575
- const attrs = this.editor.getAttributes('textStyle');
5576
- const size = attrs?.['fontSize'] || null;
5577
- this.activeFontSize = size;
5578
- const lineHeight = attrs?.['lineHeight'] || null;
5579
- this.activeLineHeight = lineHeight;
5580
- // Update active heading
5581
- let headingLevel = null;
5582
- for (const option of this.headingOptions) {
5583
- if (this.editor.isActive('heading', { level: option.value })) {
5584
- headingLevel = option.value;
5585
- break;
5570
+ this.ngZone.run(() => {
5571
+ if (!this.editor)
5572
+ return;
5573
+ // Update toolbar state (can* properties)
5574
+ this.toolbarState = buildToolbarState(this.editor, this.config);
5575
+ // Update active font size and line height
5576
+ const attrs = this.editor.getAttributes('textStyle');
5577
+ const size = attrs?.['fontSize'] || null;
5578
+ this.activeFontSize = size;
5579
+ const lineHeight = attrs?.['lineHeight'] || null;
5580
+ this.activeLineHeight = lineHeight;
5581
+ // Update active heading
5582
+ let headingLevel = null;
5583
+ for (const option of this.headingOptions) {
5584
+ if (this.editor.isActive('heading', { level: option.value })) {
5585
+ headingLevel = option.value;
5586
+ break;
5587
+ }
5586
5588
  }
5587
- }
5588
- this.activeHeading = headingLevel;
5589
- // Update active text align
5590
- const alignOption = this.textAlignOptions.find((option) => this.editor.isActive({ textAlign: option.value }));
5591
- this.activeTextAlign = alignOption?.value || null;
5592
- this.activeTextAlignIcon = alignOption?.icon || 'format_align_left';
5593
- this.cdr.markForCheck();
5589
+ this.activeHeading = headingLevel;
5590
+ // Update active text align
5591
+ const alignOption = this.textAlignOptions.find((option) => this.editor.isActive({ textAlign: option.value }));
5592
+ this.activeTextAlign = alignOption?.value || null;
5593
+ this.activeTextAlignIcon = alignOption?.icon || 'format_align_left';
5594
+ this.cdr.markForCheck();
5595
+ });
5594
5596
  };
5595
5597
  ngOnInit() {
5596
5598
  // Subscribe to selectionUpdate to keep toolbar state in sync when cursor/selection changes