@arsedizioni/ars-utils 22.5.42 → 22.5.43

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.
@@ -361,10 +361,24 @@ class TinymceEditorDirective {
361
361
  base_url: this.loader.baseUrl,
362
362
  inline,
363
363
  setup: (editor) => {
364
- // Typing, toolbar commands, undo/redo and programmatic inserts all have to
365
- // reach the form; the guard keeps our own writes from bouncing back.
364
+ /*
365
+ * Typing, toolbar commands, undo/redo and programmatic inserts all have to reach
366
+ * the form; the two guards keep everything else out.
367
+ *
368
+ * `writingValue` keeps our own writes from bouncing back. `!this.editor` — which
369
+ * stays unset until the `init` handler below — keeps out the one content event
370
+ * that fires BEFORE the editor exists, and it is the one that made an editor
371
+ * impossible to fill: TinyMCE's own `loadInitialContent` reads the textarea and
372
+ * calls `setContent(..., { initial: true })`, which dispatches `SetContent`
373
+ * because only `no_events` suppresses it. The textarea is empty — the form
374
+ * writes through the ControlValueAccessor, never into the DOM element — so this
375
+ * handler took that empty string for a user edit, overwrote the value the form
376
+ * had already handed us, and reported '' back to the model. `init` then applied
377
+ * the value it had just destroyed, and the editor came up blank whatever was
378
+ * passed to it. Saving from there stored the empty string as well.
379
+ */
366
380
  editor.on('change input undo redo SetContent', () => {
367
- if (this.writingValue)
381
+ if (this.writingValue || !this.editor)
368
382
  return;
369
383
  this.value = editor.getContent();
370
384
  this.onChange(this.value);
@@ -387,6 +401,9 @@ class TinymceEditorDirective {
387
401
  this.exitFullscreen();
388
402
  });
389
403
  editor.on('init', () => {
404
+ // Assigned BEFORE applying the value, and that order is the contract with
405
+ // the guard above: from here on content events are genuine, and the one
406
+ // raised by `applyValue` itself is covered by `writingValue`.
390
407
  this.editor = editor;
391
408
  this.applyValue(this.value);
392
409
  this.applyDisabled(this.disabled);
@@ -568,6 +585,17 @@ class TinyMceEditorComponent {
568
585
  /** Whether the editor is in read-only mode. */
569
586
  this.disabled = signal(false, /* @ts-ignore */
570
587
  ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
588
+ /**
589
+ * Why the editor could not be shown, when it could not.
590
+ *
591
+ * Without it a failure looked exactly like an empty document: the directive reported it on its
592
+ * `failed` output, nothing was listening, and the user was left with a blank box and no reason
593
+ * for it. The message is the directive's own — the bundle did not load, or TinyMCE refused to
594
+ * start — and it also goes to the console, because that is where whoever is asked about it will
595
+ * look first.
596
+ */
597
+ this.error = signal(undefined, /* @ts-ignore */
598
+ ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
571
599
  /** Current editor content. */
572
600
  this.text = signal('', /* @ts-ignore */
573
601
  ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
@@ -591,6 +619,15 @@ class TinyMceEditorComponent {
591
619
  this.tinymceConfig.toolbar = ['undo redo | quickimage insertgroup | formatgroup paragraphgroup | code'];
592
620
  this.disabled.set(data.disabled ?? false);
593
621
  }
622
+ /**
623
+ * Records that the editor could not be shown.
624
+ * @param error - What the directive could not do.
625
+ * @returns void
626
+ */
627
+ failed(error) {
628
+ console.error('[TinyMceEditorComponent] editor non disponibile', error);
629
+ this.error.set(error?.message || 'Editor non disponibile.');
630
+ }
594
631
  /**
595
632
  * Save the current editor content and close the dialog.
596
633
  */
@@ -601,12 +638,12 @@ class TinyMceEditorComponent {
601
638
  }, 500);
602
639
  }
603
640
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: TinyMceEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
604
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: TinyMceEditorComponent, isStandalone: true, selector: "ng-component", outputs: { saving: "saving" }, ngImport: i0, template: "<mat-dialog-content style=\"padding: 10px 10px 0 10px\">\n <textarea tinymceEditor class=\"full-screen-editor\" [tinymceConfig]=\"tinymceConfig\"\n [formField]=\"textForm\"></textarea>\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start center\" fxFill>\n <div fxFlex=\"50\">\n @if(dialogData().onShowInfo) {\n <button mat-stroked-button (click)=\"dialogData().onShowInfo()\">{{dialogData().infoButtonLabel ?? 'Informazioni'}}\n </button>\n }\n </div>\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\n @if (disabled()) {\n <button mat-stroked-button [mat-dialog-close]=\"true\">Chiudi</button>\n } @else {\n <button mat-flat-button (click)=\"ok()\">Salva</button>\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\n }\n </div>\n </div>\n</mat-dialog-actions>\n", styles: [".mat-mdc-dialog-content{height:calc(100% - 52px)!important;max-height:calc(100% - 52px)!important}::ng-deep .full-screen-editor+.tox-tinymce{height:100%!important}\n"], dependencies: [{ kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: TinymceEditorDirective, selector: "textarea[tinymceEditor], div[tinymceEditor]", inputs: ["tinymceConfig", "tinymceToolbarMode", "tinymceImageUploader"], outputs: ["ready", "failed"] }, { kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "ngmodule", type: FlexLayoutModule }, { kind: "directive", type: i1.FxLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg] ", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i1.FxFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg] ", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "directive", type: i1.FxLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg] ", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i1.FxLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg] ", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i1.FxFlexFillDirective, selector: " [fxFlexFill], [fxFill], [fxFlexFill.xs], [fxFlexFill.sm], [fxFlexFill.md], [fxFlexFill.lg], [fxFlexFill.xl], [fxFlexFill.lt-sm], [fxFlexFill.lt-md], [fxFlexFill.lt-lg], [fxFlexFill.lt-xl], [fxFlexFill.gt-xs], [fxFlexFill.gt-sm], [fxFlexFill.gt-md], [fxFlexFill.gt-lg] ", inputs: ["fxFlexFill", "fxFill", "fxFlexFill.xs", "fxFlexFill.sm", "fxFlexFill.md", "fxFlexFill.lg", "fxFlexFill.xl", "fxFlexFill.lt-sm", "fxFlexFill.lt-md", "fxFlexFill.lt-lg", "fxFlexFill.lt-xl", "fxFlexFill.gt-xs", "fxFlexFill.gt-sm", "fxFlexFill.gt-md", "fxFlexFill.gt-lg"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
641
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: TinyMceEditorComponent, isStandalone: true, selector: "ng-component", outputs: { saving: "saving" }, ngImport: i0, template: "<mat-dialog-content style=\"padding: 10px 10px 0 10px\">\n @if (error()) {\n <!-- The textarea is gone with the editor that could not replace it: left in place it would be a\n plain box the form does not write into, which is the empty editor this message exists to\n explain. -->\n <div class=\"editor-error\">\n <div class=\"editor-error-title\">Non \u00E8 stato possibile aprire l'editor.</div>\n <div class=\"editor-error-detail\">{{ error() }}</div>\n <div class=\"editor-error-detail\">Il testo non \u00E8 stato modificato: chiudi e riprova.</div>\n </div>\n } @else {\n <textarea tinymceEditor class=\"full-screen-editor\" [tinymceConfig]=\"tinymceConfig\"\n [formField]=\"textForm\" (failed)=\"failed($event)\"></textarea>\n }\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start center\" fxFill>\n <div fxFlex=\"50\">\n @if(dialogData().onShowInfo) {\n <button mat-stroked-button (click)=\"dialogData().onShowInfo()\">{{dialogData().infoButtonLabel ?? 'Informazioni'}}\n </button>\n }\n </div>\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\n <!-- Nothing to save when there was no editor: the only way out is the one that changes\n nothing. -->\n @if (disabled() || error()) {\n <button mat-stroked-button [mat-dialog-close]=\"true\">Chiudi</button>\n } @else {\n <button mat-flat-button (click)=\"ok()\">Salva</button>\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\n }\n </div>\n </div>\n</mat-dialog-actions>\n", styles: [".mat-mdc-dialog-content{height:calc(100% - 52px)!important;max-height:calc(100% - 52px)!important}::ng-deep .full-screen-editor+.tox-tinymce{height:100%!important}.editor-error{display:flex;flex-direction:column;gap:6px;justify-content:center;align-items:center;height:100%;min-height:120px;padding:24px;text-align:center}.editor-error .editor-error-title{font-weight:500}.editor-error .editor-error-detail{font-size:small;opacity:.8}\n"], dependencies: [{ kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: TinymceEditorDirective, selector: "textarea[tinymceEditor], div[tinymceEditor]", inputs: ["tinymceConfig", "tinymceToolbarMode", "tinymceImageUploader"], outputs: ["ready", "failed"] }, { kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "ngmodule", type: FlexLayoutModule }, { kind: "directive", type: i1.FxLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg] ", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i1.FxFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg] ", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "directive", type: i1.FxLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg] ", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i1.FxLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg] ", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i1.FxFlexFillDirective, selector: " [fxFlexFill], [fxFill], [fxFlexFill.xs], [fxFlexFill.sm], [fxFlexFill.md], [fxFlexFill.lg], [fxFlexFill.xl], [fxFlexFill.lt-sm], [fxFlexFill.lt-md], [fxFlexFill.lt-lg], [fxFlexFill.lt-xl], [fxFlexFill.gt-xs], [fxFlexFill.gt-sm], [fxFlexFill.gt-md], [fxFlexFill.gt-lg] ", inputs: ["fxFlexFill", "fxFill", "fxFlexFill.xs", "fxFlexFill.sm", "fxFlexFill.md", "fxFlexFill.lg", "fxFlexFill.xl", "fxFlexFill.lt-sm", "fxFlexFill.lt-md", "fxFlexFill.lt-lg", "fxFlexFill.lt-xl", "fxFlexFill.gt-xs", "fxFlexFill.gt-sm", "fxFlexFill.gt-md", "fxFlexFill.gt-lg"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
605
642
  }
606
643
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: TinyMceEditorComponent, decorators: [{
607
644
  type: Component,
608
645
  args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatDialogContent, TinymceEditorDirective, FormField, MatDialogActions, FlexLayoutModule,
609
- MatButtonModule, MatDialogClose], template: "<mat-dialog-content style=\"padding: 10px 10px 0 10px\">\n <textarea tinymceEditor class=\"full-screen-editor\" [tinymceConfig]=\"tinymceConfig\"\n [formField]=\"textForm\"></textarea>\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start center\" fxFill>\n <div fxFlex=\"50\">\n @if(dialogData().onShowInfo) {\n <button mat-stroked-button (click)=\"dialogData().onShowInfo()\">{{dialogData().infoButtonLabel ?? 'Informazioni'}}\n </button>\n }\n </div>\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\n @if (disabled()) {\n <button mat-stroked-button [mat-dialog-close]=\"true\">Chiudi</button>\n } @else {\n <button mat-flat-button (click)=\"ok()\">Salva</button>\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\n }\n </div>\n </div>\n</mat-dialog-actions>\n", styles: [".mat-mdc-dialog-content{height:calc(100% - 52px)!important;max-height:calc(100% - 52px)!important}::ng-deep .full-screen-editor+.tox-tinymce{height:100%!important}\n"] }]
646
+ MatButtonModule, MatDialogClose], template: "<mat-dialog-content style=\"padding: 10px 10px 0 10px\">\n @if (error()) {\n <!-- The textarea is gone with the editor that could not replace it: left in place it would be a\n plain box the form does not write into, which is the empty editor this message exists to\n explain. -->\n <div class=\"editor-error\">\n <div class=\"editor-error-title\">Non \u00E8 stato possibile aprire l'editor.</div>\n <div class=\"editor-error-detail\">{{ error() }}</div>\n <div class=\"editor-error-detail\">Il testo non \u00E8 stato modificato: chiudi e riprova.</div>\n </div>\n } @else {\n <textarea tinymceEditor class=\"full-screen-editor\" [tinymceConfig]=\"tinymceConfig\"\n [formField]=\"textForm\" (failed)=\"failed($event)\"></textarea>\n }\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start center\" fxFill>\n <div fxFlex=\"50\">\n @if(dialogData().onShowInfo) {\n <button mat-stroked-button (click)=\"dialogData().onShowInfo()\">{{dialogData().infoButtonLabel ?? 'Informazioni'}}\n </button>\n }\n </div>\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\n <!-- Nothing to save when there was no editor: the only way out is the one that changes\n nothing. -->\n @if (disabled() || error()) {\n <button mat-stroked-button [mat-dialog-close]=\"true\">Chiudi</button>\n } @else {\n <button mat-flat-button (click)=\"ok()\">Salva</button>\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\n }\n </div>\n </div>\n</mat-dialog-actions>\n", styles: [".mat-mdc-dialog-content{height:calc(100% - 52px)!important;max-height:calc(100% - 52px)!important}::ng-deep .full-screen-editor+.tox-tinymce{height:100%!important}.editor-error{display:flex;flex-direction:column;gap:6px;justify-content:center;align-items:center;height:100%;min-height:120px;padding:24px;text-align:center}.editor-error .editor-error-title{font-weight:500}.editor-error .editor-error-detail{font-size:small;opacity:.8}\n"] }]
610
647
  }], ctorParameters: () => [], propDecorators: { saving: [{ type: i0.Output, args: ["saving"] }] } });
611
648
 
612
649
  /*
@@ -1 +1 @@
1
- {"version":3,"file":"arsedizioni-ars-utils-ui.tinymce.mjs","sources":["../../../projects/ars-utils/ui.tinymce/utils.ts","../../../projects/ars-utils/ui.tinymce/tinymce-loader.service.ts","../../../projects/ars-utils/ui.tinymce/tinymce-editor.directive.ts","../../../projects/ars-utils/ui.tinymce/editor/editor.component.ts","../../../projects/ars-utils/ui.tinymce/editor/editor.component.html","../../../projects/ars-utils/ui.tinymce/public_api.ts","../../../projects/ars-utils/ui.tinymce/arsedizioni-ars-utils-ui.tinymce.ts"],"sourcesContent":["import type { RawEditorOptions } from 'tinymce';\n\n/**\n * The editor profiles the applications ask for, ready to be handed to\n * `[tinymceConfig]` on {@link TinymceEditorDirective}.\n *\n * They describe **what the editor offers** — plugins, toolbar, formats, link and image\n * behaviour — and nothing else. Everything about *loading* TinyMCE (`base_url`, `suffix`,\n * `language`, `language_url`, `license_key`) and about the *theme* (`skin`, `content_css`)\n * belongs to `TinymceLoaderService` and to the directive, which resolve them against the\n * document base href and against `ThemeService`: a preset repeating them could only get them\n * wrong, and used to — the old ones pinned a relative `assets/tinymce` that broke under a\n * sub-path, and read the skin from `prefers-color-scheme` instead of the theme the user chose.\n *\n * Uploads are the same story: `automatic_uploads`, `paste_data_images` and `file_picker_types`\n * follow the `tinymceImageUploader` input, so an editor without a handler cannot end up\n * offering an upload tab that leads nowhere.\n *\n * Each accessor returns a **fresh deep copy**: a caller that tweaks a returned object — as the\n * editor dialog does with its toolbar — cannot corrupt the preset for everyone else.\n */\nexport class TinymceUtils {\n\n /**\n * Everything TinyMCE 8 open source has to offer, for a full-page editor.\n *\n * Adapted from the TinyMCE 5 profile the library used to ship: `paste`, `print`, `hr`,\n * `textpattern` and the `fullpage_*` options no longer exist (paste and text patterns moved\n * into the core, `fullpage` and `print` were dropped in v6), and `checklist`,\n * `openCodeMirrorButton` and `insertMediaButton` are premium or application-specific buttons\n * that a self-hosted GPL build has no way to render.\n */\n private static readonly FULL: RawEditorOptions = {\n height: 500,\n width: '100%',\n min_height: 250,\n onboarding: false,\n browser_spellcheck: true,\n custom_undo_redo_levels: 50,\n // Three &nbsp; per TAB, and no wrapping of the inserted spaces.\n nonbreaking_force_tab: true,\n nonbreaking_wrap: false,\n help_tabs: ['shortcuts', 'keyboardnav', 'versions'],\n menubar: false,\n plugins: 'advlist anchor autolink autosave charmap code fullscreen help image insertdatetime'\n + ' link lists media nonbreaking pagebreak preview quickbars searchreplace table'\n + ' visualblocks visualchars',\n toolbar: [\n 'fullscreen | undo redo searchreplace | code preview | link image media charmap nonbreaking | table tableprops tabledelete',\n 'bold italic superscript subscript forecolor backcolor | alignleft aligncenter alignright alignjustify | removeformat | bullist numlist'\n ],\n quickbars_insert_toolbar: false,\n quickbars_selection_toolbar: 'removeformat | bold italic | superscript subscript | quicklink h2 h3 blockquote',\n style_formats: [\n {\n title: 'Immagini float', items: [\n { title: 'Immagine a SX', selector: 'img', styles: { float: 'left', margin: '0 10px 0 10px' } },\n { title: 'Immagine a DX', selector: 'img', styles: { float: 'right', margin: '0 10px 0 10px' } }\n ]\n },\n {\n title: 'Formati', items: [\n { title: 'Grassetto', format: 'bold' },\n { title: 'Corsivo', format: 'italic' },\n { title: 'Sottolineato', format: 'underline' },\n { title: 'Barrato', format: 'strikethrough' },\n { title: 'Superscript', format: 'superscript' },\n { title: 'Subscript', format: 'subscript' },\n { title: 'Codice', format: 'code' }\n ]\n }\n ],\n // Spans with an inline style rather than <u>/<strike>: the content travels by e-mail, where\n // the presentational tags are the first thing a client strips.\n formats: {\n underline: { inline: 'span', styles: { 'text-decoration': 'underline' }, exact: true },\n strikethrough: { inline: 'span', styles: { 'text-decoration': 'line-through' }, exact: true }\n },\n insertdatetime_formats: ['%d/%m/%Y', '%d %b %Y', '%A, %d %B %Y'],\n link_default_target: '_blank',\n link_title: true,\n link_assume_external_targets: 'https',\n link_class_list: [\n { title: 'Nessuno', value: '' },\n { title: 'Rilevante', value: 'relevant' },\n ],\n link_context_toolbar: true,\n link_quicklink: true,\n image_advtab: true,\n image_caption: true,\n image_title: true,\n };\n\n /**\n * The one for a field inside a form: it grows with the text instead of owning the page, the\n * toolbar sits under it and collapses into groups, and there is no status bar or context menu\n * to compete with the form around it.\n */\n private static readonly COMPACT: RawEditorOptions = {\n ...TinymceUtils.FULL,\n height: 200,\n min_height: 200,\n max_height: 500,\n statusbar: false,\n contextmenu: false,\n toolbar_location: 'bottom',\n plugins: 'advlist anchor autolink autoresize autosave charmap code image insertdatetime'\n + ' link lists media nonbreaking preview quickbars searchreplace table'\n + ' visualblocks visualchars',\n toolbar: ['undo redo | quickimage | formatgroup paragraphgroup'],\n toolbar_groups: {\n formatgroup: {\n icon: 'format',\n tooltip: 'Formattazione',\n items: 'bold italic underline superscript subscript | forecolor backcolor | removeformat'\n },\n paragraphgroup: {\n icon: 'paragraph',\n tooltip: 'Formato paragrafo',\n items: 'h1 h2 h3 | bullist numlist | alignleft aligncenter alignright alignjustify | indent outdent'\n },\n insertgroup: {\n icon: 'plus',\n tooltip: 'Inserisci',\n items: 'quickimage media | link charmap nonbreaking | table tableprops tabledelete'\n }\n },\n quickbars_insert_toolbar: 'quickimage',\n link_class_list: [],\n };\n\n /** The compact one plus full screen, the insert group and the source view. */\n private static readonly COMPACT_EXTENDED: RawEditorOptions = {\n ...TinymceUtils.COMPACT,\n plugins: 'advlist anchor autolink autoresize autosave charmap code fullscreen image'\n + ' insertdatetime link lists media nonbreaking preview quickbars searchreplace table'\n + ' visualblocks visualchars',\n toolbar: ['undo redo | quickimage insertgroup | formatgroup paragraphgroup | code | fullscreen'],\n };\n\n /**\n * The full-page profile.\n * @returns A fresh copy of the configuration, safe to modify.\n */\n static get TinymceConfig(): RawEditorOptions {\n return structuredClone(TinymceUtils.FULL);\n }\n\n /**\n * The in-form profile.\n * @returns A fresh copy of the configuration, safe to modify.\n */\n static get TinymceCompactConfig(): RawEditorOptions {\n return structuredClone(TinymceUtils.COMPACT);\n }\n\n /**\n * The in-form profile with full screen and source view.\n * @returns A fresh copy of the configuration, safe to modify.\n */\n static get TinymceCompactExtendedConfig(): RawEditorOptions {\n return structuredClone(TinymceUtils.COMPACT_EXTENDED);\n }\n}\n","import { Service } from '@angular/core';\nimport type { TinyMCE } from 'tinymce';\n\ndeclare global {\n interface Window {\n tinymce?: TinyMCE;\n }\n}\n\n/**\n * Loads the self-hosted TinyMCE bundle on demand.\n *\n * TinyMCE is deliberately NOT imported by any module: a static import would pull ~500 kB into\n * whichever chunk referenced it, and the editor is needed by exactly one dialog. The library is\n * copied to `assets/tinymce` by the build (see `angular.json`) and injected here as a plain\n * `<script>` the first time an editor is created, so it costs nothing until then and is served\n * from the browser cache afterwards. Loading it this way also lets TinyMCE resolve its own theme,\n * model, plugins and skin relative to `base_url`, which is how the self-hosted distribution\n * expects to work.\n */\n@Service()\nexport class TinymceLoaderService {\n\n /** The in-flight (or completed) load, so concurrent editors share a single script tag. */\n private pending?: Promise<TinyMCE>;\n\n /**\n * The absolute URL of the TinyMCE asset folder, resolved against the document base href so the\n * app keeps working when it is served from a sub-path.\n * @returns The base URL, without a trailing slash.\n */\n get baseUrl(): string {\n return new URL('assets/tinymce', document.baseURI).href.replace(/\\/$/, '');\n }\n\n /**\n * Loads TinyMCE, reusing the script already injected by a previous call.\n * @returns A promise resolving with the global TinyMCE instance.\n */\n load(): Promise<TinyMCE> {\n if (window.tinymce) return Promise.resolve(window.tinymce);\n\n // A failed load clears `pending`, so a later attempt can retry instead of being stuck on the\n // rejected promise forever (e.g. the first open happened while the network was down).\n this.pending ??= new Promise<TinyMCE>((resolve, reject) => {\n const script = document.createElement('script');\n script.src = `${this.baseUrl}/tinymce.min.js`;\n script.async = true;\n script.referrerPolicy = 'origin';\n script.onload = () => {\n if (window.tinymce) {\n resolve(window.tinymce);\n } else {\n this.pending = undefined;\n reject(new Error('TinyMCE caricato ma non disponibile.'));\n }\n };\n script.onerror = () => {\n this.pending = undefined;\n script.remove();\n reject(new Error('Impossibile caricare l\\'editor.'));\n };\n document.head.appendChild(script);\n });\n\n return this.pending;\n }\n}\n","import {\n ChangeDetectorRef,\n Directive,\n ElementRef,\n OnDestroy,\n OnInit,\n forwardRef,\n inject,\n input,\n output\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ThemeService } from '@arsedizioni/ars-utils/core';\nimport type { Editor, RawEditorOptions } from 'tinymce';\nimport { TinymceLoaderService } from './tinymce-loader.service';\n\n/** Uploads one image and resolves with the URL to reference it by. */\nexport type TinymceImageUploader = (file: File) => Promise<string>;\n\n/**\n * How the editor presents itself.\n *\n * `fixed` is the classic editor: the content lives in an iframe and the toolbar sits above it,\n * pinned so it stays reachable while the surrounding container scrolls.\n *\n * `inline` edits the host element in place, with no iframe and no chrome until the user focuses\n * it, at which point the toolbar floats over the content. It needs an ordinary element to edit —\n * a `<div>` — because there is nothing to render inside a `<textarea>`.\n */\nexport type TinymceToolbarMode = 'fixed' | 'inline';\n\n/**\n * Turns a `<textarea>` into a rich text editor backed by the self-hosted TinyMCE bundle, and wires\n * it to Angular forms as a `ControlValueAccessor`, so `[(ngModel)]`, `required` and the\n * pristine/dirty state keep working exactly as they do on a plain control.\n *\n * The library itself is fetched on demand by <see cref=\"TinymceLoaderService\"/>: nothing about\n * TinyMCE reaches the bundle until an editor is actually created.\n *\n * Usage: `<textarea tinymceEditor [(ngModel)]=\"item.text\" name=\"text\" required></textarea>`\n *\n */\n@Directive({\n // Both hosts are accepted because the two modes need different ones: the classic editor\n // replaces a textarea, the inline editor edits a div in place.\n selector: 'textarea[tinymceEditor], div[tinymceEditor]',\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TinymceEditorDirective),\n multi: true\n }]\n})\nexport class TinymceEditorDirective implements ControlValueAccessor, OnInit, OnDestroy {\n\n /** Extra TinyMCE options, merged over (and able to override) the defaults below. */\n readonly tinymceConfig = input<RawEditorOptions>({});\n\n /** Whether the toolbar is pinned above the content (`fixed`) or floats on focus (`inline`). */\n readonly tinymceToolbarMode = input<TinymceToolbarMode>('fixed');\n\n /**\n * Handler invoked for every image dropped, pasted or picked in the editor. When not provided\n * the upload tab is hidden and only images referenced by URL can be inserted.\n */\n readonly tinymceImageUploader = input<TinymceImageUploader | undefined>(undefined);\n\n /** Emitted once the editor is up, for callers that want to enable UI only when it is usable. */\n readonly ready = output<Editor>();\n\n /** Emitted when the editor could not be loaded or initialised. */\n readonly failed = output<Error>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly loader = inject(TinymceLoaderService);\n private readonly themeService = inject(ThemeService);\n private readonly changeDetector = inject(ChangeDetectorRef);\n\n private editor?: Editor;\n /** True while the editor is showing itself full screen. */\n private fullscreen = false;\n /** True once the directive has been destroyed, so a late init resolves into a no-op. */\n private destroyed = false;\n /**\n * True while the directive itself is pushing a value into the editor. TinyMCE raises the same\n * content events for a programmatic `setContent` as for a keystroke, so without this flag\n * `writeValue` would immediately echo back through `onChange` and mark a freshly loaded form\n * as dirty.\n */\n private writingValue = false;\n /** The value received before the editor existed, applied as soon as it does. */\n private value = '';\n private disabled = false;\n\n private onChange: (value: string) => void = () => { /* set by Angular forms */ };\n private onTouched: () => void = () => { /* set by Angular forms */ };\n\n /**\n * Leaves full screen on Escape, for the keystrokes that happen outside the content: with the\n * classic editor the content is an iframe, and a keydown in there never reaches this document.\n * Bound on the capture phase and stopped, so a dialog hosting the editor does not take the\n * Escape and close, throwing the edit away when the user only meant to leave full screen.\n */\n private readonly onDocumentKeydown = (event: KeyboardEvent): void => {\n if (!this.shouldEscapeLeaveFullscreen(event)) return;\n event.preventDefault();\n event.stopPropagation();\n this.exitFullscreen();\n };\n\n /**\n * Loads TinyMCE and initialises the editor over the host textarea.\n * @returns A promise that completes once the editor is ready (or has failed).\n */\n async ngOnInit(): Promise<void> {\n try {\n const tinymce = await this.loader.load();\n if (this.destroyed) return;\n\n const dark = this.themeService.getTheme() === 'dark';\n const uploader = this.tinymceImageUploader();\n const inline = this.tinymceToolbarMode() === 'inline';\n\n // Caught here rather than left to TinyMCE, which would fail deep inside its own setup\n // with a message that says nothing about the actual mistake.\n if (inline && this.host.nativeElement.tagName === 'TEXTAREA') {\n throw new Error('La modalità inline richiede un <div>, non un <textarea>.');\n }\n\n // TinyMCE ships its language packs outside the npm package, so `it.js` is committed\n // under `src/assets/tinymce/langs/`: the existing `src/assets` build rule publishes it\n // exactly where TinyMCE looks for it, relative to `base_url`.\n const defaults: RawEditorOptions = {\n // Self-hosting TinyMCE 8 requires an explicit license key: without one the editor\n // refuses to start. 'gpl' selects the GPLv2+ terms.\n license_key: 'gpl',\n language: 'it',\n branding: false,\n promotion: false,\n menubar: false,\n statusbar: false,\n resize: false,\n // Pins the toolbar while the container scrolls. In inline mode it is what keeps\n // the floating toolbar attached to the text instead of drifting off with it.\n toolbar_sticky: true,\n // An inline editor takes the size of the element it edits; only the classic one\n // has a box of its own to dimension.\n ...(inline ? {} : { height: 360 }),\n // The dialog body scrolls, and 'split' is what keeps the toolbar menus anchored\n // to the editor while it does: the popup sink is attached next to the editor, so\n // it shares its scrolling ancestry. It does NOT affect the modal dialogs — those\n // always go to <body> — which is why the CDK overlay has to be kept out of the\n // top layer (see OVERLAY_DEFAULT_CONFIG in app.config.ts).\n ui_mode: 'split',\n skin: dark ? 'oxide-dark' : 'oxide',\n content_css: dark ? 'dark' : 'default',\n // Absolute URLs must survive untouched: the content ends up in an e-mail, where a\n // relative image path resolves against nothing.\n convert_urls: false,\n plugins: 'advlist autolink lists link image table charmap searchreplace code fullscreen',\n toolbar: 'undo redo | blocks | bold italic underline | forecolor backcolor'\n + ' | bullist numlist | link image table | removeformat code fullscreen',\n content_style: 'body { font-family: Arial, Helvetica, sans-serif; font-size: 14px; }',\n // Pasted and dropped images go through the same upload path as the image dialog.\n automatic_uploads: !!uploader,\n paste_data_images: !!uploader,\n images_file_types: 'jpeg,jpg,png,gif,webp',\n file_picker_types: uploader ? 'image' : '',\n images_upload_handler: uploader\n ? (blobInfo) => uploader(new File([blobInfo.blob()], blobInfo.filename(), { type: blobInfo.blob().type }))\n : undefined,\n };\n\n await tinymce.init({\n ...defaults,\n // The caller's profile wins over every default above: that is what the presets in\n // `TinymceUtils` are for.\n ...this.tinymceConfig(),\n // Not negotiable, whatever the profile says. `target` and `base_url` are resolved\n // here and nowhere else, `inline` is the input's job, and replacing `setup` would\n // unhook the editor from the form and leave a ControlValueAccessor that never\n // reports a change.\n target: this.host.nativeElement,\n base_url: this.loader.baseUrl,\n inline,\n setup: (editor: Editor) => {\n // Typing, toolbar commands, undo/redo and programmatic inserts all have to\n // reach the form; the guard keeps our own writes from bouncing back.\n editor.on('change input undo redo SetContent', () => {\n if (this.writingValue) return;\n this.value = editor.getContent();\n this.onChange(this.value);\n this.changeDetector.markForCheck();\n });\n editor.on('blur', () => {\n this.onTouched();\n this.changeDetector.markForCheck();\n });\n editor.on('FullscreenStateChanged', (event) => {\n this.handleFullscreenChanged((event as unknown as { state?: boolean }).state === true);\n });\n // The content of a classic editor lives in an iframe, so its keystrokes are\n // only visible from the editor itself.\n editor.on('keydown', (event) => {\n if (!this.shouldEscapeLeaveFullscreen(event)) return;\n event.preventDefault();\n event.stopPropagation();\n this.exitFullscreen();\n });\n editor.on('init', () => {\n this.editor = editor;\n this.applyValue(this.value);\n this.applyDisabled(this.disabled);\n this.ready.emit(editor);\n this.changeDetector.markForCheck();\n });\n },\n });\n } catch (error) {\n if (this.destroyed) return;\n this.failed.emit(error instanceof Error ? error : new Error(String(error)));\n this.changeDetector.markForCheck();\n }\n }\n\n /**\n * Tears the editor down. TinyMCE keeps global state per instance, so leaving it behind when a\n * dialog closes leaks both DOM and editor registrations.\n * @returns void\n */\n ngOnDestroy(): void {\n this.destroyed = true;\n // Removing the editor does not raise the full-screen event, so the session is closed by\n // hand here: the Escape listener would otherwise stay attached to the document forever.\n this.releaseFullscreen();\n this.editor?.remove();\n this.editor = undefined;\n }\n\n /**\n * Decides whether an Escape press means \"leave full screen\": it does whenever the editor is\n * full screen, full stop. While full screen the editor owns Escape, and the press is stopped\n * here so it can never reach the dialog hosting it — leaving full screen must not also throw\n * away what is being written.\n * @param event The keyboard event, from the document or from the editor's content.\n * @returns True when full screen should be left.\n */\n private shouldEscapeLeaveFullscreen(event: KeyboardEvent): boolean {\n return event.key === 'Escape' && this.fullscreen;\n }\n\n /**\n * Asks the editor to leave full screen. Safe to call when it is not in full screen.\n * @returns void\n */\n private exitFullscreen(): void {\n if (!this.fullscreen) return;\n this.editor?.execCommand('mceFullScreen');\n }\n\n /**\n * Attaches or detaches everything that only makes sense while the editor is full screen.\n * @param state True when the editor has just entered full screen.\n * @returns void\n */\n private handleFullscreenChanged(state: boolean): void {\n if (state === this.fullscreen) return;\n this.fullscreen = state;\n\n if (state) {\n document.addEventListener('keydown', this.onDocumentKeydown, true);\n } else {\n this.releaseFullscreen();\n }\n\n this.changeDetector.markForCheck();\n }\n\n /**\n * Detaches the listener that only makes sense while the editor is full screen.\n * @returns void\n */\n private releaseFullscreen(): void {\n document.removeEventListener('keydown', this.onDocumentKeydown, true);\n this.fullscreen = false;\n }\n\n /**\n * Pushes a value coming from the form into the editor.\n * @param value The new content, or null/undefined for an empty editor.\n * @returns void\n */\n writeValue(value: string | null | undefined): void {\n this.value = value ?? '';\n this.applyValue(this.value);\n }\n\n /**\n * Registers the callback used to report content changes to the form.\n * @param fn The callback supplied by Angular forms.\n * @returns void\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Registers the callback used to report the first blur to the form.\n * @param fn The callback supplied by Angular forms.\n * @returns void\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Enables or disables editing.\n * @param isDisabled True to switch the editor to read-only.\n * @returns void\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.applyDisabled(isDisabled);\n }\n\n /**\n * Writes content into the editor when it exists, guarding against the echo described on\n * <see cref=\"writingValue\"/>.\n * @param value The content to write.\n * @returns void\n */\n private applyValue(value: string): void {\n const editor = this.editor;\n if (!editor) return;\n // Comparing with the serialized content avoids resetting the caret on every form patch\n // that did not actually change anything.\n if (editor.getContent() === value) return;\n this.writingValue = true;\n try {\n editor.setContent(value);\n } finally {\n this.writingValue = false;\n }\n }\n\n /**\n * Applies the disabled state to the editor when it exists.\n * @param isDisabled True to switch the editor to read-only.\n * @returns void\n */\n private applyDisabled(isDisabled: boolean): void {\n this.editor?.mode.set(isDisabled ? 'readonly' : 'design');\n }\n}\n","import { ChangeDetectionStrategy, Component, inject, output, signal } from '@angular/core';\nimport { FormField, disabled as fieldDisabled, form } from '@angular/forms/signals';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, MatDialogContent, MatDialogRef } from '@angular/material/dialog';\nimport { FlexLayoutModule } from '@arsedizioni/ars-utils/ui';\nimport type { RawEditorOptions } from 'tinymce';\nimport { TinymceEditorDirective } from '../tinymce-editor.directive';\nimport { TinymceUtils } from '../utils';\n\nexport interface TinyMceEditorDialogData {\n text: string;\n configuration: RawEditorOptions;\n infoButtonLabel?: string;\n onShowInfo?: Function,\n disabled?: boolean;\n}\n\n/**\n * A dialog that is nothing but an editor: the caller hands it a text and gets the edited one\n * back through {@link saving}.\n *\n * The editor is {@link TinymceEditorDirective} on a plain `<textarea>`, so this dialog costs\n * exactly what any other editor in the application costs — the TinyMCE bundle is fetched on\n * first use and nothing about it reaches the initial chunk.\n */\n@Component({\n templateUrl: './editor.component.html',\n styleUrls: ['./editor.component.scss'],\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [MatDialogContent, TinymceEditorDirective, FormField, MatDialogActions, FlexLayoutModule,\n MatButtonModule, MatDialogClose]\n})\nexport class TinyMceEditorComponent {\n\n /** Emitted with the edited text when the user saves. */\n readonly saving = output<string>();\n private readonly dialogRef = inject(MatDialogRef<TinyMceEditorComponent>);\n /** Dialog configuration, injected and exposed as a signal. */\n protected readonly dialogData = signal<TinyMceEditorDialogData>((() => {\n const data: TinyMceEditorDialogData = inject(MAT_DIALOG_DATA) ?? {};\n return { ...data, text: data.text ?? '' };\n })());\n /** Whether the editor is in read-only mode. */\n protected readonly disabled = signal<boolean>(false);\n /** Current editor content. */\n protected readonly text = signal<string>('');\n\n /**\n * Signal form bound to the editor textarea. The disabled state is pushed to the\n * TinymceEditorDirective through the ControlValueAccessor interop.\n */\n protected readonly textForm = form(this.text, p => {\n fieldDisabled(p, () => this.disabled());\n });\n /** The profile handed to the editor directive, merged over its defaults. */\n protected tinymceConfig: RawEditorOptions = {};\n\n constructor() {\n const data = this.dialogData();\n this.text.set(data.text);\n // The accessor already returns a private copy, so the toolbar override below cannot leak\n // into the preset shared with the rest of the application.\n this.tinymceConfig = data.configuration\n ? { ...data.configuration }\n : TinymceUtils.TinymceCompactExtendedConfig;\n // No full screen: the editor already owns the whole dialog.\n this.tinymceConfig.toolbar = ['undo redo | quickimage insertgroup | formatgroup paragraphgroup | code'];\n this.disabled.set(data.disabled ?? false);\n }\n\n\n /**\n * Save the current editor content and close the dialog.\n */\n protected ok(): void {\n this.saving.emit(this.text() ?? '');\n setTimeout(() => {\n this.dialogRef.close();\n }, 500);\n }\n}\n","<mat-dialog-content style=\"padding: 10px 10px 0 10px\">\n <textarea tinymceEditor class=\"full-screen-editor\" [tinymceConfig]=\"tinymceConfig\"\n [formField]=\"textForm\"></textarea>\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start center\" fxFill>\n <div fxFlex=\"50\">\n @if(dialogData().onShowInfo) {\n <button mat-stroked-button (click)=\"dialogData().onShowInfo()\">{{dialogData().infoButtonLabel ?? 'Informazioni'}}\n </button>\n }\n </div>\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\n @if (disabled()) {\n <button mat-stroked-button [mat-dialog-close]=\"true\">Chiudi</button>\n } @else {\n <button mat-flat-button (click)=\"ok()\">Salva</button>\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\n }\n </div>\n </div>\n</mat-dialog-actions>\n","/*\n * Public API Surface of @arsedizioni/ars-utils/ui.tinymce\n */\nexport * from './utils';\nexport * from './tinymce-loader.service';\nexport * from './tinymce-editor.directive';\nexport * from './editor/editor.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["fieldDisabled"],"mappings":";;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;AAkBG;MACU,YAAY,CAAA;AAEvB;;;;;;;;AAQG;AACqB,IAAA,SAAA,IAAA,CAAA,IAAI,GAAqB;AAC/C,QAAA,MAAM,EAAE,GAAG;AACX,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,UAAU,EAAE,GAAG;AACf,QAAA,UAAU,EAAE,KAAK;AACjB,QAAA,kBAAkB,EAAE,IAAI;AACxB,QAAA,uBAAuB,EAAE,EAAE;;AAE3B,QAAA,qBAAqB,EAAE,IAAI;AAC3B,QAAA,gBAAgB,EAAE,KAAK;AACvB,QAAA,SAAS,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,UAAU,CAAC;AACnD,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,OAAO,EAAE;cACL;cACA,2BAA2B;AAC/B,QAAA,OAAO,EAAE;YACP,2HAA2H;YAC3H;AACD,SAAA;AACD,QAAA,wBAAwB,EAAE,KAAK;AAC/B,QAAA,2BAA2B,EAAE,iFAAiF;AAC9G,QAAA,aAAa,EAAE;AACb,YAAA;AACE,gBAAA,KAAK,EAAE,gBAAgB,EAAE,KAAK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AAA,CAAA;kBARlC,SAAS;AAGI,YAAA,IAAA,EAAA,CAAA,EAAA,UAAA,EAAA,IAAI,EAAA,eAAA,EACC,uBAAuB,CAAC,MAAM,WACtC,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB;wBAC/F,eAAe,EAAE,cAAc,CAAC,EAAA,QAAA,EAAA,84BAAA,EAAA,MAAA,EAAA,CAAA,uKAAA,CAAA,EAAA;;;AE/BpC;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"arsedizioni-ars-utils-ui.tinymce.mjs","sources":["../../../projects/ars-utils/ui.tinymce/utils.ts","../../../projects/ars-utils/ui.tinymce/tinymce-loader.service.ts","../../../projects/ars-utils/ui.tinymce/tinymce-editor.directive.ts","../../../projects/ars-utils/ui.tinymce/editor/editor.component.ts","../../../projects/ars-utils/ui.tinymce/editor/editor.component.html","../../../projects/ars-utils/ui.tinymce/public_api.ts","../../../projects/ars-utils/ui.tinymce/arsedizioni-ars-utils-ui.tinymce.ts"],"sourcesContent":["import type { RawEditorOptions } from 'tinymce';\n\n/**\n * The editor profiles the applications ask for, ready to be handed to\n * `[tinymceConfig]` on {@link TinymceEditorDirective}.\n *\n * They describe **what the editor offers** — plugins, toolbar, formats, link and image\n * behaviour — and nothing else. Everything about *loading* TinyMCE (`base_url`, `suffix`,\n * `language`, `language_url`, `license_key`) and about the *theme* (`skin`, `content_css`)\n * belongs to `TinymceLoaderService` and to the directive, which resolve them against the\n * document base href and against `ThemeService`: a preset repeating them could only get them\n * wrong, and used to — the old ones pinned a relative `assets/tinymce` that broke under a\n * sub-path, and read the skin from `prefers-color-scheme` instead of the theme the user chose.\n *\n * Uploads are the same story: `automatic_uploads`, `paste_data_images` and `file_picker_types`\n * follow the `tinymceImageUploader` input, so an editor without a handler cannot end up\n * offering an upload tab that leads nowhere.\n *\n * Each accessor returns a **fresh deep copy**: a caller that tweaks a returned object — as the\n * editor dialog does with its toolbar — cannot corrupt the preset for everyone else.\n */\nexport class TinymceUtils {\n\n /**\n * Everything TinyMCE 8 open source has to offer, for a full-page editor.\n *\n * Adapted from the TinyMCE 5 profile the library used to ship: `paste`, `print`, `hr`,\n * `textpattern` and the `fullpage_*` options no longer exist (paste and text patterns moved\n * into the core, `fullpage` and `print` were dropped in v6), and `checklist`,\n * `openCodeMirrorButton` and `insertMediaButton` are premium or application-specific buttons\n * that a self-hosted GPL build has no way to render.\n */\n private static readonly FULL: RawEditorOptions = {\n height: 500,\n width: '100%',\n min_height: 250,\n onboarding: false,\n browser_spellcheck: true,\n custom_undo_redo_levels: 50,\n // Three &nbsp; per TAB, and no wrapping of the inserted spaces.\n nonbreaking_force_tab: true,\n nonbreaking_wrap: false,\n help_tabs: ['shortcuts', 'keyboardnav', 'versions'],\n menubar: false,\n plugins: 'advlist anchor autolink autosave charmap code fullscreen help image insertdatetime'\n + ' link lists media nonbreaking pagebreak preview quickbars searchreplace table'\n + ' visualblocks visualchars',\n toolbar: [\n 'fullscreen | undo redo searchreplace | code preview | link image media charmap nonbreaking | table tableprops tabledelete',\n 'bold italic superscript subscript forecolor backcolor | alignleft aligncenter alignright alignjustify | removeformat | bullist numlist'\n ],\n quickbars_insert_toolbar: false,\n quickbars_selection_toolbar: 'removeformat | bold italic | superscript subscript | quicklink h2 h3 blockquote',\n style_formats: [\n {\n title: 'Immagini float', items: [\n { title: 'Immagine a SX', selector: 'img', styles: { float: 'left', margin: '0 10px 0 10px' } },\n { title: 'Immagine a DX', selector: 'img', styles: { float: 'right', margin: '0 10px 0 10px' } }\n ]\n },\n {\n title: 'Formati', items: [\n { title: 'Grassetto', format: 'bold' },\n { title: 'Corsivo', format: 'italic' },\n { title: 'Sottolineato', format: 'underline' },\n { title: 'Barrato', format: 'strikethrough' },\n { title: 'Superscript', format: 'superscript' },\n { title: 'Subscript', format: 'subscript' },\n { title: 'Codice', format: 'code' }\n ]\n }\n ],\n // Spans with an inline style rather than <u>/<strike>: the content travels by e-mail, where\n // the presentational tags are the first thing a client strips.\n formats: {\n underline: { inline: 'span', styles: { 'text-decoration': 'underline' }, exact: true },\n strikethrough: { inline: 'span', styles: { 'text-decoration': 'line-through' }, exact: true }\n },\n insertdatetime_formats: ['%d/%m/%Y', '%d %b %Y', '%A, %d %B %Y'],\n link_default_target: '_blank',\n link_title: true,\n link_assume_external_targets: 'https',\n link_class_list: [\n { title: 'Nessuno', value: '' },\n { title: 'Rilevante', value: 'relevant' },\n ],\n link_context_toolbar: true,\n link_quicklink: true,\n image_advtab: true,\n image_caption: true,\n image_title: true,\n };\n\n /**\n * The one for a field inside a form: it grows with the text instead of owning the page, the\n * toolbar sits under it and collapses into groups, and there is no status bar or context menu\n * to compete with the form around it.\n */\n private static readonly COMPACT: RawEditorOptions = {\n ...TinymceUtils.FULL,\n height: 200,\n min_height: 200,\n max_height: 500,\n statusbar: false,\n contextmenu: false,\n toolbar_location: 'bottom',\n plugins: 'advlist anchor autolink autoresize autosave charmap code image insertdatetime'\n + ' link lists media nonbreaking preview quickbars searchreplace table'\n + ' visualblocks visualchars',\n toolbar: ['undo redo | quickimage | formatgroup paragraphgroup'],\n toolbar_groups: {\n formatgroup: {\n icon: 'format',\n tooltip: 'Formattazione',\n items: 'bold italic underline superscript subscript | forecolor backcolor | removeformat'\n },\n paragraphgroup: {\n icon: 'paragraph',\n tooltip: 'Formato paragrafo',\n items: 'h1 h2 h3 | bullist numlist | alignleft aligncenter alignright alignjustify | indent outdent'\n },\n insertgroup: {\n icon: 'plus',\n tooltip: 'Inserisci',\n items: 'quickimage media | link charmap nonbreaking | table tableprops tabledelete'\n }\n },\n quickbars_insert_toolbar: 'quickimage',\n link_class_list: [],\n };\n\n /** The compact one plus full screen, the insert group and the source view. */\n private static readonly COMPACT_EXTENDED: RawEditorOptions = {\n ...TinymceUtils.COMPACT,\n plugins: 'advlist anchor autolink autoresize autosave charmap code fullscreen image'\n + ' insertdatetime link lists media nonbreaking preview quickbars searchreplace table'\n + ' visualblocks visualchars',\n toolbar: ['undo redo | quickimage insertgroup | formatgroup paragraphgroup | code | fullscreen'],\n };\n\n /**\n * The full-page profile.\n * @returns A fresh copy of the configuration, safe to modify.\n */\n static get TinymceConfig(): RawEditorOptions {\n return structuredClone(TinymceUtils.FULL);\n }\n\n /**\n * The in-form profile.\n * @returns A fresh copy of the configuration, safe to modify.\n */\n static get TinymceCompactConfig(): RawEditorOptions {\n return structuredClone(TinymceUtils.COMPACT);\n }\n\n /**\n * The in-form profile with full screen and source view.\n * @returns A fresh copy of the configuration, safe to modify.\n */\n static get TinymceCompactExtendedConfig(): RawEditorOptions {\n return structuredClone(TinymceUtils.COMPACT_EXTENDED);\n }\n}\n","import { Service } from '@angular/core';\nimport type { TinyMCE } from 'tinymce';\n\ndeclare global {\n interface Window {\n tinymce?: TinyMCE;\n }\n}\n\n/**\n * Loads the self-hosted TinyMCE bundle on demand.\n *\n * TinyMCE is deliberately NOT imported by any module: a static import would pull ~500 kB into\n * whichever chunk referenced it, and the editor is needed by exactly one dialog. The library is\n * copied to `assets/tinymce` by the build (see `angular.json`) and injected here as a plain\n * `<script>` the first time an editor is created, so it costs nothing until then and is served\n * from the browser cache afterwards. Loading it this way also lets TinyMCE resolve its own theme,\n * model, plugins and skin relative to `base_url`, which is how the self-hosted distribution\n * expects to work.\n */\n@Service()\nexport class TinymceLoaderService {\n\n /** The in-flight (or completed) load, so concurrent editors share a single script tag. */\n private pending?: Promise<TinyMCE>;\n\n /**\n * The absolute URL of the TinyMCE asset folder, resolved against the document base href so the\n * app keeps working when it is served from a sub-path.\n * @returns The base URL, without a trailing slash.\n */\n get baseUrl(): string {\n return new URL('assets/tinymce', document.baseURI).href.replace(/\\/$/, '');\n }\n\n /**\n * Loads TinyMCE, reusing the script already injected by a previous call.\n * @returns A promise resolving with the global TinyMCE instance.\n */\n load(): Promise<TinyMCE> {\n if (window.tinymce) return Promise.resolve(window.tinymce);\n\n // A failed load clears `pending`, so a later attempt can retry instead of being stuck on the\n // rejected promise forever (e.g. the first open happened while the network was down).\n this.pending ??= new Promise<TinyMCE>((resolve, reject) => {\n const script = document.createElement('script');\n script.src = `${this.baseUrl}/tinymce.min.js`;\n script.async = true;\n script.referrerPolicy = 'origin';\n script.onload = () => {\n if (window.tinymce) {\n resolve(window.tinymce);\n } else {\n this.pending = undefined;\n reject(new Error('TinyMCE caricato ma non disponibile.'));\n }\n };\n script.onerror = () => {\n this.pending = undefined;\n script.remove();\n reject(new Error('Impossibile caricare l\\'editor.'));\n };\n document.head.appendChild(script);\n });\n\n return this.pending;\n }\n}\n","import {\n ChangeDetectorRef,\n Directive,\n ElementRef,\n OnDestroy,\n OnInit,\n forwardRef,\n inject,\n input,\n output\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ThemeService } from '@arsedizioni/ars-utils/core';\nimport type { Editor, RawEditorOptions } from 'tinymce';\nimport { TinymceLoaderService } from './tinymce-loader.service';\n\n/** Uploads one image and resolves with the URL to reference it by. */\nexport type TinymceImageUploader = (file: File) => Promise<string>;\n\n/**\n * How the editor presents itself.\n *\n * `fixed` is the classic editor: the content lives in an iframe and the toolbar sits above it,\n * pinned so it stays reachable while the surrounding container scrolls.\n *\n * `inline` edits the host element in place, with no iframe and no chrome until the user focuses\n * it, at which point the toolbar floats over the content. It needs an ordinary element to edit —\n * a `<div>` — because there is nothing to render inside a `<textarea>`.\n */\nexport type TinymceToolbarMode = 'fixed' | 'inline';\n\n/**\n * Turns a `<textarea>` into a rich text editor backed by the self-hosted TinyMCE bundle, and wires\n * it to Angular forms as a `ControlValueAccessor`, so `[(ngModel)]`, `required` and the\n * pristine/dirty state keep working exactly as they do on a plain control.\n *\n * The library itself is fetched on demand by <see cref=\"TinymceLoaderService\"/>: nothing about\n * TinyMCE reaches the bundle until an editor is actually created.\n *\n * Usage: `<textarea tinymceEditor [(ngModel)]=\"item.text\" name=\"text\" required></textarea>`\n *\n */\n@Directive({\n // Both hosts are accepted because the two modes need different ones: the classic editor\n // replaces a textarea, the inline editor edits a div in place.\n selector: 'textarea[tinymceEditor], div[tinymceEditor]',\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TinymceEditorDirective),\n multi: true\n }]\n})\nexport class TinymceEditorDirective implements ControlValueAccessor, OnInit, OnDestroy {\n\n /** Extra TinyMCE options, merged over (and able to override) the defaults below. */\n readonly tinymceConfig = input<RawEditorOptions>({});\n\n /** Whether the toolbar is pinned above the content (`fixed`) or floats on focus (`inline`). */\n readonly tinymceToolbarMode = input<TinymceToolbarMode>('fixed');\n\n /**\n * Handler invoked for every image dropped, pasted or picked in the editor. When not provided\n * the upload tab is hidden and only images referenced by URL can be inserted.\n */\n readonly tinymceImageUploader = input<TinymceImageUploader | undefined>(undefined);\n\n /** Emitted once the editor is up, for callers that want to enable UI only when it is usable. */\n readonly ready = output<Editor>();\n\n /** Emitted when the editor could not be loaded or initialised. */\n readonly failed = output<Error>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly loader = inject(TinymceLoaderService);\n private readonly themeService = inject(ThemeService);\n private readonly changeDetector = inject(ChangeDetectorRef);\n\n private editor?: Editor;\n /** True while the editor is showing itself full screen. */\n private fullscreen = false;\n /** True once the directive has been destroyed, so a late init resolves into a no-op. */\n private destroyed = false;\n /**\n * True while the directive itself is pushing a value into the editor. TinyMCE raises the same\n * content events for a programmatic `setContent` as for a keystroke, so without this flag\n * `writeValue` would immediately echo back through `onChange` and mark a freshly loaded form\n * as dirty.\n */\n private writingValue = false;\n /** The value received before the editor existed, applied as soon as it does. */\n private value = '';\n private disabled = false;\n\n private onChange: (value: string) => void = () => { /* set by Angular forms */ };\n private onTouched: () => void = () => { /* set by Angular forms */ };\n\n /**\n * Leaves full screen on Escape, for the keystrokes that happen outside the content: with the\n * classic editor the content is an iframe, and a keydown in there never reaches this document.\n * Bound on the capture phase and stopped, so a dialog hosting the editor does not take the\n * Escape and close, throwing the edit away when the user only meant to leave full screen.\n */\n private readonly onDocumentKeydown = (event: KeyboardEvent): void => {\n if (!this.shouldEscapeLeaveFullscreen(event)) return;\n event.preventDefault();\n event.stopPropagation();\n this.exitFullscreen();\n };\n\n /**\n * Loads TinyMCE and initialises the editor over the host textarea.\n * @returns A promise that completes once the editor is ready (or has failed).\n */\n async ngOnInit(): Promise<void> {\n try {\n const tinymce = await this.loader.load();\n if (this.destroyed) return;\n\n const dark = this.themeService.getTheme() === 'dark';\n const uploader = this.tinymceImageUploader();\n const inline = this.tinymceToolbarMode() === 'inline';\n\n // Caught here rather than left to TinyMCE, which would fail deep inside its own setup\n // with a message that says nothing about the actual mistake.\n if (inline && this.host.nativeElement.tagName === 'TEXTAREA') {\n throw new Error('La modalità inline richiede un <div>, non un <textarea>.');\n }\n\n // TinyMCE ships its language packs outside the npm package, so `it.js` is committed\n // under `src/assets/tinymce/langs/`: the existing `src/assets` build rule publishes it\n // exactly where TinyMCE looks for it, relative to `base_url`.\n const defaults: RawEditorOptions = {\n // Self-hosting TinyMCE 8 requires an explicit license key: without one the editor\n // refuses to start. 'gpl' selects the GPLv2+ terms.\n license_key: 'gpl',\n language: 'it',\n branding: false,\n promotion: false,\n menubar: false,\n statusbar: false,\n resize: false,\n // Pins the toolbar while the container scrolls. In inline mode it is what keeps\n // the floating toolbar attached to the text instead of drifting off with it.\n toolbar_sticky: true,\n // An inline editor takes the size of the element it edits; only the classic one\n // has a box of its own to dimension.\n ...(inline ? {} : { height: 360 }),\n // The dialog body scrolls, and 'split' is what keeps the toolbar menus anchored\n // to the editor while it does: the popup sink is attached next to the editor, so\n // it shares its scrolling ancestry. It does NOT affect the modal dialogs — those\n // always go to <body> — which is why the CDK overlay has to be kept out of the\n // top layer (see OVERLAY_DEFAULT_CONFIG in app.config.ts).\n ui_mode: 'split',\n skin: dark ? 'oxide-dark' : 'oxide',\n content_css: dark ? 'dark' : 'default',\n // Absolute URLs must survive untouched: the content ends up in an e-mail, where a\n // relative image path resolves against nothing.\n convert_urls: false,\n plugins: 'advlist autolink lists link image table charmap searchreplace code fullscreen',\n toolbar: 'undo redo | blocks | bold italic underline | forecolor backcolor'\n + ' | bullist numlist | link image table | removeformat code fullscreen',\n content_style: 'body { font-family: Arial, Helvetica, sans-serif; font-size: 14px; }',\n // Pasted and dropped images go through the same upload path as the image dialog.\n automatic_uploads: !!uploader,\n paste_data_images: !!uploader,\n images_file_types: 'jpeg,jpg,png,gif,webp',\n file_picker_types: uploader ? 'image' : '',\n images_upload_handler: uploader\n ? (blobInfo) => uploader(new File([blobInfo.blob()], blobInfo.filename(), { type: blobInfo.blob().type }))\n : undefined,\n };\n\n await tinymce.init({\n ...defaults,\n // The caller's profile wins over every default above: that is what the presets in\n // `TinymceUtils` are for.\n ...this.tinymceConfig(),\n // Not negotiable, whatever the profile says. `target` and `base_url` are resolved\n // here and nowhere else, `inline` is the input's job, and replacing `setup` would\n // unhook the editor from the form and leave a ControlValueAccessor that never\n // reports a change.\n target: this.host.nativeElement,\n base_url: this.loader.baseUrl,\n inline,\n setup: (editor: Editor) => {\n /*\n * Typing, toolbar commands, undo/redo and programmatic inserts all have to reach\n * the form; the two guards keep everything else out.\n *\n * `writingValue` keeps our own writes from bouncing back. `!this.editor` — which\n * stays unset until the `init` handler below — keeps out the one content event\n * that fires BEFORE the editor exists, and it is the one that made an editor\n * impossible to fill: TinyMCE's own `loadInitialContent` reads the textarea and\n * calls `setContent(..., { initial: true })`, which dispatches `SetContent`\n * because only `no_events` suppresses it. The textarea is empty — the form\n * writes through the ControlValueAccessor, never into the DOM element — so this\n * handler took that empty string for a user edit, overwrote the value the form\n * had already handed us, and reported '' back to the model. `init` then applied\n * the value it had just destroyed, and the editor came up blank whatever was\n * passed to it. Saving from there stored the empty string as well.\n */\n editor.on('change input undo redo SetContent', () => {\n if (this.writingValue || !this.editor) return;\n this.value = editor.getContent();\n this.onChange(this.value);\n this.changeDetector.markForCheck();\n });\n editor.on('blur', () => {\n this.onTouched();\n this.changeDetector.markForCheck();\n });\n editor.on('FullscreenStateChanged', (event) => {\n this.handleFullscreenChanged((event as unknown as { state?: boolean }).state === true);\n });\n // The content of a classic editor lives in an iframe, so its keystrokes are\n // only visible from the editor itself.\n editor.on('keydown', (event) => {\n if (!this.shouldEscapeLeaveFullscreen(event)) return;\n event.preventDefault();\n event.stopPropagation();\n this.exitFullscreen();\n });\n editor.on('init', () => {\n // Assigned BEFORE applying the value, and that order is the contract with\n // the guard above: from here on content events are genuine, and the one\n // raised by `applyValue` itself is covered by `writingValue`.\n this.editor = editor;\n this.applyValue(this.value);\n this.applyDisabled(this.disabled);\n this.ready.emit(editor);\n this.changeDetector.markForCheck();\n });\n },\n });\n } catch (error) {\n if (this.destroyed) return;\n this.failed.emit(error instanceof Error ? error : new Error(String(error)));\n this.changeDetector.markForCheck();\n }\n }\n\n /**\n * Tears the editor down. TinyMCE keeps global state per instance, so leaving it behind when a\n * dialog closes leaks both DOM and editor registrations.\n * @returns void\n */\n ngOnDestroy(): void {\n this.destroyed = true;\n // Removing the editor does not raise the full-screen event, so the session is closed by\n // hand here: the Escape listener would otherwise stay attached to the document forever.\n this.releaseFullscreen();\n this.editor?.remove();\n this.editor = undefined;\n }\n\n /**\n * Decides whether an Escape press means \"leave full screen\": it does whenever the editor is\n * full screen, full stop. While full screen the editor owns Escape, and the press is stopped\n * here so it can never reach the dialog hosting it — leaving full screen must not also throw\n * away what is being written.\n * @param event The keyboard event, from the document or from the editor's content.\n * @returns True when full screen should be left.\n */\n private shouldEscapeLeaveFullscreen(event: KeyboardEvent): boolean {\n return event.key === 'Escape' && this.fullscreen;\n }\n\n /**\n * Asks the editor to leave full screen. Safe to call when it is not in full screen.\n * @returns void\n */\n private exitFullscreen(): void {\n if (!this.fullscreen) return;\n this.editor?.execCommand('mceFullScreen');\n }\n\n /**\n * Attaches or detaches everything that only makes sense while the editor is full screen.\n * @param state True when the editor has just entered full screen.\n * @returns void\n */\n private handleFullscreenChanged(state: boolean): void {\n if (state === this.fullscreen) return;\n this.fullscreen = state;\n\n if (state) {\n document.addEventListener('keydown', this.onDocumentKeydown, true);\n } else {\n this.releaseFullscreen();\n }\n\n this.changeDetector.markForCheck();\n }\n\n /**\n * Detaches the listener that only makes sense while the editor is full screen.\n * @returns void\n */\n private releaseFullscreen(): void {\n document.removeEventListener('keydown', this.onDocumentKeydown, true);\n this.fullscreen = false;\n }\n\n /**\n * Pushes a value coming from the form into the editor.\n * @param value The new content, or null/undefined for an empty editor.\n * @returns void\n */\n writeValue(value: string | null | undefined): void {\n this.value = value ?? '';\n this.applyValue(this.value);\n }\n\n /**\n * Registers the callback used to report content changes to the form.\n * @param fn The callback supplied by Angular forms.\n * @returns void\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Registers the callback used to report the first blur to the form.\n * @param fn The callback supplied by Angular forms.\n * @returns void\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Enables or disables editing.\n * @param isDisabled True to switch the editor to read-only.\n * @returns void\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.applyDisabled(isDisabled);\n }\n\n /**\n * Writes content into the editor when it exists, guarding against the echo described on\n * <see cref=\"writingValue\"/>.\n * @param value The content to write.\n * @returns void\n */\n private applyValue(value: string): void {\n const editor = this.editor;\n if (!editor) return;\n // Comparing with the serialized content avoids resetting the caret on every form patch\n // that did not actually change anything.\n if (editor.getContent() === value) return;\n this.writingValue = true;\n try {\n editor.setContent(value);\n } finally {\n this.writingValue = false;\n }\n }\n\n /**\n * Applies the disabled state to the editor when it exists.\n * @param isDisabled True to switch the editor to read-only.\n * @returns void\n */\n private applyDisabled(isDisabled: boolean): void {\n this.editor?.mode.set(isDisabled ? 'readonly' : 'design');\n }\n}\n","import { ChangeDetectionStrategy, Component, inject, output, signal } from '@angular/core';\nimport { FormField, disabled as fieldDisabled, form } from '@angular/forms/signals';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, MatDialogContent, MatDialogRef } from '@angular/material/dialog';\nimport { FlexLayoutModule } from '@arsedizioni/ars-utils/ui';\nimport type { RawEditorOptions } from 'tinymce';\nimport { TinymceEditorDirective } from '../tinymce-editor.directive';\nimport { TinymceUtils } from '../utils';\n\nexport interface TinyMceEditorDialogData {\n text: string;\n configuration: RawEditorOptions;\n infoButtonLabel?: string;\n onShowInfo?: Function,\n disabled?: boolean;\n}\n\n/**\n * A dialog that is nothing but an editor: the caller hands it a text and gets the edited one\n * back through {@link saving}.\n *\n * The editor is {@link TinymceEditorDirective} on a plain `<textarea>`, so this dialog costs\n * exactly what any other editor in the application costs — the TinyMCE bundle is fetched on\n * first use and nothing about it reaches the initial chunk.\n */\n@Component({\n templateUrl: './editor.component.html',\n styleUrls: ['./editor.component.scss'],\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [MatDialogContent, TinymceEditorDirective, FormField, MatDialogActions, FlexLayoutModule,\n MatButtonModule, MatDialogClose]\n})\nexport class TinyMceEditorComponent {\n\n /** Emitted with the edited text when the user saves. */\n readonly saving = output<string>();\n private readonly dialogRef = inject(MatDialogRef<TinyMceEditorComponent>);\n /** Dialog configuration, injected and exposed as a signal. */\n protected readonly dialogData = signal<TinyMceEditorDialogData>((() => {\n const data: TinyMceEditorDialogData = inject(MAT_DIALOG_DATA) ?? {};\n return { ...data, text: data.text ?? '' };\n })());\n /** Whether the editor is in read-only mode. */\n protected readonly disabled = signal<boolean>(false);\n\n /**\n * Why the editor could not be shown, when it could not.\n *\n * Without it a failure looked exactly like an empty document: the directive reported it on its\n * `failed` output, nothing was listening, and the user was left with a blank box and no reason\n * for it. The message is the directive's own — the bundle did not load, or TinyMCE refused to\n * start — and it also goes to the console, because that is where whoever is asked about it will\n * look first.\n */\n protected readonly error = signal<string | undefined>(undefined);\n /** Current editor content. */\n protected readonly text = signal<string>('');\n\n /**\n * Signal form bound to the editor textarea. The disabled state is pushed to the\n * TinymceEditorDirective through the ControlValueAccessor interop.\n */\n protected readonly textForm = form(this.text, p => {\n fieldDisabled(p, () => this.disabled());\n });\n /** The profile handed to the editor directive, merged over its defaults. */\n protected tinymceConfig: RawEditorOptions = {};\n\n constructor() {\n const data = this.dialogData();\n this.text.set(data.text);\n // The accessor already returns a private copy, so the toolbar override below cannot leak\n // into the preset shared with the rest of the application.\n this.tinymceConfig = data.configuration\n ? { ...data.configuration }\n : TinymceUtils.TinymceCompactExtendedConfig;\n // No full screen: the editor already owns the whole dialog.\n this.tinymceConfig.toolbar = ['undo redo | quickimage insertgroup | formatgroup paragraphgroup | code'];\n this.disabled.set(data.disabled ?? false);\n }\n\n\n /**\n * Records that the editor could not be shown.\n * @param error - What the directive could not do.\n * @returns void\n */\n protected failed(error: Error): void {\n console.error('[TinyMceEditorComponent] editor non disponibile', error);\n this.error.set(error?.message || 'Editor non disponibile.');\n }\n\n /**\n * Save the current editor content and close the dialog.\n */\n protected ok(): void {\n this.saving.emit(this.text() ?? '');\n setTimeout(() => {\n this.dialogRef.close();\n }, 500);\n }\n}\n","<mat-dialog-content style=\"padding: 10px 10px 0 10px\">\n @if (error()) {\n <!-- The textarea is gone with the editor that could not replace it: left in place it would be a\n plain box the form does not write into, which is the empty editor this message exists to\n explain. -->\n <div class=\"editor-error\">\n <div class=\"editor-error-title\">Non è stato possibile aprire l'editor.</div>\n <div class=\"editor-error-detail\">{{ error() }}</div>\n <div class=\"editor-error-detail\">Il testo non è stato modificato: chiudi e riprova.</div>\n </div>\n } @else {\n <textarea tinymceEditor class=\"full-screen-editor\" [tinymceConfig]=\"tinymceConfig\"\n [formField]=\"textForm\" (failed)=\"failed($event)\"></textarea>\n }\n</mat-dialog-content>\n<mat-dialog-actions>\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start center\" fxFill>\n <div fxFlex=\"50\">\n @if(dialogData().onShowInfo) {\n <button mat-stroked-button (click)=\"dialogData().onShowInfo()\">{{dialogData().infoButtonLabel ?? 'Informazioni'}}\n </button>\n }\n </div>\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\n <!-- Nothing to save when there was no editor: the only way out is the one that changes\n nothing. -->\n @if (disabled() || error()) {\n <button mat-stroked-button [mat-dialog-close]=\"true\">Chiudi</button>\n } @else {\n <button mat-flat-button (click)=\"ok()\">Salva</button>\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\n }\n </div>\n </div>\n</mat-dialog-actions>\n","/*\n * Public API Surface of @arsedizioni/ars-utils/ui.tinymce\n */\nexport * from './utils';\nexport * from './tinymce-loader.service';\nexport * from './tinymce-editor.directive';\nexport * from './editor/editor.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["fieldDisabled"],"mappings":";;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;AAkBG;MACU,YAAY,CAAA;AAEvB;;;;;;;;AAQG;AACqB,IAAA,SAAA,IAAA,CAAA,IAAI,GAAqB;AAC/C,QAAA,MAAM,EAAE,GAAG;AACX,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,UAAU,EAAE,GAAG;AACf,QAAA,UAAU,EAAE,KAAK;AACjB,QAAA,kBAAkB,EAAE,IAAI;AACxB,QAAA,uBAAuB,EAAE,EAAE;;AAE3B,QAAA,qBAAqB,EAAE,IAAI;AAC3B,QAAA,gBAAgB,EAAE,KAAK;AACvB,QAAA,SAAS,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,UAAU,CAAC;AACnD,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,OAAO,EAAE;cACL;cACA,2BAA2B;AAC/B,QAAA,OAAO,EAAE;YACP,2HAA2H;YAC3H;AACD,SAAA;AACD,QAAA,wBAAwB,EAAE,KAAK;AAC/B,QAAA,2BAA2B,EAAE,iFAAiF;AAC9G,QAAA,aAAa,EAAE;AACb,YAAA;AACE,gBAAA,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE;AAC9B,oBAAA,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,KAAK,EAAE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eAAe,oXAAE,cAAc,EAAA,QAAA,EAAA,sCAAA,EAAA,MAAA,EAAA,CAAA,YAAA,EAAA,MAAA,EAAA,kBAAA,EAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAEtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBARlC,SAAS;AAGI,YAAA,IAAA,EAAA,CAAA,EAAA,UAAA,EAAA,IAAI,EAAA,eAAA,EACC,uBAAuB,CAAC,MAAM,WACtC,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB;wBAC/F,eAAe,EAAE,cAAc,CAAC,EAAA,QAAA,EAAA,ilDAAA,EAAA,MAAA,EAAA,CAAA,sbAAA,CAAA,EAAA;;;AE/BpC;;AAEG;;ACFH;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arsedizioni/ars-utils",
3
- "version": "22.5.42",
3
+ "version": "22.5.43",
4
4
  "author": {
5
5
  "email": "software@arsedizioni.it",
6
6
  "name": "Fabio Buscaroli, Alberto Doria"
@@ -259,6 +259,16 @@ declare class TinyMceEditorComponent {
259
259
  protected readonly dialogData: _angular_core.WritableSignal<TinyMceEditorDialogData>;
260
260
  /** Whether the editor is in read-only mode. */
261
261
  protected readonly disabled: _angular_core.WritableSignal<boolean>;
262
+ /**
263
+ * Why the editor could not be shown, when it could not.
264
+ *
265
+ * Without it a failure looked exactly like an empty document: the directive reported it on its
266
+ * `failed` output, nothing was listening, and the user was left with a blank box and no reason
267
+ * for it. The message is the directive's own — the bundle did not load, or TinyMCE refused to
268
+ * start — and it also goes to the console, because that is where whoever is asked about it will
269
+ * look first.
270
+ */
271
+ protected readonly error: _angular_core.WritableSignal<string>;
262
272
  /** Current editor content. */
263
273
  protected readonly text: _angular_core.WritableSignal<string>;
264
274
  /**
@@ -269,6 +279,12 @@ declare class TinyMceEditorComponent {
269
279
  /** The profile handed to the editor directive, merged over its defaults. */
270
280
  protected tinymceConfig: RawEditorOptions;
271
281
  constructor();
282
+ /**
283
+ * Records that the editor could not be shown.
284
+ * @param error - What the directive could not do.
285
+ * @returns void
286
+ */
287
+ protected failed(error: Error): void;
272
288
  /**
273
289
  * Save the current editor content and close the dialog.
274
290
  */