@arsedizioni/ars-utils 22.5.8 → 22.5.11

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,80 +1,69 @@
1
1
  import * as i0 from '@angular/core';
2
- import { output, inject, signal, ChangeDetectionStrategy, Component } from '@angular/core';
3
- import { MatDialogRef, MAT_DIALOG_DATA, MatDialogContent, MatDialogActions, MatDialogClose } from '@angular/material/dialog';
4
- import { SystemUtils } from '@arsedizioni/ars-utils/core';
2
+ import { Service, input, output, inject, ElementRef, ChangeDetectorRef, forwardRef, Directive, signal, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
5
+ import { ThemeService } from '@arsedizioni/ars-utils/core';
5
6
  import * as i3 from '@angular/material/button';
6
7
  import { MatButtonModule } from '@angular/material/button';
8
+ import { MatDialogRef, MAT_DIALOG_DATA, MatDialogContent, MatDialogActions, MatDialogClose } from '@angular/material/dialog';
7
9
  import * as i2 from '@arsedizioni/ars-utils/ui';
8
10
  import { FlexLayoutModule } from '@arsedizioni/ars-utils/ui';
9
- import * as i1 from '@angular/forms';
10
- import { FormsModule } from '@angular/forms';
11
- import { EditorComponent } from '@tinymce/tinymce-angular';
12
11
 
12
+ /**
13
+ * The editor profiles the applications ask for, ready to be handed to
14
+ * `[tinymceConfig]` on {@link TinymceEditorDirective}.
15
+ *
16
+ * They describe **what the editor offers** — plugins, toolbar, formats, link and image
17
+ * behaviour — and nothing else. Everything about *loading* TinyMCE (`base_url`, `suffix`,
18
+ * `language`, `language_url`, `license_key`) and about the *theme* (`skin`, `content_css`)
19
+ * belongs to `TinymceLoaderService` and to the directive, which resolve them against the
20
+ * document base href and against `ThemeService`: a preset repeating them could only get them
21
+ * wrong, and used to — the old ones pinned a relative `assets/tinymce` that broke under a
22
+ * sub-path, and read the skin from `prefers-color-scheme` instead of the theme the user chose.
23
+ *
24
+ * Uploads are the same story: `automatic_uploads`, `paste_data_images` and `file_picker_types`
25
+ * follow the `tinymceImageUploader` input, so an editor without a handler cannot end up
26
+ * offering an upload tab that leads nowhere.
27
+ *
28
+ * Each accessor returns a **fresh deep copy**: a caller that tweaks a returned object — as the
29
+ * editor dialog does with its toolbar — cannot corrupt the preset for everyone else.
30
+ */
13
31
  class TinymceUtils {
14
32
  /**
15
- * Returns `true` when the user agent currently prefers a dark color scheme.
16
- * Evaluated on demand (not frozen at module load) and SSR-safe.
33
+ * Everything TinyMCE 8 open source has to offer, for a full-page editor.
34
+ *
35
+ * Adapted from the TinyMCE 5 profile the library used to ship: `paste`, `print`, `hr`,
36
+ * `textpattern` and the `fullpage_*` options no longer exist (paste and text patterns moved
37
+ * into the core, `fullpage` and `print` were dropped in v6), and `checklist`,
38
+ * `openCodeMirrorButton` and `insertMediaButton` are premium or application-specific buttons
39
+ * that a self-hosted GPL build has no way to render.
17
40
  */
18
- static prefersDark() {
19
- return typeof window !== 'undefined'
20
- && typeof window.matchMedia === 'function'
21
- && window.matchMedia('(prefers-color-scheme: dark)').matches;
22
- }
23
- /** URL of the TinyMCE script hosted on the Tiny Cloud CDN. */
24
- static { this.CDN_URL = 'https://cdn.tiny.cloud/1/5lnoc6ohmpjau6zyzgqyhyf52cueoennkcs8v1yfoak57ku9/tinymce/7/tinymce.min.js'; }
25
- /** URL of the locally bundled TinyMCE script. */
26
- static { this.LOCAL_URL = '/assets/tinymce/tinymce.min.js'; }
27
- /**
28
- * Full-featured TinyMCE base configuration with all standard plugins and toolbar.
29
- */
30
- static { this.TinymceConfig = {
31
- base_url: 'assets/tinymce',
32
- suffix: '.min',
33
- license_key: 'gpl', // per evitare il warning riportarla direttamente nell'html: <editor licenseKey="gpl" ...></editor>
34
- language: 'it',
35
- language_url: "assets/tinymce/langs/it.js",
41
+ static { this.FULL = {
36
42
  height: 500,
37
43
  width: '100%',
38
44
  min_height: 250,
39
- ui_mode: 'split',
40
45
  onboarding: false,
41
- branding: false,
42
- convert_urls: false,
43
- quickbars_insert_toolbar: false,
44
- quickbars_selection_toolbar: 'removeformat | bold italic | superscript subscript | quicklink h2 h3 blockquote',
45
- fullpage_default_doctype: '<!DOCTYPE html>',
46
- fullpage_default_encoding: 'UTF-8',
47
- fullpage_default_font_family: '\'Helvetica Neue\', sans-serif', // '\'Times New Roman\', Georgia, Serif',
48
- fullpage_default_xml_pi: false,
49
- fullpage_hide_in_source_view: false,
50
46
  browser_spellcheck: true,
51
- spellchecker_language: 'it_IT',
52
- save_enablewhendirty: true,
53
47
  custom_undo_redo_levels: 50,
54
- nonbreaking_force_tab: true, // inserisce 3 &nbsp; per ogni pressione di TAB
48
+ // Three &nbsp; per TAB, and no wrapping of the inserted spaces.
49
+ nonbreaking_force_tab: true,
55
50
  nonbreaking_wrap: false,
56
51
  help_tabs: ['shortcuts', 'keyboardnav', 'versions'],
57
- plugins: 'advlist anchor autolink autosave charmap code fullscreen help hr image insertdatetime link lists media table nonbreaking paste preview print quickbars searchreplace textpattern visualblocks visualchars',
58
52
  menubar: false,
59
- skin: TinymceUtils.prefersDark() ? "oxide-dark" : "oxide",
60
- content_css: TinymceUtils.prefersDark() ? "dark" : "default",
53
+ plugins: 'advlist anchor autolink autosave charmap code fullscreen help image insertdatetime'
54
+ + ' link lists media nonbreaking pagebreak preview quickbars searchreplace table'
55
+ + ' visualblocks visualchars',
61
56
  toolbar: [
62
- 'fullscreen | undo redo searchreplace | code openCodeMirrorButton preview fullpage | link image media insertMediaButton charmap nonbreaking | table tableprops tabledelete',
63
- 'bold italic superscript subscript forecolor backcolor | alignleft aligncenter alignright alignjustify | removeformat | bullist numlist checklist'
57
+ 'fullscreen | undo redo searchreplace | code preview | link image media charmap nonbreaking | table tableprops tabledelete',
58
+ 'bold italic superscript subscript forecolor backcolor | alignleft aligncenter alignright alignjustify | removeformat | bullist numlist'
64
59
  ],
60
+ quickbars_insert_toolbar: false,
61
+ quickbars_selection_toolbar: 'removeformat | bold italic | superscript subscript | quicklink h2 h3 blockquote',
65
62
  style_formats: [
66
63
  {
67
64
  title: 'Immagini float', items: [
68
- {
69
- title: 'Immagine a SX',
70
- selector: 'img',
71
- styles: { float: 'left', margin: '0 10px 0 10px' }
72
- },
73
- {
74
- title: 'Immagine a DX',
75
- selector: 'img',
76
- styles: { float: 'right', margin: '0 10px 0 10px' }
77
- }
65
+ { title: 'Immagine a SX', selector: 'img', styles: { float: 'left', margin: '0 10px 0 10px' } },
66
+ { title: 'Immagine a DX', selector: 'img', styles: { float: 'right', margin: '0 10px 0 10px' } }
78
67
  ]
79
68
  },
80
69
  {
@@ -89,6 +78,8 @@ class TinymceUtils {
89
78
  ]
90
79
  }
91
80
  ],
81
+ // Spans with an inline style rather than <u>/<strike>: the content travels by e-mail, where
82
+ // the presentational tags are the first thing a client strips.
92
83
  formats: {
93
84
  underline: { inline: 'span', styles: { 'text-decoration': 'underline' }, exact: true },
94
85
  strikethrough: { inline: 'span', styles: { 'text-decoration': 'line-through' }, exact: true }
@@ -103,91 +94,467 @@ class TinymceUtils {
103
94
  ],
104
95
  link_context_toolbar: true,
105
96
  link_quicklink: true,
106
- rel_list: false,
107
97
  image_advtab: true,
108
- paste_data_images: true,
109
98
  image_caption: true,
110
99
  image_title: true,
111
- automatic_uploads: true,
112
- images_reuse_filename: true,
113
- images_upload_credentials: true,
114
- file_picker_types: 'file image',
115
100
  }; }
116
101
  /**
117
- * Compact TinyMCE configuration with autoresize, bottom toolbar, and grouped toolbar buttons.
118
- * Extends `TinymceConfig` with reduced height and a simplified toolbar.
102
+ * The one for a field inside a form: it grows with the text instead of owning the page, the
103
+ * toolbar sits under it and collapses into groups, and there is no status bar or context menu
104
+ * to compete with the form around it.
119
105
  */
120
- static { this.TinymceCompactConfig = Object.assign(structuredClone(this.TinymceConfig), {
106
+ static { this.COMPACT = {
107
+ ...TinymceUtils.FULL,
121
108
  height: 200,
122
- width: '100%',
123
- suffix: '.min',
124
- license_key: 'gpl',
125
- ui_mode: 'split',
126
109
  min_height: 200,
127
110
  max_height: 500,
128
- quickbars_insert_toolbar: 'quickimage hr',
129
- quickbars_selection_toolbar: 'removeformat | bold italic | superscript subscript | quicklink h2 h3 blockquote',
130
- plugins: 'advlist anchor autolink autosave autoresize charmap code image insertdatetime link lists media table nonbreaking preview quickbars searchreplace visualblocks visualchars',
131
111
  statusbar: false,
132
- menubar: false,
133
112
  contextmenu: false,
134
113
  toolbar_location: 'bottom',
135
- toolbar: ['undo redo | quickimage | formatgroup paragraphgroup '],
114
+ plugins: 'advlist anchor autolink autoresize autosave charmap code image insertdatetime'
115
+ + ' link lists media nonbreaking preview quickbars searchreplace table'
116
+ + ' visualblocks visualchars',
117
+ toolbar: ['undo redo | quickimage | formatgroup paragraphgroup'],
136
118
  toolbar_groups: {
137
119
  formatgroup: {
138
120
  icon: 'format',
139
- tooltip: 'Formatting',
121
+ tooltip: 'Formattazione',
140
122
  items: 'bold italic underline superscript subscript | forecolor backcolor | removeformat'
141
123
  },
142
124
  paragraphgroup: {
143
125
  icon: 'paragraph',
144
- tooltip: 'Paragraph format',
126
+ tooltip: 'Formato paragrafo',
145
127
  items: 'h1 h2 h3 | bullist numlist | alignleft aligncenter alignright alignjustify | indent outdent'
146
128
  },
147
129
  insertgroup: {
148
130
  icon: 'plus',
149
- tooltip: 'Insert',
131
+ tooltip: 'Inserisci',
150
132
  items: 'quickimage media | link charmap nonbreaking | table tableprops tabledelete'
151
133
  }
152
134
  },
153
- formats: {
154
- underline: { inline: 'span', styles: { 'text-decoration': 'underline' }, exact: true },
155
- strikethrough: { inline: 'span', styles: { 'text-decoration': 'line-through' }, exact: true }
156
- },
157
- link_default_target: '_blank',
158
- link_title: true,
159
- link_assume_external_targets: 'https',
135
+ quickbars_insert_toolbar: 'quickimage',
160
136
  link_class_list: [],
161
- }); }
162
- /**
163
- * Extended compact TinyMCE configuration that adds fullscreen support and an insert group.
164
- * Extends `TinymceCompactConfig`.
165
- */
166
- static { this.TinymceCompactExtendedConfig = Object.assign(structuredClone(this.TinymceCompactConfig), {
167
- license_key: 'gpl',
168
- ui_mode: 'split',
169
- plugins: 'advlist anchor autolink autosave autoresize charmap code image insertdatetime fullscreen link lists media table nonbreaking preview quickbars searchreplace visualblocks visualchars',
170
- toolbar: ['undo redo | quickimage insertgroup | formatgroup paragraphgroup | code | fullscreen '],
171
- }); }
172
- /**
173
- * Inject the TinyMCE script tag into the document head if it is not already present.
174
- * @param useCDN - When `true`, loads from the Tiny Cloud CDN; otherwise uses the local asset.
175
- */
176
- static loadTinyMCEScript(useCDN) {
177
- if (typeof document === 'undefined')
178
- return; // SSR: no-op
179
- const url = useCDN === true ? this.CDN_URL : this.LOCAL_URL;
180
- if (!document.querySelector(`script[src="${url}"]`)) {
137
+ }; }
138
+ /** The compact one plus full screen, the insert group and the source view. */
139
+ static { this.COMPACT_EXTENDED = {
140
+ ...TinymceUtils.COMPACT,
141
+ plugins: 'advlist anchor autolink autoresize autosave charmap code fullscreen image'
142
+ + ' insertdatetime link lists media nonbreaking preview quickbars searchreplace table'
143
+ + ' visualblocks visualchars',
144
+ toolbar: ['undo redo | quickimage insertgroup | formatgroup paragraphgroup | code | fullscreen'],
145
+ }; }
146
+ /**
147
+ * The full-page profile.
148
+ * @returns A fresh copy of the configuration, safe to modify.
149
+ */
150
+ static get TinymceConfig() {
151
+ return structuredClone(TinymceUtils.FULL);
152
+ }
153
+ /**
154
+ * The in-form profile.
155
+ * @returns A fresh copy of the configuration, safe to modify.
156
+ */
157
+ static get TinymceCompactConfig() {
158
+ return structuredClone(TinymceUtils.COMPACT);
159
+ }
160
+ /**
161
+ * The in-form profile with full screen and source view.
162
+ * @returns A fresh copy of the configuration, safe to modify.
163
+ */
164
+ static get TinymceCompactExtendedConfig() {
165
+ return structuredClone(TinymceUtils.COMPACT_EXTENDED);
166
+ }
167
+ }
168
+
169
+ /**
170
+ * Loads the self-hosted TinyMCE bundle on demand.
171
+ *
172
+ * TinyMCE is deliberately NOT imported by any module: a static import would pull ~500 kB into
173
+ * whichever chunk referenced it, and the editor is needed by exactly one dialog. The library is
174
+ * copied to `assets/tinymce` by the build (see `angular.json`) and injected here as a plain
175
+ * `<script>` the first time an editor is created, so it costs nothing until then and is served
176
+ * from the browser cache afterwards. Loading it this way also lets TinyMCE resolve its own theme,
177
+ * model, plugins and skin relative to `base_url`, which is how the self-hosted distribution
178
+ * expects to work.
179
+ */
180
+ class TinymceLoaderService {
181
+ /**
182
+ * The absolute URL of the TinyMCE asset folder, resolved against the document base href so the
183
+ * app keeps working when it is served from a sub-path.
184
+ * @returns The base URL, without a trailing slash.
185
+ */
186
+ get baseUrl() {
187
+ return new URL('assets/tinymce', document.baseURI).href.replace(/\/$/, '');
188
+ }
189
+ /**
190
+ * Loads TinyMCE, reusing the script already injected by a previous call.
191
+ * @returns A promise resolving with the global TinyMCE instance.
192
+ */
193
+ load() {
194
+ if (window.tinymce)
195
+ return Promise.resolve(window.tinymce);
196
+ // A failed load clears `pending`, so a later attempt can retry instead of being stuck on the
197
+ // rejected promise forever (e.g. the first open happened while the network was down).
198
+ this.pending ??= new Promise((resolve, reject) => {
181
199
  const script = document.createElement('script');
182
- script.src = url;
200
+ script.src = `${this.baseUrl}/tinymce.min.js`;
201
+ script.async = true;
183
202
  script.referrerPolicy = 'origin';
184
- script.onerror = () => console.error(`Impossibile caricare lo script TinyMCE da: ${url}`);
203
+ script.onload = () => {
204
+ if (window.tinymce) {
205
+ resolve(window.tinymce);
206
+ }
207
+ else {
208
+ this.pending = undefined;
209
+ reject(new Error('TinyMCE caricato ma non disponibile.'));
210
+ }
211
+ };
212
+ script.onerror = () => {
213
+ this.pending = undefined;
214
+ script.remove();
215
+ reject(new Error('Impossibile caricare l\'editor.'));
216
+ };
185
217
  document.head.appendChild(script);
218
+ });
219
+ return this.pending;
220
+ }
221
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: TinymceLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Service }); }
222
+ static { this.ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.3", ngImport: i0, type: TinymceLoaderService }); }
223
+ }
224
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: TinymceLoaderService, decorators: [{
225
+ type: Service
226
+ }] });
227
+
228
+ /**
229
+ * Turns a `<textarea>` into a rich text editor backed by the self-hosted TinyMCE bundle, and wires
230
+ * it to Angular forms as a `ControlValueAccessor`, so `[(ngModel)]`, `required` and the
231
+ * pristine/dirty state keep working exactly as they do on a plain control.
232
+ *
233
+ * The library itself is fetched on demand by <see cref="TinymceLoaderService"/>: nothing about
234
+ * TinyMCE reaches the bundle until an editor is actually created.
235
+ *
236
+ * Usage: `<textarea tinymceEditor [(ngModel)]="item.text" name="text" required></textarea>`
237
+ *
238
+ */
239
+ class TinymceEditorDirective {
240
+ constructor() {
241
+ /** Extra TinyMCE options, merged over (and able to override) the defaults below. */
242
+ this.tinymceConfig = input({}, /* @ts-ignore */
243
+ ...(ngDevMode ? [{ debugName: "tinymceConfig" }] : /* istanbul ignore next */ []));
244
+ /** Whether the toolbar is pinned above the content (`fixed`) or floats on focus (`inline`). */
245
+ this.tinymceToolbarMode = input('fixed', /* @ts-ignore */
246
+ ...(ngDevMode ? [{ debugName: "tinymceToolbarMode" }] : /* istanbul ignore next */ []));
247
+ /**
248
+ * Handler invoked for every image dropped, pasted or picked in the editor. When not provided
249
+ * the upload tab is hidden and only images referenced by URL can be inserted.
250
+ */
251
+ this.tinymceImageUploader = input(undefined, /* @ts-ignore */
252
+ ...(ngDevMode ? [{ debugName: "tinymceImageUploader" }] : /* istanbul ignore next */ []));
253
+ /** Emitted once the editor is up, for callers that want to enable UI only when it is usable. */
254
+ this.ready = output();
255
+ /** Emitted when the editor could not be loaded or initialised. */
256
+ this.failed = output();
257
+ this.host = inject(ElementRef);
258
+ this.loader = inject(TinymceLoaderService);
259
+ this.themeService = inject(ThemeService);
260
+ this.changeDetector = inject(ChangeDetectorRef);
261
+ /** True while the editor is showing itself full screen. */
262
+ this.fullscreen = false;
263
+ /** True once the directive has been destroyed, so a late init resolves into a no-op. */
264
+ this.destroyed = false;
265
+ /**
266
+ * True while the directive itself is pushing a value into the editor. TinyMCE raises the same
267
+ * content events for a programmatic `setContent` as for a keystroke, so without this flag
268
+ * `writeValue` would immediately echo back through `onChange` and mark a freshly loaded form
269
+ * as dirty.
270
+ */
271
+ this.writingValue = false;
272
+ /** The value received before the editor existed, applied as soon as it does. */
273
+ this.value = '';
274
+ this.disabled = false;
275
+ this.onChange = () => { };
276
+ this.onTouched = () => { };
277
+ /**
278
+ * Leaves full screen on Escape, for the keystrokes that happen outside the content: with the
279
+ * classic editor the content is an iframe, and a keydown in there never reaches this document.
280
+ * Bound on the capture phase and stopped, so a dialog hosting the editor does not take the
281
+ * Escape and close, throwing the edit away when the user only meant to leave full screen.
282
+ */
283
+ this.onDocumentKeydown = (event) => {
284
+ if (!this.shouldEscapeLeaveFullscreen(event))
285
+ return;
286
+ event.preventDefault();
287
+ event.stopPropagation();
288
+ this.exitFullscreen();
289
+ };
290
+ }
291
+ /**
292
+ * Loads TinyMCE and initialises the editor over the host textarea.
293
+ * @returns A promise that completes once the editor is ready (or has failed).
294
+ */
295
+ async ngOnInit() {
296
+ try {
297
+ const tinymce = await this.loader.load();
298
+ if (this.destroyed)
299
+ return;
300
+ const dark = this.themeService.getTheme() === 'dark';
301
+ const uploader = this.tinymceImageUploader();
302
+ const inline = this.tinymceToolbarMode() === 'inline';
303
+ // Caught here rather than left to TinyMCE, which would fail deep inside its own setup
304
+ // with a message that says nothing about the actual mistake.
305
+ if (inline && this.host.nativeElement.tagName === 'TEXTAREA') {
306
+ throw new Error('La modalità inline richiede un <div>, non un <textarea>.');
307
+ }
308
+ // TinyMCE ships its language packs outside the npm package, so `it.js` is committed
309
+ // under `src/assets/tinymce/langs/`: the existing `src/assets` build rule publishes it
310
+ // exactly where TinyMCE looks for it, relative to `base_url`.
311
+ const defaults = {
312
+ // Self-hosting TinyMCE 8 requires an explicit license key: without one the editor
313
+ // refuses to start. 'gpl' selects the GPLv2+ terms.
314
+ license_key: 'gpl',
315
+ language: 'it',
316
+ branding: false,
317
+ promotion: false,
318
+ menubar: false,
319
+ statusbar: false,
320
+ resize: false,
321
+ // Pins the toolbar while the container scrolls. In inline mode it is what keeps
322
+ // the floating toolbar attached to the text instead of drifting off with it.
323
+ toolbar_sticky: true,
324
+ // An inline editor takes the size of the element it edits; only the classic one
325
+ // has a box of its own to dimension.
326
+ ...(inline ? {} : { height: 360 }),
327
+ // The dialog body scrolls, and 'split' is what keeps the toolbar menus anchored
328
+ // to the editor while it does: the popup sink is attached next to the editor, so
329
+ // it shares its scrolling ancestry. It does NOT affect the modal dialogs — those
330
+ // always go to <body> — which is why the CDK overlay has to be kept out of the
331
+ // top layer (see OVERLAY_DEFAULT_CONFIG in app.config.ts).
332
+ ui_mode: 'split',
333
+ skin: dark ? 'oxide-dark' : 'oxide',
334
+ content_css: dark ? 'dark' : 'default',
335
+ // Absolute URLs must survive untouched: the content ends up in an e-mail, where a
336
+ // relative image path resolves against nothing.
337
+ convert_urls: false,
338
+ plugins: 'advlist autolink lists link image table charmap searchreplace code fullscreen',
339
+ toolbar: 'undo redo | blocks | bold italic underline | forecolor backcolor'
340
+ + ' | bullist numlist | link image table | removeformat code fullscreen',
341
+ content_style: 'body { font-family: Arial, Helvetica, sans-serif; font-size: 14px; }',
342
+ // Pasted and dropped images go through the same upload path as the image dialog.
343
+ automatic_uploads: !!uploader,
344
+ paste_data_images: !!uploader,
345
+ images_file_types: 'jpeg,jpg,png,gif,webp',
346
+ file_picker_types: uploader ? 'image' : '',
347
+ images_upload_handler: uploader
348
+ ? (blobInfo) => uploader(new File([blobInfo.blob()], blobInfo.filename(), { type: blobInfo.blob().type }))
349
+ : undefined,
350
+ };
351
+ await tinymce.init({
352
+ ...defaults,
353
+ // The caller's profile wins over every default above: that is what the presets in
354
+ // `TinymceUtils` are for.
355
+ ...this.tinymceConfig(),
356
+ // Not negotiable, whatever the profile says. `target` and `base_url` are resolved
357
+ // here and nowhere else, `inline` is the input's job, and replacing `setup` would
358
+ // unhook the editor from the form and leave a ControlValueAccessor that never
359
+ // reports a change.
360
+ target: this.host.nativeElement,
361
+ base_url: this.loader.baseUrl,
362
+ inline,
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.
366
+ editor.on('change input undo redo SetContent', () => {
367
+ if (this.writingValue)
368
+ return;
369
+ this.value = editor.getContent();
370
+ this.onChange(this.value);
371
+ this.changeDetector.markForCheck();
372
+ });
373
+ editor.on('blur', () => {
374
+ this.onTouched();
375
+ this.changeDetector.markForCheck();
376
+ });
377
+ editor.on('FullscreenStateChanged', (event) => {
378
+ this.handleFullscreenChanged(event.state === true);
379
+ });
380
+ // The content of a classic editor lives in an iframe, so its keystrokes are
381
+ // only visible from the editor itself.
382
+ editor.on('keydown', (event) => {
383
+ if (!this.shouldEscapeLeaveFullscreen(event))
384
+ return;
385
+ event.preventDefault();
386
+ event.stopPropagation();
387
+ this.exitFullscreen();
388
+ });
389
+ editor.on('init', () => {
390
+ this.editor = editor;
391
+ this.applyValue(this.value);
392
+ this.applyDisabled(this.disabled);
393
+ this.ready.emit(editor);
394
+ this.changeDetector.markForCheck();
395
+ });
396
+ },
397
+ });
398
+ }
399
+ catch (error) {
400
+ if (this.destroyed)
401
+ return;
402
+ this.failed.emit(error instanceof Error ? error : new Error(String(error)));
403
+ this.changeDetector.markForCheck();
404
+ }
405
+ }
406
+ /**
407
+ * Tears the editor down. TinyMCE keeps global state per instance, so leaving it behind when a
408
+ * dialog closes leaks both DOM and editor registrations.
409
+ * @returns void
410
+ */
411
+ ngOnDestroy() {
412
+ this.destroyed = true;
413
+ // Removing the editor does not raise the full-screen event, so the session is closed by
414
+ // hand here: the Escape listener would otherwise stay attached to the document forever.
415
+ this.releaseFullscreen();
416
+ this.editor?.remove();
417
+ this.editor = undefined;
418
+ }
419
+ /**
420
+ * Decides whether an Escape press means "leave full screen": it does whenever the editor is
421
+ * full screen, full stop. While full screen the editor owns Escape, and the press is stopped
422
+ * here so it can never reach the dialog hosting it — leaving full screen must not also throw
423
+ * away what is being written.
424
+ * @param event The keyboard event, from the document or from the editor's content.
425
+ * @returns True when full screen should be left.
426
+ */
427
+ shouldEscapeLeaveFullscreen(event) {
428
+ return event.key === 'Escape' && this.fullscreen;
429
+ }
430
+ /**
431
+ * Asks the editor to leave full screen. Safe to call when it is not in full screen.
432
+ * @returns void
433
+ */
434
+ exitFullscreen() {
435
+ if (!this.fullscreen)
436
+ return;
437
+ this.editor?.execCommand('mceFullScreen');
438
+ }
439
+ /**
440
+ * Attaches or detaches everything that only makes sense while the editor is full screen.
441
+ * @param state True when the editor has just entered full screen.
442
+ * @returns void
443
+ */
444
+ handleFullscreenChanged(state) {
445
+ if (state === this.fullscreen)
446
+ return;
447
+ this.fullscreen = state;
448
+ if (state) {
449
+ document.addEventListener('keydown', this.onDocumentKeydown, true);
450
+ }
451
+ else {
452
+ this.releaseFullscreen();
453
+ }
454
+ this.changeDetector.markForCheck();
455
+ }
456
+ /**
457
+ * Detaches the listener that only makes sense while the editor is full screen.
458
+ * @returns void
459
+ */
460
+ releaseFullscreen() {
461
+ document.removeEventListener('keydown', this.onDocumentKeydown, true);
462
+ this.fullscreen = false;
463
+ }
464
+ /**
465
+ * Pushes a value coming from the form into the editor.
466
+ * @param value The new content, or null/undefined for an empty editor.
467
+ * @returns void
468
+ */
469
+ writeValue(value) {
470
+ this.value = value ?? '';
471
+ this.applyValue(this.value);
472
+ }
473
+ /**
474
+ * Registers the callback used to report content changes to the form.
475
+ * @param fn The callback supplied by Angular forms.
476
+ * @returns void
477
+ */
478
+ registerOnChange(fn) {
479
+ this.onChange = fn;
480
+ }
481
+ /**
482
+ * Registers the callback used to report the first blur to the form.
483
+ * @param fn The callback supplied by Angular forms.
484
+ * @returns void
485
+ */
486
+ registerOnTouched(fn) {
487
+ this.onTouched = fn;
488
+ }
489
+ /**
490
+ * Enables or disables editing.
491
+ * @param isDisabled True to switch the editor to read-only.
492
+ * @returns void
493
+ */
494
+ setDisabledState(isDisabled) {
495
+ this.disabled = isDisabled;
496
+ this.applyDisabled(isDisabled);
497
+ }
498
+ /**
499
+ * Writes content into the editor when it exists, guarding against the echo described on
500
+ * <see cref="writingValue"/>.
501
+ * @param value The content to write.
502
+ * @returns void
503
+ */
504
+ applyValue(value) {
505
+ const editor = this.editor;
506
+ if (!editor)
507
+ return;
508
+ // Comparing with the serialized content avoids resetting the caret on every form patch
509
+ // that did not actually change anything.
510
+ if (editor.getContent() === value)
511
+ return;
512
+ this.writingValue = true;
513
+ try {
514
+ editor.setContent(value);
186
515
  }
516
+ finally {
517
+ this.writingValue = false;
518
+ }
519
+ }
520
+ /**
521
+ * Applies the disabled state to the editor when it exists.
522
+ * @param isDisabled True to switch the editor to read-only.
523
+ * @returns void
524
+ */
525
+ applyDisabled(isDisabled) {
526
+ this.editor?.mode.set(isDisabled ? 'readonly' : 'design');
187
527
  }
528
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: TinymceEditorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
529
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: TinymceEditorDirective, isStandalone: true, selector: "textarea[tinymceEditor], div[tinymceEditor]", inputs: { tinymceConfig: { classPropertyName: "tinymceConfig", publicName: "tinymceConfig", isSignal: true, isRequired: false, transformFunction: null }, tinymceToolbarMode: { classPropertyName: "tinymceToolbarMode", publicName: "tinymceToolbarMode", isSignal: true, isRequired: false, transformFunction: null }, tinymceImageUploader: { classPropertyName: "tinymceImageUploader", publicName: "tinymceImageUploader", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ready: "ready", failed: "failed" }, providers: [{
530
+ provide: NG_VALUE_ACCESSOR,
531
+ useExisting: forwardRef(() => TinymceEditorDirective),
532
+ multi: true
533
+ }], ngImport: i0 }); }
188
534
  }
535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: TinymceEditorDirective, decorators: [{
536
+ type: Directive,
537
+ args: [{
538
+ // Both hosts are accepted because the two modes need different ones: the classic editor
539
+ // replaces a textarea, the inline editor edits a div in place.
540
+ selector: 'textarea[tinymceEditor], div[tinymceEditor]',
541
+ providers: [{
542
+ provide: NG_VALUE_ACCESSOR,
543
+ useExisting: forwardRef(() => TinymceEditorDirective),
544
+ multi: true
545
+ }]
546
+ }]
547
+ }], propDecorators: { tinymceConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "tinymceConfig", required: false }] }], tinymceToolbarMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "tinymceToolbarMode", required: false }] }], tinymceImageUploader: [{ type: i0.Input, args: [{ isSignal: true, alias: "tinymceImageUploader", required: false }] }], ready: [{ type: i0.Output, args: ["ready"] }], failed: [{ type: i0.Output, args: ["failed"] }] } });
189
548
 
190
- class FullScreenEditorComponent {
549
+ /**
550
+ * A dialog that is nothing but an editor: the caller hands it a text and gets the edited one
551
+ * back through {@link saving}.
552
+ *
553
+ * The editor is {@link TinymceEditorDirective} on a plain `<textarea>`, so this dialog costs
554
+ * exactly what any other editor in the application costs — the TinyMCE bundle is fetched on
555
+ * first use and nothing about it reaches the initial chunk.
556
+ */
557
+ class TinyMceEditorComponent {
191
558
  constructor() {
192
559
  /** Emitted with the edited text when the user saves. */
193
560
  this.saving = output();
@@ -203,17 +570,17 @@ class FullScreenEditorComponent {
203
570
  ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
204
571
  /** Current editor content, kept as a plain field for [(ngModel)] two-way binding. */
205
572
  this.text = '';
206
- /** TinyMCE editor configuration. */
573
+ /** The profile handed to the editor directive, merged over its defaults. */
207
574
  this.tinymceConfig = {};
208
575
  const data = this.dialogData();
209
576
  this.text = data.text;
210
- if (data.configuration) {
211
- this.tinymceConfig = { ...data.configuration, license_key: 'gpl' };
212
- }
213
- else {
214
- this.tinymceConfig = SystemUtils.clone(TinymceUtils.TinymceCompactExtendedConfig);
215
- }
216
- this.tinymceConfig['toolbar'] = ['undo redo | formatgroup paragraphgroup insertgroup | code openCodeMirrorButton'];
577
+ // The accessor already returns a private copy, so the toolbar override below cannot leak
578
+ // into the preset shared with the rest of the application.
579
+ this.tinymceConfig = data.configuration
580
+ ? { ...data.configuration }
581
+ : TinymceUtils.TinymceCompactExtendedConfig;
582
+ // No full screen: the editor already owns the whole dialog.
583
+ this.tinymceConfig.toolbar = ['undo redo | quickimage insertgroup | formatgroup paragraphgroup | code'];
217
584
  this.disabled.set(data.disabled ?? false);
218
585
  }
219
586
  /**
@@ -225,13 +592,13 @@ class FullScreenEditorComponent {
225
592
  this.dialogRef.close();
226
593
  }, 500);
227
594
  }
228
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FullScreenEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
229
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: FullScreenEditorComponent, isStandalone: true, selector: "ng-component", outputs: { saving: "saving" }, ngImport: i0, template: "<mat-dialog-content style=\"padding: 10px 10px 0 10px\">\r\n <editor style=\"height: 100%;\" [init]=\"tinymceConfig\" class=\"full-screen-editor\" [disabled]=\"disabled()\"\r\n [(ngModel)]=\"text\" licenseKey=\"gpl\">\r\n </editor>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start center\" fxFill>\r\n <div fxFlex=\"50\">\r\n @if(dialogData().onShowInfo) {\r\n <button mat-stroked-button (click)=\"dialogData().onShowInfo()\">{{dialogData().infoButtonLabel ?? 'Informazioni'}}\r\n </button>\r\n }\r\n </div>\r\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\r\n @if (disabled()) {\r\n <button mat-stroked-button [mat-dialog-close]=\"true\">Chiudi</button>\r\n } @else {\r\n <button mat-flat-button (click)=\"ok()\">Salva</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\r\n }\r\n </div>\r\n </div>\r\n</mat-dialog-actions>\r\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: "component", type: EditorComponent, selector: "editor", inputs: ["cloudChannel", "apiKey", "licenseKey", "init", "id", "initialValue", "outputFormat", "inline", "tagName", "plugins", "toolbar", "modelEvents", "allowedEvents", "ignoreEvents", "readonly", "disabled"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "ngmodule", type: FlexLayoutModule }, { kind: "directive", type: i2.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: i2.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: i2.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: i2.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: i2.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: i3.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 }); }
595
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: TinyMceEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
596
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: TinyMceEditorComponent, isStandalone: true, selector: "ng-component", outputs: { saving: "saving" }, ngImport: i0, template: "<mat-dialog-content style=\"padding: 10px 10px 0 10px\">\r\n <textarea tinymceEditor class=\"full-screen-editor\" name=\"text\" [tinymceConfig]=\"tinymceConfig\"\r\n [disabled]=\"disabled()\" [(ngModel)]=\"text\"></textarea>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start center\" fxFill>\r\n <div fxFlex=\"50\">\r\n @if(dialogData().onShowInfo) {\r\n <button mat-stroked-button (click)=\"dialogData().onShowInfo()\">{{dialogData().infoButtonLabel ?? 'Informazioni'}}\r\n </button>\r\n }\r\n </div>\r\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\r\n @if (disabled()) {\r\n <button mat-stroked-button [mat-dialog-close]=\"true\">Chiudi</button>\r\n } @else {\r\n <button mat-flat-button (click)=\"ok()\">Salva</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\r\n }\r\n </div>\r\n </div>\r\n</mat-dialog-actions>\r\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: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "ngmodule", type: FlexLayoutModule }, { kind: "directive", type: i2.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: i2.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: i2.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: i2.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: i2.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: i3.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 }); }
230
597
  }
231
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FullScreenEditorComponent, decorators: [{
598
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: TinyMceEditorComponent, decorators: [{
232
599
  type: Component,
233
- args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatDialogContent, EditorComponent, FormsModule, MatDialogActions, FlexLayoutModule,
234
- MatButtonModule, MatDialogClose], template: "<mat-dialog-content style=\"padding: 10px 10px 0 10px\">\r\n <editor style=\"height: 100%;\" [init]=\"tinymceConfig\" class=\"full-screen-editor\" [disabled]=\"disabled()\"\r\n [(ngModel)]=\"text\" licenseKey=\"gpl\">\r\n </editor>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start center\" fxFill>\r\n <div fxFlex=\"50\">\r\n @if(dialogData().onShowInfo) {\r\n <button mat-stroked-button (click)=\"dialogData().onShowInfo()\">{{dialogData().infoButtonLabel ?? 'Informazioni'}}\r\n </button>\r\n }\r\n </div>\r\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\r\n @if (disabled()) {\r\n <button mat-stroked-button [mat-dialog-close]=\"true\">Chiudi</button>\r\n } @else {\r\n <button mat-flat-button (click)=\"ok()\">Salva</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\r\n }\r\n </div>\r\n </div>\r\n</mat-dialog-actions>\r\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"] }]
600
+ args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatDialogContent, TinymceEditorDirective, FormsModule, MatDialogActions, FlexLayoutModule,
601
+ MatButtonModule, MatDialogClose], template: "<mat-dialog-content style=\"padding: 10px 10px 0 10px\">\r\n <textarea tinymceEditor class=\"full-screen-editor\" name=\"text\" [tinymceConfig]=\"tinymceConfig\"\r\n [disabled]=\"disabled()\" [(ngModel)]=\"text\"></textarea>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <div fxLayout=\"row\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start center\" fxFill>\r\n <div fxFlex=\"50\">\r\n @if(dialogData().onShowInfo) {\r\n <button mat-stroked-button (click)=\"dialogData().onShowInfo()\">{{dialogData().infoButtonLabel ?? 'Informazioni'}}\r\n </button>\r\n }\r\n </div>\r\n <div fxFlex=\"50\" fxLayoutAlign=\"end\">\r\n @if (disabled()) {\r\n <button mat-stroked-button [mat-dialog-close]=\"true\">Chiudi</button>\r\n } @else {\r\n <button mat-flat-button (click)=\"ok()\">Salva</button>\r\n <button mat-stroked-button [mat-dialog-close]=\"true\">Annulla</button>\r\n }\r\n </div>\r\n </div>\r\n</mat-dialog-actions>\r\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"] }]
235
602
  }], ctorParameters: () => [], propDecorators: { saving: [{ type: i0.Output, args: ["saving"] }] } });
236
603
 
237
604
  /*
@@ -242,5 +609,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
242
609
  * Generated bundle index. Do not edit.
243
610
  */
244
611
 
245
- export { FullScreenEditorComponent, TinymceUtils };
612
+ export { TinyMceEditorComponent, TinymceEditorDirective, TinymceLoaderService, TinymceUtils };
246
613
  //# sourceMappingURL=arsedizioni-ars-utils-ui.tinymce.mjs.map