@besaitech/ng-design-system 0.0.71 → 0.0.73
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/README.md +32 -0
- package/charts/index.d.ts +1 -1
- package/fesm2022/besaitech-ng-design-system-rich-text.mjs +1559 -0
- package/fesm2022/besaitech-ng-design-system-rich-text.mjs.map +1 -0
- package/fesm2022/besaitech-ng-design-system.mjs +22 -0
- package/fesm2022/besaitech-ng-design-system.mjs.map +1 -1
- package/index.d.ts +38 -20
- package/package.json +10 -1
- package/rich-text/index.d.ts +363 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { InjectionToken } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
4
|
+
import { SdsIconName, SdsLocalizedValue } from '@besaitech/ng-design-system';
|
|
5
|
+
|
|
6
|
+
/** A toolbar action of {@link SdsRichTextEditor}. The tools also decide what the document may contain. */
|
|
7
|
+
type SdsRichTextTool = 'paragraph' | 'heading2' | 'heading3' | 'bold' | 'italic' | 'underline' | 'strike' | 'bulletList' | 'orderedList' | 'blockquote' | 'link' | 'table' | 'horizontalRule' | 'clearFormatting' | 'undo' | 'redo';
|
|
8
|
+
/** The toolbar shown when `[tools]` is not set. */
|
|
9
|
+
declare const SDS_RICH_TEXT_DEFAULT_TOOLS: readonly SdsRichTextTool[];
|
|
10
|
+
type SdsRichTextAppearance = 'default' | 'filled';
|
|
11
|
+
/** Every string the editor shows or speaks. Translate them in a multi-language app. */
|
|
12
|
+
interface SdsRichTextLabels {
|
|
13
|
+
/** Accessible name of the toolbar. */
|
|
14
|
+
toolbar: string;
|
|
15
|
+
paragraph: string;
|
|
16
|
+
heading2: string;
|
|
17
|
+
heading3: string;
|
|
18
|
+
bold: string;
|
|
19
|
+
italic: string;
|
|
20
|
+
underline: string;
|
|
21
|
+
strike: string;
|
|
22
|
+
bulletList: string;
|
|
23
|
+
orderedList: string;
|
|
24
|
+
blockquote: string;
|
|
25
|
+
link: string;
|
|
26
|
+
/** Insert a table (3 × 3, header row). */
|
|
27
|
+
table: string;
|
|
28
|
+
horizontalRule: string;
|
|
29
|
+
clearFormatting: string;
|
|
30
|
+
undo: string;
|
|
31
|
+
redo: string;
|
|
32
|
+
/** Label of the link address field. */
|
|
33
|
+
linkUrl: string;
|
|
34
|
+
linkPlaceholder: string;
|
|
35
|
+
linkApply: string;
|
|
36
|
+
linkRemove: string;
|
|
37
|
+
linkCancel: string;
|
|
38
|
+
/** Shown under the address field when it is not an http(s), mailto, tel, relative or anchor link. */
|
|
39
|
+
linkInvalid: string;
|
|
40
|
+
/** Accessible name of the table bar shown while the caret is in a table. */
|
|
41
|
+
tableTools: string;
|
|
42
|
+
tableAddRow: string;
|
|
43
|
+
tableAddColumn: string;
|
|
44
|
+
tableDeleteRow: string;
|
|
45
|
+
tableDeleteColumn: string;
|
|
46
|
+
/** Toggles the first row between header and data cells. */
|
|
47
|
+
tableHeaderRow: string;
|
|
48
|
+
tableDelete: string;
|
|
49
|
+
/**
|
|
50
|
+
* Warning when the loaded HTML holds elements the enabled tools cannot keep; token `{elements}` (e.g.
|
|
51
|
+
* `<img>, <iframe>`).
|
|
52
|
+
*/
|
|
53
|
+
unsupportedContent: string;
|
|
54
|
+
/** Spoken counter with a `[maxLength]`; tokens `{count}` and `{max}`. */
|
|
55
|
+
countLimit: string;
|
|
56
|
+
/** Spoken counter without a limit; token `{count}`. */
|
|
57
|
+
count: string;
|
|
58
|
+
}
|
|
59
|
+
declare const SDS_RICH_TEXT_LABELS_EN: SdsRichTextLabels;
|
|
60
|
+
/**
|
|
61
|
+
* App-wide label overrides for every {@link SdsRichTextEditor} — provide a (partial) translation once, e.g.
|
|
62
|
+
* `{ provide: SDS_RICH_TEXT_LABELS, useValue: { bold: 'Gras', … } }`. A component's own `[labels]` win over it.
|
|
63
|
+
* For an app that switches language at runtime, bind `[labels]` instead.
|
|
64
|
+
*/
|
|
65
|
+
declare const SDS_RICH_TEXT_LABELS: InjectionToken<Partial<SdsRichTextLabels>>;
|
|
66
|
+
/**
|
|
67
|
+
* The link target the editor accepts for `raw`, normalised — or `null` when it is not safe to link to.
|
|
68
|
+
* Accepted: `http(s):`, `mailto:` and `tel:` URLs, site-relative paths (`/formations`) and anchors (`#faq`);
|
|
69
|
+
* a bare domain (`example.ch/page`) gets `https://`, a bare e-mail address gets `mailto:`. Everything else —
|
|
70
|
+
* `javascript:`, `data:`, protocol-relative `//host`, whitespace — is refused. The editor applies the same
|
|
71
|
+
* rule to pasted and loaded HTML, so an unsafe link never survives in its output.
|
|
72
|
+
*/
|
|
73
|
+
declare function sdsSafeHref(raw: string | null | undefined): string | null;
|
|
74
|
+
|
|
75
|
+
interface ToolDef {
|
|
76
|
+
tool: SdsRichTextTool;
|
|
77
|
+
icon: SdsIconName;
|
|
78
|
+
group: number;
|
|
79
|
+
/** A formatting state the button reflects with `aria-pressed`. */
|
|
80
|
+
toggle: boolean;
|
|
81
|
+
/** Tiptap's keyboard shortcut, shown in the tooltip (`Mod` = ⌘ on Apple, Ctrl elsewhere). */
|
|
82
|
+
shortcut?: string;
|
|
83
|
+
}
|
|
84
|
+
type TableAction = 'addRow' | 'addColumn' | 'deleteRow' | 'deleteColumn' | 'headerRow' | 'delete';
|
|
85
|
+
/**
|
|
86
|
+
* Marks content projected at the END of an {@link SdsRichTextEditor}'s toolbar — a language switcher (as in
|
|
87
|
+
* {@link SdsLocalizedRichTextEditor}), an "insert variable" menu… It stays visible in `readonly` mode, where
|
|
88
|
+
* the formatting buttons are hidden: `<div sdsRichTextToolbarEnd>…</div>`.
|
|
89
|
+
*/
|
|
90
|
+
declare class SdsRichTextToolbarEnd {
|
|
91
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdsRichTextToolbarEnd, never>;
|
|
92
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SdsRichTextToolbarEnd, "[sdsRichTextToolbarEnd]", never, {}, {}, never, never, true, never>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A rich-text field — headings, bold / italic / underline / strike, lists, quotes, links, dividers, undo/redo —
|
|
96
|
+
* for content that is stored and shown as HTML (course pages, instructions, articles). Built on Tiptap
|
|
97
|
+
* (ProseMirror), so the HTML it emits is always clean and structured: no inline styles, no `<font>`/`<span>`
|
|
98
|
+
* soup from Word or web pages, nothing outside the enabled tools.
|
|
99
|
+
*
|
|
100
|
+
* **The tools are the schema.** `[tools]` chooses the toolbar AND what the document may contain: drop
|
|
101
|
+
* `heading2`/`heading3` and pasted headings become paragraphs; drop `link` and links are unwrapped. Links
|
|
102
|
+
* only accept http(s), mailto, tel, site-relative paths and anchors ({@link sdsSafeHref}) — `javascript:`
|
|
103
|
+
* and friends are stripped from typed, pasted and loaded HTML alike, and links open in a new tab with
|
|
104
|
+
* `rel="noopener noreferrer nofollow"`. Still sanitise on display, as for any stored HTML.
|
|
105
|
+
*
|
|
106
|
+
* Implements ControlValueAccessor over an HTML string — use with reactive forms or `[(ngModel)]`. An empty
|
|
107
|
+
* document is `''` (not `<p></p>`), so `Validators.required` works. Writing a value never marks the control
|
|
108
|
+
* dirty. Keyboard: the usual shortcuts (⌘/Ctrl+B, I, U, K for a link, ⌘/Ctrl+Alt+2/3 for headings, Markdown
|
|
109
|
+
* shortcuts like `## ` or `- `); the toolbar is one Tab stop, arrows move inside it.
|
|
110
|
+
*
|
|
111
|
+
* Strings are English by default: pass `[labels]` (or provide {@link SDS_RICH_TEXT_LABELS}) in another
|
|
112
|
+
* language. Import from the secondary entry point `@besaitech/ng-design-system/rich-text`.
|
|
113
|
+
*/
|
|
114
|
+
declare class SdsRichTextEditor implements ControlValueAccessor {
|
|
115
|
+
readonly fieldId: string;
|
|
116
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
117
|
+
/** Accessible name used when no visible [label] is provided. */
|
|
118
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
119
|
+
/** Shown in the empty document. */
|
|
120
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
121
|
+
readonly hint: _angular_core.InputSignal<string>;
|
|
122
|
+
readonly error: _angular_core.InputSignal<string>;
|
|
123
|
+
/** Mark the field invalid (danger frame + `aria-invalid`) without showing an [error] message. */
|
|
124
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
125
|
+
/**
|
|
126
|
+
* Language of the content (`lang` on the editable document), so the browser spell-checks it in the right
|
|
127
|
+
* language — e.g. `'de'` for the German version of a translated text.
|
|
128
|
+
*/
|
|
129
|
+
readonly contentLanguage: _angular_core.InputSignal<string>;
|
|
130
|
+
/** Asterisk after the [label] (hidden from screen readers) + `aria-required`. It does not validate. */
|
|
131
|
+
readonly required: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
132
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
133
|
+
/** Shows the content without the toolbar; it can be selected and copied but not changed. */
|
|
134
|
+
readonly readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
135
|
+
/**
|
|
136
|
+
* The toolbar, in display order (groups are fixed: block, text, lists, insert, clear, history) — and the
|
|
137
|
+
* content the document may hold. Defaults to {@link SDS_RICH_TEXT_DEFAULT_TOOLS}. Set once: changing it
|
|
138
|
+
* rebuilds the editor (the content is kept, minus what the new tools no longer allow).
|
|
139
|
+
*/
|
|
140
|
+
readonly tools: _angular_core.InputSignal<readonly SdsRichTextTool[]>;
|
|
141
|
+
/** Minimum visible lines of the editing area. */
|
|
142
|
+
readonly rows: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
143
|
+
/** Lines after which the area scrolls instead of growing; 0 (default) grows with the content. */
|
|
144
|
+
readonly maxRows: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
145
|
+
/** Cap on the plain-text length (markup is not counted); 0 means no limit. Typing stops at the cap. */
|
|
146
|
+
readonly maxLength: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
147
|
+
/** Show the character counter (always shown with a [maxLength]). */
|
|
148
|
+
readonly showCount: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
149
|
+
/** `filled`: a borderless field on a muted ground, like `sds-textarea`'s. */
|
|
150
|
+
readonly appearance: _angular_core.InputSignal<SdsRichTextAppearance>;
|
|
151
|
+
/** Per-instance strings (merged over {@link SDS_RICH_TEXT_LABELS} and the English defaults). */
|
|
152
|
+
readonly labels: _angular_core.InputSignal<Partial<SdsRichTextLabels>>;
|
|
153
|
+
private readonly cdr;
|
|
154
|
+
private readonly host;
|
|
155
|
+
private readonly appLabels;
|
|
156
|
+
private readonly contentHost;
|
|
157
|
+
private readonly linkInput;
|
|
158
|
+
private readonly toolButtons;
|
|
159
|
+
protected readonly toolbarEnd: _angular_core.Signal<SdsRichTextToolbarEnd | undefined>;
|
|
160
|
+
private editor;
|
|
161
|
+
/** The HTML last written to or emitted by the control — '' for an empty document. */
|
|
162
|
+
private html;
|
|
163
|
+
private builtTools;
|
|
164
|
+
private readonly ready;
|
|
165
|
+
private readonly cvaDisabled;
|
|
166
|
+
/** Formatting active at the selection, per tool (refreshed on every transaction). */
|
|
167
|
+
private readonly activeTools;
|
|
168
|
+
private readonly history;
|
|
169
|
+
/** The first row of the table holding the caret is a header row. */
|
|
170
|
+
protected readonly headerRow: _angular_core.WritableSignal<boolean>;
|
|
171
|
+
/** Elements of the loaded HTML the enabled tools could not keep (see {@link LOSSY_TAGS}). */
|
|
172
|
+
protected readonly lostElements: _angular_core.WritableSignal<string[]>;
|
|
173
|
+
protected readonly tableActions: readonly {
|
|
174
|
+
action: TableAction;
|
|
175
|
+
label: keyof SdsRichTextLabels;
|
|
176
|
+
icon: SdsIconName | null;
|
|
177
|
+
}[];
|
|
178
|
+
protected readonly characters: _angular_core.WritableSignal<number>;
|
|
179
|
+
protected readonly rovingTool: _angular_core.WritableSignal<SdsRichTextTool | null>;
|
|
180
|
+
protected readonly linkOpen: _angular_core.WritableSignal<boolean>;
|
|
181
|
+
protected readonly linkDraft: _angular_core.WritableSignal<string>;
|
|
182
|
+
protected readonly linkError: _angular_core.WritableSignal<boolean>;
|
|
183
|
+
protected readonly l: _angular_core.Signal<SdsRichTextLabels>;
|
|
184
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
185
|
+
/** The document can be changed (and the toolbar used). */
|
|
186
|
+
protected readonly interactive: _angular_core.Signal<boolean>;
|
|
187
|
+
protected readonly showToolbar: _angular_core.Signal<boolean>;
|
|
188
|
+
private readonly toolSet;
|
|
189
|
+
protected readonly groups: _angular_core.Signal<ToolDef[][]>;
|
|
190
|
+
protected readonly hasCounter: _angular_core.Signal<boolean>;
|
|
191
|
+
protected readonly lostLabel: _angular_core.Signal<string>;
|
|
192
|
+
protected readonly atLimit: _angular_core.Signal<boolean>;
|
|
193
|
+
protected readonly countLabel: _angular_core.Signal<string>;
|
|
194
|
+
protected readonly maxHeight: _angular_core.Signal<string | null>;
|
|
195
|
+
private readonly danger;
|
|
196
|
+
protected readonly frameClasses: _angular_core.Signal<string>;
|
|
197
|
+
private readonly describedBy;
|
|
198
|
+
/** Attributes of the contenteditable document (ProseMirror's own element). */
|
|
199
|
+
private readonly documentAttributes;
|
|
200
|
+
private readonly isApple;
|
|
201
|
+
constructor();
|
|
202
|
+
/** Move the caret into the document. */
|
|
203
|
+
focus(): void;
|
|
204
|
+
/**
|
|
205
|
+
* Insert plain text at the caret (replacing the selection) — for an "insert variable" button in the
|
|
206
|
+
* {@link SdsRichTextToolbarEnd} slot, say. The text is inserted as text, never parsed as HTML. No-op while
|
|
207
|
+
* disabled or read-only.
|
|
208
|
+
*/
|
|
209
|
+
insertText(text: string): void;
|
|
210
|
+
private onChange;
|
|
211
|
+
private onTouched;
|
|
212
|
+
writeValue(value: string | null): void;
|
|
213
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
214
|
+
registerOnTouched(fn: () => void): void;
|
|
215
|
+
setDisabledState(isDisabled: boolean): void;
|
|
216
|
+
protected isOn(tool: SdsRichTextTool): boolean;
|
|
217
|
+
protected canRun(tool: SdsRichTextTool): boolean;
|
|
218
|
+
protected buttonClass(def: ToolDef): string;
|
|
219
|
+
protected tooltip(def: ToolDef): string;
|
|
220
|
+
protected run(tool: SdsRichTextTool): void;
|
|
221
|
+
/** Roving focus inside the toolbar: one Tab stop, arrows / Home / End move between the buttons. */
|
|
222
|
+
protected onToolbarKeydown(event: KeyboardEvent): void;
|
|
223
|
+
/** A click in the blank area under the last line still places the caret (at the end). */
|
|
224
|
+
protected onAreaClick(event: MouseEvent): void;
|
|
225
|
+
protected tableButtonClass(action: TableAction): string;
|
|
226
|
+
protected runTable(action: TableAction): void;
|
|
227
|
+
protected openLink(): void;
|
|
228
|
+
protected onLinkInput(event: Event): void;
|
|
229
|
+
protected onLinkKeydown(event: KeyboardEvent): void;
|
|
230
|
+
protected applyLink(): void;
|
|
231
|
+
protected removeLink(): void;
|
|
232
|
+
protected closeLink(refocus: boolean): void;
|
|
233
|
+
private build;
|
|
234
|
+
private extensions;
|
|
235
|
+
private editorProps;
|
|
236
|
+
/**
|
|
237
|
+
* ⌘/Ctrl+K opens the link field. The editor owns the shortcut while it has focus: the event is stopped
|
|
238
|
+
* so an app-wide ⌘K (a command palette such as `sds-search-command`) does not open on top of it.
|
|
239
|
+
*/
|
|
240
|
+
private onDocumentKeydown;
|
|
241
|
+
/**
|
|
242
|
+
* The control's value for the editor's document: '' when it is empty, and without the editor's own
|
|
243
|
+
* scaffolding — the empty paragraphs kept after a final list / quote / table so the caret can leave it
|
|
244
|
+
* (Tiptap's trailing node), and the table layout hints (`<colgroup>`, `style="min-width…"`, the default
|
|
245
|
+
* `colspan="1" rowspan="1"`) that columns no one resized do not need.
|
|
246
|
+
*/
|
|
247
|
+
private currentHtml;
|
|
248
|
+
/** Flags the elements of `source` whose content the schema could not keep (shown under the field). */
|
|
249
|
+
private detectLoss;
|
|
250
|
+
private emit;
|
|
251
|
+
private refresh;
|
|
252
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdsRichTextEditor, never>;
|
|
253
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdsRichTextEditor, "sds-rich-text-editor", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "contentLanguage": { "alias": "contentLanguage"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "tools": { "alias": "tools"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "maxRows": { "alias": "maxRows"; "required": false; "isSignal": true; }; "maxLength": { "alias": "maxLength"; "required": false; "isSignal": true; }; "showCount": { "alias": "showCount"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; }, {}, ["toolbarEnd"], ["[sdsRichTextToolbarEnd]"], true, never>;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* The translatable twin of {@link SdsRichTextEditor}: one rich-text field over a {@link SdsLocalizedValue} —
|
|
258
|
+
* `{ fr: '<p>…</p>', de: '<p>…</p>', en: … }` — for content stored per language (course pages, homework
|
|
259
|
+
* instructions, articles). It works like `sds-localized-input`: one language is edited at a time, a compact
|
|
260
|
+
* switcher at the end of the toolbar flips the language, and a dot marks the languages that already have
|
|
261
|
+
* content (green), a required one that is still empty (danger) or a missing translation (faint). Empty
|
|
262
|
+
* translations are pruned from the emitted value, so an untouched language never appears in the map.
|
|
263
|
+
*
|
|
264
|
+
* Each language has its own editor underneath, kept alive while hidden: undo / redo, the caret and the
|
|
265
|
+
* scroll position stay per language, and undoing after a switch can never bring another language's text
|
|
266
|
+
* back. The document carries its `lang`, so the browser spell-checks each translation in its language.
|
|
267
|
+
*
|
|
268
|
+
* The active language defaults to {@link currentLanguage} when it is one of {@link languages}, otherwise the
|
|
269
|
+
* first accepted language. Everything else — `[tools]` (the schema), safe links, `rows` / `maxRows`,
|
|
270
|
+
* `maxLength` (per language), labels — behaves as in {@link SdsRichTextEditor}.
|
|
271
|
+
*
|
|
272
|
+
* Implements ControlValueAccessor over the map — use with reactive forms or `[(ngModel)]`:
|
|
273
|
+
* `<sds-localized-rich-text-editor [languages]="['fr','de','en']" formControlName="description" />`.
|
|
274
|
+
* Import from `@besaitech/ng-design-system/rich-text`.
|
|
275
|
+
*/
|
|
276
|
+
declare class SdsLocalizedRichTextEditor implements ControlValueAccessor {
|
|
277
|
+
protected readonly baseId: string;
|
|
278
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
279
|
+
/** Accessible name when there is no visible {@link label}; each language's editor adds its code. */
|
|
280
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
281
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
282
|
+
readonly hint: _angular_core.InputSignal<string>;
|
|
283
|
+
/** Error message under the field (danger frame + `aria-invalid`); replaces the hint. */
|
|
284
|
+
readonly error: _angular_core.InputSignal<string>;
|
|
285
|
+
/** Mark the field invalid (danger frame + `aria-invalid`) without showing an [error] message. */
|
|
286
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
287
|
+
/** An asterisk after the [label] and `aria-required`. It does not validate — keep your own validator. */
|
|
288
|
+
readonly required: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
289
|
+
/**
|
|
290
|
+
* Languages that must be filled (e.g. the site's main language): while empty, their switcher dot shows in the
|
|
291
|
+
* danger colour and its title says {@link requiredLanguageLabel}. Display only — validate in the form.
|
|
292
|
+
*/
|
|
293
|
+
readonly requiredLanguages: _angular_core.InputSignal<string[]>;
|
|
294
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
295
|
+
/** Every translation can be read (the switcher still works) but none changed; the toolbar is hidden. */
|
|
296
|
+
readonly readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
297
|
+
/** The accepted language codes, in display order (e.g. `['fr','de','en']`). */
|
|
298
|
+
readonly languages: _angular_core.InputSignal<string[]>;
|
|
299
|
+
/** Language to open on; used when it is one of {@link languages}, else the first accepted language. */
|
|
300
|
+
readonly currentLanguage: _angular_core.InputSignal<string | null>;
|
|
301
|
+
/** The toolbar and the schema, as on {@link SdsRichTextEditor}. */
|
|
302
|
+
readonly tools: _angular_core.InputSignal<readonly SdsRichTextTool[]>;
|
|
303
|
+
readonly rows: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
304
|
+
readonly maxRows: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
305
|
+
/** Cap on each language's plain-text length; 0 means no limit. */
|
|
306
|
+
readonly maxLength: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
307
|
+
/** Show the character counter of the language being edited (always shown with a [maxLength]). */
|
|
308
|
+
readonly showCount: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
309
|
+
readonly appearance: _angular_core.InputSignal<SdsRichTextAppearance>;
|
|
310
|
+
/** Editor strings, as on {@link SdsRichTextEditor}. */
|
|
311
|
+
readonly labels: _angular_core.InputSignal<Partial<SdsRichTextLabels>>;
|
|
312
|
+
/**
|
|
313
|
+
* Accessible name of the language switcher, and the title suffixes of an empty language. English defaults;
|
|
314
|
+
* translate them in a multi-language app (the tabs show only the language code).
|
|
315
|
+
*/
|
|
316
|
+
readonly languageSwitcherLabel: _angular_core.InputSignal<string>;
|
|
317
|
+
readonly untranslatedLabel: _angular_core.InputSignal<string>;
|
|
318
|
+
/** Title suffix of a required language that is still empty (see {@link requiredLanguages}). */
|
|
319
|
+
readonly requiredLanguageLabel: _angular_core.InputSignal<string>;
|
|
320
|
+
private readonly host;
|
|
321
|
+
private readonly cdr;
|
|
322
|
+
private readonly editors;
|
|
323
|
+
protected readonly valueMap: _angular_core.WritableSignal<SdsLocalizedValue>;
|
|
324
|
+
/** Language chosen with the switcher; null means "follow currentLanguage / the first language". */
|
|
325
|
+
private readonly manual;
|
|
326
|
+
private readonly cvaDisabled;
|
|
327
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
328
|
+
/** The language being edited. */
|
|
329
|
+
protected readonly activeLang: _angular_core.Signal<string>;
|
|
330
|
+
/** Move the caret into the active language's document. */
|
|
331
|
+
focus(): void;
|
|
332
|
+
protected filled(lang: string): boolean;
|
|
333
|
+
/** A required language (see {@link requiredLanguages}) that is still empty. */
|
|
334
|
+
protected mustFill(lang: string): boolean;
|
|
335
|
+
protected editorName(lang: string): string;
|
|
336
|
+
protected placeholderFor(lang: string): string;
|
|
337
|
+
protected tabTitle(lang: string): string;
|
|
338
|
+
protected tabClass(lang: string): string;
|
|
339
|
+
protected dotClass(lang: string): string;
|
|
340
|
+
/**
|
|
341
|
+
* Switch language. From a click, the caret goes into the new language's document (ready to type); from the
|
|
342
|
+
* arrow keys, focus follows to the new language's tab. Rendered at once so focus never lands on the
|
|
343
|
+
* editor that was just hidden.
|
|
344
|
+
*/
|
|
345
|
+
protected select(lang: string, focusTarget: 'editor' | 'tab'): void;
|
|
346
|
+
/** The switcher is one Tab stop; arrows / Home / End change the language (automatic activation). */
|
|
347
|
+
protected onTabsKeydown(event: KeyboardEvent): void;
|
|
348
|
+
protected write(lang: string, html: string): void;
|
|
349
|
+
/** Touched once focus leaves the whole field (moving between toolbar, link field and document is not leaving). */
|
|
350
|
+
protected onFocusOut(event: FocusEvent): void;
|
|
351
|
+
private editorFor;
|
|
352
|
+
private onChange;
|
|
353
|
+
private onTouched;
|
|
354
|
+
writeValue(value: SdsLocalizedValue | null): void;
|
|
355
|
+
registerOnChange(fn: (value: SdsLocalizedValue) => void): void;
|
|
356
|
+
registerOnTouched(fn: () => void): void;
|
|
357
|
+
setDisabledState(isDisabled: boolean): void;
|
|
358
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdsLocalizedRichTextEditor, never>;
|
|
359
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdsLocalizedRichTextEditor, "sds-localized-rich-text-editor", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "requiredLanguages": { "alias": "requiredLanguages"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "languages": { "alias": "languages"; "required": false; "isSignal": true; }; "currentLanguage": { "alias": "currentLanguage"; "required": false; "isSignal": true; }; "tools": { "alias": "tools"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "maxRows": { "alias": "maxRows"; "required": false; "isSignal": true; }; "maxLength": { "alias": "maxLength"; "required": false; "isSignal": true; }; "showCount": { "alias": "showCount"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "languageSwitcherLabel": { "alias": "languageSwitcherLabel"; "required": false; "isSignal": true; }; "untranslatedLabel": { "alias": "untranslatedLabel"; "required": false; "isSignal": true; }; "requiredLanguageLabel": { "alias": "requiredLanguageLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export { SDS_RICH_TEXT_DEFAULT_TOOLS, SDS_RICH_TEXT_LABELS, SDS_RICH_TEXT_LABELS_EN, SdsLocalizedRichTextEditor, SdsRichTextEditor, SdsRichTextToolbarEnd, sdsSafeHref };
|
|
363
|
+
export type { SdsRichTextAppearance, SdsRichTextLabels, SdsRichTextTool };
|