@flogeez/angular-tiptap-editor 3.4.0 → 3.4.2

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/esm2022/lib/components/editor/angular-tiptap-editor.component.mjs +3 -1
  3. package/esm2022/lib/components/table-of-contents/ate-table-of-contents.component.mjs +21 -6
  4. package/esm2022/lib/components/table-of-contents/ate-toc-node.component.mjs +64 -0
  5. package/esm2022/lib/config/ate-slash-commands.config.mjs +10 -1
  6. package/esm2022/lib/config/ate-toc.config.mjs +13 -0
  7. package/esm2022/lib/i18n/ateTranslationsModel.mjs +1 -1
  8. package/esm2022/lib/i18n/de_ateTranslations.mjs +6 -1
  9. package/esm2022/lib/i18n/en_ateTranslations.mjs +6 -1
  10. package/esm2022/lib/i18n/fr_ateTranslations.mjs +6 -1
  11. package/esm2022/lib/models/ate-editor-config.model.mjs +1 -1
  12. package/esm2022/lib/models/ate-toc.model.mjs +2 -0
  13. package/esm2022/lib/node-view/ate-angular-node-view.mjs +8 -2
  14. package/esm2022/lib/node-view/ate-node-view.renderer.mjs +11 -6
  15. package/esm2022/public-api.mjs +4 -1
  16. package/fesm2022/flogeez-angular-tiptap-editor.mjs +8373 -8250
  17. package/fesm2022/flogeez-angular-tiptap-editor.mjs.map +1 -1
  18. package/lib/components/editor/angular-tiptap-editor.component.d.ts +1 -0
  19. package/lib/components/table-of-contents/ate-table-of-contents.component.d.ts +3 -9
  20. package/lib/components/table-of-contents/ate-toc-node.component.d.ts +19 -0
  21. package/lib/config/ate-slash-commands.config.d.ts +1 -1
  22. package/lib/config/ate-toc.config.d.ts +5 -0
  23. package/lib/i18n/ateTranslationsModel.d.ts +5 -0
  24. package/lib/models/ate-editor-config.model.d.ts +3 -0
  25. package/lib/models/ate-toc.model.d.ts +26 -0
  26. package/lib/node-view/ate-angular-node-view.d.ts +4 -0
  27. package/lib/services/ate-i18n.service.d.ts +9 -0
  28. package/package.json +1 -1
  29. package/public-api.d.ts +4 -1
@@ -220,6 +220,7 @@ export declare class AngularTiptapEditorComponent implements AfterViewInit, OnDe
220
220
  tableBubbleMenu?: Partial<Record<"addColumnBefore" | "addColumnAfter" | "deleteColumn" | "addRowBefore" | "addRowAfter" | "deleteRow" | "deleteTable" | "toggleHeaderColumn" | "toggleHeaderRow" | "separator", boolean>> | undefined;
221
221
  cellBubbleMenu?: Partial<Record<"mergeCells" | "splitCell", boolean>> | undefined;
222
222
  slashCommands?: AteSlashCommandsConfig | undefined;
223
+ tableOfContents?: import("@flogeez/angular-tiptap-editor").AteTocConfig | undefined;
223
224
  floatingToolbar?: boolean | undefined;
224
225
  imageUpload?: import("../../models/ate-image.model").AteImageUploadConfig | undefined;
225
226
  angularNodes?: AteAngularNode[] | undefined;
@@ -1,15 +1,8 @@
1
1
  import { OnDestroy } from "@angular/core";
2
2
  import { Editor } from "@tiptap/core";
3
3
  import { AteEditorRef } from "../../models/ate-editor-ref";
4
+ import { AteTocItem, AteTocVariant } from "../../models/ate-toc.model";
4
5
  import * as i0 from "@angular/core";
5
- export interface AteTocItem {
6
- text: string;
7
- level: number;
8
- pos: number;
9
- id: string;
10
- active: boolean;
11
- }
12
- export type AteTocVariant = "card" | "transparent" | "minimal";
13
6
  /**
14
7
  * Table of Contents Component (Notion-style)
15
8
  * Dynamically extracts headings from the active editor and displays them.
@@ -23,6 +16,7 @@ export declare class AteTableOfContentsComponent implements OnDestroy {
23
16
  position: import("@angular/core").InputSignal<"left" | "right">;
24
17
  variant: import("@angular/core").InputSignal<AteTocVariant>;
25
18
  hoverExpand: import("@angular/core").InputSignal<boolean>;
19
+ maxDepth: import("@angular/core").InputSignalWithTransform<number, string | number>;
26
20
  private readonly registry;
27
21
  private readonly i18n;
28
22
  dashWidth(level: number): number;
@@ -44,5 +38,5 @@ export declare class AteTableOfContentsComponent implements OnDestroy {
44
38
  private updateHeadings;
45
39
  private checkActiveHeading;
46
40
  static ɵfac: i0.ɵɵFactoryDeclaration<AteTableOfContentsComponent, never>;
47
- static ɵcmp: i0.ɵɵComponentDeclaration<AteTableOfContentsComponent, "ate-table-of-contents", never, { "editor": { "alias": "editor"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "showTitle": { "alias": "showTitle"; "required": false; "isSignal": true; }; "floating": { "alias": "floating"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "hoverExpand": { "alias": "hoverExpand"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
41
+ static ɵcmp: i0.ɵɵComponentDeclaration<AteTableOfContentsComponent, "ate-table-of-contents", never, { "editor": { "alias": "editor"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "showTitle": { "alias": "showTitle"; "required": false; "isSignal": true; }; "floating": { "alias": "floating"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "hoverExpand": { "alias": "hoverExpand"; "required": false; "isSignal": true; }; "maxDepth": { "alias": "maxDepth"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
48
42
  }
@@ -0,0 +1,19 @@
1
+ import { Injector } from "@angular/core";
2
+ import { AteAngularNodeView } from "../../node-view/ate-angular-node-view";
3
+ import { RegisterAngularComponentOptions } from "../../node-view/ate-node-view.models";
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Custom Angular NodeView wrapper for displaying Table of Contents directly inside the editor content.
7
+ */
8
+ export declare class AteTocNodeComponent extends AteAngularNodeView {
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<AteTocNodeComponent, never>;
10
+ static ɵcmp: i0.ɵɵComponentDeclaration<AteTocNodeComponent, "ate-toc-node", never, {}, {}, never, never, true, never>;
11
+ }
12
+ /**
13
+ * Registration options for the Table of Contents Angular NodeView
14
+ */
15
+ export declare const AteTocNodeOptions: RegisterAngularComponentOptions<AteTocNodeComponent>;
16
+ /**
17
+ * Creates the Table of Contents TipTap Node Extension instance.
18
+ */
19
+ export declare function getAteTocNodeExtension(injector?: Injector): import("@tiptap/core").Node<any, any>;
@@ -4,7 +4,7 @@ import { AteEditorCommandsService } from "../services/ate-editor-commands.servic
4
4
  /**
5
5
  * Clés des commandes natives dans l'ordre d'affichage
6
6
  */
7
- export declare const ATE_SLASH_COMMAND_KEYS: readonly ["heading1", "heading2", "heading3", "bulletList", "orderedList", "blockquote", "code", "image", "horizontalRule", "table"];
7
+ export declare const ATE_SLASH_COMMAND_KEYS: readonly ["heading1", "heading2", "heading3", "bulletList", "orderedList", "blockquote", "code", "image", "horizontalRule", "table", "tableOfContents"];
8
8
  export type AteSlashCommandKey = (typeof ATE_SLASH_COMMAND_KEYS)[number];
9
9
  /**
10
10
  * Configuration simplifiée pour activer/désactiver les slash commands natives.
@@ -0,0 +1,5 @@
1
+ import { AteTocConfig } from "../models/ate-toc.model";
2
+ /**
3
+ * Default Table of Contents configuration
4
+ */
5
+ export declare const ATE_DEFAULT_TOC_CONFIG: Required<AteTocConfig>;
@@ -104,6 +104,11 @@ export interface AteTranslations {
104
104
  description: string;
105
105
  keywords: string[];
106
106
  };
107
+ tableOfContents: {
108
+ title: string;
109
+ description: string;
110
+ keywords: string[];
111
+ };
107
112
  };
108
113
  table: {
109
114
  addRowBefore: string;
@@ -4,6 +4,7 @@ import { RegisterAngularComponentOptions } from "../node-view/ate-node-view.mode
4
4
  import { AteBubbleMenuConfig, AteImageBubbleMenuConfig, AteTableBubbleMenuConfig, AteCellBubbleMenuConfig } from "./ate-bubble-menu.model";
5
5
  import { AteSlashCommandsConfig } from "../config/ate-slash-commands.config";
6
6
  import { AteImageUploadConfig } from "./ate-image.model";
7
+ import { AteTocConfig } from "./ate-toc.model";
7
8
  import { Extension, Node, Mark, EditorOptions } from "@tiptap/core";
8
9
  import { AteStateCalculator } from "./ate-editor-state.model";
9
10
  import { AteCustomSlashCommands } from "./ate-slash-command.model";
@@ -90,6 +91,8 @@ export interface AteEditorConfig {
90
91
  cellBubbleMenu?: AteCellBubbleMenuConfig;
91
92
  /** Slash commands configuration (/) */
92
93
  slashCommands?: AteSlashCommandsConfig;
94
+ /** Table of Contents configuration */
95
+ tableOfContents?: AteTocConfig;
93
96
  /** If true, shows the floating toolbar on focus */
94
97
  floatingToolbar?: boolean;
95
98
  /** Technical configuration for image uploads */
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Visual variants for Table of Contents
3
+ */
4
+ export type AteTocVariant = "card" | "transparent" | "minimal";
5
+ /**
6
+ * Item structure extracted by Table of Contents
7
+ */
8
+ export interface AteTocItem {
9
+ text: string;
10
+ level: number;
11
+ pos: number;
12
+ id: string;
13
+ active: boolean;
14
+ }
15
+ /**
16
+ * Configuration options for Table of Contents
17
+ */
18
+ export interface AteTocConfig {
19
+ enabled?: boolean;
20
+ floating?: boolean;
21
+ position?: "left" | "right";
22
+ variant?: AteTocVariant;
23
+ hoverExpand?: boolean;
24
+ showTitle?: boolean;
25
+ maxDepth?: number;
26
+ }
@@ -49,6 +49,10 @@ export declare abstract class AteAngularNodeView {
49
49
  * The ProseMirror node
50
50
  */
51
51
  node: Signal<ProseMirrorNode>;
52
+ /**
53
+ * Helper signal to directly access node attributes
54
+ */
55
+ attributes: Signal<Record<string, unknown>>;
52
56
  /**
53
57
  * Decorations applied to this node
54
58
  */
@@ -113,6 +113,11 @@ export declare class AteI18nService {
113
113
  description: string;
114
114
  keywords: string[];
115
115
  };
116
+ tableOfContents: {
117
+ title: string;
118
+ description: string;
119
+ keywords: string[];
120
+ };
116
121
  }>;
117
122
  readonly table: import("@angular/core").Signal<{
118
123
  addRowBefore: string;
@@ -244,6 +249,10 @@ export declare class AteI18nService {
244
249
  title: string;
245
250
  description: string;
246
251
  keywords: string[];
252
+ } | {
253
+ title: string;
254
+ description: string;
255
+ keywords: string[];
247
256
  };
248
257
  static ɵfac: i0.ɵɵFactoryDeclaration<AteI18nService, never>;
249
258
  static ɵprov: i0.ɵɵInjectableDeclaration<AteI18nService>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flogeez/angular-tiptap-editor",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
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
@@ -1,5 +1,6 @@
1
1
  export * from "./lib/components/editor/angular-tiptap-editor.component";
2
- export { AteTableOfContentsComponent, type AteTocItem, type AteTocVariant } from "./lib/components/table-of-contents/ate-table-of-contents.component";
2
+ export { AteTableOfContentsComponent } from "./lib/components/table-of-contents/ate-table-of-contents.component";
3
+ export { AteTocNodeComponent, AteTocNodeOptions, getAteTocNodeExtension } from "./lib/components/table-of-contents/ate-toc-node.component";
3
4
  export * from "./lib/ate-editor.provider";
4
5
  export * from "./lib/directives/ate-noop-value-accessor.directive";
5
6
  export * from "./lib/directives/ate-tooltip.directive";
@@ -23,8 +24,10 @@ export * from "./lib/models/ate-image.model";
23
24
  export * from "./lib/models/ate-bubble-menu.model";
24
25
  export * from "./lib/models/ate-editor-config.model";
25
26
  export * from "./lib/models/ate-slash-command.model";
27
+ export * from "./lib/models/ate-toc.model";
26
28
  export * from "./lib/config/ate-editor.config";
27
29
  export * from "./lib/config/ate-global-config.token";
30
+ export * from "./lib/config/ate-toc.config";
28
31
  export * from "./lib/config/ate-slash-commands.config";
29
32
  export type { SupportedLocale } from "./lib/i18n/ateTranslationsModel";
30
33
  export { AteAngularNodeView } from "./lib/node-view/ate-angular-node-view";