@acorex/components 22.4.7 → 22.4.9
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/acorex-components-action-sheet.mjs +2 -2
- package/fesm2022/acorex-components-action-sheet.mjs.map +1 -1
- package/fesm2022/acorex-components-alert.mjs +2 -2
- package/fesm2022/acorex-components-alert.mjs.map +1 -1
- package/fesm2022/acorex-components-avatar.mjs +2 -2
- package/fesm2022/acorex-components-map.mjs +27 -9
- package/fesm2022/acorex-components-map.mjs.map +1 -1
- package/fesm2022/acorex-components-text-editor.mjs +58 -653
- package/fesm2022/acorex-components-text-editor.mjs.map +1 -1
- package/fesm2022/acorex-components-time-duration.mjs +59 -19
- package/fesm2022/acorex-components-time-duration.mjs.map +1 -1
- package/package.json +3 -3
- package/text-editor/README.md +3 -1
- package/types/acorex-components-map.d.ts +7 -0
- package/types/acorex-components-text-editor.d.ts +27 -67
- package/types/acorex-components-time-duration.d.ts +17 -3
|
@@ -4,7 +4,8 @@ import { AXDecoratorIconComponent, AXDecoratorGenericComponent } from '@acorex/c
|
|
|
4
4
|
import { AXTranslatorPipe, AXTranslationService } from '@acorex/core/translation';
|
|
5
5
|
import { AsyncPipe, isPlatformBrowser } from '@angular/common';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
|
-
import { signal, computed, Injectable,
|
|
7
|
+
import { inject, signal, computed, Injectable, input, ViewEncapsulation, ChangeDetectionStrategy, Component, ElementRef, PLATFORM_ID, afterNextRender, effect, DestroyRef, contentChild, forwardRef, model, viewChild, NgModule } from '@angular/core';
|
|
8
|
+
import { AXTextEditor, AX_TEXT_EDITOR_ZOOM_MAX, AX_TEXT_EDITOR_ZOOM_MIN, AX_TEXT_EDITOR_DEFAULT_TEXT_COLORS, AX_TEXT_EDITOR_DEFAULT_BACKGROUND_COLORS, AX_TEXT_EDITOR_ZOOM_PRESETS, AX_TEXT_EDITOR_FONT_SIZES } from '@acorex/cdk/text-editor';
|
|
8
9
|
import { isEqual } from 'lodash-es';
|
|
9
10
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
10
11
|
import * as i1 from '@angular/forms';
|
|
@@ -17,293 +18,29 @@ import { AXColorPaletteComponent, AXColorPalettePickerComponent, AXColorPaletteS
|
|
|
17
18
|
import { AXToastService } from '@acorex/components/toast';
|
|
18
19
|
import { AXFileService, AXFileTypeRegistryService, AX_IMAGE_FILE_TYPE, AX_VIDEO_FILE_TYPE } from '@acorex/core/file';
|
|
19
20
|
|
|
20
|
-
function escapeHtml(value) {
|
|
21
|
-
return value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"');
|
|
22
|
-
}
|
|
23
|
-
function normalizeHref(value) {
|
|
24
|
-
const href = value.trim();
|
|
25
|
-
if (!href)
|
|
26
|
-
return '';
|
|
27
|
-
if (/^(https?:|mailto:|tel:|#|\/)/i.test(href))
|
|
28
|
-
return href;
|
|
29
|
-
return `https://${href}`;
|
|
30
|
-
}
|
|
31
|
-
function headingLevel(attrs) {
|
|
32
|
-
const level = Number(attrs?.['level']);
|
|
33
|
-
return level === 1 || level === 2 || level === 3 ? level : undefined;
|
|
34
|
-
}
|
|
35
|
-
function isTextEditorCommandActive(editor, command, attrs) {
|
|
36
|
-
switch (command) {
|
|
37
|
-
case 'heading': {
|
|
38
|
-
const level = headingLevel(attrs);
|
|
39
|
-
return level ? editor.isActive('heading', { level }) : editor.isActive('heading');
|
|
40
|
-
}
|
|
41
|
-
case 'paragraph':
|
|
42
|
-
return editor.isActive('paragraph');
|
|
43
|
-
case 'align':
|
|
44
|
-
return editor.isActive({ textAlign: attrs?.['align'] });
|
|
45
|
-
case 'direction':
|
|
46
|
-
return editor.isActive({ dir: attrs?.['direction'] });
|
|
47
|
-
case 'link':
|
|
48
|
-
return editor.isActive('link');
|
|
49
|
-
case 'image':
|
|
50
|
-
return editor.isActive('image');
|
|
51
|
-
case 'video':
|
|
52
|
-
return editor.isActive('video');
|
|
53
|
-
case 'fontSize':
|
|
54
|
-
return Boolean(editor.getAttributes('textStyle')?.['fontSize']);
|
|
55
|
-
case 'insertTable':
|
|
56
|
-
return editor.isActive('table');
|
|
57
|
-
case 'unlink':
|
|
58
|
-
case 'color':
|
|
59
|
-
case 'highlight':
|
|
60
|
-
case 'undo':
|
|
61
|
-
case 'redo':
|
|
62
|
-
case 'horizontalRule':
|
|
63
|
-
return false;
|
|
64
|
-
default:
|
|
65
|
-
return editor.isActive(command);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function canRunTextEditorCommand(editor, command, attrs) {
|
|
69
|
-
switch (command) {
|
|
70
|
-
case 'undo':
|
|
71
|
-
return editor.can().undo();
|
|
72
|
-
case 'redo':
|
|
73
|
-
return editor.can().redo();
|
|
74
|
-
case 'heading': {
|
|
75
|
-
const level = headingLevel(attrs);
|
|
76
|
-
return level ? editor.can().setHeading({ level }) : editor.can().setParagraph();
|
|
77
|
-
}
|
|
78
|
-
case 'paragraph':
|
|
79
|
-
return editor.can().setParagraph();
|
|
80
|
-
case 'align':
|
|
81
|
-
return editor.can().setTextAlign(String(attrs?.['align'] ?? 'left'));
|
|
82
|
-
case 'direction':
|
|
83
|
-
return true;
|
|
84
|
-
case 'color':
|
|
85
|
-
return attrs?.['color'] ? editor.can().setColor(String(attrs['color'])) : editor.can().unsetColor();
|
|
86
|
-
case 'highlight':
|
|
87
|
-
return attrs?.['color']
|
|
88
|
-
? editor.can().setHighlight({ color: String(attrs['color']) })
|
|
89
|
-
: editor.can().unsetHighlight();
|
|
90
|
-
case 'fontSize':
|
|
91
|
-
return editor.isEditable;
|
|
92
|
-
case 'link':
|
|
93
|
-
return editor.isEditable;
|
|
94
|
-
case 'unlink':
|
|
95
|
-
return editor.isEditable && editor.can().unsetLink();
|
|
96
|
-
case 'image':
|
|
97
|
-
case 'video':
|
|
98
|
-
return editor.isEditable;
|
|
99
|
-
case 'insertTable':
|
|
100
|
-
return editor.can().insertTable({
|
|
101
|
-
rows: Number(attrs?.['rows'] ?? 3),
|
|
102
|
-
cols: Number(attrs?.['cols'] ?? 3),
|
|
103
|
-
withHeaderRow: Boolean(attrs?.['withHeaderRow'] ?? false),
|
|
104
|
-
});
|
|
105
|
-
case 'addColumnBefore':
|
|
106
|
-
return editor.can().addColumnBefore();
|
|
107
|
-
case 'addColumnAfter':
|
|
108
|
-
return editor.can().addColumnAfter();
|
|
109
|
-
case 'deleteColumn':
|
|
110
|
-
return editor.can().deleteColumn();
|
|
111
|
-
case 'addRowBefore':
|
|
112
|
-
return editor.can().addRowBefore();
|
|
113
|
-
case 'addRowAfter':
|
|
114
|
-
return editor.can().addRowAfter();
|
|
115
|
-
case 'deleteRow':
|
|
116
|
-
return editor.can().deleteRow();
|
|
117
|
-
case 'toggleHeaderRow':
|
|
118
|
-
return editor.can().toggleHeaderRow();
|
|
119
|
-
case 'deleteTable':
|
|
120
|
-
return editor.can().deleteTable();
|
|
121
|
-
case 'blockquote':
|
|
122
|
-
return editor.can().toggleBlockquote();
|
|
123
|
-
case 'code':
|
|
124
|
-
return editor.can().toggleCode();
|
|
125
|
-
case 'codeBlock':
|
|
126
|
-
return editor.can().toggleCodeBlock();
|
|
127
|
-
case 'horizontalRule':
|
|
128
|
-
return editor.can().setHorizontalRule();
|
|
129
|
-
case 'bulletList':
|
|
130
|
-
return editor.isEditable && Boolean(editor.schema.nodes['bulletList']);
|
|
131
|
-
case 'orderedList':
|
|
132
|
-
return editor.isEditable && Boolean(editor.schema.nodes['orderedList']);
|
|
133
|
-
case 'superscript':
|
|
134
|
-
return editor.can().toggleSuperscript();
|
|
135
|
-
case 'subscript':
|
|
136
|
-
return editor.can().toggleSubscript();
|
|
137
|
-
case 'bold':
|
|
138
|
-
return editor.can().toggleBold();
|
|
139
|
-
case 'italic':
|
|
140
|
-
return editor.can().toggleItalic();
|
|
141
|
-
case 'underline':
|
|
142
|
-
return editor.can().toggleUnderline();
|
|
143
|
-
case 'strike':
|
|
144
|
-
return editor.can().toggleStrike();
|
|
145
|
-
default:
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function runTextEditorCommand(editor, command, attrs) {
|
|
150
|
-
const chain = editor.chain().focus();
|
|
151
|
-
switch (command) {
|
|
152
|
-
case 'undo':
|
|
153
|
-
return chain.undo().run();
|
|
154
|
-
case 'redo':
|
|
155
|
-
return chain.redo().run();
|
|
156
|
-
case 'heading': {
|
|
157
|
-
const level = headingLevel(attrs);
|
|
158
|
-
return level ? chain.setHeading({ level }).run() : chain.setParagraph().run();
|
|
159
|
-
}
|
|
160
|
-
case 'paragraph':
|
|
161
|
-
return chain.setParagraph().run();
|
|
162
|
-
case 'align':
|
|
163
|
-
return chain.setTextAlign(String(attrs?.['align'] ?? 'left')).run();
|
|
164
|
-
case 'direction': {
|
|
165
|
-
const direction = attrs?.['direction'] === 'rtl' ? 'rtl' : 'ltr';
|
|
166
|
-
return chain
|
|
167
|
-
.updateAttributes('paragraph', { dir: direction })
|
|
168
|
-
.updateAttributes('heading', { dir: direction })
|
|
169
|
-
.run();
|
|
170
|
-
}
|
|
171
|
-
case 'color':
|
|
172
|
-
return attrs?.['color'] ? chain.setColor(String(attrs['color'])).run() : chain.unsetColor().run();
|
|
173
|
-
case 'highlight':
|
|
174
|
-
return attrs?.['color']
|
|
175
|
-
? chain.setHighlight({ color: String(attrs['color']) }).run()
|
|
176
|
-
: chain.unsetHighlight().run();
|
|
177
|
-
case 'fontSize':
|
|
178
|
-
return chain.setFontSize(attrs?.['size'] ? String(attrs['size']) : null).run();
|
|
179
|
-
case 'link': {
|
|
180
|
-
const href = normalizeHref(String(attrs?.['href'] ?? ''));
|
|
181
|
-
if (!href) {
|
|
182
|
-
return chain.extendMarkRange('link').unsetLink().run();
|
|
183
|
-
}
|
|
184
|
-
if (editor.state.selection.empty) {
|
|
185
|
-
const safeHref = escapeHtml(href);
|
|
186
|
-
return chain.insertContent(`<a href="${safeHref}">${safeHref}</a>`).run();
|
|
187
|
-
}
|
|
188
|
-
return chain.extendMarkRange('link').setLink({ href }).run();
|
|
189
|
-
}
|
|
190
|
-
case 'unlink':
|
|
191
|
-
return chain.extendMarkRange('link').unsetLink().run();
|
|
192
|
-
case 'image': {
|
|
193
|
-
const src = String(attrs?.['src'] ?? '').trim();
|
|
194
|
-
if (!src)
|
|
195
|
-
return false;
|
|
196
|
-
return chain.setImage({ src, alt: String(attrs?.['alt'] ?? '') }).run();
|
|
197
|
-
}
|
|
198
|
-
case 'video': {
|
|
199
|
-
const src = String(attrs?.['src'] ?? '').trim();
|
|
200
|
-
if (!src)
|
|
201
|
-
return false;
|
|
202
|
-
return chain.setVideo({ src }).run();
|
|
203
|
-
}
|
|
204
|
-
case 'insertTable':
|
|
205
|
-
return chain
|
|
206
|
-
.insertTable({
|
|
207
|
-
rows: Number(attrs?.['rows'] ?? 3),
|
|
208
|
-
cols: Number(attrs?.['cols'] ?? 3),
|
|
209
|
-
withHeaderRow: Boolean(attrs?.['withHeaderRow'] ?? false),
|
|
210
|
-
})
|
|
211
|
-
.run();
|
|
212
|
-
case 'addColumnBefore':
|
|
213
|
-
return chain.addColumnBefore().run();
|
|
214
|
-
case 'addColumnAfter':
|
|
215
|
-
return chain.addColumnAfter().run();
|
|
216
|
-
case 'deleteColumn':
|
|
217
|
-
return chain.deleteColumn().run();
|
|
218
|
-
case 'addRowBefore':
|
|
219
|
-
return chain.addRowBefore().run();
|
|
220
|
-
case 'addRowAfter':
|
|
221
|
-
return chain.addRowAfter().run();
|
|
222
|
-
case 'deleteRow':
|
|
223
|
-
return chain.deleteRow().run();
|
|
224
|
-
case 'toggleHeaderRow':
|
|
225
|
-
return chain.toggleHeaderRow().run();
|
|
226
|
-
case 'deleteTable':
|
|
227
|
-
return chain.deleteTable().run();
|
|
228
|
-
case 'blockquote':
|
|
229
|
-
return chain.toggleBlockquote().run();
|
|
230
|
-
case 'code':
|
|
231
|
-
return chain.toggleCode().run();
|
|
232
|
-
case 'codeBlock':
|
|
233
|
-
return chain.toggleCodeBlock().run();
|
|
234
|
-
case 'horizontalRule':
|
|
235
|
-
return chain.setHorizontalRule().run();
|
|
236
|
-
case 'bulletList':
|
|
237
|
-
return chain.toggleBulletList().run();
|
|
238
|
-
case 'orderedList':
|
|
239
|
-
return chain.toggleOrderedList().run();
|
|
240
|
-
case 'superscript':
|
|
241
|
-
return chain.toggleSuperscript().run();
|
|
242
|
-
case 'subscript':
|
|
243
|
-
return chain.toggleSubscript().run();
|
|
244
|
-
case 'bold':
|
|
245
|
-
return chain.toggleBold().run();
|
|
246
|
-
case 'italic':
|
|
247
|
-
return chain.toggleItalic().run();
|
|
248
|
-
case 'underline':
|
|
249
|
-
return chain.toggleUnderline().run();
|
|
250
|
-
case 'strike':
|
|
251
|
-
return chain.toggleStrike().run();
|
|
252
|
-
default:
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const AX_TEXT_EDITOR_ZOOM_PRESETS = [40, 50, 75, 90, 100, 125, 150, 175, 200];
|
|
258
|
-
const AX_TEXT_EDITOR_ZOOM_MIN = 40;
|
|
259
|
-
const AX_TEXT_EDITOR_ZOOM_MAX = 200;
|
|
260
|
-
const AX_TEXT_EDITOR_FONT_SIZES = [8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 72];
|
|
261
|
-
const AX_TEXT_EDITOR_DEFAULT_TEXT_COLORS = [
|
|
262
|
-
'#f59e0b',
|
|
263
|
-
'#eab308',
|
|
264
|
-
'#22c55e',
|
|
265
|
-
'#06b6d4',
|
|
266
|
-
'#3b82f6',
|
|
267
|
-
'#a855f7',
|
|
268
|
-
'#ec4899',
|
|
269
|
-
'#ef4444',
|
|
270
|
-
];
|
|
271
|
-
const AX_TEXT_EDITOR_DEFAULT_BACKGROUND_COLORS = [
|
|
272
|
-
'#ffffff',
|
|
273
|
-
'#f5e6c8',
|
|
274
|
-
'#fde68a',
|
|
275
|
-
'#f9a8d4',
|
|
276
|
-
'#bbf7d0',
|
|
277
|
-
'#ddd6fe',
|
|
278
|
-
'#fbcfe8',
|
|
279
|
-
'#fdba74',
|
|
280
|
-
];
|
|
281
|
-
|
|
282
21
|
/**
|
|
283
|
-
* Per-editor
|
|
284
|
-
*
|
|
285
|
-
* named-command helpers or the full Tiptap instance.
|
|
22
|
+
* Per-editor facade for `ax-text-editor`. Wraps headless {@link AXTextEditor} from `@acorex/cdk/text-editor`.
|
|
23
|
+
* Projected toolbar tools inject this service for commands, selection preservation, and zoom.
|
|
286
24
|
*/
|
|
287
25
|
class AXTextEditorService {
|
|
288
26
|
constructor() {
|
|
289
|
-
this.
|
|
290
|
-
...(ngDevMode ? [{ debugName: "_editor" }] : /* istanbul ignore next */ []));
|
|
27
|
+
this.core = inject(AXTextEditor);
|
|
291
28
|
this.host = null;
|
|
292
29
|
this.preservedRange = null;
|
|
293
|
-
this.editor = this.
|
|
294
|
-
this.
|
|
295
|
-
|
|
30
|
+
this.editor = this.core.editor;
|
|
31
|
+
this.state = this.core.state;
|
|
32
|
+
this.version = this.core.version;
|
|
296
33
|
this.disabled = signal(false, /* @ts-ignore */
|
|
297
34
|
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
298
35
|
this.readonly = signal(false, /* @ts-ignore */
|
|
299
36
|
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
300
37
|
this.editable = computed(() => !this.disabled() && !this.readonly(), /* @ts-ignore */
|
|
301
38
|
...(ngDevMode ? [{ debugName: "editable" }] : /* istanbul ignore next */ []));
|
|
302
|
-
this.textColor =
|
|
39
|
+
this.textColor = computed(() => this.core.state().textColor, /* @ts-ignore */
|
|
303
40
|
...(ngDevMode ? [{ debugName: "textColor" }] : /* istanbul ignore next */ []));
|
|
304
|
-
this.highlightColor =
|
|
41
|
+
this.highlightColor = computed(() => this.core.state().highlightColor, /* @ts-ignore */
|
|
305
42
|
...(ngDevMode ? [{ debugName: "highlightColor" }] : /* istanbul ignore next */ []));
|
|
306
|
-
this.fontSize =
|
|
43
|
+
this.fontSize = computed(() => this.core.state().fontSize, /* @ts-ignore */
|
|
307
44
|
...(ngDevMode ? [{ debugName: "fontSize" }] : /* istanbul ignore next */ []));
|
|
308
45
|
this.zoom = signal(100, /* @ts-ignore */
|
|
309
46
|
...(ngDevMode ? [{ debugName: "zoom" }] : /* istanbul ignore next */ []));
|
|
@@ -322,46 +59,28 @@ class AXTextEditorService {
|
|
|
322
59
|
getHost() {
|
|
323
60
|
return this.host;
|
|
324
61
|
}
|
|
325
|
-
setEditor(editor) {
|
|
326
|
-
this._editor.set(editor);
|
|
327
|
-
this.refresh();
|
|
328
|
-
}
|
|
329
62
|
refresh() {
|
|
330
|
-
this.
|
|
331
|
-
const editor = this._editor();
|
|
332
|
-
if (!editor) {
|
|
333
|
-
this.textColor.set(null);
|
|
334
|
-
this.highlightColor.set(null);
|
|
335
|
-
this.fontSize.set(null);
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
this.textColor.set(editor.getAttributes('textStyle')?.['color'] ?? null);
|
|
339
|
-
this.highlightColor.set(editor.getAttributes('highlight')?.['color'] ?? null);
|
|
340
|
-
this.fontSize.set(editor.getAttributes('textStyle')?.['fontSize'] ?? null);
|
|
63
|
+
this.core.refresh();
|
|
341
64
|
}
|
|
342
65
|
chain() {
|
|
343
|
-
return this.
|
|
66
|
+
return this.core.chain();
|
|
344
67
|
}
|
|
345
68
|
get commands() {
|
|
346
|
-
return this.
|
|
69
|
+
return this.core.commands;
|
|
347
70
|
}
|
|
348
71
|
get canCommands() {
|
|
349
|
-
return this.
|
|
72
|
+
return this.core.editor()?.can();
|
|
350
73
|
}
|
|
351
74
|
isActive(command, attrs) {
|
|
352
|
-
this.
|
|
353
|
-
const editor = this._editor();
|
|
354
|
-
return editor ? isTextEditorCommandActive(editor, command, attrs) : false;
|
|
75
|
+
return this.core.isActive(command, attrs);
|
|
355
76
|
}
|
|
356
77
|
can(command, attrs) {
|
|
357
|
-
this.version();
|
|
358
78
|
if (!this.editable())
|
|
359
79
|
return false;
|
|
360
|
-
|
|
361
|
-
return editor ? canRunTextEditorCommand(editor, command, attrs) : false;
|
|
80
|
+
return this.core.can(command, attrs);
|
|
362
81
|
}
|
|
363
82
|
preserveSelection() {
|
|
364
|
-
const editor = this.
|
|
83
|
+
const editor = this.core.editor();
|
|
365
84
|
if (!editor)
|
|
366
85
|
return;
|
|
367
86
|
const { from, to } = editor.state.selection;
|
|
@@ -371,11 +90,13 @@ class AXTextEditorService {
|
|
|
371
90
|
this.preservedRange = null;
|
|
372
91
|
}
|
|
373
92
|
run(command, attrs) {
|
|
374
|
-
|
|
375
|
-
|
|
93
|
+
if (!this.editable())
|
|
94
|
+
return false;
|
|
95
|
+
const editor = this.core.editor();
|
|
96
|
+
if (!editor)
|
|
376
97
|
return false;
|
|
377
98
|
this.restorePreservedSelection(editor);
|
|
378
|
-
return
|
|
99
|
+
return this.core.run(command, attrs);
|
|
379
100
|
}
|
|
380
101
|
restorePreservedSelection(editor) {
|
|
381
102
|
const range = this.preservedRange;
|
|
@@ -389,44 +110,46 @@ class AXTextEditorService {
|
|
|
389
110
|
editor.commands.setTextSelection({ from, to });
|
|
390
111
|
}
|
|
391
112
|
getJSON() {
|
|
392
|
-
return this.
|
|
113
|
+
return this.core.getJSON();
|
|
393
114
|
}
|
|
394
115
|
getHTML() {
|
|
395
|
-
return this.
|
|
116
|
+
return this.core.getHTML();
|
|
396
117
|
}
|
|
397
118
|
getText(options) {
|
|
398
|
-
return this.
|
|
119
|
+
return this.core.getText(options);
|
|
399
120
|
}
|
|
400
121
|
setContent(content, emitUpdate = false) {
|
|
401
|
-
|
|
122
|
+
this.core.setContent(content, emitUpdate);
|
|
123
|
+
return true;
|
|
402
124
|
}
|
|
403
125
|
insertContent(value) {
|
|
404
|
-
return this.
|
|
126
|
+
return this.core.insertContent(value);
|
|
405
127
|
}
|
|
406
128
|
clearContent() {
|
|
407
|
-
return this.
|
|
129
|
+
return this.core.clearContent();
|
|
408
130
|
}
|
|
409
131
|
focus() {
|
|
410
|
-
|
|
132
|
+
this.core.focus();
|
|
133
|
+
return true;
|
|
411
134
|
}
|
|
412
135
|
blur() {
|
|
413
|
-
|
|
136
|
+
this.core.blur();
|
|
137
|
+
return true;
|
|
414
138
|
}
|
|
415
139
|
isEmpty() {
|
|
416
|
-
return this.
|
|
140
|
+
return this.core.isEmpty();
|
|
417
141
|
}
|
|
418
142
|
isFocused() {
|
|
419
|
-
return this.
|
|
143
|
+
return this.core.isFocused();
|
|
420
144
|
}
|
|
421
145
|
isEditable() {
|
|
422
|
-
return this.
|
|
146
|
+
return this.core.isEditable();
|
|
423
147
|
}
|
|
424
148
|
setEditable(editable) {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
this.refresh();
|
|
149
|
+
this.core.setEditable(editable);
|
|
150
|
+
}
|
|
151
|
+
destroyEditor() {
|
|
152
|
+
this.core.destroy();
|
|
430
153
|
}
|
|
431
154
|
setZoom(value) {
|
|
432
155
|
if (!Number.isFinite(value))
|
|
@@ -440,7 +163,7 @@ class AXTextEditorService {
|
|
|
440
163
|
this.setZoom(this.zoom() - step);
|
|
441
164
|
}
|
|
442
165
|
fitToPage() {
|
|
443
|
-
const editor = this.
|
|
166
|
+
const editor = this.core.editor();
|
|
444
167
|
if (!editor) {
|
|
445
168
|
this.setZoom(100);
|
|
446
169
|
return;
|
|
@@ -565,10 +288,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImpor
|
|
|
565
288
|
class AXTextEditorContentComponent extends AXTextEditorSlot {
|
|
566
289
|
constructor() {
|
|
567
290
|
super();
|
|
291
|
+
this.textEditor = inject(AXTextEditor);
|
|
568
292
|
this.editorService = inject(AXTextEditorService);
|
|
569
293
|
this.elementRef = inject((ElementRef));
|
|
570
294
|
this.platformId = inject(PLATFORM_ID);
|
|
571
|
-
this.editor = null;
|
|
572
295
|
afterNextRender(() => void this.createEditor());
|
|
573
296
|
effect(() => {
|
|
574
297
|
if (!this.editorService.editor())
|
|
@@ -580,31 +303,25 @@ class AXTextEditorContentComponent extends AXTextEditorSlot {
|
|
|
580
303
|
return this.editorService.getHost();
|
|
581
304
|
}
|
|
582
305
|
ngOnDestroy() {
|
|
583
|
-
this.
|
|
584
|
-
this.editor = null;
|
|
585
|
-
this.editorService.setEditor(null);
|
|
306
|
+
this.editorService.destroyEditor();
|
|
586
307
|
}
|
|
587
308
|
async createEditor() {
|
|
588
|
-
if (!isPlatformBrowser(this.platformId) || this.
|
|
309
|
+
if (!isPlatformBrowser(this.platformId) || this.textEditor.ready())
|
|
589
310
|
return;
|
|
590
311
|
const host = this.host();
|
|
591
312
|
const element = this.elementRef.nativeElement.querySelector('.ax-text-editor-surface');
|
|
592
313
|
if (!host || !element)
|
|
593
314
|
return;
|
|
594
|
-
|
|
595
|
-
import('@tiptap/core'),
|
|
596
|
-
Promise.resolve().then(function () { return textEditor_extensions; }),
|
|
597
|
-
]);
|
|
598
|
-
const extensions = await createTextEditorExtensions(() => this.host()?.placeHolder() ?? '');
|
|
599
|
-
this.editor = new Editor({
|
|
600
|
-
element,
|
|
601
|
-
extensions,
|
|
315
|
+
await this.textEditor.init(element, {
|
|
602
316
|
content: this.toContent(host.value()),
|
|
603
317
|
editable: this.editorService.editable(),
|
|
318
|
+
placeholder: () => this.host()?.placeHolder() ?? '',
|
|
319
|
+
onUpdate: () => this.emitValue(),
|
|
320
|
+
onSelectionUpdate: () => this.editorService.refresh(),
|
|
321
|
+
onTransaction: () => this.editorService.refresh(),
|
|
322
|
+
onFocus: (_, event) => this.host()?.notifyFocus(event),
|
|
323
|
+
onBlur: (_, event) => this.host()?.notifyBlur(event),
|
|
604
324
|
editorProps: {
|
|
605
|
-
attributes: {
|
|
606
|
-
class: 'ax-text-editor-prose',
|
|
607
|
-
},
|
|
608
325
|
handleDOMEvents: {
|
|
609
326
|
mousedown: () => {
|
|
610
327
|
this.editorService.clearPreservedSelection();
|
|
@@ -612,13 +329,7 @@ class AXTextEditorContentComponent extends AXTextEditorSlot {
|
|
|
612
329
|
},
|
|
613
330
|
},
|
|
614
331
|
},
|
|
615
|
-
onUpdate: () => this.emitValue(),
|
|
616
|
-
onSelectionUpdate: () => this.editorService.refresh(),
|
|
617
|
-
onTransaction: () => this.editorService.refresh(),
|
|
618
|
-
onFocus: () => this.host()?.notifyFocus(),
|
|
619
|
-
onBlur: () => this.host()?.notifyBlur(),
|
|
620
332
|
});
|
|
621
|
-
this.editorService.setEditor(this.editor);
|
|
622
333
|
}
|
|
623
334
|
emitValue() {
|
|
624
335
|
const host = this.host();
|
|
@@ -631,9 +342,10 @@ class AXTextEditorContentComponent extends AXTextEditorSlot {
|
|
|
631
342
|
this.editorService.refresh();
|
|
632
343
|
}
|
|
633
344
|
serialize() {
|
|
634
|
-
|
|
345
|
+
const editor = this.textEditor.editor();
|
|
346
|
+
if (!editor || editor.isEmpty)
|
|
635
347
|
return null;
|
|
636
|
-
return this.host()?.outputFormat() === 'html' ?
|
|
348
|
+
return this.host()?.outputFormat() === 'html' ? editor.getHTML() : editor.getJSON();
|
|
637
349
|
}
|
|
638
350
|
toContent(value) {
|
|
639
351
|
if (value == null || value === '')
|
|
@@ -789,6 +501,7 @@ class AXTextEditorComponent extends classes((MXInputBaseValueComponent), MXLookC
|
|
|
789
501
|
}
|
|
790
502
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
791
503
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: AXTextEditorComponent, isStandalone: true, selector: "ax-text-editor", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: false, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: false, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: false, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: false, isRequired: false, transformFunction: null }, placeHolder: { classPropertyName: "placeHolder", publicName: "placeHolder", isSignal: true, isRequired: false, transformFunction: null }, outputFormat: { classPropertyName: "outputFormat", publicName: "outputFormat", isSignal: true, isRequired: false, transformFunction: null }, initialLine: { classPropertyName: "initialLine", publicName: "initialLine", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onBlur: "onBlur", onFocus: "onFocus", valueChange: "valueChange", stateChange: "stateChange", onValueChanged: "onValueChanged", readonlyChange: "readonlyChange", disabledChange: "disabledChange" }, host: { attributes: { "ngSkipHydration": "true" }, properties: { "style.--ax-comp-text-editor-initial-line": "initialLine()", "style.--ax-comp-text-editor-zoom": "zoomFactor()", "class.ax-state-disabled": "disabled", "class.ax-state-readonly": "readonly && !disabled" }, classAttribute: "ax-text-editor" }, providers: [
|
|
504
|
+
AXTextEditor,
|
|
792
505
|
AXTextEditorService,
|
|
793
506
|
{ provide: AXComponent, useExisting: AXTextEditorComponent },
|
|
794
507
|
{ provide: AXFocusableComponent, useExisting: AXTextEditorComponent },
|
|
@@ -818,6 +531,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImpor
|
|
|
818
531
|
class: 'ax-text-editor',
|
|
819
532
|
ngSkipHydration: 'true',
|
|
820
533
|
}, providers: [
|
|
534
|
+
AXTextEditor,
|
|
821
535
|
AXTextEditorService,
|
|
822
536
|
{ provide: AXComponent, useExisting: AXTextEditorComponent },
|
|
823
537
|
{ provide: AXFocusableComponent, useExisting: AXTextEditorComponent },
|
|
@@ -830,315 +544,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImpor
|
|
|
830
544
|
], imports: [AXTextEditorContentComponent], template: "<div class=\"ax-editor-container ax-default {{ look }}\">\n <ng-content></ng-content>\n @if (!projectedContent()) {\n <ax-text-editor-content></ax-text-editor-content>\n }\n <ng-content select=\"ax-validation-rule\"></ng-content>\n</div>\n<div class=\"ax-error-container\"></div>\n", styles: ["@layer components{ax-text-editor{position:relative;display:block;width:100%;max-width:100%;min-width:calc(var(--spacing, .25rem) * 0);overflow:visible;border-radius:var(--ax-sys-border-radius)}ax-text-editor:focus-within{box-shadow:0 0 0 2px var(--ax-sys-color-primary-light, rgb(147 197 253))}ax-text-editor>.ax-editor-container{position:relative;display:flex;max-width:100%;min-width:calc(var(--spacing, .25rem) * 0);flex-direction:column;display:flex!important;flex-direction:column!important;align-items:stretch!important;justify-content:flex-start!important;height:auto!important;min-height:var(--ax-sys-size-default, 2.5rem);padding:0!important;overflow:visible!important}ax-text-editor ax-text-editor-toolbar{width:100%;flex-shrink:0}ax-text-editor ax-text-editor-content{min-width:calc(var(--spacing, .25rem) * 0);flex:1;overflow:auto}ax-text-editor:has(ax-text-editor-toolbar.ax-orientation-vertical)>.ax-editor-container{flex-direction:row!important;align-items:stretch!important}ax-text-editor:has(ax-text-editor-toolbar.ax-orientation-vertical) ax-text-editor-toolbar.ax-orientation-vertical{width:auto;max-width:none;flex-shrink:0;align-self:flex-start;overflow:hidden;max-height:var( --ax-comp-text-editor-min-height, calc(var(--ax-comp-text-editor-initial-line, 6) * 1.5em + 1.5rem) )}:dir(rtl) ax-text-editor:has(ax-text-editor-toolbar.ax-orientation-vertical)>.ax-editor-container{flex-direction:row-reverse!important}:is(ax-text-editor.ax-state-disabled,ax-text-editor.ax-state-readonly) ax-text-editor-toolbar{pointer-events:none;opacity:60%}ax-text-editor.ax-state-readonly:not(.ax-state-disabled) ax-text-editor-content{cursor:default}ax-text-editor.ax-state-disabled{cursor:not-allowed}ax-text-editor.ax-state-disabled ax-text-editor-content{pointer-events:none;cursor:not-allowed;opacity:60%}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
831
545
|
}], ctorParameters: () => [], propDecorators: { projected: [{ type: i0.ContentChild, args: [i0.forwardRef(() => AXTextEditorContentComponent), { isSignal: true }] }], placeHolder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeHolder", required: false }] }], outputFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "outputFormat", required: false }] }], initialLine: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialLine", required: false }] }] } });
|
|
832
546
|
|
|
833
|
-
function createSuperscript(core) {
|
|
834
|
-
return core.Mark.create({
|
|
835
|
-
name: 'superscript',
|
|
836
|
-
excludes: 'subscript',
|
|
837
|
-
parseHTML() {
|
|
838
|
-
return [{ tag: 'sup' }];
|
|
839
|
-
},
|
|
840
|
-
renderHTML({ HTMLAttributes }) {
|
|
841
|
-
return ['sup', core.mergeAttributes(HTMLAttributes), 0];
|
|
842
|
-
},
|
|
843
|
-
addCommands() {
|
|
844
|
-
return {
|
|
845
|
-
toggleSuperscript: () => ({ commands }) => commands.toggleMark(this.name),
|
|
846
|
-
};
|
|
847
|
-
},
|
|
848
|
-
});
|
|
849
|
-
}
|
|
850
|
-
function createSubscript(core) {
|
|
851
|
-
return core.Mark.create({
|
|
852
|
-
name: 'subscript',
|
|
853
|
-
excludes: 'superscript',
|
|
854
|
-
parseHTML() {
|
|
855
|
-
return [{ tag: 'sub' }];
|
|
856
|
-
},
|
|
857
|
-
renderHTML({ HTMLAttributes }) {
|
|
858
|
-
return ['sub', core.mergeAttributes(HTMLAttributes), 0];
|
|
859
|
-
},
|
|
860
|
-
addCommands() {
|
|
861
|
-
return {
|
|
862
|
-
toggleSubscript: () => ({ commands }) => commands.toggleMark(this.name),
|
|
863
|
-
};
|
|
864
|
-
},
|
|
865
|
-
});
|
|
866
|
-
}
|
|
867
|
-
function createKeepSelection(core, pmState, pmView) {
|
|
868
|
-
const keepSelectionKey = new pmState.PluginKey('axKeepSelection');
|
|
869
|
-
return core.Extension.create({
|
|
870
|
-
name: 'keepSelection',
|
|
871
|
-
addProseMirrorPlugins() {
|
|
872
|
-
return [
|
|
873
|
-
new pmState.Plugin({
|
|
874
|
-
key: keepSelectionKey,
|
|
875
|
-
state: {
|
|
876
|
-
init() {
|
|
877
|
-
return pmView.DecorationSet.empty;
|
|
878
|
-
},
|
|
879
|
-
apply(tr, set) {
|
|
880
|
-
const meta = tr.getMeta(keepSelectionKey);
|
|
881
|
-
if (meta === 'clear')
|
|
882
|
-
return pmView.DecorationSet.empty;
|
|
883
|
-
if (meta && meta.from !== meta.to) {
|
|
884
|
-
return pmView.DecorationSet.create(tr.doc, [
|
|
885
|
-
pmView.Decoration.inline(meta.from, meta.to, { class: 'ax-text-editor-kept-selection' }),
|
|
886
|
-
]);
|
|
887
|
-
}
|
|
888
|
-
return set.map(tr.mapping, tr.doc);
|
|
889
|
-
},
|
|
890
|
-
},
|
|
891
|
-
props: {
|
|
892
|
-
decorations(state) {
|
|
893
|
-
return keepSelectionKey.getState(state);
|
|
894
|
-
},
|
|
895
|
-
handleDOMEvents: {
|
|
896
|
-
blur(view) {
|
|
897
|
-
const { from, to } = view.state.selection;
|
|
898
|
-
if (from !== to) {
|
|
899
|
-
view.dispatch(view.state.tr.setMeta(keepSelectionKey, { from, to }));
|
|
900
|
-
}
|
|
901
|
-
return false;
|
|
902
|
-
},
|
|
903
|
-
focus(view) {
|
|
904
|
-
const decorations = keepSelectionKey.getState(view.state);
|
|
905
|
-
if (decorations?.find().length) {
|
|
906
|
-
view.dispatch(view.state.tr.setMeta(keepSelectionKey, 'clear'));
|
|
907
|
-
}
|
|
908
|
-
return false;
|
|
909
|
-
},
|
|
910
|
-
},
|
|
911
|
-
},
|
|
912
|
-
}),
|
|
913
|
-
];
|
|
914
|
-
},
|
|
915
|
-
});
|
|
916
|
-
}
|
|
917
|
-
function createTextDirection(core) {
|
|
918
|
-
return core.Extension.create({
|
|
919
|
-
name: 'textDirection',
|
|
920
|
-
addGlobalAttributes() {
|
|
921
|
-
return [
|
|
922
|
-
{
|
|
923
|
-
types: ['paragraph', 'heading'],
|
|
924
|
-
attributes: {
|
|
925
|
-
dir: {
|
|
926
|
-
default: null,
|
|
927
|
-
parseHTML: (element) => element.getAttribute('dir'),
|
|
928
|
-
renderHTML: (attributes) => (attributes['dir'] ? { dir: attributes['dir'] } : {}),
|
|
929
|
-
},
|
|
930
|
-
},
|
|
931
|
-
},
|
|
932
|
-
];
|
|
933
|
-
},
|
|
934
|
-
});
|
|
935
|
-
}
|
|
936
|
-
function createFontSize(core) {
|
|
937
|
-
return core.Extension.create({
|
|
938
|
-
name: 'axTextEditorFontSize',
|
|
939
|
-
addGlobalAttributes() {
|
|
940
|
-
return [
|
|
941
|
-
{
|
|
942
|
-
types: ['textStyle'],
|
|
943
|
-
attributes: {
|
|
944
|
-
fontSize: {
|
|
945
|
-
default: null,
|
|
946
|
-
parseHTML: (element) => element.style.fontSize?.replace(/['"]+/g, '') || null,
|
|
947
|
-
renderHTML: (attributes) => attributes['fontSize'] ? { style: `font-size: ${attributes['fontSize']}` } : {},
|
|
948
|
-
},
|
|
949
|
-
},
|
|
950
|
-
},
|
|
951
|
-
];
|
|
952
|
-
},
|
|
953
|
-
addCommands() {
|
|
954
|
-
return {
|
|
955
|
-
setFontSize: (size) => ({ chain }) => {
|
|
956
|
-
if (!size) {
|
|
957
|
-
return chain().focus().setMark('textStyle', { fontSize: null }).removeEmptyTextStyle().run();
|
|
958
|
-
}
|
|
959
|
-
return chain().focus().setMark('textStyle', { fontSize: size }).run();
|
|
960
|
-
},
|
|
961
|
-
};
|
|
962
|
-
},
|
|
963
|
-
});
|
|
964
|
-
}
|
|
965
|
-
function createVideo(core) {
|
|
966
|
-
return core.Node.create({
|
|
967
|
-
name: 'video',
|
|
968
|
-
group: 'block',
|
|
969
|
-
atom: true,
|
|
970
|
-
addOptions() {
|
|
971
|
-
return {
|
|
972
|
-
HTMLAttributes: {},
|
|
973
|
-
};
|
|
974
|
-
},
|
|
975
|
-
addAttributes() {
|
|
976
|
-
return {
|
|
977
|
-
src: {
|
|
978
|
-
default: null,
|
|
979
|
-
},
|
|
980
|
-
};
|
|
981
|
-
},
|
|
982
|
-
parseHTML() {
|
|
983
|
-
return [
|
|
984
|
-
{ tag: 'video[src]' },
|
|
985
|
-
{ tag: 'div[data-text-editor-video] video' },
|
|
986
|
-
{ tag: 'div[data-wysiwyg-video] iframe' },
|
|
987
|
-
{ tag: 'iframe[src]' },
|
|
988
|
-
];
|
|
989
|
-
},
|
|
990
|
-
renderHTML({ HTMLAttributes }) {
|
|
991
|
-
const src = String(HTMLAttributes['src'] ?? '');
|
|
992
|
-
if (isEmbedSrc(src)) {
|
|
993
|
-
return [
|
|
994
|
-
'div',
|
|
995
|
-
core.mergeAttributes(this.options.HTMLAttributes, { 'data-text-editor-video': '' }),
|
|
996
|
-
[
|
|
997
|
-
'iframe',
|
|
998
|
-
core.mergeAttributes({
|
|
999
|
-
src,
|
|
1000
|
-
frameborder: '0',
|
|
1001
|
-
allowfullscreen: 'true',
|
|
1002
|
-
allow: 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture',
|
|
1003
|
-
}),
|
|
1004
|
-
],
|
|
1005
|
-
];
|
|
1006
|
-
}
|
|
1007
|
-
return [
|
|
1008
|
-
'video',
|
|
1009
|
-
core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
|
|
1010
|
-
class: 'ax-text-editor-video',
|
|
1011
|
-
controls: 'true',
|
|
1012
|
-
}),
|
|
1013
|
-
];
|
|
1014
|
-
},
|
|
1015
|
-
addCommands() {
|
|
1016
|
-
return {
|
|
1017
|
-
setVideo: ({ src }) => ({ commands }) => commands.insertContent({
|
|
1018
|
-
type: this.name,
|
|
1019
|
-
attrs: { src: toVideoSrc(src) },
|
|
1020
|
-
}),
|
|
1021
|
-
};
|
|
1022
|
-
},
|
|
1023
|
-
});
|
|
1024
|
-
}
|
|
1025
|
-
function isEmbedSrc(src) {
|
|
1026
|
-
return /youtube\.com\/embed\/|youtu\.be\//i.test(src);
|
|
1027
|
-
}
|
|
1028
|
-
function toVideoSrc(src) {
|
|
1029
|
-
const trimmed = src.trim();
|
|
1030
|
-
if (!trimmed)
|
|
1031
|
-
return trimmed;
|
|
1032
|
-
try {
|
|
1033
|
-
const url = new URL(trimmed);
|
|
1034
|
-
if (url.hostname.includes('youtube.com') && url.searchParams.get('v')) {
|
|
1035
|
-
return `https://www.youtube.com/embed/${url.searchParams.get('v')}`;
|
|
1036
|
-
}
|
|
1037
|
-
if (url.hostname === 'youtu.be') {
|
|
1038
|
-
return `https://www.youtube.com/embed/${url.pathname.slice(1)}`;
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
catch {
|
|
1042
|
-
return trimmed;
|
|
1043
|
-
}
|
|
1044
|
-
return trimmed;
|
|
1045
|
-
}
|
|
1046
|
-
async function createTextEditorExtensions(placeholder = '') {
|
|
1047
|
-
const placeholderFn = typeof placeholder === 'function' ? placeholder : () => placeholder;
|
|
1048
|
-
const [core, pmState, pmView, starterKitMod, textStyleMod, highlightMod, textAlignMod, extensionsMod, tableMod, imageMod] = await Promise.all([
|
|
1049
|
-
import('@tiptap/core'),
|
|
1050
|
-
import('@tiptap/pm/state'),
|
|
1051
|
-
import('@tiptap/pm/view'),
|
|
1052
|
-
import('@tiptap/starter-kit'),
|
|
1053
|
-
import('@tiptap/extension-text-style'),
|
|
1054
|
-
import('@tiptap/extension-highlight'),
|
|
1055
|
-
import('@tiptap/extension-text-align'),
|
|
1056
|
-
import('@tiptap/extensions'),
|
|
1057
|
-
import('@tiptap/extension-table/kit'),
|
|
1058
|
-
import('@tiptap/extension-image'),
|
|
1059
|
-
]);
|
|
1060
|
-
const Image = imageMod.default ?? imageMod.Image;
|
|
1061
|
-
return [
|
|
1062
|
-
starterKitMod.StarterKit.configure({
|
|
1063
|
-
heading: {
|
|
1064
|
-
levels: [1, 2, 3],
|
|
1065
|
-
HTMLAttributes: {
|
|
1066
|
-
class: 'ax-text-editor-heading',
|
|
1067
|
-
},
|
|
1068
|
-
},
|
|
1069
|
-
link: {
|
|
1070
|
-
openOnClick: false,
|
|
1071
|
-
HTMLAttributes: {
|
|
1072
|
-
class: 'ax-text-editor-link',
|
|
1073
|
-
},
|
|
1074
|
-
},
|
|
1075
|
-
code: {
|
|
1076
|
-
HTMLAttributes: {
|
|
1077
|
-
class: 'ax-text-editor-code',
|
|
1078
|
-
},
|
|
1079
|
-
},
|
|
1080
|
-
codeBlock: {
|
|
1081
|
-
HTMLAttributes: {
|
|
1082
|
-
class: 'ax-text-editor-code-block',
|
|
1083
|
-
},
|
|
1084
|
-
},
|
|
1085
|
-
bulletList: {
|
|
1086
|
-
HTMLAttributes: {
|
|
1087
|
-
class: 'ax-text-editor-bullet-list',
|
|
1088
|
-
},
|
|
1089
|
-
},
|
|
1090
|
-
orderedList: {
|
|
1091
|
-
HTMLAttributes: {
|
|
1092
|
-
class: 'ax-text-editor-ordered-list',
|
|
1093
|
-
},
|
|
1094
|
-
},
|
|
1095
|
-
listItem: {
|
|
1096
|
-
HTMLAttributes: {
|
|
1097
|
-
class: 'ax-text-editor-list-item',
|
|
1098
|
-
},
|
|
1099
|
-
},
|
|
1100
|
-
}),
|
|
1101
|
-
createSuperscript(core),
|
|
1102
|
-
createSubscript(core),
|
|
1103
|
-
textStyleMod.TextStyle,
|
|
1104
|
-
textStyleMod.Color,
|
|
1105
|
-
createFontSize(core),
|
|
1106
|
-
highlightMod.Highlight.configure({ multicolor: true }),
|
|
1107
|
-
textAlignMod.TextAlign.configure({
|
|
1108
|
-
types: ['heading', 'paragraph'],
|
|
1109
|
-
}),
|
|
1110
|
-
createTextDirection(core),
|
|
1111
|
-
createKeepSelection(core, pmState, pmView),
|
|
1112
|
-
tableMod.TableKit.configure({
|
|
1113
|
-
table: {
|
|
1114
|
-
resizable: true,
|
|
1115
|
-
lastColumnResizable: true,
|
|
1116
|
-
cellMinWidth: 64,
|
|
1117
|
-
HTMLAttributes: {
|
|
1118
|
-
class: 'ax-text-editor-table',
|
|
1119
|
-
},
|
|
1120
|
-
},
|
|
1121
|
-
}),
|
|
1122
|
-
Image.configure({
|
|
1123
|
-
inline: true,
|
|
1124
|
-
allowBase64: true,
|
|
1125
|
-
HTMLAttributes: {
|
|
1126
|
-
class: 'ax-text-editor-image',
|
|
1127
|
-
},
|
|
1128
|
-
}),
|
|
1129
|
-
createVideo(core),
|
|
1130
|
-
extensionsMod.Placeholder.configure({
|
|
1131
|
-
placeholder: placeholderFn,
|
|
1132
|
-
showOnlyCurrent: true,
|
|
1133
|
-
}),
|
|
1134
|
-
];
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
var textEditor_extensions = /*#__PURE__*/Object.freeze({
|
|
1138
|
-
__proto__: null,
|
|
1139
|
-
createTextEditorExtensions: createTextEditorExtensions
|
|
1140
|
-
});
|
|
1141
|
-
|
|
1142
547
|
class AXTextEditorToolbarComponent extends AXTextEditorSlot {
|
|
1143
548
|
constructor() {
|
|
1144
549
|
super(...arguments);
|
|
@@ -2495,5 +1900,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImpor
|
|
|
2495
1900
|
* Generated bundle index. Do not edit.
|
|
2496
1901
|
*/
|
|
2497
1902
|
|
|
2498
|
-
export { AXTextEditorAlignmentComponent, AXTextEditorBlocksComponent, AXTextEditorColorSwatchesComponent, AXTextEditorColorsComponent, AXTextEditorCommandComponent, AXTextEditorComponent, AXTextEditorContentComponent, AXTextEditorFontSizeComponent, AXTextEditorFontStyleComponent, AXTextEditorHeadingComponent, AXTextEditorHistoryComponent, AXTextEditorLinkComponent, AXTextEditorListComponent, AXTextEditorMediaComponent, AXTextEditorModule, AXTextEditorScriptComponent, AXTextEditorService, AXTextEditorSlot, AXTextEditorTableComponent, AXTextEditorToolbarComponent, AXTextEditorZoomComponent,
|
|
1903
|
+
export { AXTextEditorAlignmentComponent, AXTextEditorBlocksComponent, AXTextEditorColorSwatchesComponent, AXTextEditorColorsComponent, AXTextEditorCommandComponent, AXTextEditorComponent, AXTextEditorContentComponent, AXTextEditorFontSizeComponent, AXTextEditorFontStyleComponent, AXTextEditorHeadingComponent, AXTextEditorHistoryComponent, AXTextEditorLinkComponent, AXTextEditorListComponent, AXTextEditorMediaComponent, AXTextEditorModule, AXTextEditorScriptComponent, AXTextEditorService, AXTextEditorSlot, AXTextEditorTableComponent, AXTextEditorToolbarComponent, AXTextEditorZoomComponent, AX_TEXT_EDITOR_I18N };
|
|
2499
1904
|
//# sourceMappingURL=acorex-components-text-editor.mjs.map
|