@flogeez/angular-tiptap-editor 2.2.3 → 2.4.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.
- package/CHANGELOG.md +24 -0
- package/README.md +132 -93
- package/fesm2022/flogeez-angular-tiptap-editor.mjs +565 -40
- package/fesm2022/flogeez-angular-tiptap-editor.mjs.map +1 -1
- package/index.d.ts +417 -5
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as _flogeez_angular_tiptap_editor from '@flogeez/angular-tiptap-editor';
|
|
2
|
-
import { Editor, Node, Mark,
|
|
2
|
+
import { Editor, NodeConfig, Extension, Node as Node$2, Mark, EditorOptions, JSONContent } from '@tiptap/core';
|
|
3
3
|
import * as _angular_core from '@angular/core';
|
|
4
|
-
import { AfterViewInit, OnDestroy, ElementRef } from '@angular/core';
|
|
4
|
+
import { Injector, Type, AfterViewInit, OnDestroy, ElementRef, EnvironmentProviders, InjectionToken, Signal } from '@angular/core';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
|
+
import { Node as Node$1 } from '@tiptap/pm/model';
|
|
7
|
+
import { Decoration, EditorView, NodeView } from '@tiptap/pm/view';
|
|
6
8
|
import { ControlValueAccessor } from '@angular/forms';
|
|
7
9
|
|
|
8
10
|
type SupportedLocale = "en" | "fr" | (string & {});
|
|
@@ -782,6 +784,147 @@ declare const ATE_CELL_BUBBLE_MENU_KEYS: readonly ["mergeCells", "splitCell"];
|
|
|
782
784
|
type AteCellBubbleMenuKey = (typeof ATE_CELL_BUBBLE_MENU_KEYS)[number];
|
|
783
785
|
type AteCellBubbleMenuConfig = Partial<Record<AteCellBubbleMenuKey, boolean>>;
|
|
784
786
|
|
|
787
|
+
/**
|
|
788
|
+
* Common options for rendering any Angular component as a TipTap NodeView
|
|
789
|
+
*/
|
|
790
|
+
interface AteComponentRenderOptions {
|
|
791
|
+
/**
|
|
792
|
+
* Angular injector to use for creating the component
|
|
793
|
+
*/
|
|
794
|
+
injector: Injector;
|
|
795
|
+
/**
|
|
796
|
+
* Additional inputs to pass to the component
|
|
797
|
+
*/
|
|
798
|
+
inputs?: Record<string, unknown>;
|
|
799
|
+
/**
|
|
800
|
+
* Custom wrapper element tag (default: 'div')
|
|
801
|
+
*/
|
|
802
|
+
wrapperTag?: string;
|
|
803
|
+
/**
|
|
804
|
+
* CSS classes to add to the wrapper element
|
|
805
|
+
*/
|
|
806
|
+
wrapperClass?: string;
|
|
807
|
+
/**
|
|
808
|
+
* Whether the node should be treated as an atom (not editable)
|
|
809
|
+
* Default: true
|
|
810
|
+
*/
|
|
811
|
+
atom?: boolean;
|
|
812
|
+
/**
|
|
813
|
+
* Enables editable content for <ng-content>.
|
|
814
|
+
* If true, TipTap will treat the component's content as editable.
|
|
815
|
+
* @default false
|
|
816
|
+
*/
|
|
817
|
+
editableContent?: boolean;
|
|
818
|
+
/**
|
|
819
|
+
* Optional CSS selector to target an internal element of the component as the editable area.
|
|
820
|
+
*/
|
|
821
|
+
contentSelector?: string;
|
|
822
|
+
/**
|
|
823
|
+
* Type of content allowed in the editable area.
|
|
824
|
+
*/
|
|
825
|
+
contentMode?: "block" | "inline";
|
|
826
|
+
/**
|
|
827
|
+
* Whether to ignore mutations in the component's DOM.
|
|
828
|
+
* If true, TipTap won't try to sync changes from the component's DOM back to the editor state.
|
|
829
|
+
* @default true
|
|
830
|
+
*/
|
|
831
|
+
ignoreMutation?: boolean | ((mutation: MutationRecord | {
|
|
832
|
+
type: "selection";
|
|
833
|
+
target: Node;
|
|
834
|
+
}) => boolean);
|
|
835
|
+
/**
|
|
836
|
+
* Callback called when an Output event is emitted by the component.
|
|
837
|
+
*/
|
|
838
|
+
onOutput?: (outputName: string, value: unknown) => void;
|
|
839
|
+
/**
|
|
840
|
+
* Callback called when the node is updated.
|
|
841
|
+
*/
|
|
842
|
+
onUpdate?: (node: Node$1) => void;
|
|
843
|
+
/**
|
|
844
|
+
* Callback called when the component is destroyed.
|
|
845
|
+
*/
|
|
846
|
+
onDestroy?: () => void;
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* Unified configuration for registering an Angular component as an interactive 'Angular Node'.
|
|
850
|
+
* This provides high-level options to map Angular component logic (inputs, outputs, lifestyle)
|
|
851
|
+
* directly to TipTap's document structure.
|
|
852
|
+
*/
|
|
853
|
+
interface RegisterAngularComponentOptions<T = unknown> {
|
|
854
|
+
/**
|
|
855
|
+
* The Angular component to register
|
|
856
|
+
*/
|
|
857
|
+
component: Type<T>;
|
|
858
|
+
/**
|
|
859
|
+
* Unique name for the TipTap node
|
|
860
|
+
*/
|
|
861
|
+
name?: string;
|
|
862
|
+
/**
|
|
863
|
+
* Default inputs (for standard components)
|
|
864
|
+
*/
|
|
865
|
+
defaultInputs?: Record<string, unknown>;
|
|
866
|
+
/**
|
|
867
|
+
* TipTap attributes (for TipTap-aware components)
|
|
868
|
+
*/
|
|
869
|
+
attributes?: Record<string, {
|
|
870
|
+
default?: unknown;
|
|
871
|
+
parseHTML?: (element: HTMLElement) => unknown;
|
|
872
|
+
renderHTML?: (attributes: Record<string, unknown>) => Record<string, unknown> | null;
|
|
873
|
+
}>;
|
|
874
|
+
/**
|
|
875
|
+
* CSS selector for the editable area inside the component
|
|
876
|
+
*/
|
|
877
|
+
contentSelector?: string;
|
|
878
|
+
/**
|
|
879
|
+
* Content mode for the editable area
|
|
880
|
+
*/
|
|
881
|
+
contentMode?: "block" | "inline";
|
|
882
|
+
/**
|
|
883
|
+
* Enable editable content via <ng-content> or contentSelector
|
|
884
|
+
* @default false
|
|
885
|
+
*/
|
|
886
|
+
editableContent?: boolean;
|
|
887
|
+
/**
|
|
888
|
+
* Node group (block or inline)
|
|
889
|
+
* @default 'block'
|
|
890
|
+
*/
|
|
891
|
+
group?: "block" | "inline";
|
|
892
|
+
/**
|
|
893
|
+
* Is the node draggable?
|
|
894
|
+
* @default true
|
|
895
|
+
*/
|
|
896
|
+
draggable?: boolean;
|
|
897
|
+
/**
|
|
898
|
+
* Whether to ignore mutations in the component's DOM.
|
|
899
|
+
* @default true
|
|
900
|
+
*/
|
|
901
|
+
ignoreMutation?: boolean | ((mutation: MutationRecord | {
|
|
902
|
+
type: "selection";
|
|
903
|
+
target: Node;
|
|
904
|
+
}) => boolean);
|
|
905
|
+
/**
|
|
906
|
+
* Custom HTML attributes for the wrapper
|
|
907
|
+
*/
|
|
908
|
+
HTMLAttributes?: Record<string, unknown>;
|
|
909
|
+
/**
|
|
910
|
+
* Custom parseHTML rules
|
|
911
|
+
*/
|
|
912
|
+
parseHTML?: NodeConfig["parseHTML"];
|
|
913
|
+
/**
|
|
914
|
+
* Custom renderHTML function
|
|
915
|
+
*/
|
|
916
|
+
renderHTML?: NodeConfig["renderHTML"];
|
|
917
|
+
/**
|
|
918
|
+
* Callback called when an Output event is emitted by the component.
|
|
919
|
+
*/
|
|
920
|
+
onOutput?: (outputName: string, value: unknown) => void;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Type representing an Angular component that can be registered as an editor node.
|
|
925
|
+
* Can be a direct Component class or a full registration options object.
|
|
926
|
+
*/
|
|
927
|
+
type AteAngularNode = Type<unknown> | RegisterAngularComponentOptions<unknown>;
|
|
785
928
|
/**
|
|
786
929
|
* Global configuration interface for Angular Tiptap Editor.
|
|
787
930
|
* Uses a flat structure for common settings and objects for complex configurations.
|
|
@@ -851,6 +994,22 @@ interface AteEditorConfig {
|
|
|
851
994
|
floatingToolbar?: boolean;
|
|
852
995
|
/** Technical configuration for image uploads */
|
|
853
996
|
imageUpload?: AteImageUploadConfig;
|
|
997
|
+
/**
|
|
998
|
+
* List of Angular components to automatically register as interactive editor nodes.
|
|
999
|
+
* This is the preferred way to extend the editor with custom Angular logic.
|
|
1000
|
+
*/
|
|
1001
|
+
angularNodes?: AteAngularNode[];
|
|
1002
|
+
/** Standard TipTap extensions (Nodes, Marks, or Plugins) */
|
|
1003
|
+
tiptapExtensions?: (Extension | Node$2 | Mark)[];
|
|
1004
|
+
/** Raw TipTap editor options (e.g., enableInputRules, injectCSS, etc.) */
|
|
1005
|
+
tiptapOptions?: Partial<EditorOptions>;
|
|
1006
|
+
/** Reactive state calculators to extend the editor's live state */
|
|
1007
|
+
stateCalculators?: AteStateCalculator[];
|
|
1008
|
+
/**
|
|
1009
|
+
* Fully custom slash commands configuration.
|
|
1010
|
+
* When provided, it replaces the default groups based on toolbar toggles.
|
|
1011
|
+
*/
|
|
1012
|
+
customSlashCommands?: AteCustomSlashCommands;
|
|
854
1013
|
}
|
|
855
1014
|
|
|
856
1015
|
/**
|
|
@@ -865,6 +1024,14 @@ declare class AteNoopValueAccessorDirective implements ControlValueAccessor {
|
|
|
865
1024
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AteNoopValueAccessorDirective, never, never, {}, {}, never, never, true, never>;
|
|
866
1025
|
}
|
|
867
1026
|
|
|
1027
|
+
/**
|
|
1028
|
+
* The main rich-text editor component for Angular.
|
|
1029
|
+
*
|
|
1030
|
+
* Powered by Tiptap and built with a native Signal-based architecture, it provides
|
|
1031
|
+
* a seamless, high-performance editing experience. Supports automatic registration
|
|
1032
|
+
* of Angular components as interactive nodes ('Angular Nodes'), full Reactive Forms
|
|
1033
|
+
* integration, and extensive customization via the AteEditorConfig.
|
|
1034
|
+
*/
|
|
868
1035
|
declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
869
1036
|
/** Configuration globale de l'éditeur */
|
|
870
1037
|
config: _angular_core.InputSignal<AteEditorConfig>;
|
|
@@ -891,7 +1058,7 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
|
891
1058
|
floatingToolbar: _angular_core.InputSignal<boolean>;
|
|
892
1059
|
showEditToggle: _angular_core.InputSignal<boolean>;
|
|
893
1060
|
spellcheck: _angular_core.InputSignal<boolean>;
|
|
894
|
-
tiptapExtensions: _angular_core.InputSignal<(Node<any, any> | Mark<any, any> | Extension<any, any>)[]>;
|
|
1061
|
+
tiptapExtensions: _angular_core.InputSignal<(Node$2<any, any> | Mark<any, any> | Extension<any, any>)[]>;
|
|
895
1062
|
tiptapOptions: _angular_core.InputSignal<Partial<EditorOptions>>;
|
|
896
1063
|
showBubbleMenu: _angular_core.InputSignal<boolean>;
|
|
897
1064
|
bubbleMenu: _angular_core.InputSignal<Partial<AteBubbleMenuConfig>>;
|
|
@@ -989,6 +1156,10 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
|
989
1156
|
readonly finalShowCharacterCount: _angular_core.Signal<boolean>;
|
|
990
1157
|
readonly finalShowWordCount: _angular_core.Signal<boolean>;
|
|
991
1158
|
readonly finalLocale: _angular_core.Signal<SupportedLocale>;
|
|
1159
|
+
readonly finalTiptapExtensions: _angular_core.Signal<(Node$2<any, any> | Mark<any, any> | Extension<any, any>)[]>;
|
|
1160
|
+
readonly finalTiptapOptions: _angular_core.Signal<Partial<EditorOptions>>;
|
|
1161
|
+
readonly finalStateCalculators: _angular_core.Signal<AteStateCalculator[]>;
|
|
1162
|
+
readonly finalAngularNodesConfig: _angular_core.Signal<_flogeez_angular_tiptap_editor.AteAngularNode[]>;
|
|
992
1163
|
readonly finalImageUploadConfig: _angular_core.Signal<{
|
|
993
1164
|
maxSize: number;
|
|
994
1165
|
handler?: AteImageUploadHandler;
|
|
@@ -1008,6 +1179,51 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
|
1008
1179
|
readonly i18nService: AteI18nService;
|
|
1009
1180
|
readonly editorCommandsService: AteEditorCommandsService;
|
|
1010
1181
|
readonly editorState: _angular_core.Signal<_flogeez_angular_tiptap_editor.EditorStateSnapshot>;
|
|
1182
|
+
private injector;
|
|
1183
|
+
private globalConfig;
|
|
1184
|
+
/**
|
|
1185
|
+
* Final merged configuration.
|
|
1186
|
+
* Priority: Input [config] > Global config via provideAteEditor()
|
|
1187
|
+
*/
|
|
1188
|
+
readonly effectiveConfig: _angular_core.Signal<{
|
|
1189
|
+
theme?: "light" | "dark" | "auto";
|
|
1190
|
+
mode?: "classic" | "seamless";
|
|
1191
|
+
height?: string;
|
|
1192
|
+
autofocus?: "start" | "end" | "all" | boolean | number;
|
|
1193
|
+
placeholder?: string;
|
|
1194
|
+
editable?: boolean;
|
|
1195
|
+
minHeight?: string;
|
|
1196
|
+
maxHeight?: string;
|
|
1197
|
+
fillContainer?: boolean;
|
|
1198
|
+
disabled?: boolean;
|
|
1199
|
+
locale?: string;
|
|
1200
|
+
spellcheck?: boolean;
|
|
1201
|
+
enableOfficePaste?: boolean;
|
|
1202
|
+
showToolbar?: boolean;
|
|
1203
|
+
showFooter?: boolean;
|
|
1204
|
+
showCharacterCount?: boolean;
|
|
1205
|
+
showWordCount?: boolean;
|
|
1206
|
+
showEditToggle?: boolean;
|
|
1207
|
+
showBubbleMenu?: boolean;
|
|
1208
|
+
showImageBubbleMenu?: boolean;
|
|
1209
|
+
showTableMenu?: boolean;
|
|
1210
|
+
showCellMenu?: boolean;
|
|
1211
|
+
enableSlashCommands?: boolean;
|
|
1212
|
+
maxCharacters?: number;
|
|
1213
|
+
toolbar?: AteToolbarConfig;
|
|
1214
|
+
bubbleMenu?: AteBubbleMenuConfig;
|
|
1215
|
+
imageBubbleMenu?: AteImageBubbleMenuConfig;
|
|
1216
|
+
tableBubbleMenu?: AteTableBubbleMenuConfig;
|
|
1217
|
+
cellBubbleMenu?: AteCellBubbleMenuConfig;
|
|
1218
|
+
slashCommands?: AteSlashCommandsConfig;
|
|
1219
|
+
floatingToolbar?: boolean;
|
|
1220
|
+
imageUpload?: _flogeez_angular_tiptap_editor.AteImageUploadConfig;
|
|
1221
|
+
angularNodes?: _flogeez_angular_tiptap_editor.AteAngularNode[];
|
|
1222
|
+
tiptapExtensions?: (Extension | Node$2 | Mark)[];
|
|
1223
|
+
tiptapOptions?: Partial<EditorOptions>;
|
|
1224
|
+
stateCalculators?: AteStateCalculator[];
|
|
1225
|
+
customSlashCommands?: AteCustomSlashCommands;
|
|
1226
|
+
}>;
|
|
1011
1227
|
constructor();
|
|
1012
1228
|
ngAfterViewInit(): void;
|
|
1013
1229
|
ngOnDestroy(): void;
|
|
@@ -1031,6 +1247,26 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
|
1031
1247
|
static ɵcmp: _angular_core.ɵɵ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; }; "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 AteNoopValueAccessorDirective; inputs: {}; outputs: {}; }]>;
|
|
1032
1248
|
}
|
|
1033
1249
|
|
|
1250
|
+
/**
|
|
1251
|
+
* Provides the necessary configuration and initialization for the Angular TipTap Editor.
|
|
1252
|
+
* This should be called in your app.config.ts (for standalone) or main.ts.
|
|
1253
|
+
*
|
|
1254
|
+
* This provider is essential for 'Angular Nodes' to work correctly, as it captures the
|
|
1255
|
+
* root Injector required to instantiate custom Angular components within the editor.
|
|
1256
|
+
* @example
|
|
1257
|
+
* ```ts
|
|
1258
|
+
* bootstrapApplication(AppComponent, {
|
|
1259
|
+
* providers: [
|
|
1260
|
+
* provideAteEditor({
|
|
1261
|
+
* theme: 'dark',
|
|
1262
|
+
* mode: 'seamless'
|
|
1263
|
+
* })
|
|
1264
|
+
* ]
|
|
1265
|
+
* });
|
|
1266
|
+
* ```
|
|
1267
|
+
*/
|
|
1268
|
+
declare function provideAteEditor(config?: AteEditorConfig): EnvironmentProviders;
|
|
1269
|
+
|
|
1034
1270
|
declare class AteImageService {
|
|
1035
1271
|
/** Signals for image state */
|
|
1036
1272
|
selectedImage: _angular_core.WritableSignal<AteImageData | null>;
|
|
@@ -1228,6 +1464,182 @@ declare const ATE_DEFAULT_IMAGE_BUBBLE_MENU_CONFIG: AteImageBubbleMenuConfig;
|
|
|
1228
1464
|
declare const ATE_DEFAULT_TABLE_MENU_CONFIG: AteTableBubbleMenuConfig;
|
|
1229
1465
|
declare const ATE_DEFAULT_CELL_MENU_CONFIG: AteCellBubbleMenuConfig;
|
|
1230
1466
|
|
|
1467
|
+
/**
|
|
1468
|
+
* Injection Token for global editor configuration.
|
|
1469
|
+
*/
|
|
1470
|
+
declare const ATE_GLOBAL_CONFIG: InjectionToken<AteEditorConfig>;
|
|
1471
|
+
|
|
1472
|
+
/**
|
|
1473
|
+
* Props that are injected into Angular NodeView components
|
|
1474
|
+
*/
|
|
1475
|
+
interface AteAngularNodeViewProps {
|
|
1476
|
+
editor: Editor;
|
|
1477
|
+
node: Node$1;
|
|
1478
|
+
decorations: readonly Decoration[];
|
|
1479
|
+
selected: boolean;
|
|
1480
|
+
extension: unknown;
|
|
1481
|
+
getPos: () => number | undefined;
|
|
1482
|
+
updateAttributes: (attrs: Record<string, unknown>) => void;
|
|
1483
|
+
deleteNode: () => void;
|
|
1484
|
+
}
|
|
1485
|
+
/**
|
|
1486
|
+
* Base abstract class for custom 'Angular Nodes'.
|
|
1487
|
+
*
|
|
1488
|
+
* Extend this class in your custom components to automatically receive TipTap editor
|
|
1489
|
+
* properties (node attributes, selection state, etc.) as reactive Signals.
|
|
1490
|
+
*
|
|
1491
|
+
* @example
|
|
1492
|
+
* ```typescript
|
|
1493
|
+
* @Component({
|
|
1494
|
+
* selector: 'app-counter',
|
|
1495
|
+
* template: `
|
|
1496
|
+
* <div>
|
|
1497
|
+
* <button (click)="increment()">Count: {{ node().attrs['count'] }}</button>
|
|
1498
|
+
* </div>
|
|
1499
|
+
* `
|
|
1500
|
+
* })
|
|
1501
|
+
* export class CounterComponent extends AteAngularNodeView {
|
|
1502
|
+
* increment() {
|
|
1503
|
+
* const count = this.node().attrs['count'] || 0;
|
|
1504
|
+
* this.updateAttributes({ count: count + 1 });
|
|
1505
|
+
* }
|
|
1506
|
+
* }
|
|
1507
|
+
* ```
|
|
1508
|
+
*/
|
|
1509
|
+
declare abstract class AteAngularNodeView {
|
|
1510
|
+
/**
|
|
1511
|
+
* The TipTap editor instance
|
|
1512
|
+
*/
|
|
1513
|
+
editor: Signal<Editor>;
|
|
1514
|
+
/**
|
|
1515
|
+
* The ProseMirror node
|
|
1516
|
+
*/
|
|
1517
|
+
node: Signal<Node$1>;
|
|
1518
|
+
/**
|
|
1519
|
+
* Decorations applied to this node
|
|
1520
|
+
*/
|
|
1521
|
+
decorations: Signal<readonly Decoration[]>;
|
|
1522
|
+
/**
|
|
1523
|
+
* Whether the node is currently selected
|
|
1524
|
+
*/
|
|
1525
|
+
selected: Signal<boolean>;
|
|
1526
|
+
/**
|
|
1527
|
+
* The extension instance that created this node
|
|
1528
|
+
*/
|
|
1529
|
+
extension: Signal<unknown>;
|
|
1530
|
+
/**
|
|
1531
|
+
* Function to get the current position of this node in the document
|
|
1532
|
+
*/
|
|
1533
|
+
getPos: () => number | undefined;
|
|
1534
|
+
/**
|
|
1535
|
+
* Update the attributes of this node
|
|
1536
|
+
*
|
|
1537
|
+
* @param attrs - Partial attributes to update
|
|
1538
|
+
*
|
|
1539
|
+
* @example
|
|
1540
|
+
* ```typescript
|
|
1541
|
+
* this.updateAttributes({ count: 5, color: 'blue' });
|
|
1542
|
+
* ```
|
|
1543
|
+
*/
|
|
1544
|
+
updateAttributes: (attrs: Record<string, unknown>) => void;
|
|
1545
|
+
/**
|
|
1546
|
+
* Delete this node from the document
|
|
1547
|
+
*/
|
|
1548
|
+
deleteNode: () => void;
|
|
1549
|
+
/** @internal */
|
|
1550
|
+
private _writableSignals?;
|
|
1551
|
+
/**
|
|
1552
|
+
* Internal method to initialize the component with NodeView props.
|
|
1553
|
+
* This is called by the AngularNodeViewRenderer.
|
|
1554
|
+
*
|
|
1555
|
+
* @internal
|
|
1556
|
+
*/
|
|
1557
|
+
_initNodeView(props: AteAngularNodeViewProps): void;
|
|
1558
|
+
/**
|
|
1559
|
+
* Internal method to update the component when the node changes.
|
|
1560
|
+
* This is called by the AngularNodeViewRenderer.
|
|
1561
|
+
*
|
|
1562
|
+
* @internal
|
|
1563
|
+
*/
|
|
1564
|
+
_updateNodeView(node: Node$1, decorations: readonly Decoration[]): void;
|
|
1565
|
+
/**
|
|
1566
|
+
* Internal method to update the selection state.
|
|
1567
|
+
* This is called by the AngularNodeViewRenderer.
|
|
1568
|
+
*
|
|
1569
|
+
* @internal
|
|
1570
|
+
*/
|
|
1571
|
+
_selectNodeView(): void;
|
|
1572
|
+
/**
|
|
1573
|
+
* Internal method to update the deselection state.
|
|
1574
|
+
* This is called by the AngularNodeViewRenderer.
|
|
1575
|
+
*
|
|
1576
|
+
* @internal
|
|
1577
|
+
*/
|
|
1578
|
+
_deselectNodeView(): void;
|
|
1579
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AteAngularNodeView, never>;
|
|
1580
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AteAngularNodeView, never, never, {}, {}, never, never, true, never>;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
/**
|
|
1584
|
+
* Universal Renderer for Angular Components as TipTap NodeViews.
|
|
1585
|
+
*
|
|
1586
|
+
* Supports:
|
|
1587
|
+
* - TipTap-Aware components (extending AteAngularNodeView)
|
|
1588
|
+
* - Standard library components (automatic @Input() sync)
|
|
1589
|
+
* - Signal-based inputs and outputs (Angular 18+)
|
|
1590
|
+
* - Content projection (editableContent)
|
|
1591
|
+
* - Unified lifecycle and event management
|
|
1592
|
+
*/
|
|
1593
|
+
declare function AteNodeViewRenderer<T>(component: Type<T>, options: AteComponentRenderOptions): (props: {
|
|
1594
|
+
node: Node$1;
|
|
1595
|
+
view: EditorView;
|
|
1596
|
+
getPos: () => number | undefined;
|
|
1597
|
+
decorations: readonly Decoration[];
|
|
1598
|
+
editor: Editor;
|
|
1599
|
+
extension: unknown;
|
|
1600
|
+
}) => NodeView;
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* Factory to transform an Angular component into a TipTap Node extension.
|
|
1604
|
+
* Supports both "TipTap-Aware" and "Standard" modes.
|
|
1605
|
+
*
|
|
1606
|
+
* @internal
|
|
1607
|
+
*/
|
|
1608
|
+
declare function createAngularComponentExtension<T = unknown>(injector: Injector, options: RegisterAngularComponentOptions<T>): Node$2;
|
|
1609
|
+
|
|
1610
|
+
/**
|
|
1611
|
+
* Registers ANY Angular component as a TipTap node extension.
|
|
1612
|
+
*
|
|
1613
|
+
* This function is the single public entry point for adding custom components.
|
|
1614
|
+
* It supports two distinct modes:
|
|
1615
|
+
*
|
|
1616
|
+
* 1. **TipTap-Aware Mode** (the component extends `AteAngularNodeView`):
|
|
1617
|
+
* Grants direct access to the TipTap API (`editor`, `node`, `updateAttributes`, etc.) within the component.
|
|
1618
|
+
*
|
|
1619
|
+
* 2. **Standard Mode** (library or legacy components):
|
|
1620
|
+
* Allows using any existing Angular component. Its `@Input()` properties are automatically
|
|
1621
|
+
* synchronized with TipTap node attributes.
|
|
1622
|
+
*
|
|
1623
|
+
* @param injectorOrOptions - The Angular Injector OR the configuration options
|
|
1624
|
+
* @param maybeOptions - Configuration options (if the first param was an injector)
|
|
1625
|
+
* @returns A TipTap Node extension ready to be used
|
|
1626
|
+
*
|
|
1627
|
+
* @example
|
|
1628
|
+
* ```typescript
|
|
1629
|
+
* // Modern way (requires provideAteEditor())
|
|
1630
|
+
* registerAngularComponent({
|
|
1631
|
+
* component: MyComponent,
|
|
1632
|
+
* name: 'myComponent'
|
|
1633
|
+
* });
|
|
1634
|
+
*
|
|
1635
|
+
* // Classic way
|
|
1636
|
+
* registerAngularComponent(injector, {
|
|
1637
|
+
* component: MyComponent
|
|
1638
|
+
* });
|
|
1639
|
+
* ```
|
|
1640
|
+
*/
|
|
1641
|
+
declare function registerAngularComponent<T = unknown>(injectorOrOptions: Injector | RegisterAngularComponentOptions<T>, maybeOptions?: RegisterAngularComponentOptions<T>): Node$2;
|
|
1642
|
+
|
|
1231
1643
|
/** @deprecated Renamed to `ATE_INITIAL_EDITOR_STATE`. This alias will be removed in v3.0.0. */
|
|
1232
1644
|
declare const INITIAL_EDITOR_STATE: AteEditorStateSnapshot;
|
|
1233
1645
|
|
|
@@ -1259,5 +1671,5 @@ declare const DEFAULT_TABLE_MENU_CONFIG: Partial<Record<"addColumnBefore" | "add
|
|
|
1259
1671
|
/** @deprecated Renamed to `ATE_DEFAULT_CELL_MENU_CONFIG`. This alias will be removed in v3.0.0. */
|
|
1260
1672
|
declare const DEFAULT_CELL_MENU_CONFIG: Partial<Record<"mergeCells" | "splitCell", boolean>>;
|
|
1261
1673
|
|
|
1262
|
-
export { ATE_BUBBLE_MENU_KEYS, ATE_CELL_BUBBLE_MENU_KEYS, ATE_DEFAULT_BUBBLE_MENU_CONFIG, ATE_DEFAULT_CELL_MENU_CONFIG, ATE_DEFAULT_IMAGE_BUBBLE_MENU_CONFIG, ATE_DEFAULT_SLASH_COMMANDS_CONFIG, ATE_DEFAULT_TABLE_MENU_CONFIG, ATE_DEFAULT_TOOLBAR_CONFIG, ATE_IMAGE_BUBBLE_MENU_KEYS, ATE_INITIAL_EDITOR_STATE, ATE_SLASH_COMMAND_KEYS, ATE_TABLE_BUBBLE_MENU_KEYS, ATE_TOOLBAR_KEYS, AngularTiptapEditorComponent, AteColorPickerService, AteDiscoveryCalculator, AteEditorCommandsService, AteI18nService, AteImageCalculator, AteImageService, AteLinkService, AteMarksCalculator, AteNoopValueAccessorDirective, AteSelectionCalculator, AteStructureCalculator, AteTableCalculator, AteColorPickerService as ColorPickerService, DEFAULT_BUBBLE_MENU_CONFIG, DEFAULT_CELL_MENU_CONFIG, DEFAULT_IMAGE_BUBBLE_MENU_CONFIG, DEFAULT_SLASH_COMMANDS_CONFIG, DEFAULT_TABLE_MENU_CONFIG, DEFAULT_TOOLBAR_CONFIG, DiscoveryCalculator, AteEditorCommandsService as EditorCommandsService, INITIAL_EDITOR_STATE, ImageCalculator, AteImageService as ImageService, AteLinkService as LinkService, MarksCalculator, SLASH_COMMAND_KEYS, SelectionCalculator, StructureCalculator, TableCalculator, AteI18nService as TiptapI18nService, createDefaultSlashCommands, filterSlashCommands };
|
|
1263
|
-
export type { AteBubbleMenuConfig, AteBubbleMenuKey, AteCellBubbleMenuConfig, AteCellBubbleMenuKey, AteColorEditMode, AteColorPickerSelection, AteCustomBubbleMenuItem, AteCustomSlashCommands, AteCustomToolbarItem, AteEditorConfig, AteEditorStateSnapshot, AteImageBubbleMenuConfig, AteImageBubbleMenuKey, AteImageData, AteImageUploadConfig, AteImageUploadContext, AteImageUploadHandler, AteImageUploadHandlerResult, AteImageUploadOptions, AteImageUploadResult, AteResizeOptions, AteSlashCommandItem, AteSlashCommandKey, AteSlashCommandsConfig, AteStateCalculator, AteTableBubbleMenuConfig, AteTableBubbleMenuKey, AteToolbarConfig, AteToolbarKey, AteTranslations, AteBubbleMenuConfig as BubbleMenuConfig, AteCellBubbleMenuConfig as CellBubbleMenuConfig, AteCustomSlashCommands as CustomSlashCommands, AteEditorConfig as EditorConfig, AteEditorStateSnapshot as EditorStateSnapshot, AteImageBubbleMenuConfig as ImageBubbleMenuConfig, AteImageData as ImageData, AteImageUploadHandler as ImageUploadHandler, AteImageUploadOptions as ImageUploadOptions, AteImageUploadResult as ImageUploadResult, AteResizeOptions as ResizeOptions, AteSlashCommandItem as SlashCommandItem, AteSlashCommandKey as SlashCommandKey, AteSlashCommandsConfig as SlashCommandsConfig, SupportedLocale, AteTableBubbleMenuConfig as TableBubbleMenuConfig, AteToolbarConfig as ToolbarConfig };
|
|
1674
|
+
export { ATE_BUBBLE_MENU_KEYS, ATE_CELL_BUBBLE_MENU_KEYS, ATE_DEFAULT_BUBBLE_MENU_CONFIG, ATE_DEFAULT_CELL_MENU_CONFIG, ATE_DEFAULT_IMAGE_BUBBLE_MENU_CONFIG, ATE_DEFAULT_SLASH_COMMANDS_CONFIG, ATE_DEFAULT_TABLE_MENU_CONFIG, ATE_DEFAULT_TOOLBAR_CONFIG, ATE_GLOBAL_CONFIG, ATE_IMAGE_BUBBLE_MENU_KEYS, ATE_INITIAL_EDITOR_STATE, ATE_SLASH_COMMAND_KEYS, ATE_TABLE_BUBBLE_MENU_KEYS, ATE_TOOLBAR_KEYS, AngularTiptapEditorComponent, AteAngularNodeView, AteColorPickerService, AteDiscoveryCalculator, AteEditorCommandsService, AteI18nService, AteImageCalculator, AteImageService, AteLinkService, AteMarksCalculator, AteNodeViewRenderer, AteNoopValueAccessorDirective, AteSelectionCalculator, AteStructureCalculator, AteTableCalculator, AteColorPickerService as ColorPickerService, DEFAULT_BUBBLE_MENU_CONFIG, DEFAULT_CELL_MENU_CONFIG, DEFAULT_IMAGE_BUBBLE_MENU_CONFIG, DEFAULT_SLASH_COMMANDS_CONFIG, DEFAULT_TABLE_MENU_CONFIG, DEFAULT_TOOLBAR_CONFIG, DiscoveryCalculator, AteEditorCommandsService as EditorCommandsService, INITIAL_EDITOR_STATE, ImageCalculator, AteImageService as ImageService, AteLinkService as LinkService, MarksCalculator, SLASH_COMMAND_KEYS, SelectionCalculator, StructureCalculator, TableCalculator, AteI18nService as TiptapI18nService, createAngularComponentExtension, createDefaultSlashCommands, filterSlashCommands, provideAteEditor, registerAngularComponent };
|
|
1675
|
+
export type { AteAngularNode, AteBubbleMenuConfig, AteBubbleMenuKey, AteCellBubbleMenuConfig, AteCellBubbleMenuKey, AteColorEditMode, AteColorPickerSelection, AteComponentRenderOptions, AteCustomBubbleMenuItem, AteCustomSlashCommands, AteCustomToolbarItem, AteEditorConfig, AteEditorStateSnapshot, AteImageBubbleMenuConfig, AteImageBubbleMenuKey, AteImageData, AteImageUploadConfig, AteImageUploadContext, AteImageUploadHandler, AteImageUploadHandlerResult, AteImageUploadOptions, AteImageUploadResult, AteResizeOptions, AteSlashCommandItem, AteSlashCommandKey, AteSlashCommandsConfig, AteStateCalculator, AteTableBubbleMenuConfig, AteTableBubbleMenuKey, AteToolbarConfig, AteToolbarKey, AteTranslations, AteBubbleMenuConfig as BubbleMenuConfig, AteCellBubbleMenuConfig as CellBubbleMenuConfig, AteCustomSlashCommands as CustomSlashCommands, AteEditorConfig as EditorConfig, AteEditorStateSnapshot as EditorStateSnapshot, AteImageBubbleMenuConfig as ImageBubbleMenuConfig, AteImageData as ImageData, AteImageUploadHandler as ImageUploadHandler, AteImageUploadOptions as ImageUploadOptions, AteImageUploadResult as ImageUploadResult, RegisterAngularComponentOptions, AteResizeOptions as ResizeOptions, AteSlashCommandItem as SlashCommandItem, AteSlashCommandKey as SlashCommandKey, AteSlashCommandsConfig as SlashCommandsConfig, SupportedLocale, AteTableBubbleMenuConfig as TableBubbleMenuConfig, AteToolbarConfig as ToolbarConfig };
|
package/package.json
CHANGED