@tectra-ng/editor 0.3.2 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tectra-ng/editor",
3
- "version": "0.3.2",
3
+ "version": "0.4.1",
4
4
  "description": "Rich text editor for tectra: toolbar, menus, links, images, mentions and a renderer for saved HTML.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://tectra-ng.com",
@@ -32,10 +32,10 @@
32
32
  "@angular/common": "^22.2.0",
33
33
  "@angular/core": "^22.2.0",
34
34
  "@angular/forms": "^22.2.0",
35
- "@tectra-ng/core": "^0.3.2",
36
- "@tectra-ng/icons": "^0.3.2",
37
- "@tectra-ng/themes": "^0.3.2",
38
- "@tectra-ng/ui": "^0.3.2",
35
+ "@tectra-ng/core": "^0.4.1",
36
+ "@tectra-ng/icons": "^0.4.1",
37
+ "@tectra-ng/themes": "^0.4.1",
38
+ "@tectra-ng/ui": "^0.4.1",
39
39
  "@angular/platform-browser": "^22.2.0"
40
40
  },
41
41
  "dependencies": {
@@ -1,135 +1,62 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { TxPassThroughOptions } from "@tectra-ng/core/config";
3
- import { TectraDeepPartial } from "@tectra-ng/themes";
3
+ import { TectraDeepPartial, TectraEditorContentTokens } from "@tectra-ng/themes";
4
+ /** Markup of the saved text: clean `html` or Quill 2 markup (`quill`). */
4
5
  export type TxEditorFormat = 'html' | 'quill';
6
+ /** Parts of `tx-editor-content` that `pt` can style. */
5
7
  export type TxEditorContentPart = 'root' | 'body';
8
+ /** An image of `tx-editor-content` was clicked. */
6
9
  export interface TxEditorImageClickEvent {
10
+ /** The click or key press that triggered it. */
7
11
  originalEvent: MouseEvent | KeyboardEvent;
12
+ /** Address of the image. */
8
13
  src: string;
14
+ /** Alternative text of the image. */
9
15
  alt: string;
10
16
  }
17
+ /** Tells whether the HTML carries Quill 2 markup. */
11
18
  export declare function isQuillHtml(html: string | null | undefined): boolean;
19
+ /** Converts Quill 2 markup to the clean HTML of the editor; other HTML passes through. */
12
20
  export declare function fromQuillHtml(html: string | null | undefined, document?: Document | null): string;
21
+ /** Converts the clean HTML of the editor to Quill 2 markup. */
13
22
  export declare function toQuillHtml(html: string | null | undefined, document?: Document | null): string;
23
+ /** Brings saved text, from the editor or from Quill, to the clean HTML the editor reads. */
14
24
  export declare function toEditorHtml(html: string | null | undefined, document?: Document | null): string;
25
+ /** Writes the editor HTML in the chosen format: unchanged for `html`, converted for `quill`. */
15
26
  export declare function formatEditorHtml(html: string, format: TxEditorFormat, document?: Document | null): string;
27
+ /**
28
+ * Cleans HTML with an allowlist: keeps colours, alignment and indents, drops scripts, handlers and unsafe links.
29
+ */
16
30
  export declare function sanitizeEditorHtml(html: string | null | undefined, document?: Document | null): string;
31
+ /**
32
+ * Loads the typography of editor text (`tx-editor-prose`); add it once where saved text is shown without `tx-editor-content`.
33
+ */
17
34
  export declare class TxEditorProseStyles {
18
35
  private readonly contentTheme;
19
36
  static ɵfac: i0.ɵɵFactoryDeclaration<TxEditorProseStyles, never>;
20
37
  static ɵcmp: i0.ɵɵComponentDeclaration<TxEditorProseStyles, "tx-editor-prose-styles", never, {}, {}, never, never, true, never>;
21
38
  }
39
+ /**
40
+ * Shows saved rich text — clean HTML from `tx-editor` or Quill 2 markup — with the same typography as the editor. An own allowlist sanitizer keeps colours, alignment and indents and drops scripts, handlers and unsafe links; images open in a preview. The entry point does not load the editor engine.
41
+ * @see https://tectra-ng.com/components/editor-content
42
+ */
22
43
  export declare class TxEditorContent {
23
44
  private readonly contentTheme;
24
45
  private sanitizer;
25
46
  private document;
47
+ /** The saved HTML, clean or Quill */
26
48
  readonly html: import("@angular/core").InputSignal<string | null | undefined>;
49
+ /** Images open in a preview dialog on click */
27
50
  readonly previewImages: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
28
- readonly dt: import("@angular/core").InputSignal<TectraDeepPartial<{
29
- root: {
30
- color: string;
31
- fontSize: string;
32
- lineHeight: string;
33
- paragraphGap: string;
34
- blockGap: string;
35
- };
36
- heading: {
37
- fontWeight: string;
38
- lineHeight: string;
39
- spaceBefore: string;
40
- spaceAfter: string;
41
- h1Size: string;
42
- h2Size: string;
43
- h3Size: string;
44
- h4Size: string;
45
- h5Size: string;
46
- h6Size: string;
47
- h6Color: string;
48
- };
49
- link: {
50
- color: string;
51
- underlineColor: string;
52
- hoverUnderlineColor: string;
53
- };
54
- list: {
55
- indent: string;
56
- itemGap: string;
57
- markerColor: string;
58
- };
59
- task: {
60
- size: string;
61
- gap: string;
62
- borderRadius: string;
63
- borderColor: string;
64
- checkedBackground: string;
65
- checkedColor: string;
66
- doneColor: string;
67
- };
68
- quote: {
69
- borderWidth: string;
70
- borderColor: string;
71
- padding: string;
72
- color: string;
73
- };
74
- code: {
75
- fontFamily: string;
76
- fontSize: string;
77
- padding: string;
78
- borderRadius: string;
79
- background: string;
80
- color: string;
81
- };
82
- codeBlock: {
83
- padding: string;
84
- borderRadius: string;
85
- background: string;
86
- borderColor: string;
87
- fontSize: string;
88
- lineHeight: string;
89
- };
90
- rule: {
91
- color: string;
92
- spacing: string;
93
- };
94
- image: {
95
- borderRadius: string;
96
- selectedOutline: string;
97
- };
98
- video: {
99
- borderRadius: string;
100
- aspectRatio: string;
101
- };
102
- mention: {
103
- padding: string;
104
- borderRadius: string;
105
- background: string;
106
- color: string;
107
- fontWeight: string;
108
- };
109
- callout: {
110
- paddingBlock: string;
111
- paddingInlineEnd: string;
112
- paddingInlineStart: string;
113
- borderRadius: string;
114
- tint: string;
115
- markerSize: string;
116
- markerStart: string;
117
- markerFontSize: string;
118
- infoColor: string;
119
- successColor: string;
120
- warnColor: string;
121
- dangerColor: string;
122
- markerColor: string;
123
- };
124
- table: {
125
- borderColor: string;
126
- headerBackground: string;
127
- cellPadding: string;
128
- };
129
- }> | undefined>;
51
+ /** Design tokens of this instance (`editorContent`) */
52
+ readonly dt: import("@angular/core").InputSignal<TectraDeepPartial<TectraEditorContentTokens> | undefined>;
53
+ /** Classes and styles of the parts: `root`, `body` */
130
54
  readonly pt: import("@angular/core").InputSignal<Partial<Record<TxEditorContentPart, import("@tectra-ng/core/config").TxPassThroughValue<TxEditorContent>>> | undefined>;
55
+ /** How `pt` merges with the global pass-through */
131
56
  readonly ptOptions: import("@angular/core").InputSignal<TxPassThroughOptions | undefined>;
57
+ /** Removes the tectra styles */
132
58
  readonly unstyled: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
59
+ /** An image was clicked: `{ originalEvent, src, alt }` */
133
60
  readonly imageClick: import("@angular/core").OutputEmitterRef<TxEditorImageClickEvent>;
134
61
  readonly translations: import("@angular/core").Signal<import("@tectra-ng/core/config").TxTranslations>;
135
62
  readonly isUnstyled: import("@angular/core").Signal<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"tectra-ng-editor-content.d.ts","names":[],"sources":["../../../../packages/editor/content/src/editor-content.types.ts","../../../../packages/editor/content/src/editor-html.ts","../../../../packages/editor/content/src/editor-sanitizer.ts","../../../../packages/editor/content/src/editor-prose-styles.component.ts","../../../../packages/editor/content/src/editor-content.component.ts"],"mappings":";;;YAAY;YAEA;iBAEK;EACf,eAAe,aAAa;EAC5B;EACA;;wBC+Gc,YAAY;wBAIZ,cAAc,iCAAiC,WAAW;wBA2F1D,YAAY,iCAAiC,WAAW;wBAiFxD,aAAa,iCAAiC,WAAW;wBAIzD,iBAAiB,cAAc,QAAQ,gBAAgB,WAAW;wBC7LlE,mBAAmB,iCAAiC,WAAW;qBC/FlE;mBACM;SADN,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;;qBCyCA;mBACM;UAET;UACA;WAEC,8BAAI;WACJ,uCAAa;WACb,4BAAE,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WACF,4BAAE,YAAA,QAAA,OAAA,sDAAA,mBAAA;WACF,mCAAS,YAAA;WACT,kCAAQ;WAER,oCAAU,iBAAA;WAEV,sCAAY,wCAAA;WACZ,oCAAU;WACV,qCAAW,OAAA,QAAA,OAAA,sDAAA;mBACH;qBACE,iCAAO;IAAiB;IAAa;;qBACrC,qCAAW;qBACX,kCAAQ,2CAAA;WAClB,mCAAS;;;;YAqBR,QAAQ,OAAO;YAOf,UAAU,OAAO;UAQnB;SA1DG,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;IAAe;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;;IAAA"}
1
+ {"version":3,"file":"tectra-ng-editor-content.d.ts","names":[],"sources":["../../../../packages/editor/content/src/editor-content.types.ts","../../../../packages/editor/content/src/editor-html.ts","../../../../packages/editor/content/src/editor-sanitizer.ts","../../../../packages/editor/content/src/editor-prose-styles.component.ts","../../../../packages/editor/content/src/editor-content.component.ts"],"mappings":";;;;YACY;;YAGA;;iBAGK;;EAEf,eAAe,aAAa;;EAE5B;;EAEA;;;wBC0Gc,YAAY;;wBAKZ,cAAc,iCAAiC,WAAW;;wBA4F1D,YAAY,iCAAiC,WAAW;;wBAkFxD,aAAa,iCAAiC,WAAW;;wBAKzD,iBAAiB,cAAc,QAAQ,gBAAgB,WAAW;;;;wBC/LlE,mBAAmB,iCAAiC,WAAW;;;;qBC/FlE;mBACM;SADN,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;;;;;;qBCsCA;mBACM;UAET;UACA;;WAEC,8BAAI;;WACJ,uCAAa;;WACb,4BAAE,YAAA,kBAAA;;WACF,4BAAE,YAAA,QAAA,OAAA,sDAAA,mBAAA;;WACF,mCAAS,YAAA;;WACT,kCAAQ;;WAER,oCAAU,iBAAA;WAEV,sCAAY,wCAAA;WACZ,oCAAU;WACV,qCAAW,OAAA,QAAA,OAAA,sDAAA;mBACH;qBACE,iCAAO;IAAiB;IAAa;;qBACrC,qCAAW;qBACX,kCAAQ,2CAAA;WAClB,mCAAS;;;;YAqBR,QAAQ,OAAO;YAOf,UAAU,OAAO;UAQnB;SA1DG,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;IAAe;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;;IAAA"}
@@ -6,72 +6,127 @@ import { Schema } from "prosemirror-model";
6
6
  import { ConnectedPosition } from "@angular/cdk/overlay";
7
7
  import { TxFormControlBase } from "@tectra-ng/core/forms";
8
8
  import { TxEditorFormat } from "@tectra-ng/editor/content";
9
- import { TectraDeepPartial } from "@tectra-ng/themes";
9
+ import { TectraDeepPartial, TectraEditorTokens } from "@tectra-ng/themes";
10
10
  import { TxMenuItem } from "@tectra-ng/ui/menu";
11
11
  import { EditorView } from "prosemirror-view";
12
+ /** A button of the toolbar; list them in `toolbar` to build your own layout. */
12
13
  export type TxEditorTool = 'undo' | 'redo' | 'blockStyle' | 'fontSize' | 'bold' | 'italic' | 'underline' | 'strike' | 'code' | 'subscript' | 'superscript' | 'textColor' | 'highlight' | 'bulletList' | 'orderedList' | 'taskList' | 'outdent' | 'indent' | 'align' | 'link' | 'image' | 'video' | 'blockquote' | 'codeBlock' | 'horizontalRule' | 'clearFormatting' | 'table' | 'callout';
14
+ /** A ready toolbar layout: `full`, `compact`, `minimal` or `none` (no toolbar). */
13
15
  export type TxEditorToolbarPreset = 'full' | 'compact' | 'minimal' | 'none';
16
+ /** The toolbar: a preset name, or your own groups of tools, each inner list being one group. */
14
17
  export type TxEditorToolbar = TxEditorToolbarPreset | readonly (readonly TxEditorTool[])[];
18
+ /** Heading level, 1 to 6. */
15
19
  export type TxEditorHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
20
+ /** Text alignment of a block. */
16
21
  export type TxEditorAlign = 'left' | 'center' | 'right' | 'justify';
22
+ /** Parts of `tx-editor` that `pt` can style. */
17
23
  export type TxEditorPart = 'root' | 'toolbar' | 'tool' | 'content' | 'footer' | 'bubble' | 'suggestions';
24
+ /** A colour of the text or highlight palette. */
18
25
  export interface TxEditorColor {
26
+ /** Translation key of the colour name shown as its tooltip. */
19
27
  label: string;
28
+ /** CSS colour applied to the text or its background. */
20
29
  value: string;
21
30
  }
31
+ /** One entry of the `@` mention list. */
22
32
  export interface TxEditorMentionItem {
33
+ /** Identifier stored in the mention. */
23
34
  id: string;
35
+ /** Name shown in the list and in the text. */
24
36
  label: string;
37
+ /** Second line under the name in the list. */
25
38
  description?: string;
39
+ /** Image URL of a round picture before the name. */
26
40
  avatar?: string;
27
41
  }
42
+ /**
43
+ * Finds the people or things offered after `@`: gets the typed query and returns the items or a Promise of them.
44
+ */
28
45
  export type TxEditorMentionSource = (query: string) => readonly TxEditorMentionItem[] | Promise<readonly TxEditorMentionItem[]>;
46
+ /** Uploads an image file and resolves with the URL to put in the text. */
29
47
  export type TxEditorImageUpload = (file: File) => Promise<string>;
48
+ /** An image that was not inserted, with the reason. */
30
49
  export interface TxEditorImageRejection {
50
+ /** The rejected file. */
31
51
  file: File;
52
+ /** `type` when the file is not an image, `size` when it is larger than `maxImageSize`. */
32
53
  reason: 'type' | 'size';
54
+ /** Text to show the user: the file name for a wrong type, a "too large" message for a size. */
33
55
  message: string;
34
56
  }
57
+ /** The selection of the editor, as emitted by `selectionChange`. */
35
58
  export interface TxEditorSelection {
59
+ /** Start position in the document. */
36
60
  from: number;
61
+ /** End position in the document. */
37
62
  to: number;
63
+ /** `true` for a caret without selected text. */
38
64
  empty: boolean;
65
+ /** The selected plain text. */
39
66
  text: string;
40
67
  }
68
+ /** The text after a change, as emitted by `textChange`. */
41
69
  export interface TxEditorTextChange {
70
+ /** The content as HTML. */
42
71
  html: string;
72
+ /** The content as plain text. */
43
73
  text: string;
44
74
  }
75
+ /** An AI action offered on the selected text. */
45
76
  export interface TxEditorAiAction {
77
+ /** Identifier you read back in the request. */
46
78
  id: string;
79
+ /** Text of the menu item. */
47
80
  label: string;
81
+ /** Icon of the menu item; `sparkles` by default. */
48
82
  icon?: string;
49
83
  }
84
+ /** An AI action the user picked, emitted by `aiAction` with the selected text. */
50
85
  export interface TxEditorAiRequest {
86
+ /** The action that was picked. */
51
87
  action: TxEditorAiAction;
88
+ /** The selected plain text. */
52
89
  text: string;
90
+ /** The selected content as HTML. */
53
91
  html: string;
92
+ /**
93
+ * Replaces the selection with the answer; pass a string, or an async stream of chunks that is written as it arrives.
94
+ */
54
95
  replace: (content: string | AsyncIterable<string>) => Promise<void>;
55
96
  }
97
+ /**
98
+ * Content at the end of the toolbar, before the AI and full view buttons
99
+ * @see https://tectra-ng.com/components/editor
100
+ */
56
101
  export declare class TxEditorToolbarEnd {
57
102
  static ɵfac: i0.ɵɵFactoryDeclaration<TxEditorToolbarEnd, never>;
58
103
  static ɵdir: i0.ɵɵDirectiveDeclaration<TxEditorToolbarEnd, "[txEditorToolbarEnd]", never, {}, {}, never, never, true, never>;
59
104
  }
105
+ /** How one toolbar tool looks and works: icon, label, shortcut and command. */
60
106
  export interface TxEditorToolSpec {
107
+ /** Name of the toolbar icon. */
61
108
  icon: string;
109
+ /** Translation key of the tool name, used as tooltip and accessible name. */
62
110
  label: keyof TxTranslations;
111
+ /** Keyboard shortcut written with `Mod` for Ctrl or Cmd, such as `Mod+B`. */
63
112
  shortcut?: string;
113
+ /** Runs when the tool is pressed; missing for tools that open a menu or a popover. */
64
114
  command?: Command;
115
+ /** Tells whether the tool is on at the current selection, which shows it pressed. */
65
116
  active?: (state: EditorState) => boolean;
66
117
  }
118
+ /** The groups of tools of each toolbar preset. */
67
119
  export declare const TX_EDITOR_TOOLBARS: Record<Exclude<TxEditorToolbarPreset, 'none'>, readonly (readonly TxEditorTool[])[]>;
120
+ /** Icon, label, shortcut and command of every toolbar tool. */
68
121
  export declare const TX_EDITOR_TOOLS: Record<TxEditorTool, TxEditorToolSpec>;
122
+ /** Icon name of each text alignment. */
69
123
  export declare const TX_EDITOR_ALIGN_ICONS: {
70
124
  readonly left: "align-left";
71
125
  readonly center: "align-center";
72
126
  readonly right: "align-right";
73
127
  readonly justify: "align-justify";
74
128
  };
129
+ /** Choices of the font size menu: a translation key and the CSS size in `em`, `null` for the normal size. */
75
130
  export declare const TX_EDITOR_FONT_SIZES: readonly [{
76
131
  readonly label: "editorSizeSmall";
77
132
  readonly value: "0.75em";
@@ -85,68 +140,128 @@ export declare const TX_EDITOR_FONT_SIZES: readonly [{
85
140
  readonly label: "editorSizeHuge";
86
141
  readonly value: "2.5em";
87
142
  }];
143
+ /** Palette of the text colour tool. */
88
144
  export declare const TX_EDITOR_TEXT_COLORS: readonly TxEditorColor[];
145
+ /** Palette of the highlight tool, in translucent colours that work on light and dark backgrounds. */
89
146
  export declare const TX_EDITOR_HIGHLIGHT_COLORS: readonly TxEditorColor[];
147
+ /** Writes a shortcut for display: `Mod` becomes the Cmd symbol on Mac and `Ctrl` elsewhere. */
90
148
  export declare function shortcutLabel(shortcut: string, mac: boolean): string;
149
+ /** Icons the editor draws itself; register them once to use their names elsewhere. */
91
150
  export declare const TX_EDITOR_ICONS: TxIconSet;
151
+ /** Width of one indent level, in `em`. */
92
152
  export declare const INDENT_STEP_EM = 3;
153
+ /** Deepest indent level of a block. */
93
154
  export declare const MAX_INDENT = 8;
155
+ /** Block-level formatting shared by paragraphs and headings: alignment, indent and direction. */
94
156
  export interface TxBlockAttrs {
157
+ /** Text alignment: `center`, `right` or `justify`; `null` for the default left. */
95
158
  align: string | null;
159
+ /** Indent level, from 0 to `MAX_INDENT`. */
96
160
  indent: number;
161
+ /** `rtl` for right-to-left text; `null` for the default direction. */
97
162
  dir: string | null;
98
163
  }
164
+ /**
165
+ * Turns a YouTube or Vimeo link into its embed address; any other `https` link is kept, anything else gives `null`.
166
+ */
99
167
  export declare function toVideoEmbed(value: string): string | null;
168
+ /** Tones a callout block can take. */
100
169
  export declare const CALLOUT_TONES: string[];
170
+ /** Document model of the editor: its blocks, such as lists, tables, callouts and mentions, and its marks. */
101
171
  export declare const txEditorSchema: Schema<string, string>;
172
+ /** Type of `txEditorSchema`. */
102
173
  export type TxEditorSchema = typeof txEditorSchema;
174
+ /** The text an AI action works on, marked while it is pending and when its answer is in. */
103
175
  interface TxAiRange {
176
+ /** Start position in the document. */
104
177
  from: number;
178
+ /** End position in the document. */
105
179
  to: number;
180
+ /** `true` once the answer replaced the text, `false` while it is awaited. */
106
181
  done: boolean;
107
182
  }
183
+ /** Kind of suggestion list: `mention` after `@`, `slash` after `/` and `emoji` after `:`. */
108
184
  type TxSuggestionKind = 'mention' | 'slash' | 'emoji';
185
+ /** The trigger text under the caret that opens a suggestion list. */
109
186
  interface TxSuggestionMatch {
187
+ /** Which list the text opens. */
110
188
  kind: TxSuggestionKind;
189
+ /** Document position of the trigger character. */
111
190
  from: number;
191
+ /** Document position of the caret, the end of the typed query. */
112
192
  to: number;
193
+ /** The text typed after the trigger character. */
113
194
  query: string;
114
195
  }
196
+ /** One emoji of the `:` list. */
115
197
  interface TxEditorEmoji {
198
+ /** Name typed after `:`. */
116
199
  name: string;
200
+ /** The emoji character inserted. */
117
201
  char: string;
202
+ /** Other names that find the emoji. */
118
203
  aliases?: readonly string[];
119
204
  }
205
+ /** A block the `/` menu can insert. */
120
206
  type TxEditorSlashCommand = 'paragraph' | 'heading1' | 'heading2' | 'heading3' | 'bulletList' | 'orderedList' | 'taskList' | 'blockquote' | 'codeBlock' | 'callout' | 'table' | 'divider' | 'image' | 'video';
207
+ /** One entry of the `/` block menu. */
121
208
  interface TxEditorSlashItem {
209
+ /** The block the entry inserts. */
122
210
  id: TxEditorSlashCommand;
211
+ /** Translation key of the entry name. */
123
212
  label: keyof TxTranslations;
213
+ /** Heading level that fills `{level}` in the label. */
124
214
  level?: number;
215
+ /** Icon name of the entry. */
125
216
  icon: string;
217
+ /** Extra words that find the entry when typed after `/`. */
126
218
  keywords: readonly string[];
219
+ /** Keyboard shortcut of the block, shown at the end of the row. */
127
220
  shortcut?: string;
128
221
  }
222
+ /** One row of the suggestion list under the caret, for a mention, a block or an emoji. */
129
223
  export interface TxEditorSuggestionOption {
224
+ /** Identifier of the row. */
130
225
  id: string;
226
+ /** Main text of the row. */
131
227
  label: string;
228
+ /** Second line under the label. */
132
229
  description?: string;
230
+ /** Image URL of a round picture before the label. */
133
231
  avatar?: string;
232
+ /** Icon name before the label. */
134
233
  icon?: string;
234
+ /** Character shown before the label, used for emoji. */
135
235
  glyph?: string;
236
+ /** Keyboard shortcut shown at the end of the row. */
136
237
  shortcut?: string;
238
+ /** The mention item, slash item or emoji behind the row, handed back when it is picked. */
137
239
  value: TxEditorMentionItem | TxEditorSlashItem | TxEditorEmoji;
138
240
  }
241
+ /** A toolbar tool with its position among all tools, used for keyboard navigation. */
139
242
  interface TxToolView {
243
+ /** The tool. */
140
244
  tool: TxEditorTool;
245
+ /** Position of the tool in the toolbar, counted across groups. */
141
246
  index: number;
142
247
  }
248
+ /** Position and size of the box an overlay is anchored to, in pixels. */
143
249
  interface TxAnchorBox {
250
+ /** Distance from the left edge. */
144
251
  left: number;
252
+ /** Distance from the top edge. */
145
253
  top: number;
254
+ /** Width of the box. */
146
255
  width: number;
256
+ /** Height of the box. */
147
257
  height: number;
148
258
  }
259
+ /** The popovers of the toolbar: link, text colour, highlight and video address. */
149
260
  type TxEditorPopover = 'link' | 'textColor' | 'highlight' | 'video';
261
+ /**
262
+ * Its own package: `tectra-ng` and `@tectra-ng/ui` do not include it, so apps without an editor do not carry the engine. It needs `@tectra-ng/ui` (and with it `core`, `themes`, `icons`) of the same version.
263
+ * @see https://tectra-ng.com/components/editor
264
+ */
150
265
  export declare class TxEditor extends TxFormControlBase<string> {
151
266
  private readonly editorTheme;
152
267
  private document;
@@ -154,141 +269,97 @@ export declare class TxEditor extends TxFormControlBase<string> {
154
269
  private destroyRef;
155
270
  private injector;
156
271
  private localeService;
272
+ /** Two-way: the HTML of the text; a form control works too */
157
273
  readonly html: import("@angular/core").ModelSignal<string>;
274
+ /** `html` (clean HTML) or `quill` (Quill 2 markup) for the value it writes; both are read */
158
275
  readonly format: import("@angular/core").InputSignal<TxEditorFormat>;
276
+ /** `full`, `compact`, `minimal`, `none` or own groups of tools: `[['bold', 'italic'], ['link']]` */
159
277
  readonly toolbar: import("@angular/core").InputSignal<TxEditorToolbar>;
278
+ /** Heading levels in the text style menu; `full` offers 1–6, the others 1–2 */
160
279
  readonly headingLevels: import("@angular/core").InputSignal<readonly TxEditorHeadingLevel[] | undefined>;
280
+ /** Text shown while the editor is empty */
161
281
  readonly placeholder: import("@angular/core").InputSignal<string>;
282
+ /** Shows the text without editing; the toolbar is turned off */
162
283
  readonly readonly: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
284
+ /** Turns the editor off */
163
285
  readonly disabledInput: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
286
+ /** Red frame; follows the form control by default */
164
287
  readonly invalid: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
288
+ /** Height of the text area, e.g. `220px`; it scrolls inside */
165
289
  readonly height: import("@angular/core").InputSignal<string | undefined>;
290
+ /** Minimum height of the text area */
166
291
  readonly minHeight: import("@angular/core").InputSignal<string | undefined>;
292
+ /** Maximum height; the area grows with the text until then */
167
293
  readonly maxHeight: import("@angular/core").InputSignal<string | undefined>;
294
+ /** Most characters; typing and pasting stop at the limit and the counter shows it */
168
295
  readonly maxLength: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
296
+ /** Shows the character counter without a limit */
169
297
  readonly showCount: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
298
+ /** `_blank` (new tab, the default) or `_self` for new links */
170
299
  readonly linkTarget: import("@angular/core").InputSignal<"_blank" | "_self">;
300
+ /** Text colour palette, `{ label, value }`; `label` may be a translation key */
171
301
  readonly textColors: import("@angular/core").InputSignal<readonly TxEditorColor[]>;
302
+ /** Highlight palette */
172
303
  readonly highlightColors: import("@angular/core").InputSignal<readonly TxEditorColor[]>;
304
+ /** `(file) => Promise<url>`; without it images are embedded as data URLs */
173
305
  readonly imageUpload: import("@angular/core").InputSignal<TxEditorImageUpload | undefined>;
306
+ /** Largest image in bytes; a bigger one emits `imageRejected` */
174
307
  readonly maxImageSize: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
308
+ /** `(query) => items` or a Promise of them: turns on `@` mentions with a suggestion list */
175
309
  readonly mentions: import("@angular/core").InputSignal<TxEditorMentionSource | undefined>;
310
+ /** Character that starts a mention */
176
311
  readonly mentionTrigger: import("@angular/core").InputSignal<string>;
312
+ /** Typing `/` at the start of a line or after a space opens the block menu */
177
313
  readonly slashMenu: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
314
+ /** Typing `:` and two letters suggests emoji */
178
315
  readonly emoji: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
316
+ /** Turns `--` into —, `->` into →, `...` into …, straight quotes into the locale's quotes; Backspace right after undoes it */
179
317
  readonly typography: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
318
+ /** Keeps a draft under this key in the browser storage and restores it into an empty editor; `clearDraft()` after sending */
180
319
  readonly draftKey: import("@angular/core").InputSignal<string | undefined>;
320
+ /** Shows the menu over selected text, links and tables */
181
321
  readonly selectionMenu: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
322
+ /** Shows the AI button; it emits `aiRequested` */
182
323
  readonly ai: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
324
+ /** Label of the AI button */
183
325
  readonly aiLabel: import("@angular/core").InputSignal<string | undefined>;
326
+ /** Actions for the AI button of the selection menu, `{ id, label, icon? }`; picking one emits `aiAction` */
184
327
  readonly aiActions: import("@angular/core").InputSignal<readonly TxEditorAiAction[]>;
328
+ /** Two-way: the editor fills the window over a backdrop */
185
329
  readonly fullView: import("@angular/core").ModelSignal<boolean>;
330
+ /** Shows the full view button (on with the `full` toolbar) */
186
331
  readonly fullViewButton: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
332
+ /** Accessible name of the text area */
187
333
  readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
334
+ /** Id of the element that names the text area */
188
335
  readonly ariaLabelledBy: import("@angular/core").InputSignal<string | undefined>;
189
- readonly dt: import("@angular/core").InputSignal<TectraDeepPartial<{
190
- root: {
191
- borderRadius: string;
192
- background: string;
193
- transitionDuration: string;
194
- easing: string;
195
- };
196
- toolbar: {
197
- padding: string;
198
- gap: string;
199
- background: string;
200
- borderColor: string;
201
- separatorColor: string;
202
- separatorHeight: string;
203
- separatorSpacing: string;
204
- };
205
- tool: {
206
- size: string;
207
- borderRadius: string;
208
- iconSize: string;
209
- color: string;
210
- hoverBackground: string;
211
- hoverColor: string;
212
- activeBackground: string;
213
- activeColor: string;
214
- disabledOpacity: string;
215
- labelFontSize: string;
216
- labelFontWeight: string;
217
- labelPadding: string;
218
- focusRingWidth: string;
219
- focusRingColor: string;
220
- };
221
- ai: {
222
- background: string;
223
- hoverBackground: string;
224
- color: string;
225
- animationDuration: string;
226
- };
227
- content: {
228
- padding: string;
229
- minHeight: string;
230
- placeholderColor: string;
231
- };
232
- footer: {
233
- padding: string;
234
- color: string;
235
- fontSize: string;
236
- limitColor: string;
237
- };
238
- image: {
239
- handleWidth: string;
240
- handleHeight: string;
241
- handleBackground: string;
242
- handleBorderColor: string;
243
- handleShadow: string;
244
- dropCursorColor: string;
245
- };
246
- bubble: {
247
- padding: string;
248
- gap: string;
249
- borderRadius: string;
250
- background: string;
251
- borderColor: string;
252
- shadow: string;
253
- offset: string;
254
- linkMaxWidth: string;
255
- };
256
- popover: {
257
- padding: string;
258
- gap: string;
259
- width: string;
260
- };
261
- swatch: {
262
- size: string;
263
- gap: string;
264
- borderRadius: string;
265
- ring: string;
266
- selectedRing: string;
267
- };
268
- suggestion: {
269
- width: string;
270
- maxHeight: string;
271
- padding: string;
272
- itemPadding: string;
273
- itemGap: string;
274
- itemRadius: string;
275
- itemFocusBackground: string;
276
- avatarSize: string;
277
- secondaryColor: string;
278
- };
279
- }> | undefined>;
336
+ /** Design tokens of this instance (`editor`); the text uses `editorContent` */
337
+ readonly dt: import("@angular/core").InputSignal<TectraDeepPartial<TectraEditorTokens> | undefined>;
338
+ /** Classes and styles of the parts: `root`, `toolbar`, `tool`, `content`, `footer`, `bubble`, `suggestions` */
280
339
  readonly pt: import("@angular/core").InputSignal<Partial<Record<TxEditorPart, import("@tectra-ng/core/config").TxPassThroughValue<TxEditor>>> | undefined>;
340
+ /** How `pt` merges with the global pass-through */
281
341
  readonly ptOptions: import("@angular/core").InputSignal<TxPassThroughOptions | undefined>;
342
+ /** Removes the tectra styles */
282
343
  readonly unstyled: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
344
+ /** `{ html, text }` after every change */
283
345
  readonly textChange: import("@angular/core").OutputEmitterRef<TxEditorTextChange>;
346
+ /** `{ from, to, empty, text }` */
284
347
  readonly selectionChange: import("@angular/core").OutputEmitterRef<TxEditorSelection>;
348
+ /** The text area got focus */
285
349
  readonly focused: import("@angular/core").OutputEmitterRef<void>;
350
+ /** The text area lost focus */
286
351
  readonly blurred: import("@angular/core").OutputEmitterRef<void>;
352
+ /** The editor view was created */
287
353
  readonly ready: import("@angular/core").OutputEmitterRef<EditorView>;
354
+ /** The AI button was pressed; emits the HTML */
288
355
  readonly aiRequested: import("@angular/core").OutputEmitterRef<string>;
356
+ /** An AI action was picked for the selection: `{ action, text, html, replace }`; `replace` takes a string, HTML or an `AsyncIterable` of chunks that stream into the text; then Keep / Undo appear */
289
357
  readonly aiAction: import("@angular/core").OutputEmitterRef<TxEditorAiRequest>;
358
+ /** An image was not added: `{ file, reason: 'type' | 'size', message }` */
290
359
  readonly imageRejected: import("@angular/core").OutputEmitterRef<TxEditorImageRejection>;
360
+ /** A mention was picked from the list */
291
361
  readonly mentionSelected: import("@angular/core").OutputEmitterRef<TxEditorMentionItem>;
362
+ /** A saved draft was put back into the editor; emits its HTML */
292
363
  readonly draftRestored: import("@angular/core").OutputEmitterRef<string>;
293
364
  readonly translations: import("@angular/core").Signal<TxTranslations>;
294
365
  readonly isUnstyled: import("@angular/core").Signal<boolean>;