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

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, NgZone, ViewContainerRef, EnvironmentInjector, NgModule, ApplicationRef, createComponent, Renderer2 } from '@angular/core';
2
+ import { HostBinding, Input, Directive, inject, Injectable, ElementRef, ViewEncapsulation, ChangeDetectionStrategy, Component, EventEmitter, Output, ChangeDetectorRef, 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';
@@ -533,21 +533,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
533
533
  }], ctorParameters: () => [] });
534
534
 
535
535
  class IconComponent {
536
- name = '';
537
- cdr = inject(ChangeDetectorRef);
536
+ set name(value) {
537
+ const svgContent = this.iconRegistry.getIconString(value);
538
+ const hostElement = this.elementRef.nativeElement;
539
+ // Set innerHTML to render SVG
540
+ hostElement.innerHTML = svgContent;
541
+ // this.cdr.markForCheck();
542
+ }
543
+ // private cdr = inject(ChangeDetectorRef);
538
544
  elementRef = inject(ElementRef);
539
545
  iconRegistry = inject(IconRegistryService);
540
- ngOnChanges(changes) {
541
- if (changes['name']) {
542
- const svgContent = this.iconRegistry.getIconString(this.name);
543
- const hostElement = this.elementRef.nativeElement;
544
- // Set innerHTML to render SVG
545
- hostElement.innerHTML = svgContent;
546
- this.cdr.markForCheck();
547
- }
548
- }
549
546
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
550
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: IconComponent, isStandalone: true, selector: "document-engine-icon", inputs: { name: "name" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
547
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: IconComponent, isStandalone: true, selector: "document-engine-icon", inputs: { name: "name" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
551
548
  }
552
549
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IconComponent, decorators: [{
553
550
  type: Component,
@@ -4819,10 +4816,10 @@ class EditorBubbleMenuComponent {
4819
4816
  this.addDocumentClickHandler();
4820
4817
  }
4821
4818
  ngAfterViewInit() {
4822
- const bubbleElement = this.bubbleElement?.nativeElement;
4823
- if (bubbleElement) {
4824
- this.focusTrap.attach(bubbleElement);
4825
- }
4819
+ // const bubbleElement = this.bubbleElement?.nativeElement;
4820
+ // if (bubbleElement) {
4821
+ // this.focusTrap.attach(bubbleElement);
4822
+ // }
4826
4823
  }
4827
4824
  ngOnDestroy() {
4828
4825
  if (this.cleanupSelection) {
@@ -4930,8 +4927,11 @@ class EditorBubbleMenuComponent {
4930
4927
  // if (isAttached) {
4931
4928
  // this.eventManager.detach(this.config.pluginKey);
4932
4929
  // }
4930
+ // Reset force open state
4931
+ this.forceOpen.value = false;
4933
4932
  this.destroyCurrentView();
4934
4933
  this.currentAttributes = {};
4934
+ this.cdr.markForCheck();
4935
4935
  }
4936
4936
  /**
4937
4937
  * Select which view should be shown initially
@@ -4982,6 +4982,9 @@ class EditorBubbleMenuComponent {
4982
4982
  this.currentViewId = viewId;
4983
4983
  // Activate new view
4984
4984
  this.activateView(this.currentViewRef);
4985
+ // Trigger change detection for the child component to render immediately
4986
+ // This is especially important for Angular v14 compatibility
4987
+ this.cdr.markForCheck();
4985
4988
  // Mark bubble as visible for transition handling
4986
4989
  const bubbleElement = this.bubbleElement?.nativeElement;
4987
4990
  if (bubbleElement && this.config.target?.requireFocus) {
@@ -4989,7 +4992,7 @@ class EditorBubbleMenuComponent {
4989
4992
  requestAnimationFrame(() => {
4990
4993
  bubbleElement.setAttribute('data-visible', 'true');
4991
4994
  // Re-setup focus trap after view is created (focusable elements may have changed)
4992
- this.focusTrap.reattach(bubbleElement, true);
4995
+ // this.focusTrap.reattach(bubbleElement, true);
4993
4996
  });
4994
4997
  }
4995
4998
  }