@flogeez/angular-tiptap-editor 3.1.5 → 3.2.0

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.
@@ -83,6 +83,11 @@ export declare class AngularTiptapEditorComponent implements AfterViewInit, OnDe
83
83
  * ```
84
84
  */
85
85
  imageUploadHandler: import("@angular/core").InputSignal<AteImageUploadHandler | undefined>;
86
+ /**
87
+ * Optional unique identifier for the editor instance in the registry.
88
+ * If not specified, a unique ID is automatically generated.
89
+ */
90
+ editorId: import("@angular/core").InputSignal<string | undefined>;
86
91
  contentChange: import("@angular/core").OutputEmitterRef<string>;
87
92
  editorCreated: import("@angular/core").OutputEmitterRef<Editor>;
88
93
  editorUpdate: import("@angular/core").OutputEmitterRef<{
@@ -171,6 +176,9 @@ export declare class AngularTiptapEditorComponent implements AfterViewInit, OnDe
171
176
  readonly i18nService: AteI18nService;
172
177
  readonly editorCommandsService: AteEditorCommandsService;
173
178
  readonly editorState: import("@angular/core").Signal<import("../../models/ate-editor-state.model").AteEditorStateSnapshot>;
179
+ private editorRegistry;
180
+ private _registeredId;
181
+ readonly registeredId: import("@angular/core").Signal<string | null>;
174
182
  private injector;
175
183
  private globalConfig;
176
184
  /**
@@ -238,5 +246,5 @@ export declare class AngularTiptapEditorComponent implements AfterViewInit, OnDe
238
246
  private setupFormControlSubscription;
239
247
  onEditorClick(event: Event): void;
240
248
  static ɵfac: i0.ɵɵFactoryDeclaration<AngularTiptapEditorComponent, never>;
241
- static ɵcmp: i0.ɵɵComponentDeclaration<AngularTiptapEditorComponent, "angular-tiptap-editor", never, { "config": { "alias": "config"; "required": false; "isSignal": true; }; "content": { "alias": "content"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "minHeight": { "alias": "minHeight"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "fillContainer": { "alias": "fillContainer"; "required": false; "isSignal": true; }; "showToolbar": { "alias": "showToolbar"; "required": false; "isSignal": true; }; "showFooter": { "alias": "showFooter"; "required": false; "isSignal": true; }; "showCharacterCount": { "alias": "showCharacterCount"; "required": false; "isSignal": true; }; "showWordCount": { "alias": "showWordCount"; "required": false; "isSignal": true; }; "maxCharacters": { "alias": "maxCharacters"; "required": false; "isSignal": true; }; "enableOfficePaste": { "alias": "enableOfficePaste"; "required": false; "isSignal": true; }; "enableSlashCommands": { "alias": "enableSlashCommands"; "required": false; "isSignal": true; }; "slashCommands": { "alias": "slashCommands"; "required": false; "isSignal": true; }; "customSlashCommands": { "alias": "customSlashCommands"; "required": false; "isSignal": true; }; "blockControls": { "alias": "blockControls"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; "seamless": { "alias": "seamless"; "required": false; "isSignal": true; }; "floatingToolbar": { "alias": "floatingToolbar"; "required": false; "isSignal": true; }; "showEditToggle": { "alias": "showEditToggle"; "required": false; "isSignal": true; }; "spellcheck": { "alias": "spellcheck"; "required": false; "isSignal": true; }; "tiptapExtensions": { "alias": "tiptapExtensions"; "required": false; "isSignal": true; }; "tiptapOptions": { "alias": "tiptapOptions"; "required": false; "isSignal": true; }; "showBubbleMenu": { "alias": "showBubbleMenu"; "required": false; "isSignal": true; }; "bubbleMenu": { "alias": "bubbleMenu"; "required": false; "isSignal": true; }; "showImageBubbleMenu": { "alias": "showImageBubbleMenu"; "required": false; "isSignal": true; }; "imageBubbleMenu": { "alias": "imageBubbleMenu"; "required": false; "isSignal": true; }; "toolbar": { "alias": "toolbar"; "required": false; "isSignal": true; }; "showTableBubbleMenu": { "alias": "showTableBubbleMenu"; "required": false; "isSignal": true; }; "tableBubbleMenu": { "alias": "tableBubbleMenu"; "required": false; "isSignal": true; }; "showCellBubbleMenu": { "alias": "showCellBubbleMenu"; "required": false; "isSignal": true; }; "cellBubbleMenu": { "alias": "cellBubbleMenu"; "required": false; "isSignal": true; }; "stateCalculators": { "alias": "stateCalculators"; "required": false; "isSignal": true; }; "imageUpload": { "alias": "imageUpload"; "required": false; "isSignal": true; }; "imageUploadHandler": { "alias": "imageUploadHandler"; "required": false; "isSignal": true; }; }, { "contentChange": "contentChange"; "editorCreated": "editorCreated"; "editorUpdate": "editorUpdate"; "editorFocus": "editorFocus"; "editorBlur": "editorBlur"; "editableChange": "editableChange"; }, never, never, true, [{ directive: typeof i1.AteNoopValueAccessorDirective; inputs: {}; outputs: {}; }]>;
249
+ static ɵcmp: i0.ɵɵComponentDeclaration<AngularTiptapEditorComponent, "angular-tiptap-editor", never, { "config": { "alias": "config"; "required": false; "isSignal": true; }; "content": { "alias": "content"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "minHeight": { "alias": "minHeight"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "fillContainer": { "alias": "fillContainer"; "required": false; "isSignal": true; }; "showToolbar": { "alias": "showToolbar"; "required": false; "isSignal": true; }; "showFooter": { "alias": "showFooter"; "required": false; "isSignal": true; }; "showCharacterCount": { "alias": "showCharacterCount"; "required": false; "isSignal": true; }; "showWordCount": { "alias": "showWordCount"; "required": false; "isSignal": true; }; "maxCharacters": { "alias": "maxCharacters"; "required": false; "isSignal": true; }; "enableOfficePaste": { "alias": "enableOfficePaste"; "required": false; "isSignal": true; }; "enableSlashCommands": { "alias": "enableSlashCommands"; "required": false; "isSignal": true; }; "slashCommands": { "alias": "slashCommands"; "required": false; "isSignal": true; }; "customSlashCommands": { "alias": "customSlashCommands"; "required": false; "isSignal": true; }; "blockControls": { "alias": "blockControls"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; "seamless": { "alias": "seamless"; "required": false; "isSignal": true; }; "floatingToolbar": { "alias": "floatingToolbar"; "required": false; "isSignal": true; }; "showEditToggle": { "alias": "showEditToggle"; "required": false; "isSignal": true; }; "spellcheck": { "alias": "spellcheck"; "required": false; "isSignal": true; }; "tiptapExtensions": { "alias": "tiptapExtensions"; "required": false; "isSignal": true; }; "tiptapOptions": { "alias": "tiptapOptions"; "required": false; "isSignal": true; }; "showBubbleMenu": { "alias": "showBubbleMenu"; "required": false; "isSignal": true; }; "bubbleMenu": { "alias": "bubbleMenu"; "required": false; "isSignal": true; }; "showImageBubbleMenu": { "alias": "showImageBubbleMenu"; "required": false; "isSignal": true; }; "imageBubbleMenu": { "alias": "imageBubbleMenu"; "required": false; "isSignal": true; }; "toolbar": { "alias": "toolbar"; "required": false; "isSignal": true; }; "showTableBubbleMenu": { "alias": "showTableBubbleMenu"; "required": false; "isSignal": true; }; "tableBubbleMenu": { "alias": "tableBubbleMenu"; "required": false; "isSignal": true; }; "showCellBubbleMenu": { "alias": "showCellBubbleMenu"; "required": false; "isSignal": true; }; "cellBubbleMenu": { "alias": "cellBubbleMenu"; "required": false; "isSignal": true; }; "stateCalculators": { "alias": "stateCalculators"; "required": false; "isSignal": true; }; "imageUpload": { "alias": "imageUpload"; "required": false; "isSignal": true; }; "imageUploadHandler": { "alias": "imageUploadHandler"; "required": false; "isSignal": true; }; "editorId": { "alias": "editorId"; "required": false; "isSignal": true; }; }, { "contentChange": "contentChange"; "editorCreated": "editorCreated"; "editorUpdate": "editorUpdate"; "editorFocus": "editorFocus"; "editorBlur": "editorBlur"; "editableChange": "editableChange"; }, never, never, true, [{ directive: typeof i1.AteNoopValueAccessorDirective; inputs: {}; outputs: {}; }]>;
242
250
  }
@@ -0,0 +1,73 @@
1
+ import { Signal } from "@angular/core";
2
+ import { Editor, JSONContent } from "@tiptap/core";
3
+ import { AteEditorCommandsService } from "../services/ate-editor-commands.service";
4
+ import { AteEditorStateSnapshot } from "./ate-editor-state.model";
5
+ import { AteImageUploadOptions } from "./ate-image.model";
6
+ import { AteExportFormat, AteExportOptions } from "../services/ate-export.service";
7
+ /**
8
+ * A wrapper class that holds a reference to a registered editor component.
9
+ * It provides direct, type-safe facade methods to interact with the editor
10
+ * and execute formatting/utility commands without needing to manage the raw
11
+ * TipTap editor instance directly.
12
+ */
13
+ export declare class AteEditorRef {
14
+ readonly id: string;
15
+ private readonly getEditorInstance;
16
+ readonly commandsService: AteEditorCommandsService;
17
+ constructor(id: string, getEditorInstance: () => Editor | null, commandsService: AteEditorCommandsService);
18
+ /** Get the raw TipTap Editor instance. */
19
+ get editor(): Editor | null;
20
+ /** Get the current editor state snapshot. */
21
+ get state(): AteEditorStateSnapshot;
22
+ /** Get the reactive editor state as a Signal. */
23
+ get stateSignal(): Signal<AteEditorStateSnapshot>;
24
+ /** Execute a generic command by name. */
25
+ execute(command: string, ...args: unknown[]): void;
26
+ toggleBold(): void;
27
+ toggleItalic(): void;
28
+ toggleStrike(): void;
29
+ toggleCode(): void;
30
+ toggleCodeBlock(): void;
31
+ toggleUnderline(): void;
32
+ toggleSuperscript(): void;
33
+ toggleSubscript(): void;
34
+ toggleHeading(level: 1 | 2 | 3): void;
35
+ toggleBulletList(): void;
36
+ toggleOrderedList(): void;
37
+ toggleBlockquote(): void;
38
+ setTextAlign(alignment: "left" | "center" | "right" | "justify"): void;
39
+ insertHorizontalRule(): void;
40
+ insertImage(options: AteImageUploadOptions): void;
41
+ uploadImage(file: File, options?: AteImageUploadOptions): void;
42
+ toggleHighlight(color: string): void;
43
+ undo(): void;
44
+ redo(): void;
45
+ insertTable(rows?: number, cols?: number): void;
46
+ addColumnBefore(): void;
47
+ addColumnAfter(): void;
48
+ deleteColumn(): void;
49
+ addRowBefore(): void;
50
+ addRowAfter(): void;
51
+ deleteRow(): void;
52
+ deleteTable(): void;
53
+ mergeCells(): void;
54
+ splitCell(): void;
55
+ toggleHeaderColumn(): void;
56
+ toggleHeaderRow(): void;
57
+ applyColor(color: string, selectionOnly?: boolean, closeMenu?: boolean): void;
58
+ applyHighlight(color: string, selectionOnly?: boolean, closeMenu?: boolean): void;
59
+ unsetColor(selectionOnly?: boolean): void;
60
+ unsetHighlight(selectionOnly?: boolean): void;
61
+ toggleLink(event?: Event): void;
62
+ unsetLink(): void;
63
+ toggleColorPicker(mode: "text" | "highlight", event: Event): void;
64
+ clearContent(): void;
65
+ setContent(content: string, emitUpdate?: boolean): void;
66
+ getContent(format: AteExportFormat): string;
67
+ getHTML(): string;
68
+ getJSON(): JSONContent | undefined;
69
+ getText(): string;
70
+ exportAs(format: AteExportFormat, method: "clipboard" | "download", options?: AteExportOptions): Promise<void>;
71
+ focus(): void;
72
+ blur(): void;
73
+ }
@@ -0,0 +1,36 @@
1
+ import { Editor } from "@tiptap/core";
2
+ import { AteEditorRef } from "../models/ate-editor-ref";
3
+ import { AteEditorCommandsService } from "./ate-editor-commands.service";
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * A root-level registry service to register, unregister, and manage active editor instances.
7
+ * This service is provided in 'root' and can be injected anywhere in the application.
8
+ */
9
+ export declare class AteEditorRegistry {
10
+ private static counter;
11
+ private readonly _editors;
12
+ readonly editors: import("@angular/core").Signal<Map<string, AteEditorRef>>;
13
+ private readonly _activeEditorId;
14
+ readonly activeEditorId: import("@angular/core").Signal<string | null>;
15
+ readonly editorIds: import("@angular/core").Signal<string[]>;
16
+ readonly activeEditor: import("@angular/core").Signal<AteEditorRef | null>;
17
+ /**
18
+ * Register an editor instance.
19
+ * Returns the final registered ID.
20
+ */
21
+ register(id: string | undefined, getEditor: () => Editor | null, commandsService: AteEditorCommandsService): string;
22
+ /**
23
+ * Unregister an editor instance by ID.
24
+ */
25
+ unregister(id: string): void;
26
+ /**
27
+ * Mark an editor as active (usually on focus).
28
+ */
29
+ setActive(id: string): void;
30
+ /**
31
+ * Retrieve an editor reference by ID, or the active editor if ID is not specified.
32
+ */
33
+ get(id?: string): AteEditorRef | undefined;
34
+ static ɵfac: i0.ɵɵFactoryDeclaration<AteEditorRegistry, never>;
35
+ static ɵprov: i0.ɵɵInjectableDeclaration<AteEditorRegistry>;
36
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flogeez/angular-tiptap-editor",
3
- "version": "3.1.5",
3
+ "version": "3.2.0",
4
4
  "description": "A modern, customizable rich-text editor for Angular (18+), built with Tiptap and featuring complete internationalization support",
5
5
  "keywords": [
6
6
  "angular",
package/public-api.d.ts CHANGED
@@ -8,6 +8,8 @@ export * from "./lib/services/ate-image.service";
8
8
  export * from "./lib/services/ate-color-picker.service";
9
9
  export * from "./lib/services/ate-link.service";
10
10
  export * from "./lib/services/ate-export.service";
11
+ export * from "./lib/services/ate-editor-registry.service";
12
+ export * from "./lib/models/ate-editor-ref";
11
13
  export * from "./lib/models/ate-editor-state.model";
12
14
  export * from "./lib/extensions/calculators/ate-discovery.calculator";
13
15
  export * from "./lib/extensions/calculators/ate-image.calculator";