@arsedizioni/ars-utils 22.5.9 → 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.
@@ -5,7 +5,7 @@ import { MatExpansionPanel } from '@angular/material/expansion';
5
5
  import { MatInput } from '@angular/material/input';
6
6
  import { MatPaginator, PageEvent } from '@angular/material/paginator';
7
7
  import { MatDrawer } from '@angular/material/sidenav';
8
- import { ClipperSearchFacetsSnapshot, ClipperSearchFacet, ClipperSearchFacetGroup, ClipperService, ClipperDocumentInfo, ClipperSearchParams, ClipperQueryReferencesMode, ClipperModule, ClipperModel, ClipperSearchCalendarSnapshotMonth, ClipperSearchCalendarSnapshotResult, ClipperSelectionMode, ClipperSearchResult, ClipperSort, ClipperUserSearch, SectorInfo, ClipperUserInfo, EditDialogCompleted, ClipperContactInfo, ClipperDocumentRelevants, ClipperDocumentAnchorInfo, ClipperDocumentNote, EditDialogData } from '@arsedizioni/ars-utils/clipper.common';
8
+ import { ClipperSearchFacetsSnapshot, ClipperSearchFacet, ClipperSearchFacetGroup, ClipperService, ClipperDocumentInfo, ClipperSearchParams, ClipperQueryReferencesMode, ClipperModule, ClipperModel, ClipperSearchCalendarSnapshotMonth, ClipperSearchCalendarSnapshotResult, ClipperSelectionMode, ClipperSearchResult, ClipperSort, ClipperUserSearch, SectorInfo, ClipperUserInfo, ClipperDocumentRelevants, ClipperDocumentAnchorInfo } from '@arsedizioni/ars-utils/clipper.common';
9
9
  import { BroadcastService, DateInterval, ThemeService, ScreenService, SelectableModel, NameValueItem, INode, ThemeType } from '@arsedizioni/ars-utils/core';
10
10
  import { CalendarEmptyHeader, ButtonSelectorComponent, ChipsSelectorComponent } from '@arsedizioni/ars-utils/ui.controls';
11
11
  import { BreakpointObserver } from '@angular/cdk/layout';
@@ -13,7 +13,6 @@ import { Clipboard } from '@angular/cdk/clipboard';
13
13
  import { ApplicationDialogService } from '@arsedizioni/ars-utils/ui.application';
14
14
  import { SendToPopulateData } from '@arsedizioni/ars-utils/ui';
15
15
  import { MatCalendar, MatCalendarCellClassFunction } from '@angular/material/datepicker';
16
- import { NgForm } from '@angular/forms';
17
16
  import { MatSelectionList } from '@angular/material/list';
18
17
  import { MatMenuTrigger, MatMenu } from '@angular/material/menu';
19
18
 
@@ -79,8 +78,6 @@ declare class ClipperDocumentManager {
79
78
  readonly clipperService: ClipperService;
80
79
  protected readonly broadcastService: BroadcastService;
81
80
  protected readonly dialogService: ApplicationDialogService;
82
- protected readonly canUseArchive: _angular_core.WritableSignal<boolean>;
83
- protected readonly canUseNotes: _angular_core.WritableSignal<boolean>;
84
81
  protected readonly canHandleTooManyResults: _angular_core.WritableSignal<boolean>;
85
82
  protected readonly canPopulateContacts: _angular_core.WritableSignal<boolean>;
86
83
  /**
@@ -100,16 +97,6 @@ declare class ClipperDocumentManager {
100
97
  * @param item - The document whose deadline to export.
101
98
  */
102
99
  exportDeadline(item: ClipperDocumentInfo): void;
103
- /**
104
- * Sends a broadcast message to add the given documents to the archive.
105
- * @param items - The list of documents to archive.
106
- */
107
- addToArchive(items: ClipperDocumentInfo[]): void;
108
- /**
109
- * Sends a broadcast message to create a new calendar deadline from the given document.
110
- * @param item - The document to add to the calendar.
111
- */
112
- addToCalendar(item: ClipperDocumentInfo): void;
113
100
  /**
114
101
  * Sends a broadcast message to add the given documents to the working-documents set.
115
102
  * @param items - The list of documents to add.
@@ -120,11 +107,6 @@ declare class ClipperDocumentManager {
120
107
  * @param items - The list of documents to add.
121
108
  */
122
109
  addItemsToBag(items: ClipperDocumentInfo[]): void;
123
- /**
124
- * Sends a broadcast message to add custom notes to the given document.
125
- * @param item - The document to add notes to.
126
- */
127
- addItemNotes(item: ClipperDocumentInfo): void;
128
110
  /**
129
111
  * Copies the document's metadata (ID, titles, number, date, origin) as a tab-separated string to the clipboard.
130
112
  * @param item - The document whose metadata to copy.
@@ -748,56 +730,6 @@ declare class ClipperBrowserDialogComponent {
748
730
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ClipperBrowserDialogComponent, "ng-component", never, {}, {}, never, never, true, never>;
749
731
  }
750
732
 
751
- declare class ClipperContactEditComponent {
752
- private clipperService;
753
- private dialogService;
754
- private dialogRef;
755
- private dialogData;
756
- protected readonly f: _angular_core.Signal<NgForm>;
757
- readonly done: _angular_core.OutputEmitterRef<EditDialogCompleted<ClipperContactInfo>>;
758
- protected readonly dialogTitle: string;
759
- protected readonly isNew: _angular_core.WritableSignal<boolean>;
760
- protected item: ClipperContactInfo;
761
- protected readonly availableTeams: _angular_core.WritableSignal<NameValueItem<string>[]>;
762
- protected selectedTeam: NameValueItem<string>;
763
- constructor();
764
- /**
765
- * Loads the list of available teams from the server and populates the team selector.
766
- * Pre-selects the team that matches the current contact's team id, falling back to 'Personale'.
767
- */
768
- private loadTeams;
769
- /**
770
- * Persists the current contact to the server.
771
- * Closes the dialog without saving when editing an existing contact whose form is unchanged.
772
- */
773
- protected save(): void;
774
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClipperContactEditComponent, never>;
775
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<ClipperContactEditComponent, "ng-component", never, {}, { "done": "done"; }, never, never, true, never>;
776
- }
777
-
778
- declare class ClipperContactsSelector {
779
- /**
780
- * Builds an HTML string representing a list of email addresses separated by line breaks.
781
- * @param emails - A semicolon-separated string of email addresses, or undefined.
782
- * @returns An HTML string with each address wrapped in a `<span>` tag.
783
- */
784
- private static buildEmailsHtml;
785
- /**
786
- * Builds the HTML row template used to display a contact inside the selection dialog.
787
- * @param item - The contact data to render.
788
- * @returns An HTML string representing the contact row.
789
- */
790
- private static buildContactTemplate;
791
- /**
792
- * Opens the contacts selection/management dialog and wires up all interaction events.
793
- * @param injector - The Angular injector used to resolve services within the dialog context.
794
- * @param canAppend - When true, the dialog allows adding new contacts.
795
- * @param canEdit - When true, the dialog allows editing and deleting contacts.
796
- * @param onSelect - Optional callback invoked with the selection result when the user confirms.
797
- */
798
- static Show(injector: Injector, canAppend?: boolean, canEdit?: boolean, onSelect?: (result: unknown) => void): void;
799
- }
800
-
801
733
  interface ClipperDocumentDialogData {
802
734
  selectionMode?: ClipperSelectionMode;
803
735
  selectableModules?: ClipperModule[];
@@ -805,8 +737,6 @@ interface ClipperDocumentDialogData {
805
737
  query?: string;
806
738
  queryChunks?: string;
807
739
  theme?: ThemeType;
808
- canUseArchive?: boolean;
809
- canUseNotes?: boolean;
810
740
  canHandleTooManyResults?: boolean;
811
741
  }
812
742
  declare class ClipperDocumentComponent extends ClipperDocumentManager {
@@ -1072,9 +1002,6 @@ declare class ClipperDocumentMenuComponent {
1072
1002
  readonly isLawInForce: _angular_core.InputSignal<boolean>;
1073
1003
  readonly canPrint: _angular_core.InputSignal<boolean>;
1074
1004
  readonly canFind: _angular_core.InputSignal<boolean>;
1075
- readonly canUseCalendar: _angular_core.InputSignal<boolean>;
1076
- readonly canUseArchive: _angular_core.InputSignal<boolean>;
1077
- readonly canUseNotes: _angular_core.InputSignal<boolean>;
1078
1005
  readonly canUseAIAssistant: _angular_core.InputSignal<boolean>;
1079
1006
  protected readonly canUseAIEditor: boolean;
1080
1007
  readonly canUseRS: _angular_core.InputSignal<boolean>;
@@ -1087,13 +1014,7 @@ declare class ClipperDocumentMenuComponent {
1087
1014
  protected readonly canOpen: _angular_core.Signal<boolean>;
1088
1015
  /** `true` when at least one item can be sent by email. */
1089
1016
  protected readonly canSendByEmail: _angular_core.Signal<boolean>;
1090
- /** `true` when custom notes can be added to the single selected document. */
1091
- protected readonly canAddNotes: _angular_core.Signal<boolean>;
1092
- /** `true` when archive access is enabled and there is at least one selected item. */
1093
- protected readonly canAddToArchive: _angular_core.Signal<boolean>;
1094
- /** `true` when all selected items are deadline/alert documents and calendar is enabled. */
1095
- protected readonly canAddToCalendar: _angular_core.Signal<boolean>;
1096
- /** `true` when all selected items can be exported as an ICS calendar file. */
1017
+ /** `true` when all selected items are deadline/alert documents and can travel as an ICS file. */
1097
1018
  protected readonly canExportCalendar: _angular_core.Signal<boolean>;
1098
1019
  /** `true` when the selection contains non-Coordinamento items that can be added to working documents. */
1099
1020
  protected readonly canAddToWorkingDocuments: _angular_core.Signal<boolean>;
@@ -1155,113 +1076,7 @@ declare class ClipperDocumentMenuComponent {
1155
1076
  */
1156
1077
  protected openReferences(item: ClipperDocumentInfo | undefined, mode: number): void;
1157
1078
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClipperDocumentMenuComponent, never>;
1158
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<ClipperDocumentMenuComponent, "clipper-document-menu", never, { "useSelections": { "alias": "useSelections"; "required": false; "isSignal": true; }; "selectionSource": { "alias": "selectionSource"; "required": false; "isSignal": true; }; "parent": { "alias": "parent"; "required": true; "isSignal": true; }; "item": { "alias": "item"; "required": false; "isSignal": true; }; "isReference": { "alias": "isReference"; "required": false; "isSignal": true; }; "isReadable": { "alias": "isReadable"; "required": false; "isSignal": true; }; "isReadableModel": { "alias": "isReadableModel"; "required": false; "isSignal": true; }; "isLawInForce": { "alias": "isLawInForce"; "required": false; "isSignal": true; }; "canPrint": { "alias": "canPrint"; "required": false; "isSignal": true; }; "canFind": { "alias": "canFind"; "required": false; "isSignal": true; }; "canUseCalendar": { "alias": "canUseCalendar"; "required": false; "isSignal": true; }; "canUseArchive": { "alias": "canUseArchive"; "required": false; "isSignal": true; }; "canUseNotes": { "alias": "canUseNotes"; "required": false; "isSignal": true; }; "canUseAIAssistant": { "alias": "canUseAIAssistant"; "required": false; "isSignal": true; }; "canUseRS": { "alias": "canUseRS"; "required": false; "isSignal": true; }; "canOpenDocument": { "alias": "canOpenDocument"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1159
- }
1160
-
1161
- declare class ClipperNoteBadgeComponent {
1162
- private readonly themeService;
1163
- private readonly injector;
1164
- private readonly clipperService;
1165
- private readonly broadcastService;
1166
- private readonly dialogService;
1167
- private readonly destroyRef;
1168
- private readonly overlay;
1169
- private overlayRef;
1170
- private resizeSub;
1171
- private readonly viewContainerRef;
1172
- readonly populateContacts: _angular_core.OutputEmitterRef<SendToPopulateData>;
1173
- private readonly popupTpl;
1174
- readonly note: _angular_core.ModelSignal<ClipperDocumentNote>;
1175
- private readonly theme;
1176
- /**
1177
- * Badge background colour, blended from the note colour and the active theme.
1178
- * Recomputes automatically whenever the theme or the note colour changes.
1179
- */
1180
- protected readonly backgroundColor: _angular_core.Signal<string>;
1181
- protected readonly trackingUnopenedCount: _angular_core.Signal<number>;
1182
- protected readonly trackingOpenedCount: _angular_core.Signal<number>;
1183
- protected readonly totalTrackings: _angular_core.Signal<number>;
1184
- constructor();
1185
- /**
1186
- * Opens the note-details popup positioned near the mouse cursor.
1187
- * Stops event propagation to avoid triggering parent click handlers.
1188
- * @param event - The mouse event used to determine the popup position.
1189
- */
1190
- protected showPopup(event: MouseEvent): void;
1191
- /**
1192
- * Closes the note-details popup and cleans up overlay resources.
1193
- * @param event - Optional mouse event; when provided, propagation is stopped.
1194
- */
1195
- protected closePopup(event?: MouseEvent): void;
1196
- /**
1197
- * Opens the note-edit dialog pre-populated with the current note data.
1198
- * On confirmation, updates the model and broadcasts the change.
1199
- * Stops event propagation to avoid triggering parent click handlers.
1200
- * @param event - The mouse event that triggered the edit action.
1201
- */
1202
- protected edit(event: MouseEvent): void;
1203
- /**
1204
- * Opens a confirmation dialog and, on confirmation, deletes the note via the service.
1205
- * Broadcasts the deletion and closes the popup on success.
1206
- * Stops event propagation to avoid triggering parent click handlers.
1207
- * @param event - The mouse event that triggered the delete action.
1208
- */
1209
- protected delete(event: MouseEvent): void;
1210
- /**
1211
- * Opens the send-by-email dialog for the document linked to this note.
1212
- * On confirmation, sends a notification via the service and updates tracking data.
1213
- * Stops event propagation to avoid triggering parent click handlers.
1214
- * @param event - The mouse event that triggered the send action.
1215
- */
1216
- protected sendTo(event: MouseEvent): void;
1217
- /**
1218
- * Opens a confirmation dialog and, on confirmation, resends the email notifications
1219
- * associated with this note.
1220
- * Stops event propagation to avoid triggering parent click handlers.
1221
- * @param event - The mouse event that triggered the resend action.
1222
- * @param notifyIfNotOpen - When `true`, only recipients who have not yet opened the previous email are notified.
1223
- */
1224
- protected sendAgain(event: MouseEvent, notifyIfNotOpen: boolean): void;
1225
- /**
1226
- * Fetches the latest tracking data for the note from the server and updates the model.
1227
- * Stops event propagation to avoid triggering parent click handlers.
1228
- * @param event - The mouse event that triggered the refresh action.
1229
- */
1230
- protected refresh(event: MouseEvent): void;
1231
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClipperNoteBadgeComponent, never>;
1232
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<ClipperNoteBadgeComponent, "clipper-note-badge", never, { "note": { "alias": "note"; "required": true; "isSignal": true; }; }, { "populateContacts": "populateContacts"; "note": "noteChange"; }, never, never, true, never>;
1233
- }
1234
-
1235
- declare class ClipperNoteEditComponent {
1236
- readonly done: _angular_core.OutputEmitterRef<ClipperDocumentNote>;
1237
- private readonly dialogService;
1238
- protected readonly dialogData: EditDialogData<ClipperDocumentNote>;
1239
- protected readonly dialogTitle: _angular_core.WritableSignal<string>;
1240
- private readonly clipperService;
1241
- protected readonly colors: NameValueItem<string>[];
1242
- protected readonly isNew: _angular_core.WritableSignal<boolean>;
1243
- protected readonly availableTeams: _angular_core.WritableSignal<NameValueItem<string>[]>;
1244
- protected selectedTeam: NameValueItem<string>;
1245
- protected item: ClipperDocumentNote;
1246
- constructor();
1247
- /**
1248
- * Returns the display name for the given colour value.
1249
- * @param value - The hex/CSS colour string to look up.
1250
- * @returns The human-readable colour name, or the raw value when not found.
1251
- */
1252
- protected colorName(value: string): string;
1253
- /**
1254
- * Loads the teams available for shared-workspace notes and populates the teams dropdown.
1255
- * Pre-selects the team matching the current item's teamId, defaulting to "Personale".
1256
- */
1257
- private loadTeams;
1258
- /**
1259
- * Saves the note via the service and emits the result through the `done` output.
1260
- * For new notes, assigns the selected team before saving.
1261
- */
1262
- protected ok(): void;
1263
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClipperNoteEditComponent, never>;
1264
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<ClipperNoteEditComponent, "ng-component", never, {}, { "done": "done"; }, never, never, true, never>;
1079
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ClipperDocumentMenuComponent, "clipper-document-menu", never, { "useSelections": { "alias": "useSelections"; "required": false; "isSignal": true; }; "selectionSource": { "alias": "selectionSource"; "required": false; "isSignal": true; }; "parent": { "alias": "parent"; "required": true; "isSignal": true; }; "item": { "alias": "item"; "required": false; "isSignal": true; }; "isReference": { "alias": "isReference"; "required": false; "isSignal": true; }; "isReadable": { "alias": "isReadable"; "required": false; "isSignal": true; }; "isReadableModel": { "alias": "isReadableModel"; "required": false; "isSignal": true; }; "isLawInForce": { "alias": "isLawInForce"; "required": false; "isSignal": true; }; "canPrint": { "alias": "canPrint"; "required": false; "isSignal": true; }; "canFind": { "alias": "canFind"; "required": false; "isSignal": true; }; "canUseAIAssistant": { "alias": "canUseAIAssistant"; "required": false; "isSignal": true; }; "canUseRS": { "alias": "canUseRS"; "required": false; "isSignal": true; }; "canOpenDocument": { "alias": "canOpenDocument"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1265
1080
  }
1266
1081
 
1267
1082
  interface ClipperReferencesDialogData {
@@ -1270,7 +1085,6 @@ interface ClipperReferencesDialogData {
1270
1085
  anchorTitle?: string;
1271
1086
  documentId: string;
1272
1087
  model: number;
1273
- canUseArchive?: boolean;
1274
1088
  canHandleTooManyResults?: boolean;
1275
1089
  }
1276
1090
  interface ClipperReferenceDialogResult {
@@ -1450,13 +1264,11 @@ declare class ClipperDocumentsUtils {
1450
1264
  * @param selectionMode - The Clipper selection mode to activate inside the viewer.
1451
1265
  * @param selectableModules - The list of Clipper modules available for selection.
1452
1266
  * @param theme - The UI theme to apply. Defaults to the system theme.
1453
- * @param canUseArchive - When `true`, archive access is enabled inside the viewer.
1454
- * @param canUseNotes - When `true`, notes access is enabled inside the viewer.
1455
1267
  * @param canHandleTooManyResults - When `true`, the component handles oversized result sets.
1456
1268
  * @param replaceUrl - When provided, after the dialog closes the method calls `window.close()`
1457
1269
  * if the page was opened by another window, or navigates to this URL otherwise.
1458
1270
  */
1459
- static openDocument(injector: Injector, documentId: string, query?: string, queryChunks?: string, selectionMode?: ClipperSelectionMode, selectableModules?: ClipperModule[], theme?: ThemeType, canUseArchive?: boolean, canUseNotes?: boolean, canHandleTooManyResults?: boolean, replaceUrl?: string): void;
1271
+ static openDocument(injector: Injector, documentId: string, query?: string, queryChunks?: string, selectionMode?: ClipperSelectionMode, selectableModules?: ClipperModule[], theme?: ThemeType, canHandleTooManyResults?: boolean, replaceUrl?: string): void;
1460
1272
  /**
1461
1273
  * Extracts the display title from a full document title by stripping any trailing `[...]` suffix.
1462
1274
  * @param title - The full document title, which may contain a bracketed qualifier.
@@ -1465,5 +1277,5 @@ declare class ClipperDocumentsUtils {
1465
1277
  static parseDocumentTitle(title: string): string;
1466
1278
  }
1467
1279
 
1468
- export { ClipperBrowserComponent, ClipperBrowserDialogComponent, ClipperContactEditComponent, ClipperContactsSelector, ClipperDocumentComponent, ClipperDocumentIndexComponent, ClipperDocumentManager, ClipperDocumentMenuComponent, ClipperDocumentsUtils, ClipperNoteBadgeComponent, ClipperNoteEditComponent, ClipperReferencesComponent, ClipperSearchCalendarComponent, ClipperSearchFacetsComponent, ClipperSearchFreeTextHelpComponent, ClipperSearchFreeTextQueryBuilderComponent, ClipperSearchResultItemComponent, ClipperSearchResultItemDisplayMode, ClipperSearchResultManager };
1280
+ export { ClipperBrowserComponent, ClipperBrowserDialogComponent, ClipperDocumentComponent, ClipperDocumentIndexComponent, ClipperDocumentManager, ClipperDocumentMenuComponent, ClipperDocumentsUtils, ClipperReferencesComponent, ClipperSearchCalendarComponent, ClipperSearchFacetsComponent, ClipperSearchFreeTextHelpComponent, ClipperSearchFreeTextQueryBuilderComponent, ClipperSearchResultItemComponent, ClipperSearchResultItemDisplayMode, ClipperSearchResultManager };
1469
1281
  export type { ClipperBrowserDialogData, ClipperDocumentDialogData, ClipperDocumentIndexDialogData, ClipperDocumentIndexDialogResult, ClipperReferenceDialogResult, ClipperReferencesDialogData, SearchFreeTextQueryParams };
@@ -1,63 +1,275 @@
1
+ import { RawEditorOptions, TinyMCE, Editor } from 'tinymce';
1
2
  import * as _angular_core from '@angular/core';
3
+ import { OnInit, OnDestroy } from '@angular/core';
4
+ import { ControlValueAccessor } from '@angular/forms';
2
5
 
6
+ /**
7
+ * The editor profiles the applications ask for, ready to be handed to
8
+ * `[tinymceConfig]` on {@link TinymceEditorDirective}.
9
+ *
10
+ * They describe **what the editor offers** — plugins, toolbar, formats, link and image
11
+ * behaviour — and nothing else. Everything about *loading* TinyMCE (`base_url`, `suffix`,
12
+ * `language`, `language_url`, `license_key`) and about the *theme* (`skin`, `content_css`)
13
+ * belongs to `TinymceLoaderService` and to the directive, which resolve them against the
14
+ * document base href and against `ThemeService`: a preset repeating them could only get them
15
+ * wrong, and used to — the old ones pinned a relative `assets/tinymce` that broke under a
16
+ * sub-path, and read the skin from `prefers-color-scheme` instead of the theme the user chose.
17
+ *
18
+ * Uploads are the same story: `automatic_uploads`, `paste_data_images` and `file_picker_types`
19
+ * follow the `tinymceImageUploader` input, so an editor without a handler cannot end up
20
+ * offering an upload tab that leads nowhere.
21
+ *
22
+ * Each accessor returns a **fresh deep copy**: a caller that tweaks a returned object — as the
23
+ * editor dialog does with its toolbar — cannot corrupt the preset for everyone else.
24
+ */
3
25
  declare class TinymceUtils {
4
26
  /**
5
- * Returns `true` when the user agent currently prefers a dark color scheme.
6
- * Evaluated on demand (not frozen at module load) and SSR-safe.
27
+ * Everything TinyMCE 8 open source has to offer, for a full-page editor.
28
+ *
29
+ * Adapted from the TinyMCE 5 profile the library used to ship: `paste`, `print`, `hr`,
30
+ * `textpattern` and the `fullpage_*` options no longer exist (paste and text patterns moved
31
+ * into the core, `fullpage` and `print` were dropped in v6), and `checklist`,
32
+ * `openCodeMirrorButton` and `insertMediaButton` are premium or application-specific buttons
33
+ * that a self-hosted GPL build has no way to render.
7
34
  */
8
- private static prefersDark;
9
- /** URL of the TinyMCE script hosted on the Tiny Cloud CDN. */
10
- static readonly CDN_URL = "https://cdn.tiny.cloud/1/5lnoc6ohmpjau6zyzgqyhyf52cueoennkcs8v1yfoak57ku9/tinymce/7/tinymce.min.js";
11
- /** URL of the locally bundled TinyMCE script. */
12
- static readonly LOCAL_URL = "/assets/tinymce/tinymce.min.js";
35
+ private static readonly FULL;
13
36
  /**
14
- * Full-featured TinyMCE base configuration with all standard plugins and toolbar.
37
+ * The one for a field inside a form: it grows with the text instead of owning the page, the
38
+ * toolbar sits under it and collapses into groups, and there is no status bar or context menu
39
+ * to compete with the form around it.
15
40
  */
16
- static TinymceConfig: Record<string, any>;
41
+ private static readonly COMPACT;
42
+ /** The compact one plus full screen, the insert group and the source view. */
43
+ private static readonly COMPACT_EXTENDED;
17
44
  /**
18
- * Compact TinyMCE configuration with autoresize, bottom toolbar, and grouped toolbar buttons.
19
- * Extends `TinymceConfig` with reduced height and a simplified toolbar.
45
+ * The full-page profile.
46
+ * @returns A fresh copy of the configuration, safe to modify.
20
47
  */
21
- static TinymceCompactConfig: Record<string, any>;
48
+ static get TinymceConfig(): RawEditorOptions;
22
49
  /**
23
- * Extended compact TinyMCE configuration that adds fullscreen support and an insert group.
24
- * Extends `TinymceCompactConfig`.
50
+ * The in-form profile.
51
+ * @returns A fresh copy of the configuration, safe to modify.
25
52
  */
26
- static TinymceCompactExtendedConfig: Record<string, any>;
53
+ static get TinymceCompactConfig(): RawEditorOptions;
27
54
  /**
28
- * Inject the TinyMCE script tag into the document head if it is not already present.
29
- * @param useCDN - When `true`, loads from the Tiny Cloud CDN; otherwise uses the local asset.
55
+ * The in-form profile with full screen and source view.
56
+ * @returns A fresh copy of the configuration, safe to modify.
30
57
  */
31
- static loadTinyMCEScript(useCDN?: boolean): void;
58
+ static get TinymceCompactExtendedConfig(): RawEditorOptions;
32
59
  }
33
60
 
34
- interface FullScreenEditorDialogData {
61
+ declare global {
62
+ interface Window {
63
+ tinymce?: TinyMCE;
64
+ }
65
+ }
66
+ /**
67
+ * Loads the self-hosted TinyMCE bundle on demand.
68
+ *
69
+ * TinyMCE is deliberately NOT imported by any module: a static import would pull ~500 kB into
70
+ * whichever chunk referenced it, and the editor is needed by exactly one dialog. The library is
71
+ * copied to `assets/tinymce` by the build (see `angular.json`) and injected here as a plain
72
+ * `<script>` the first time an editor is created, so it costs nothing until then and is served
73
+ * from the browser cache afterwards. Loading it this way also lets TinyMCE resolve its own theme,
74
+ * model, plugins and skin relative to `base_url`, which is how the self-hosted distribution
75
+ * expects to work.
76
+ */
77
+ declare class TinymceLoaderService {
78
+ /** The in-flight (or completed) load, so concurrent editors share a single script tag. */
79
+ private pending?;
80
+ /**
81
+ * The absolute URL of the TinyMCE asset folder, resolved against the document base href so the
82
+ * app keeps working when it is served from a sub-path.
83
+ * @returns The base URL, without a trailing slash.
84
+ */
85
+ get baseUrl(): string;
86
+ /**
87
+ * Loads TinyMCE, reusing the script already injected by a previous call.
88
+ * @returns A promise resolving with the global TinyMCE instance.
89
+ */
90
+ load(): Promise<TinyMCE>;
91
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TinymceLoaderService, never>;
92
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<TinymceLoaderService>;
93
+ }
94
+
95
+ /** Uploads one image and resolves with the URL to reference it by. */
96
+ type TinymceImageUploader = (file: File) => Promise<string>;
97
+ /**
98
+ * How the editor presents itself.
99
+ *
100
+ * `fixed` is the classic editor: the content lives in an iframe and the toolbar sits above it,
101
+ * pinned so it stays reachable while the surrounding container scrolls.
102
+ *
103
+ * `inline` edits the host element in place, with no iframe and no chrome until the user focuses
104
+ * it, at which point the toolbar floats over the content. It needs an ordinary element to edit —
105
+ * a `<div>` — because there is nothing to render inside a `<textarea>`.
106
+ */
107
+ type TinymceToolbarMode = 'fixed' | 'inline';
108
+ /**
109
+ * Turns a `<textarea>` into a rich text editor backed by the self-hosted TinyMCE bundle, and wires
110
+ * it to Angular forms as a `ControlValueAccessor`, so `[(ngModel)]`, `required` and the
111
+ * pristine/dirty state keep working exactly as they do on a plain control.
112
+ *
113
+ * The library itself is fetched on demand by <see cref="TinymceLoaderService"/>: nothing about
114
+ * TinyMCE reaches the bundle until an editor is actually created.
115
+ *
116
+ * Usage: `<textarea tinymceEditor [(ngModel)]="item.text" name="text" required></textarea>`
117
+ *
118
+ */
119
+ declare class TinymceEditorDirective implements ControlValueAccessor, OnInit, OnDestroy {
120
+ /** Extra TinyMCE options, merged over (and able to override) the defaults below. */
121
+ readonly tinymceConfig: _angular_core.InputSignal<RawEditorOptions>;
122
+ /** Whether the toolbar is pinned above the content (`fixed`) or floats on focus (`inline`). */
123
+ readonly tinymceToolbarMode: _angular_core.InputSignal<TinymceToolbarMode>;
124
+ /**
125
+ * Handler invoked for every image dropped, pasted or picked in the editor. When not provided
126
+ * the upload tab is hidden and only images referenced by URL can be inserted.
127
+ */
128
+ readonly tinymceImageUploader: _angular_core.InputSignal<TinymceImageUploader>;
129
+ /** Emitted once the editor is up, for callers that want to enable UI only when it is usable. */
130
+ readonly ready: _angular_core.OutputEmitterRef<Editor>;
131
+ /** Emitted when the editor could not be loaded or initialised. */
132
+ readonly failed: _angular_core.OutputEmitterRef<Error>;
133
+ private readonly host;
134
+ private readonly loader;
135
+ private readonly themeService;
136
+ private readonly changeDetector;
137
+ private editor?;
138
+ /** True while the editor is showing itself full screen. */
139
+ private fullscreen;
140
+ /** True once the directive has been destroyed, so a late init resolves into a no-op. */
141
+ private destroyed;
142
+ /**
143
+ * True while the directive itself is pushing a value into the editor. TinyMCE raises the same
144
+ * content events for a programmatic `setContent` as for a keystroke, so without this flag
145
+ * `writeValue` would immediately echo back through `onChange` and mark a freshly loaded form
146
+ * as dirty.
147
+ */
148
+ private writingValue;
149
+ /** The value received before the editor existed, applied as soon as it does. */
150
+ private value;
151
+ private disabled;
152
+ private onChange;
153
+ private onTouched;
154
+ /**
155
+ * Leaves full screen on Escape, for the keystrokes that happen outside the content: with the
156
+ * classic editor the content is an iframe, and a keydown in there never reaches this document.
157
+ * Bound on the capture phase and stopped, so a dialog hosting the editor does not take the
158
+ * Escape and close, throwing the edit away when the user only meant to leave full screen.
159
+ */
160
+ private readonly onDocumentKeydown;
161
+ /**
162
+ * Loads TinyMCE and initialises the editor over the host textarea.
163
+ * @returns A promise that completes once the editor is ready (or has failed).
164
+ */
165
+ ngOnInit(): Promise<void>;
166
+ /**
167
+ * Tears the editor down. TinyMCE keeps global state per instance, so leaving it behind when a
168
+ * dialog closes leaks both DOM and editor registrations.
169
+ * @returns void
170
+ */
171
+ ngOnDestroy(): void;
172
+ /**
173
+ * Decides whether an Escape press means "leave full screen": it does whenever the editor is
174
+ * full screen, full stop. While full screen the editor owns Escape, and the press is stopped
175
+ * here so it can never reach the dialog hosting it — leaving full screen must not also throw
176
+ * away what is being written.
177
+ * @param event The keyboard event, from the document or from the editor's content.
178
+ * @returns True when full screen should be left.
179
+ */
180
+ private shouldEscapeLeaveFullscreen;
181
+ /**
182
+ * Asks the editor to leave full screen. Safe to call when it is not in full screen.
183
+ * @returns void
184
+ */
185
+ private exitFullscreen;
186
+ /**
187
+ * Attaches or detaches everything that only makes sense while the editor is full screen.
188
+ * @param state True when the editor has just entered full screen.
189
+ * @returns void
190
+ */
191
+ private handleFullscreenChanged;
192
+ /**
193
+ * Detaches the listener that only makes sense while the editor is full screen.
194
+ * @returns void
195
+ */
196
+ private releaseFullscreen;
197
+ /**
198
+ * Pushes a value coming from the form into the editor.
199
+ * @param value The new content, or null/undefined for an empty editor.
200
+ * @returns void
201
+ */
202
+ writeValue(value: string | null | undefined): void;
203
+ /**
204
+ * Registers the callback used to report content changes to the form.
205
+ * @param fn The callback supplied by Angular forms.
206
+ * @returns void
207
+ */
208
+ registerOnChange(fn: (value: string) => void): void;
209
+ /**
210
+ * Registers the callback used to report the first blur to the form.
211
+ * @param fn The callback supplied by Angular forms.
212
+ * @returns void
213
+ */
214
+ registerOnTouched(fn: () => void): void;
215
+ /**
216
+ * Enables or disables editing.
217
+ * @param isDisabled True to switch the editor to read-only.
218
+ * @returns void
219
+ */
220
+ setDisabledState(isDisabled: boolean): void;
221
+ /**
222
+ * Writes content into the editor when it exists, guarding against the echo described on
223
+ * <see cref="writingValue"/>.
224
+ * @param value The content to write.
225
+ * @returns void
226
+ */
227
+ private applyValue;
228
+ /**
229
+ * Applies the disabled state to the editor when it exists.
230
+ * @param isDisabled True to switch the editor to read-only.
231
+ * @returns void
232
+ */
233
+ private applyDisabled;
234
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TinymceEditorDirective, never>;
235
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TinymceEditorDirective, "textarea[tinymceEditor], div[tinymceEditor]", never, { "tinymceConfig": { "alias": "tinymceConfig"; "required": false; "isSignal": true; }; "tinymceToolbarMode": { "alias": "tinymceToolbarMode"; "required": false; "isSignal": true; }; "tinymceImageUploader": { "alias": "tinymceImageUploader"; "required": false; "isSignal": true; }; }, { "ready": "ready"; "failed": "failed"; }, never, never, true, never>;
236
+ }
237
+
238
+ interface TinyMceEditorDialogData {
35
239
  text: string;
36
- configuration: Record<string, any>;
240
+ configuration: RawEditorOptions;
37
241
  infoButtonLabel?: string;
38
242
  onShowInfo?: Function;
39
243
  disabled?: boolean;
40
244
  }
41
- declare class FullScreenEditorComponent {
245
+ /**
246
+ * A dialog that is nothing but an editor: the caller hands it a text and gets the edited one
247
+ * back through {@link saving}.
248
+ *
249
+ * The editor is {@link TinymceEditorDirective} on a plain `<textarea>`, so this dialog costs
250
+ * exactly what any other editor in the application costs — the TinyMCE bundle is fetched on
251
+ * first use and nothing about it reaches the initial chunk.
252
+ */
253
+ declare class TinyMceEditorComponent {
42
254
  /** Emitted with the edited text when the user saves. */
43
255
  readonly saving: _angular_core.OutputEmitterRef<string>;
44
256
  private readonly dialogRef;
45
257
  /** Dialog configuration, injected and exposed as a signal. */
46
- protected readonly dialogData: _angular_core.WritableSignal<FullScreenEditorDialogData>;
258
+ protected readonly dialogData: _angular_core.WritableSignal<TinyMceEditorDialogData>;
47
259
  /** Whether the editor is in read-only mode. */
48
260
  protected readonly disabled: _angular_core.WritableSignal<boolean>;
49
261
  /** Current editor content, kept as a plain field for [(ngModel)] two-way binding. */
50
262
  protected text: string;
51
- /** TinyMCE editor configuration. */
52
- protected tinymceConfig: Record<string, any>;
263
+ /** The profile handed to the editor directive, merged over its defaults. */
264
+ protected tinymceConfig: RawEditorOptions;
53
265
  constructor();
54
266
  /**
55
267
  * Save the current editor content and close the dialog.
56
268
  */
57
269
  protected ok(): void;
58
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<FullScreenEditorComponent, never>;
59
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<FullScreenEditorComponent, "ng-component", never, {}, { "saving": "saving"; }, never, never, true, never>;
270
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TinyMceEditorComponent, never>;
271
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TinyMceEditorComponent, "ng-component", never, {}, { "saving": "saving"; }, never, never, true, never>;
60
272
  }
61
273
 
62
- export { FullScreenEditorComponent, TinymceUtils };
63
- export type { FullScreenEditorDialogData };
274
+ export { TinyMceEditorComponent, TinymceEditorDirective, TinymceLoaderService, TinymceUtils };
275
+ export type { TinyMceEditorDialogData, TinymceImageUploader, TinymceToolbarMode };