@flogeez/angular-tiptap-editor 3.1.5 → 3.2.1
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.
- package/CHANGELOG.md +12 -0
- package/esm2022/lib/components/bubble-menus/base/ate-base-bubble-menu.mjs +1 -1
- package/esm2022/lib/components/bubble-menus/base/ate-base-sub-bubble-menu.mjs +1 -1
- package/esm2022/lib/components/bubble-menus/link/ate-link-bubble-menu.component.mjs +1 -1
- package/esm2022/lib/components/editor/angular-tiptap-editor.component.mjs +40 -3
- package/esm2022/lib/components/slash-commands/ate-slash-commands.component.mjs +1 -1
- package/esm2022/lib/models/ate-editor-ref.mjs +319 -0
- package/esm2022/lib/services/ate-editor-commands.service.mjs +4 -1
- package/esm2022/lib/services/ate-editor-registry.service.mjs +94 -0
- package/esm2022/lib/services/ate-image.service.mjs +4 -1
- package/esm2022/lib/utils/ate-markdown.utils.mjs +2 -4
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/flogeez-angular-tiptap-editor.mjs +456 -6
- package/fesm2022/flogeez-angular-tiptap-editor.mjs.map +1 -1
- package/lib/components/editor/angular-tiptap-editor.component.d.ts +11 -2
- package/lib/models/ate-editor-ref.d.ts +73 -0
- package/lib/services/ate-editor-commands.service.d.ts +2 -1
- package/lib/services/ate-editor-registry.service.d.ts +36 -0
- package/lib/services/ate-image.service.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -9,7 +9,7 @@ import { AteSlashCommandsConfig } from "../../config/ate-slash-commands.config";
|
|
|
9
9
|
import { AteToolbarConfig } from "../../models/ate-toolbar.model";
|
|
10
10
|
import { AteBubbleMenuConfig } from "../../models/ate-bubble-menu.model";
|
|
11
11
|
import { AteEditorConfig, AteAngularNode, AteBlockControlsMode, AteAutofocusMode } from "../../models/ate-editor-config.model";
|
|
12
|
-
import { AteImageUploadHandler, AteImageUploadOptions } from "../../models/ate-image.model";
|
|
12
|
+
import { AteImageUploadHandler, AteImageUploadOptions, AteImageUploadResult } from "../../models/ate-image.model";
|
|
13
13
|
import * as i0 from "@angular/core";
|
|
14
14
|
import * as i1 from "../../directives/ate-noop-value-accessor.directive";
|
|
15
15
|
/**
|
|
@@ -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<{
|
|
@@ -98,6 +103,7 @@ export declare class AngularTiptapEditorComponent implements AfterViewInit, OnDe
|
|
|
98
103
|
event: FocusEvent;
|
|
99
104
|
}>;
|
|
100
105
|
editableChange: import("@angular/core").OutputEmitterRef<boolean>;
|
|
106
|
+
imageUploaded: import("@angular/core").OutputEmitterRef<AteImageUploadResult>;
|
|
101
107
|
editorElement: import("@angular/core").Signal<ElementRef<any>>;
|
|
102
108
|
hideBubbleMenus(): void;
|
|
103
109
|
showBubbleMenus(): void;
|
|
@@ -171,6 +177,9 @@ export declare class AngularTiptapEditorComponent implements AfterViewInit, OnDe
|
|
|
171
177
|
readonly i18nService: AteI18nService;
|
|
172
178
|
readonly editorCommandsService: AteEditorCommandsService;
|
|
173
179
|
readonly editorState: import("@angular/core").Signal<import("../../models/ate-editor-state.model").AteEditorStateSnapshot>;
|
|
180
|
+
private editorRegistry;
|
|
181
|
+
private _registeredId;
|
|
182
|
+
readonly registeredId: import("@angular/core").Signal<string | null>;
|
|
174
183
|
private injector;
|
|
175
184
|
private globalConfig;
|
|
176
185
|
/**
|
|
@@ -238,5 +247,5 @@ export declare class AngularTiptapEditorComponent implements AfterViewInit, OnDe
|
|
|
238
247
|
private setupFormControlSubscription;
|
|
239
248
|
onEditorClick(event: Event): void;
|
|
240
249
|
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: {}; }]>;
|
|
250
|
+
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"; "imageUploaded": "imageUploaded"; }, never, never, true, [{ directive: typeof i1.AteNoopValueAccessorDirective; inputs: {}; outputs: {}; }]>;
|
|
242
251
|
}
|
|
@@ -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
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Editor } from "@tiptap/core";
|
|
2
2
|
import { AteExportFormat, AteExportOptions } from "./ate-export.service";
|
|
3
3
|
import { AteEditorStateSnapshot } from "../models/ate-editor-state.model";
|
|
4
|
-
import { AteImageUploadHandler, AteImageUploadOptions } from "../models/ate-image.model";
|
|
4
|
+
import { AteImageUploadHandler, AteImageUploadOptions, AteImageUploadResult } from "../models/ate-image.model";
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class AteEditorCommandsService {
|
|
7
7
|
private imageService;
|
|
@@ -19,6 +19,7 @@ export declare class AteEditorCommandsService {
|
|
|
19
19
|
readonly isUploading: import("@angular/core").Signal<boolean>;
|
|
20
20
|
readonly uploadProgress: import("@angular/core").Signal<number>;
|
|
21
21
|
readonly uploadMessage: import("@angular/core").Signal<string>;
|
|
22
|
+
set onImageUploaded(callback: ((result: AteImageUploadResult) => void) | null);
|
|
22
23
|
set uploadHandler(handler: AteImageUploadHandler | null);
|
|
23
24
|
/** Update state (called by TiptapStateExtension) */
|
|
24
25
|
updateState(state: AteEditorStateSnapshot): void;
|
|
@@ -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
|
+
}
|
|
@@ -2,6 +2,7 @@ import { Editor } from "@tiptap/core";
|
|
|
2
2
|
import { AteResizeOptions, AteImageUploadOptions, AteImageUploadHandler, AteImageUploadResult, AteImageData } from "../models/ate-image.model";
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class AteImageService {
|
|
5
|
+
onImageUploadedCallback?: (result: AteImageUploadResult) => void;
|
|
5
6
|
/** Signals for image state */
|
|
6
7
|
selectedImage: import("@angular/core").WritableSignal<AteImageData | null>;
|
|
7
8
|
isImageSelected: import("@angular/core").Signal<boolean>;
|
package/package.json
CHANGED
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";
|