@thalassic/ui 22.14.3 → 22.15.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/fesm2022/thalassic-ui-rich-text-editor.mjs +650 -0
- package/fesm2022/thalassic-ui-rich-text-editor.mjs.map +1 -0
- package/fesm2022/thalassic-ui.mjs +1088 -533
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +46 -2
- package/types/thalassic-ui-rich-text-editor.d.ts +141 -0
- package/types/thalassic-ui.d.ts +299 -27
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, model, input, booleanAttribute, viewChild, signal, computed, effect, afterNextRender, forwardRef, Component, makeEnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { Toolbar, ToolbarWidget } from '@angular/aria/toolbar';
|
|
4
|
+
import { chainCommands, exitCode, toggleMark, baseKeymap, lift, wrapIn, setBlockType } from 'prosemirror-commands';
|
|
5
|
+
import { NodeSelection, EditorState } from 'prosemirror-state';
|
|
6
|
+
import { EditorView } from 'prosemirror-view';
|
|
7
|
+
import { ValueFormControl, Icon, FORM_CONTROL } from '@thalassic/ui';
|
|
8
|
+
import MarkdownIt from 'markdown-it';
|
|
9
|
+
import { schema, MarkdownSerializer, defaultMarkdownSerializer, MarkdownParser, defaultMarkdownParser } from 'prosemirror-markdown';
|
|
10
|
+
import { Schema } from 'prosemirror-model';
|
|
11
|
+
import { redo, undo, history } from 'prosemirror-history';
|
|
12
|
+
import { inputRules, wrappingInputRule, textblockTypeInputRule, undoInputRule } from 'prosemirror-inputrules';
|
|
13
|
+
import { keymap } from 'prosemirror-keymap';
|
|
14
|
+
import { sinkListItem, liftListItem, splitListItem, wrapInList } from 'prosemirror-schema-list';
|
|
15
|
+
import { deepMerge } from '@thalassic/core';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Whether the runtime is an Apple platform, where shortcuts are shown with the ⌘ symbol
|
|
19
|
+
* (matching ProseMirror's `Mod-` resolution to Cmd there and Ctrl elsewhere).
|
|
20
|
+
*/
|
|
21
|
+
const IS_APPLE_PLATFORM = typeof navigator !== 'undefined' && /Mac|iPhone|iPad|iPod/.test(navigator.platform);
|
|
22
|
+
/** Matches a URL scheme prefix (`https:`, `javascript:`, …) at the start of an href. */
|
|
23
|
+
const LINK_SCHEME_REGEX = /^[a-z][a-z0-9+.-]*:/i;
|
|
24
|
+
/**
|
|
25
|
+
* Schemes a link href may carry. Anything else (`javascript:`, `data:`, …) is rejected
|
|
26
|
+
* so a crafted URL cannot smuggle an executable payload into the emitted Markdown;
|
|
27
|
+
* scheme-less hrefs (relative paths, `#anchors`) are always allowed.
|
|
28
|
+
*/
|
|
29
|
+
const SAFE_LINK_SCHEMES = ['http:', 'https:', 'mailto:', 'tel:'];
|
|
30
|
+
/** The default toolbar layout, grouped by kind with `separator` entries between groups. */
|
|
31
|
+
const DEFAULT_RICH_TEXT_TOOLBAR = [
|
|
32
|
+
'bold',
|
|
33
|
+
'italic',
|
|
34
|
+
'strikethrough',
|
|
35
|
+
'code',
|
|
36
|
+
'separator',
|
|
37
|
+
'heading1',
|
|
38
|
+
'heading2',
|
|
39
|
+
'heading3',
|
|
40
|
+
'separator',
|
|
41
|
+
'bulletList',
|
|
42
|
+
'orderedList',
|
|
43
|
+
'blockquote',
|
|
44
|
+
'separator',
|
|
45
|
+
'link',
|
|
46
|
+
'codeBlock',
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The editor document schema. It reuses `prosemirror-markdown`'s Markdown-capable
|
|
51
|
+
* node/mark set (paragraph, headings, blockquote, code block, ordered/bullet lists,
|
|
52
|
+
* strong, em, inline code, link) so every document round-trips losslessly to Markdown,
|
|
53
|
+
* extended with a `strikethrough` mark for GFM `~~…~~`.
|
|
54
|
+
*/
|
|
55
|
+
const richTextSchema = new Schema({
|
|
56
|
+
nodes: schema.spec.nodes,
|
|
57
|
+
marks: schema.spec.marks.addToEnd('strikethrough', {
|
|
58
|
+
parseDOM: [
|
|
59
|
+
{ tag: 's' },
|
|
60
|
+
{ tag: 'del' },
|
|
61
|
+
{ style: 'text-decoration=line-through' },
|
|
62
|
+
{ style: 'text-decoration-line=line-through' },
|
|
63
|
+
],
|
|
64
|
+
toDOM: () => ['s', 0],
|
|
65
|
+
}),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Serializes an editor document to a Markdown string. Extends the default serializer
|
|
70
|
+
* with the `strikethrough` mark, emitted as GFM `~~…~~`.
|
|
71
|
+
*/
|
|
72
|
+
const markdownSerializer = new MarkdownSerializer(defaultMarkdownSerializer.nodes, {
|
|
73
|
+
...defaultMarkdownSerializer.marks,
|
|
74
|
+
strikethrough: {
|
|
75
|
+
open: '~~',
|
|
76
|
+
close: '~~',
|
|
77
|
+
mixable: true,
|
|
78
|
+
expelEnclosingWhitespace: true,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* Parses a Markdown string into an editor document. Uses a dedicated CommonMark tokenizer
|
|
83
|
+
* (matching `prosemirror-markdown`'s default, without mutating that shared instance) with
|
|
84
|
+
* strikethrough enabled so `~~…~~` maps onto the `strikethrough` mark, and targets the
|
|
85
|
+
* extended {@link richTextSchema}.
|
|
86
|
+
*/
|
|
87
|
+
const markdownParser = new MarkdownParser(richTextSchema, new MarkdownIt('commonmark', { html: false }).enable('strikethrough'), {
|
|
88
|
+
...defaultMarkdownParser.tokens,
|
|
89
|
+
s: { mark: 'strikethrough' },
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Markdown-style typing shortcuts: `# ` for headings, `- `/`* ` for bullet lists,
|
|
93
|
+
// `1. ` for ordered lists, `> ` for blockquotes, and a fenced ``` for code blocks.
|
|
94
|
+
function buildInputRules(schema) {
|
|
95
|
+
return inputRules({
|
|
96
|
+
rules: [
|
|
97
|
+
wrappingInputRule(/^\s*>\s$/, schema.nodes['blockquote']),
|
|
98
|
+
wrappingInputRule(/^(\d+)\.\s$/, schema.nodes['ordered_list'], match => ({ order: Number(match[1]) }), (match, node) => node.childCount + node.attrs['order'] === Number(match[1])),
|
|
99
|
+
wrappingInputRule(/^\s*([-+*])\s$/, schema.nodes['bullet_list']),
|
|
100
|
+
textblockTypeInputRule(/^```$/, schema.nodes['code_block']),
|
|
101
|
+
textblockTypeInputRule(/^(#{1,3})\s$/, schema.nodes['heading'], match => ({
|
|
102
|
+
level: match[1].length,
|
|
103
|
+
})),
|
|
104
|
+
],
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// Keyboard shortcuts layered on top of the base editing keymap: inline-mark toggles,
|
|
108
|
+
// history, input-rule reversal, list splitting/indentation, and a soft line break.
|
|
109
|
+
// Shortcuts whose behavior lives in the host component (link editing) come from `handlers`.
|
|
110
|
+
function buildKeymap(schema, handlers) {
|
|
111
|
+
const hardBreak = schema.nodes['hard_break'];
|
|
112
|
+
const listItem = schema.nodes['list_item'];
|
|
113
|
+
return keymap({
|
|
114
|
+
'Mod-z': undo,
|
|
115
|
+
'Shift-Mod-z': redo,
|
|
116
|
+
'Mod-y': redo,
|
|
117
|
+
Backspace: undoInputRule,
|
|
118
|
+
'Mod-b': toggleMark(schema.marks['strong']),
|
|
119
|
+
'Mod-i': toggleMark(schema.marks['em']),
|
|
120
|
+
'Mod-`': toggleMark(schema.marks['code']),
|
|
121
|
+
'Mod-k': () => handlers.toggleLink(),
|
|
122
|
+
Enter: splitListItem(listItem),
|
|
123
|
+
'Mod-[': liftListItem(listItem),
|
|
124
|
+
'Mod-]': sinkListItem(listItem),
|
|
125
|
+
'Shift-Enter': chainCommands(exitCode, (state, dispatch) => {
|
|
126
|
+
if (dispatch)
|
|
127
|
+
dispatch(state.tr.replaceSelectionWith(hardBreak.create()).scrollIntoView());
|
|
128
|
+
return true;
|
|
129
|
+
}),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/** The full plugin stack shared by every editor instance built on {@link richTextSchema}. */
|
|
133
|
+
function buildRichTextPlugins(schema, handlers) {
|
|
134
|
+
return [buildInputRules(schema), buildKeymap(schema, handlers), keymap(baseKeymap), history()];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const DEFAULT_RICH_TEXT_EDITOR_CONFIG = {
|
|
138
|
+
size: 'md',
|
|
139
|
+
placeholder: '',
|
|
140
|
+
fluid: false,
|
|
141
|
+
toolbar: DEFAULT_RICH_TEXT_TOOLBAR,
|
|
142
|
+
minRows: 4,
|
|
143
|
+
labels: {
|
|
144
|
+
toolbar: 'Text formatting',
|
|
145
|
+
linkUrl: 'Link URL',
|
|
146
|
+
linkPlaceholder: 'https://example.com',
|
|
147
|
+
linkApply: 'Apply',
|
|
148
|
+
linkCancel: 'Cancel',
|
|
149
|
+
controls: {
|
|
150
|
+
bold: 'Bold',
|
|
151
|
+
italic: 'Italic',
|
|
152
|
+
strikethrough: 'Strikethrough',
|
|
153
|
+
code: 'Inline code',
|
|
154
|
+
heading1: 'Heading 1',
|
|
155
|
+
heading2: 'Heading 2',
|
|
156
|
+
heading3: 'Heading 3',
|
|
157
|
+
bulletList: 'Bulleted list',
|
|
158
|
+
orderedList: 'Numbered list',
|
|
159
|
+
blockquote: 'Quote',
|
|
160
|
+
link: 'Link',
|
|
161
|
+
codeBlock: 'Code block',
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const RICH_TEXT_EDITOR_CONFIG = new InjectionToken('RICH_TEXT_EDITOR_CONFIG', {
|
|
167
|
+
factory: () => DEFAULT_RICH_TEXT_EDITOR_CONFIG,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// Human-readable label for a `Mod-<key>` shortcut on the current platform (e.g. ⌘B / Ctrl+B).
|
|
171
|
+
function shortcutLabel(key) {
|
|
172
|
+
return IS_APPLE_PLATFORM ? `⌘${key}` : `Ctrl+${key}`;
|
|
173
|
+
}
|
|
174
|
+
// Whether `markType` is applied across the selection (or is queued on an empty selection).
|
|
175
|
+
function markActive(state, markType) {
|
|
176
|
+
const { from, $from, to, empty } = state.selection;
|
|
177
|
+
if (empty)
|
|
178
|
+
return Boolean(markType.isInSet(state.storedMarks || $from.marks()));
|
|
179
|
+
return state.doc.rangeHasMark(from, to, markType);
|
|
180
|
+
}
|
|
181
|
+
// Whether the selection's textblock is exactly `nodeType` (optionally matching `attrs`).
|
|
182
|
+
function blockActive(state, nodeType, attrs) {
|
|
183
|
+
const selection = state.selection;
|
|
184
|
+
if (selection instanceof NodeSelection)
|
|
185
|
+
return selection.node.hasMarkup(nodeType, attrs);
|
|
186
|
+
const { $from, to } = selection;
|
|
187
|
+
return to <= $from.end() && $from.parent.hasMarkup(nodeType, attrs);
|
|
188
|
+
}
|
|
189
|
+
// Whether the selection sits inside a list/blockquote of `nodeType` (walks ancestors).
|
|
190
|
+
function ancestorActive(state, nodeType) {
|
|
191
|
+
const { $from } = state.selection;
|
|
192
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
193
|
+
if ($from.node(depth).type === nodeType)
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
// Toggles list membership: wraps the selection in `listType`, or lifts it out one
|
|
199
|
+
// level when the selection already sits inside one — so the toolbar control both
|
|
200
|
+
// enters and leaves the list instead of silently failing on a wrapped selection.
|
|
201
|
+
function toggleList(listType, itemType) {
|
|
202
|
+
return (state, dispatch, view) => {
|
|
203
|
+
const command = ancestorActive(state, listType) ? liftListItem(itemType) : wrapInList(listType);
|
|
204
|
+
return command(state, dispatch, view);
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
// Toggles a wrapping node (blockquote): wraps the selection, or lifts it out when
|
|
208
|
+
// the selection already sits inside one.
|
|
209
|
+
function toggleWrap(nodeType) {
|
|
210
|
+
return (state, dispatch, view) => {
|
|
211
|
+
const command = ancestorActive(state, nodeType) ? lift : wrapIn(nodeType);
|
|
212
|
+
return command(state, dispatch, view);
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
// Toggles between a heading of the given level and a plain paragraph.
|
|
216
|
+
function toggleHeading(headingType, paragraphType, level) {
|
|
217
|
+
return (state, dispatch, view) => {
|
|
218
|
+
const command = blockActive(state, headingType, { level })
|
|
219
|
+
? setBlockType(paragraphType)
|
|
220
|
+
: setBlockType(headingType, { level });
|
|
221
|
+
return command(state, dispatch, view);
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Builds the runtime toolbar-control map for a schema: each entry pairs the ProseMirror
|
|
226
|
+
* command it dispatches with the predicate that reflects its active state. The `link`
|
|
227
|
+
* control's command removes an existing link; adding a link is handled by the component,
|
|
228
|
+
* which supplies the target URL.
|
|
229
|
+
*/
|
|
230
|
+
function buildToolbarButtons(schema, labels) {
|
|
231
|
+
const { strong, em, strikethrough, code, link } = schema.marks;
|
|
232
|
+
const { heading, bullet_list, ordered_list, blockquote, code_block, paragraph, list_item } = schema.nodes;
|
|
233
|
+
return {
|
|
234
|
+
bold: {
|
|
235
|
+
id: 'bold',
|
|
236
|
+
icon: 'bold',
|
|
237
|
+
label: labels.controls.bold,
|
|
238
|
+
shortcut: shortcutLabel('B'),
|
|
239
|
+
command: toggleMark(strong),
|
|
240
|
+
isActive: state => markActive(state, strong),
|
|
241
|
+
},
|
|
242
|
+
italic: {
|
|
243
|
+
id: 'italic',
|
|
244
|
+
icon: 'italic',
|
|
245
|
+
label: labels.controls.italic,
|
|
246
|
+
shortcut: shortcutLabel('I'),
|
|
247
|
+
command: toggleMark(em),
|
|
248
|
+
isActive: state => markActive(state, em),
|
|
249
|
+
},
|
|
250
|
+
strikethrough: {
|
|
251
|
+
id: 'strikethrough',
|
|
252
|
+
icon: 'strikethrough',
|
|
253
|
+
label: labels.controls.strikethrough,
|
|
254
|
+
command: toggleMark(strikethrough),
|
|
255
|
+
isActive: state => markActive(state, strikethrough),
|
|
256
|
+
},
|
|
257
|
+
code: {
|
|
258
|
+
id: 'code',
|
|
259
|
+
icon: 'inline-code',
|
|
260
|
+
label: labels.controls.code,
|
|
261
|
+
shortcut: shortcutLabel('`'),
|
|
262
|
+
command: toggleMark(code),
|
|
263
|
+
isActive: state => markActive(state, code),
|
|
264
|
+
},
|
|
265
|
+
heading1: {
|
|
266
|
+
id: 'heading1',
|
|
267
|
+
label: labels.controls.heading1,
|
|
268
|
+
text: 'H1',
|
|
269
|
+
command: toggleHeading(heading, paragraph, 1),
|
|
270
|
+
isActive: state => blockActive(state, heading, { level: 1 }),
|
|
271
|
+
},
|
|
272
|
+
heading2: {
|
|
273
|
+
id: 'heading2',
|
|
274
|
+
label: labels.controls.heading2,
|
|
275
|
+
text: 'H2',
|
|
276
|
+
command: toggleHeading(heading, paragraph, 2),
|
|
277
|
+
isActive: state => blockActive(state, heading, { level: 2 }),
|
|
278
|
+
},
|
|
279
|
+
heading3: {
|
|
280
|
+
id: 'heading3',
|
|
281
|
+
label: labels.controls.heading3,
|
|
282
|
+
text: 'H3',
|
|
283
|
+
command: toggleHeading(heading, paragraph, 3),
|
|
284
|
+
isActive: state => blockActive(state, heading, { level: 3 }),
|
|
285
|
+
},
|
|
286
|
+
bulletList: {
|
|
287
|
+
id: 'bulletList',
|
|
288
|
+
icon: 'bullet-list',
|
|
289
|
+
label: labels.controls.bulletList,
|
|
290
|
+
command: toggleList(bullet_list, list_item),
|
|
291
|
+
isActive: state => ancestorActive(state, bullet_list),
|
|
292
|
+
},
|
|
293
|
+
orderedList: {
|
|
294
|
+
id: 'orderedList',
|
|
295
|
+
icon: 'ordered-list',
|
|
296
|
+
label: labels.controls.orderedList,
|
|
297
|
+
command: toggleList(ordered_list, list_item),
|
|
298
|
+
isActive: state => ancestorActive(state, ordered_list),
|
|
299
|
+
},
|
|
300
|
+
blockquote: {
|
|
301
|
+
id: 'blockquote',
|
|
302
|
+
icon: 'blockquote',
|
|
303
|
+
label: labels.controls.blockquote,
|
|
304
|
+
command: toggleWrap(blockquote),
|
|
305
|
+
isActive: state => ancestorActive(state, blockquote),
|
|
306
|
+
},
|
|
307
|
+
link: {
|
|
308
|
+
id: 'link',
|
|
309
|
+
icon: 'link',
|
|
310
|
+
label: labels.controls.link,
|
|
311
|
+
shortcut: shortcutLabel('K'),
|
|
312
|
+
command: toggleMark(link),
|
|
313
|
+
isActive: state => markActive(state, link),
|
|
314
|
+
},
|
|
315
|
+
codeBlock: {
|
|
316
|
+
id: 'codeBlock',
|
|
317
|
+
icon: 'code-block',
|
|
318
|
+
label: labels.controls.codeBlock,
|
|
319
|
+
command: (state, dispatch, view) => {
|
|
320
|
+
const command = blockActive(state, code_block)
|
|
321
|
+
? setBlockType(paragraph)
|
|
322
|
+
: setBlockType(code_block);
|
|
323
|
+
return command(state, dispatch, view);
|
|
324
|
+
},
|
|
325
|
+
isActive: state => blockActive(state, code_block),
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* A WYSIWYG rich-text form control whose value is a Markdown string. The editable surface is
|
|
332
|
+
* powered by ProseMirror against a Markdown-capable schema, so content round-trips losslessly
|
|
333
|
+
* to Markdown while the user edits formatted text directly.
|
|
334
|
+
*/
|
|
335
|
+
class RichTextEditor extends ValueFormControl {
|
|
336
|
+
// Injections
|
|
337
|
+
_config = inject(RICH_TEXT_EDITOR_CONFIG);
|
|
338
|
+
// Inputs
|
|
339
|
+
value = model('', /* @ts-ignore */
|
|
340
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
341
|
+
placeholder = input(this._config.placeholder, /* @ts-ignore */
|
|
342
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
343
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
344
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
345
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
346
|
+
toolbar = input(this._config.toolbar, /* @ts-ignore */
|
|
347
|
+
...(ngDevMode ? [{ debugName: "toolbar" }] : /* istanbul ignore next */ []));
|
|
348
|
+
minRows = input(this._config.minRows, /* @ts-ignore */
|
|
349
|
+
...(ngDevMode ? [{ debugName: "minRows" }] : /* istanbul ignore next */ []));
|
|
350
|
+
// State
|
|
351
|
+
_editorHost = viewChild.required('editorHost');
|
|
352
|
+
_linkInput = viewChild('linkInput', /* @ts-ignore */
|
|
353
|
+
...(ngDevMode ? [{ debugName: "_linkInput" }] : /* istanbul ignore next */ []));
|
|
354
|
+
_editorState = signal(null, /* @ts-ignore */
|
|
355
|
+
...(ngDevMode ? [{ debugName: "_editorState" }] : /* istanbul ignore next */ []));
|
|
356
|
+
linkEditing = signal(false, /* @ts-ignore */
|
|
357
|
+
...(ngDevMode ? [{ debugName: "linkEditing" }] : /* istanbul ignore next */ []));
|
|
358
|
+
linkUrl = signal('', /* @ts-ignore */
|
|
359
|
+
...(ngDevMode ? [{ debugName: "linkUrl" }] : /* istanbul ignore next */ []));
|
|
360
|
+
labels = this._config.labels;
|
|
361
|
+
// The toolbar-control map, resolved once against the schema.
|
|
362
|
+
_buttons = buildToolbarButtons(richTextSchema, this._config.labels);
|
|
363
|
+
_view = null;
|
|
364
|
+
// The most recent Markdown this component emitted, used to ignore its own value writes.
|
|
365
|
+
_lastEmitted = '';
|
|
366
|
+
// Computed
|
|
367
|
+
classes = computed(() => {
|
|
368
|
+
const array = ['tls-rich-text-editor'];
|
|
369
|
+
// Size/fluid ride the shared form-control classes (like every text control),
|
|
370
|
+
// so the theme's size tokens apply without a duplicated per-component table.
|
|
371
|
+
array.push(`${this.CLASS_NAME}--${this.size()}`);
|
|
372
|
+
if (this.fluid())
|
|
373
|
+
array.push(`${this.CLASS_NAME}--fluid`);
|
|
374
|
+
return array.concat(this.controlClasses());
|
|
375
|
+
}, /* @ts-ignore */
|
|
376
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
377
|
+
// The toolbar layout resolved to renderable entries (separators and controls).
|
|
378
|
+
entries = computed(() => this.toolbar().map(entry => {
|
|
379
|
+
if (entry === 'separator')
|
|
380
|
+
return { separator: true, button: null };
|
|
381
|
+
return { separator: false, button: this._buttons[entry] };
|
|
382
|
+
}), /* @ts-ignore */
|
|
383
|
+
...(ngDevMode ? [{ debugName: "entries" }] : /* istanbul ignore next */ []));
|
|
384
|
+
// ARIA/state attributes forwarded onto the contenteditable textbox managed by ProseMirror.
|
|
385
|
+
_contentAttributes = computed(() => {
|
|
386
|
+
const attributes = {
|
|
387
|
+
class: 'tls-rich-text-editor__content',
|
|
388
|
+
role: 'textbox',
|
|
389
|
+
'aria-multiline': 'true',
|
|
390
|
+
translate: 'no',
|
|
391
|
+
};
|
|
392
|
+
const label = this.ariaLabel();
|
|
393
|
+
if (label)
|
|
394
|
+
attributes['aria-label'] = label;
|
|
395
|
+
const labelledby = this.labelledBy();
|
|
396
|
+
if (labelledby)
|
|
397
|
+
attributes['aria-labelledby'] = labelledby;
|
|
398
|
+
const describedby = this.describedBy();
|
|
399
|
+
if (describedby)
|
|
400
|
+
attributes['aria-describedby'] = describedby;
|
|
401
|
+
if (this.invalid())
|
|
402
|
+
attributes['aria-invalid'] = 'true';
|
|
403
|
+
if (this.required())
|
|
404
|
+
attributes['aria-required'] = 'true';
|
|
405
|
+
if (this.pending())
|
|
406
|
+
attributes['aria-busy'] = 'true';
|
|
407
|
+
if (this.readonly())
|
|
408
|
+
attributes['aria-readonly'] = 'true';
|
|
409
|
+
const placeholder = this.placeholder();
|
|
410
|
+
if (placeholder) {
|
|
411
|
+
attributes['data-placeholder'] = placeholder;
|
|
412
|
+
if (this._isDocumentEmpty())
|
|
413
|
+
attributes['data-empty'] = 'true';
|
|
414
|
+
}
|
|
415
|
+
return attributes;
|
|
416
|
+
}, /* @ts-ignore */
|
|
417
|
+
...(ngDevMode ? [{ debugName: "_contentAttributes" }] : /* istanbul ignore next */ []));
|
|
418
|
+
constructor() {
|
|
419
|
+
super();
|
|
420
|
+
// Reflect external value writes back into the document, skipping the component's own emits
|
|
421
|
+
// and no-op writes so typing never rebuilds the document under the cursor.
|
|
422
|
+
effect(() => {
|
|
423
|
+
const markdown = this.value();
|
|
424
|
+
const view = this._view;
|
|
425
|
+
if (!view)
|
|
426
|
+
return;
|
|
427
|
+
if (markdown === this._lastEmitted)
|
|
428
|
+
return;
|
|
429
|
+
if (markdown === markdownSerializer.serialize(view.state.doc)) {
|
|
430
|
+
this._lastEmitted = markdown;
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
// Replace the document through a transaction on the live state rather than a
|
|
434
|
+
// rebuilt EditorState, so plugin state — notably the undo history — survives
|
|
435
|
+
// the external write (and the write itself becomes undoable).
|
|
436
|
+
const parsed = markdownParser.parse(markdown);
|
|
437
|
+
const transaction = view.state.tr.replaceWith(0, view.state.doc.content.size, parsed.content);
|
|
438
|
+
view.dispatch(transaction);
|
|
439
|
+
this._lastEmitted = markdown;
|
|
440
|
+
});
|
|
441
|
+
// Keep the editable state and forwarded ARIA attributes in sync with the control's inputs.
|
|
442
|
+
effect(() => {
|
|
443
|
+
const editable = !this.notInteractive();
|
|
444
|
+
const attributes = this._contentAttributes();
|
|
445
|
+
const view = this._view;
|
|
446
|
+
if (!view)
|
|
447
|
+
return;
|
|
448
|
+
view.setProps({ editable: () => editable, attributes: () => attributes });
|
|
449
|
+
});
|
|
450
|
+
// Move focus into the URL input when the link editor opens, so the ⌘K/toolbar flow
|
|
451
|
+
// continues on the keyboard without tabbing.
|
|
452
|
+
effect(() => {
|
|
453
|
+
const linkInput = this._linkInput();
|
|
454
|
+
if (this.linkEditing() && linkInput)
|
|
455
|
+
linkInput.nativeElement.focus();
|
|
456
|
+
});
|
|
457
|
+
afterNextRender(() => this._createView());
|
|
458
|
+
}
|
|
459
|
+
// Protected methods
|
|
460
|
+
isActive(button) {
|
|
461
|
+
const state = this._editorState();
|
|
462
|
+
if (!state)
|
|
463
|
+
return false;
|
|
464
|
+
return button.isActive(state);
|
|
465
|
+
}
|
|
466
|
+
runCommand(button) {
|
|
467
|
+
const view = this._view;
|
|
468
|
+
if (!view)
|
|
469
|
+
return;
|
|
470
|
+
if (button.id === 'link') {
|
|
471
|
+
this._toggleLink();
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
button.command(view.state, view.dispatch, view);
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Returns focus to the editable surface after a pointer-driven toolbar click.
|
|
478
|
+
*
|
|
479
|
+
* Bound on the toolbar container rather than the controls themselves: the roving-tabindex
|
|
480
|
+
* behavior focuses the clicked control from that control's own `click` handler, so only a
|
|
481
|
+
* listener further up the bubble path is guaranteed to run afterwards. Restoring focus
|
|
482
|
+
* there keeps it inside the same event dispatch, so no frame ever paints with focus — and
|
|
483
|
+
* its ring — on the button.
|
|
484
|
+
*
|
|
485
|
+
* Keyboard-activated clicks report an empty `pointerType` and are left alone: there the
|
|
486
|
+
* toolbar is the user's position in the widget and must keep both focus and its ring.
|
|
487
|
+
*/
|
|
488
|
+
restoreEditorFocus(event) {
|
|
489
|
+
if (!(event instanceof PointerEvent))
|
|
490
|
+
return;
|
|
491
|
+
if (event.pointerType === '')
|
|
492
|
+
return;
|
|
493
|
+
// The URL editor legitimately owns focus once it opens.
|
|
494
|
+
if (this.linkEditing())
|
|
495
|
+
return;
|
|
496
|
+
const view = this._view;
|
|
497
|
+
if (view)
|
|
498
|
+
view.focus();
|
|
499
|
+
}
|
|
500
|
+
applyLink(event) {
|
|
501
|
+
// Enter must not bubble into an enclosing <form> submit or other default handling.
|
|
502
|
+
if (event)
|
|
503
|
+
event.preventDefault();
|
|
504
|
+
const view = this._view;
|
|
505
|
+
const href = this.linkUrl().trim();
|
|
506
|
+
this.linkEditing.set(false);
|
|
507
|
+
if (!view)
|
|
508
|
+
return;
|
|
509
|
+
if (!href || !this._isSafeHref(href)) {
|
|
510
|
+
view.focus();
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
toggleMark(richTextSchema.marks['link'], { href })(view.state, view.dispatch);
|
|
514
|
+
view.focus();
|
|
515
|
+
}
|
|
516
|
+
cancelLink(event) {
|
|
517
|
+
// Escape must not also close an enclosing dialog or clear other default behavior.
|
|
518
|
+
if (event)
|
|
519
|
+
event.preventDefault();
|
|
520
|
+
const view = this._view;
|
|
521
|
+
this.linkEditing.set(false);
|
|
522
|
+
if (view)
|
|
523
|
+
view.focus();
|
|
524
|
+
}
|
|
525
|
+
onLinkInput(event) {
|
|
526
|
+
const target = event.target;
|
|
527
|
+
this.linkUrl.set(target.value);
|
|
528
|
+
}
|
|
529
|
+
// Private methods
|
|
530
|
+
_createView() {
|
|
531
|
+
const host = this._editorHost();
|
|
532
|
+
const state = EditorState.create({
|
|
533
|
+
schema: richTextSchema,
|
|
534
|
+
doc: markdownParser.parse(this.value()),
|
|
535
|
+
plugins: buildRichTextPlugins(richTextSchema, {
|
|
536
|
+
toggleLink: () => {
|
|
537
|
+
this._toggleLink();
|
|
538
|
+
return true;
|
|
539
|
+
},
|
|
540
|
+
}),
|
|
541
|
+
});
|
|
542
|
+
const view = new EditorView(host.nativeElement, {
|
|
543
|
+
state,
|
|
544
|
+
editable: () => !this.notInteractive(),
|
|
545
|
+
attributes: () => this._contentAttributes(),
|
|
546
|
+
handleDOMEvents: {
|
|
547
|
+
blur: () => {
|
|
548
|
+
this.touched.set(true);
|
|
549
|
+
return false;
|
|
550
|
+
},
|
|
551
|
+
},
|
|
552
|
+
dispatchTransaction: transaction => {
|
|
553
|
+
const newState = view.state.apply(transaction);
|
|
554
|
+
view.updateState(newState);
|
|
555
|
+
this._editorState.set(newState);
|
|
556
|
+
if (transaction.docChanged) {
|
|
557
|
+
const markdown = markdownSerializer.serialize(newState.doc);
|
|
558
|
+
this._lastEmitted = markdown;
|
|
559
|
+
this.value.set(markdown);
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
});
|
|
563
|
+
this._view = view;
|
|
564
|
+
this._editorState.set(state);
|
|
565
|
+
// Seed with the Markdown the document was built from, so the value-sync effect's
|
|
566
|
+
// "own emit" guard starts aligned with the actual content — otherwise the first
|
|
567
|
+
// external write that happens to equal the seed default is silently dropped.
|
|
568
|
+
this._lastEmitted = this.value();
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Whether an href is safe to store as a link: scheme-less (relative, `#anchor`) or
|
|
572
|
+
* carrying an allow-listed scheme. Rejects `javascript:`/`data:`-style URLs so a
|
|
573
|
+
* crafted link cannot smuggle an executable payload into the emitted Markdown.
|
|
574
|
+
*/
|
|
575
|
+
_isSafeHref(href) {
|
|
576
|
+
const scheme = LINK_SCHEME_REGEX.exec(href);
|
|
577
|
+
if (!scheme)
|
|
578
|
+
return true;
|
|
579
|
+
return SAFE_LINK_SCHEMES.includes(scheme[0].toLowerCase());
|
|
580
|
+
}
|
|
581
|
+
// Whether the document holds no content (a single empty top-level block), so the
|
|
582
|
+
// placeholder should show. ProseMirror keeps a trailing `<br>` in empty textblocks,
|
|
583
|
+
// which defeats a CSS `:empty` check, so emptiness is derived from the document model.
|
|
584
|
+
_isDocumentEmpty() {
|
|
585
|
+
const state = this._editorState();
|
|
586
|
+
if (!state)
|
|
587
|
+
return true;
|
|
588
|
+
const { doc } = state;
|
|
589
|
+
if (doc.childCount > 1)
|
|
590
|
+
return false;
|
|
591
|
+
const firstChild = doc.firstChild;
|
|
592
|
+
return firstChild === null || firstChild.content.size === 0;
|
|
593
|
+
}
|
|
594
|
+
// Removes the link on the current selection, or opens the link editor to add one.
|
|
595
|
+
_toggleLink() {
|
|
596
|
+
const view = this._view;
|
|
597
|
+
if (!view)
|
|
598
|
+
return;
|
|
599
|
+
if (this._buttons['link'].isActive(view.state)) {
|
|
600
|
+
this._buttons['link'].command(view.state, view.dispatch, view);
|
|
601
|
+
view.focus();
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
if (view.state.selection.empty) {
|
|
605
|
+
view.focus();
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
this.linkUrl.set('');
|
|
609
|
+
this.linkEditing.set(true);
|
|
610
|
+
}
|
|
611
|
+
// Lifecycle
|
|
612
|
+
ngOnDestroy() {
|
|
613
|
+
const view = this._view;
|
|
614
|
+
if (!view)
|
|
615
|
+
return;
|
|
616
|
+
// Cleared so a deferred focus restore that outlives the component is a no-op
|
|
617
|
+
// rather than a call into a destroyed view.
|
|
618
|
+
this._view = null;
|
|
619
|
+
view.destroy();
|
|
620
|
+
}
|
|
621
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RichTextEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
622
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: RichTextEditor, isStandalone: true, selector: "tls-rich-text-editor", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, toolbar: { classPropertyName: "toolbar", publicName: "toolbar", isSignal: true, isRequired: false, transformFunction: null }, minRows: { classPropertyName: "minRows", publicName: "minRows", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "group" }, properties: { "class": "classes()", "style.--tls-rich-text-editor-min-rows": "minRows()", "attr.aria-invalid": "invalid() ? 'true' : null" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => RichTextEditor) }], viewQueries: [{ propertyName: "_editorHost", first: true, predicate: ["editorHost"], descendants: true, isSignal: true }, { propertyName: "_linkInput", first: true, predicate: ["linkInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"tls-rich-text-editor__toolbar\"\n ngToolbar\n [attr.aria-label]=\"labels.toolbar\"\n (click)=\"restoreEditorFocus($event)\"\n>\n @for (entry of entries(); track $index) {\n @if (entry.separator) {\n <span class=\"tls-rich-text-editor__separator\" aria-hidden=\"true\"></span>\n } @else if (entry.button) {\n <button\n class=\"tls-rich-text-editor__button\"\n [class.tls-rich-text-editor__button--active]=\"isActive(entry.button)\"\n [class.tls-rich-text-editor__button--text]=\"entry.button.text\"\n type=\"button\"\n ngToolbarWidget\n [value]=\"entry.button.id\"\n [disabled]=\"notInteractive()\"\n [attr.aria-label]=\"entry.button.label\"\n [attr.aria-pressed]=\"isActive(entry.button)\"\n [attr.title]=\"entry.button.shortcut ? entry.button.label + ' (' + entry.button.shortcut + ')' : entry.button.label\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"runCommand(entry.button)\"\n >\n @if (entry.button.text) {\n <span aria-hidden=\"true\">{{ entry.button.text }}</span>\n } @else if (entry.button.icon) {\n <tls-icon class=\"tls-rich-text-editor__icon\" [name]=\"entry.button.icon\" aria-hidden=\"true\" />\n }\n </button>\n }\n }\n</div>\n\n<div #editorHost class=\"tls-rich-text-editor__editor\"></div>\n\n@if (linkEditing()) {\n <div class=\"tls-rich-text-editor__link-bar\">\n <input\n #linkInput\n class=\"tls-rich-text-editor__link-input\"\n type=\"url\"\n inputmode=\"url\"\n [placeholder]=\"labels.linkPlaceholder\"\n [attr.aria-label]=\"labels.linkUrl\"\n [value]=\"linkUrl()\"\n (input)=\"onLinkInput($event)\"\n (keydown.enter)=\"applyLink($event)\"\n (keydown.escape)=\"cancelLink($event)\"\n />\n <button\n class=\"tls-rich-text-editor__link-action\"\n type=\"button\"\n (click)=\"applyLink()\"\n >\n {{ labels.linkApply }}\n </button>\n <button\n class=\"tls-rich-text-editor__link-action tls-rich-text-editor__link-action--ghost\"\n type=\"button\"\n (click)=\"cancelLink()\"\n >\n {{ labels.linkCancel }}\n </button>\n </div>\n}\n", styles: [":host{--tls-rich-text-editor-width: 320px;position:relative;width:var(--tls-rich-text-editor-width);display:flex;flex-direction:column}:host.tls-form-control--fluid{--tls-rich-text-editor-width: 100%}:host .tls-rich-text-editor__toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--spacing-3)}:host .tls-rich-text-editor__separator{width:1px;height:16px;margin-inline:var(--spacing-1)}:host .tls-rich-text-editor__button{position:relative;width:var(--tls-rich-text-editor-button-size, 32px);height:var(--tls-rich-text-editor-button-size, 32px);display:inline-flex;justify-content:center;align-items:center;cursor:pointer}:host .tls-rich-text-editor__button:disabled{cursor:not-allowed}:host .tls-rich-text-editor__button--text{font-weight:600}:host .tls-rich-text-editor__icon{width:16px;height:16px}:host .tls-rich-text-editor__editor{display:flex;flex-direction:column}:host .tls-rich-text-editor__link-bar{display:flex;align-items:center;gap:var(--spacing-2)}:host .tls-rich-text-editor__link-input{flex:1 1 auto;min-width:0}:host .tls-rich-text-editor__link-action{position:relative}\n"], dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: Toolbar, selector: "[ngToolbar]", inputs: ["orientation", "softDisabled", "disabled", "wrap", "value"], outputs: ["valueChange"], exportAs: ["ngToolbar"] }, { kind: "directive", type: ToolbarWidget, selector: "[ngToolbarWidget]", inputs: ["id", "disabled", "value"], exportAs: ["ngToolbarWidget"] }] });
|
|
623
|
+
}
|
|
624
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: RichTextEditor, decorators: [{
|
|
625
|
+
type: Component,
|
|
626
|
+
args: [{ selector: 'tls-rich-text-editor', imports: [Icon, Toolbar, ToolbarWidget], host: {
|
|
627
|
+
role: 'group',
|
|
628
|
+
'[class]': 'classes()',
|
|
629
|
+
'[style.--tls-rich-text-editor-min-rows]': 'minRows()',
|
|
630
|
+
'[attr.aria-invalid]': "invalid() ? 'true' : null",
|
|
631
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => RichTextEditor) }], template: "<div\n class=\"tls-rich-text-editor__toolbar\"\n ngToolbar\n [attr.aria-label]=\"labels.toolbar\"\n (click)=\"restoreEditorFocus($event)\"\n>\n @for (entry of entries(); track $index) {\n @if (entry.separator) {\n <span class=\"tls-rich-text-editor__separator\" aria-hidden=\"true\"></span>\n } @else if (entry.button) {\n <button\n class=\"tls-rich-text-editor__button\"\n [class.tls-rich-text-editor__button--active]=\"isActive(entry.button)\"\n [class.tls-rich-text-editor__button--text]=\"entry.button.text\"\n type=\"button\"\n ngToolbarWidget\n [value]=\"entry.button.id\"\n [disabled]=\"notInteractive()\"\n [attr.aria-label]=\"entry.button.label\"\n [attr.aria-pressed]=\"isActive(entry.button)\"\n [attr.title]=\"entry.button.shortcut ? entry.button.label + ' (' + entry.button.shortcut + ')' : entry.button.label\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"runCommand(entry.button)\"\n >\n @if (entry.button.text) {\n <span aria-hidden=\"true\">{{ entry.button.text }}</span>\n } @else if (entry.button.icon) {\n <tls-icon class=\"tls-rich-text-editor__icon\" [name]=\"entry.button.icon\" aria-hidden=\"true\" />\n }\n </button>\n }\n }\n</div>\n\n<div #editorHost class=\"tls-rich-text-editor__editor\"></div>\n\n@if (linkEditing()) {\n <div class=\"tls-rich-text-editor__link-bar\">\n <input\n #linkInput\n class=\"tls-rich-text-editor__link-input\"\n type=\"url\"\n inputmode=\"url\"\n [placeholder]=\"labels.linkPlaceholder\"\n [attr.aria-label]=\"labels.linkUrl\"\n [value]=\"linkUrl()\"\n (input)=\"onLinkInput($event)\"\n (keydown.enter)=\"applyLink($event)\"\n (keydown.escape)=\"cancelLink($event)\"\n />\n <button\n class=\"tls-rich-text-editor__link-action\"\n type=\"button\"\n (click)=\"applyLink()\"\n >\n {{ labels.linkApply }}\n </button>\n <button\n class=\"tls-rich-text-editor__link-action tls-rich-text-editor__link-action--ghost\"\n type=\"button\"\n (click)=\"cancelLink()\"\n >\n {{ labels.linkCancel }}\n </button>\n </div>\n}\n", styles: [":host{--tls-rich-text-editor-width: 320px;position:relative;width:var(--tls-rich-text-editor-width);display:flex;flex-direction:column}:host.tls-form-control--fluid{--tls-rich-text-editor-width: 100%}:host .tls-rich-text-editor__toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--spacing-3)}:host .tls-rich-text-editor__separator{width:1px;height:16px;margin-inline:var(--spacing-1)}:host .tls-rich-text-editor__button{position:relative;width:var(--tls-rich-text-editor-button-size, 32px);height:var(--tls-rich-text-editor-button-size, 32px);display:inline-flex;justify-content:center;align-items:center;cursor:pointer}:host .tls-rich-text-editor__button:disabled{cursor:not-allowed}:host .tls-rich-text-editor__button--text{font-weight:600}:host .tls-rich-text-editor__icon{width:16px;height:16px}:host .tls-rich-text-editor__editor{display:flex;flex-direction:column}:host .tls-rich-text-editor__link-bar{display:flex;align-items:center;gap:var(--spacing-2)}:host .tls-rich-text-editor__link-input{flex:1 1 auto;min-width:0}:host .tls-rich-text-editor__link-action{position:relative}\n"] }]
|
|
632
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], toolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "toolbar", required: false }] }], minRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "minRows", required: false }] }], _editorHost: [{ type: i0.ViewChild, args: ['editorHost', { isSignal: true }] }], _linkInput: [{ type: i0.ViewChild, args: ['linkInput', { isSignal: true }] }] } });
|
|
633
|
+
|
|
634
|
+
const provideThalassicRichTextEditorConfig = (config) => {
|
|
635
|
+
return makeEnvironmentProviders([
|
|
636
|
+
{
|
|
637
|
+
provide: RICH_TEXT_EDITOR_CONFIG,
|
|
638
|
+
// `labels` is a deep-partial override; deepMerge merges it recursively, but its
|
|
639
|
+
// `Partial<T>` signature only models a shallow partial, so cast to it.
|
|
640
|
+
useValue: deepMerge(DEFAULT_RICH_TEXT_EDITOR_CONFIG, config),
|
|
641
|
+
},
|
|
642
|
+
]);
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Generated bundle index. Do not edit.
|
|
647
|
+
*/
|
|
648
|
+
|
|
649
|
+
export { DEFAULT_RICH_TEXT_EDITOR_CONFIG, RICH_TEXT_EDITOR_CONFIG, RichTextEditor, provideThalassicRichTextEditorConfig };
|
|
650
|
+
//# sourceMappingURL=thalassic-ui-rich-text-editor.mjs.map
|