@acorex/components 22.4.2 → 22.4.4
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-calendar.mjs +2 -2
- package/fesm2022/acorex-components-calendar.mjs.map +1 -1
- package/fesm2022/acorex-components-data-table.mjs +2 -2
- package/fesm2022/acorex-components-data-table.mjs.map +1 -1
- package/fesm2022/acorex-components-datetime-picker.mjs +2 -2
- package/fesm2022/acorex-components-datetime-picker.mjs.map +1 -1
- package/fesm2022/acorex-components-drawer.mjs +2 -2
- package/fesm2022/acorex-components-drawer.mjs.map +1 -1
- package/fesm2022/acorex-components-dropdown-button.mjs +16 -11
- package/fesm2022/acorex-components-dropdown-button.mjs.map +1 -1
- package/fesm2022/acorex-components-text-editor.mjs +1988 -0
- package/fesm2022/acorex-components-text-editor.mjs.map +1 -0
- package/package.json +9 -3
- package/text-editor/README.md +3 -0
- package/types/acorex-components-dropdown-button.d.ts +7 -2
- package/types/acorex-components-text-editor.d.ts +296 -0
|
@@ -0,0 +1,1988 @@
|
|
|
1
|
+
import { AXComponent, MXInputBaseValueComponent, MXLookComponent, AXFocusableComponent, AXValuableComponent } from '@acorex/cdk/common';
|
|
2
|
+
import { AXButtonComponent, AXButtonItemListComponent, AXButtonItemComponent } from '@acorex/components/button';
|
|
3
|
+
import { AXDecoratorIconComponent, AXDecoratorGenericComponent } from '@acorex/components/decorators';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { signal, computed, Injectable, inject, input, ViewEncapsulation, ChangeDetectionStrategy, Component, ElementRef, PLATFORM_ID, afterNextRender, effect, DestroyRef, contentChild, forwardRef, model, viewChild, NgModule } from '@angular/core';
|
|
6
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
7
|
+
import { Mark, mergeAttributes, Extension, Editor } from '@tiptap/core';
|
|
8
|
+
import { isEqual } from 'lodash-es';
|
|
9
|
+
import { Highlight } from '@tiptap/extension-highlight';
|
|
10
|
+
import { TableKit } from '@tiptap/extension-table/kit';
|
|
11
|
+
import { TextAlign } from '@tiptap/extension-text-align';
|
|
12
|
+
import { TextStyle, Color } from '@tiptap/extension-text-style';
|
|
13
|
+
import { Placeholder } from '@tiptap/extensions';
|
|
14
|
+
import { StarterKit } from '@tiptap/starter-kit';
|
|
15
|
+
import { PluginKey, Plugin } from '@tiptap/pm/state';
|
|
16
|
+
import { DecorationSet, Decoration } from '@tiptap/pm/view';
|
|
17
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
18
|
+
import * as i1 from '@angular/forms';
|
|
19
|
+
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
20
|
+
import { classes } from 'polytype';
|
|
21
|
+
import { AXHorizontalScrollDirective } from '@acorex/cdk/horizontal-scroll';
|
|
22
|
+
import { AXDropdownButtonComponent } from '@acorex/components/dropdown-button';
|
|
23
|
+
import { AXBadgeComponent } from '@acorex/components/badge';
|
|
24
|
+
import { AXColorPaletteComponent, AXColorPalettePickerComponent, AXColorPaletteSwatchesComponent, AXColorPaletteInputComponent } from '@acorex/components/color-palette';
|
|
25
|
+
|
|
26
|
+
const AX_TEXT_EDITOR_ZOOM_PRESETS = [40, 50, 75, 90, 100, 125, 150, 175, 200];
|
|
27
|
+
const AX_TEXT_EDITOR_ZOOM_MIN = 40;
|
|
28
|
+
const AX_TEXT_EDITOR_ZOOM_MAX = 200;
|
|
29
|
+
const AX_TEXT_EDITOR_DEFAULT_TEXT_COLORS = [
|
|
30
|
+
'#f59e0b',
|
|
31
|
+
'#eab308',
|
|
32
|
+
'#22c55e',
|
|
33
|
+
'#06b6d4',
|
|
34
|
+
'#3b82f6',
|
|
35
|
+
'#a855f7',
|
|
36
|
+
'#ec4899',
|
|
37
|
+
'#ef4444',
|
|
38
|
+
];
|
|
39
|
+
const AX_TEXT_EDITOR_DEFAULT_BACKGROUND_COLORS = [
|
|
40
|
+
'#ffffff',
|
|
41
|
+
'#f5e6c8',
|
|
42
|
+
'#fde68a',
|
|
43
|
+
'#f9a8d4',
|
|
44
|
+
'#bbf7d0',
|
|
45
|
+
'#ddd6fe',
|
|
46
|
+
'#fbcfe8',
|
|
47
|
+
'#fdba74',
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
function escapeHtml(value) {
|
|
51
|
+
return value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"');
|
|
52
|
+
}
|
|
53
|
+
function normalizeHref(value) {
|
|
54
|
+
const href = value.trim();
|
|
55
|
+
if (!href)
|
|
56
|
+
return '';
|
|
57
|
+
if (/^(https?:|mailto:|tel:|#|\/)/i.test(href))
|
|
58
|
+
return href;
|
|
59
|
+
return `https://${href}`;
|
|
60
|
+
}
|
|
61
|
+
function headingLevel(attrs) {
|
|
62
|
+
const level = Number(attrs?.['level']);
|
|
63
|
+
return level === 1 || level === 2 || level === 3 ? level : undefined;
|
|
64
|
+
}
|
|
65
|
+
function isTextEditorCommandActive(editor, command, attrs) {
|
|
66
|
+
switch (command) {
|
|
67
|
+
case 'heading': {
|
|
68
|
+
const level = headingLevel(attrs);
|
|
69
|
+
return level ? editor.isActive('heading', { level }) : editor.isActive('heading');
|
|
70
|
+
}
|
|
71
|
+
case 'paragraph':
|
|
72
|
+
return editor.isActive('paragraph');
|
|
73
|
+
case 'align':
|
|
74
|
+
return editor.isActive({ textAlign: attrs?.['align'] });
|
|
75
|
+
case 'direction':
|
|
76
|
+
return editor.isActive({ dir: attrs?.['direction'] });
|
|
77
|
+
case 'link':
|
|
78
|
+
return editor.isActive('link');
|
|
79
|
+
case 'insertTable':
|
|
80
|
+
return editor.isActive('table');
|
|
81
|
+
case 'unlink':
|
|
82
|
+
case 'color':
|
|
83
|
+
case 'highlight':
|
|
84
|
+
case 'undo':
|
|
85
|
+
case 'redo':
|
|
86
|
+
case 'horizontalRule':
|
|
87
|
+
return false;
|
|
88
|
+
default:
|
|
89
|
+
return editor.isActive(command);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function canRunTextEditorCommand(editor, command, attrs) {
|
|
93
|
+
switch (command) {
|
|
94
|
+
case 'undo':
|
|
95
|
+
return editor.can().undo();
|
|
96
|
+
case 'redo':
|
|
97
|
+
return editor.can().redo();
|
|
98
|
+
case 'heading': {
|
|
99
|
+
const level = headingLevel(attrs);
|
|
100
|
+
return level ? editor.can().setHeading({ level }) : editor.can().setParagraph();
|
|
101
|
+
}
|
|
102
|
+
case 'paragraph':
|
|
103
|
+
return editor.can().setParagraph();
|
|
104
|
+
case 'align':
|
|
105
|
+
return editor.can().setTextAlign(String(attrs?.['align'] ?? 'left'));
|
|
106
|
+
case 'direction':
|
|
107
|
+
return true;
|
|
108
|
+
case 'color':
|
|
109
|
+
return attrs?.['color'] ? editor.can().setColor(String(attrs['color'])) : editor.can().unsetColor();
|
|
110
|
+
case 'highlight':
|
|
111
|
+
return attrs?.['color']
|
|
112
|
+
? editor.can().setHighlight({ color: String(attrs['color']) })
|
|
113
|
+
: editor.can().unsetHighlight();
|
|
114
|
+
case 'link':
|
|
115
|
+
return editor.isEditable;
|
|
116
|
+
case 'unlink':
|
|
117
|
+
return editor.isEditable && editor.can().unsetLink();
|
|
118
|
+
case 'insertTable':
|
|
119
|
+
return editor.can().insertTable({
|
|
120
|
+
rows: Number(attrs?.['rows'] ?? 3),
|
|
121
|
+
cols: Number(attrs?.['cols'] ?? 3),
|
|
122
|
+
withHeaderRow: Boolean(attrs?.['withHeaderRow'] ?? false),
|
|
123
|
+
});
|
|
124
|
+
case 'addColumnBefore':
|
|
125
|
+
return editor.can().addColumnBefore();
|
|
126
|
+
case 'addColumnAfter':
|
|
127
|
+
return editor.can().addColumnAfter();
|
|
128
|
+
case 'deleteColumn':
|
|
129
|
+
return editor.can().deleteColumn();
|
|
130
|
+
case 'addRowBefore':
|
|
131
|
+
return editor.can().addRowBefore();
|
|
132
|
+
case 'addRowAfter':
|
|
133
|
+
return editor.can().addRowAfter();
|
|
134
|
+
case 'deleteRow':
|
|
135
|
+
return editor.can().deleteRow();
|
|
136
|
+
case 'toggleHeaderRow':
|
|
137
|
+
return editor.can().toggleHeaderRow();
|
|
138
|
+
case 'deleteTable':
|
|
139
|
+
return editor.can().deleteTable();
|
|
140
|
+
case 'blockquote':
|
|
141
|
+
return editor.can().toggleBlockquote();
|
|
142
|
+
case 'code':
|
|
143
|
+
return editor.can().toggleCode();
|
|
144
|
+
case 'codeBlock':
|
|
145
|
+
return editor.can().toggleCodeBlock();
|
|
146
|
+
case 'horizontalRule':
|
|
147
|
+
return editor.can().setHorizontalRule();
|
|
148
|
+
case 'bulletList':
|
|
149
|
+
return editor.isEditable && Boolean(editor.schema.nodes['bulletList']);
|
|
150
|
+
case 'orderedList':
|
|
151
|
+
return editor.isEditable && Boolean(editor.schema.nodes['orderedList']);
|
|
152
|
+
case 'superscript':
|
|
153
|
+
return editor.can().toggleSuperscript();
|
|
154
|
+
case 'subscript':
|
|
155
|
+
return editor.can().toggleSubscript();
|
|
156
|
+
case 'bold':
|
|
157
|
+
return editor.can().toggleBold();
|
|
158
|
+
case 'italic':
|
|
159
|
+
return editor.can().toggleItalic();
|
|
160
|
+
case 'underline':
|
|
161
|
+
return editor.can().toggleUnderline();
|
|
162
|
+
case 'strike':
|
|
163
|
+
return editor.can().toggleStrike();
|
|
164
|
+
default:
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function runTextEditorCommand(editor, command, attrs) {
|
|
169
|
+
const chain = editor.chain().focus();
|
|
170
|
+
switch (command) {
|
|
171
|
+
case 'undo':
|
|
172
|
+
return chain.undo().run();
|
|
173
|
+
case 'redo':
|
|
174
|
+
return chain.redo().run();
|
|
175
|
+
case 'heading': {
|
|
176
|
+
const level = headingLevel(attrs);
|
|
177
|
+
return level ? chain.setHeading({ level }).run() : chain.setParagraph().run();
|
|
178
|
+
}
|
|
179
|
+
case 'paragraph':
|
|
180
|
+
return chain.setParagraph().run();
|
|
181
|
+
case 'align':
|
|
182
|
+
return chain.setTextAlign(String(attrs?.['align'] ?? 'left')).run();
|
|
183
|
+
case 'direction': {
|
|
184
|
+
const direction = attrs?.['direction'] === 'rtl' ? 'rtl' : 'ltr';
|
|
185
|
+
return chain
|
|
186
|
+
.updateAttributes('paragraph', { dir: direction })
|
|
187
|
+
.updateAttributes('heading', { dir: direction })
|
|
188
|
+
.run();
|
|
189
|
+
}
|
|
190
|
+
case 'color':
|
|
191
|
+
return attrs?.['color'] ? chain.setColor(String(attrs['color'])).run() : chain.unsetColor().run();
|
|
192
|
+
case 'highlight':
|
|
193
|
+
return attrs?.['color']
|
|
194
|
+
? chain.setHighlight({ color: String(attrs['color']) }).run()
|
|
195
|
+
: chain.unsetHighlight().run();
|
|
196
|
+
case 'link': {
|
|
197
|
+
const href = normalizeHref(String(attrs?.['href'] ?? ''));
|
|
198
|
+
if (!href) {
|
|
199
|
+
return chain.extendMarkRange('link').unsetLink().run();
|
|
200
|
+
}
|
|
201
|
+
if (editor.state.selection.empty) {
|
|
202
|
+
const safeHref = escapeHtml(href);
|
|
203
|
+
return chain.insertContent(`<a href="${safeHref}">${safeHref}</a>`).run();
|
|
204
|
+
}
|
|
205
|
+
return chain.extendMarkRange('link').setLink({ href }).run();
|
|
206
|
+
}
|
|
207
|
+
case 'unlink':
|
|
208
|
+
return chain.extendMarkRange('link').unsetLink().run();
|
|
209
|
+
case 'insertTable':
|
|
210
|
+
return chain
|
|
211
|
+
.insertTable({
|
|
212
|
+
rows: Number(attrs?.['rows'] ?? 3),
|
|
213
|
+
cols: Number(attrs?.['cols'] ?? 3),
|
|
214
|
+
withHeaderRow: Boolean(attrs?.['withHeaderRow'] ?? false),
|
|
215
|
+
})
|
|
216
|
+
.run();
|
|
217
|
+
case 'addColumnBefore':
|
|
218
|
+
return chain.addColumnBefore().run();
|
|
219
|
+
case 'addColumnAfter':
|
|
220
|
+
return chain.addColumnAfter().run();
|
|
221
|
+
case 'deleteColumn':
|
|
222
|
+
return chain.deleteColumn().run();
|
|
223
|
+
case 'addRowBefore':
|
|
224
|
+
return chain.addRowBefore().run();
|
|
225
|
+
case 'addRowAfter':
|
|
226
|
+
return chain.addRowAfter().run();
|
|
227
|
+
case 'deleteRow':
|
|
228
|
+
return chain.deleteRow().run();
|
|
229
|
+
case 'toggleHeaderRow':
|
|
230
|
+
return chain.toggleHeaderRow().run();
|
|
231
|
+
case 'deleteTable':
|
|
232
|
+
return chain.deleteTable().run();
|
|
233
|
+
case 'blockquote':
|
|
234
|
+
return chain.toggleBlockquote().run();
|
|
235
|
+
case 'code':
|
|
236
|
+
return chain.toggleCode().run();
|
|
237
|
+
case 'codeBlock':
|
|
238
|
+
return chain.toggleCodeBlock().run();
|
|
239
|
+
case 'horizontalRule':
|
|
240
|
+
return chain.setHorizontalRule().run();
|
|
241
|
+
case 'bulletList':
|
|
242
|
+
return chain.toggleBulletList().run();
|
|
243
|
+
case 'orderedList':
|
|
244
|
+
return chain.toggleOrderedList().run();
|
|
245
|
+
case 'superscript':
|
|
246
|
+
return chain.toggleSuperscript().run();
|
|
247
|
+
case 'subscript':
|
|
248
|
+
return chain.toggleSubscript().run();
|
|
249
|
+
case 'bold':
|
|
250
|
+
return chain.toggleBold().run();
|
|
251
|
+
case 'italic':
|
|
252
|
+
return chain.toggleItalic().run();
|
|
253
|
+
case 'underline':
|
|
254
|
+
return chain.toggleUnderline().run();
|
|
255
|
+
case 'strike':
|
|
256
|
+
return chain.toggleStrike().run();
|
|
257
|
+
default:
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Per-editor Tiptap facade. Provided on `ax-text-editor`, so projected tools and
|
|
264
|
+
* custom toolbar children can `inject(AXTextEditorService)` and use either the
|
|
265
|
+
* named-command helpers or the full Tiptap instance.
|
|
266
|
+
*/
|
|
267
|
+
class AXTextEditorService {
|
|
268
|
+
constructor() {
|
|
269
|
+
this._editor = signal(null, /* @ts-ignore */
|
|
270
|
+
...(ngDevMode ? [{ debugName: "_editor" }] : /* istanbul ignore next */ []));
|
|
271
|
+
this.host = null;
|
|
272
|
+
this.preservedRange = null;
|
|
273
|
+
this.editor = this._editor.asReadonly();
|
|
274
|
+
this.version = signal(0, /* @ts-ignore */
|
|
275
|
+
...(ngDevMode ? [{ debugName: "version" }] : /* istanbul ignore next */ []));
|
|
276
|
+
this.disabled = signal(false, /* @ts-ignore */
|
|
277
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
278
|
+
this.readonly = signal(false, /* @ts-ignore */
|
|
279
|
+
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
280
|
+
this.editable = computed(() => !this.disabled() && !this.readonly(), /* @ts-ignore */
|
|
281
|
+
...(ngDevMode ? [{ debugName: "editable" }] : /* istanbul ignore next */ []));
|
|
282
|
+
this.textColor = signal(null, /* @ts-ignore */
|
|
283
|
+
...(ngDevMode ? [{ debugName: "textColor" }] : /* istanbul ignore next */ []));
|
|
284
|
+
this.highlightColor = signal(null, /* @ts-ignore */
|
|
285
|
+
...(ngDevMode ? [{ debugName: "highlightColor" }] : /* istanbul ignore next */ []));
|
|
286
|
+
this.zoom = signal(100, /* @ts-ignore */
|
|
287
|
+
...(ngDevMode ? [{ debugName: "zoom" }] : /* istanbul ignore next */ []));
|
|
288
|
+
this.zoomFactor = computed(() => this.zoom() / 100, /* @ts-ignore */
|
|
289
|
+
...(ngDevMode ? [{ debugName: "zoomFactor" }] : /* istanbul ignore next */ []));
|
|
290
|
+
}
|
|
291
|
+
bindHost(host) {
|
|
292
|
+
this.host = host;
|
|
293
|
+
this.syncHostState();
|
|
294
|
+
}
|
|
295
|
+
syncHostState() {
|
|
296
|
+
this.disabled.set(Boolean(this.host?.disabled()));
|
|
297
|
+
this.readonly.set(Boolean(this.host?.readonly()));
|
|
298
|
+
this.setEditable(this.editable());
|
|
299
|
+
}
|
|
300
|
+
getHost() {
|
|
301
|
+
return this.host;
|
|
302
|
+
}
|
|
303
|
+
setEditor(editor) {
|
|
304
|
+
this._editor.set(editor);
|
|
305
|
+
this.refresh();
|
|
306
|
+
}
|
|
307
|
+
refresh() {
|
|
308
|
+
this.version.update((value) => value + 1);
|
|
309
|
+
const editor = this._editor();
|
|
310
|
+
if (!editor) {
|
|
311
|
+
this.textColor.set(null);
|
|
312
|
+
this.highlightColor.set(null);
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
this.textColor.set(editor.getAttributes('textStyle')?.['color'] ?? null);
|
|
316
|
+
this.highlightColor.set(editor.getAttributes('highlight')?.['color'] ?? null);
|
|
317
|
+
}
|
|
318
|
+
chain() {
|
|
319
|
+
return this._editor()?.chain() ?? null;
|
|
320
|
+
}
|
|
321
|
+
get commands() {
|
|
322
|
+
return this._editor()?.commands;
|
|
323
|
+
}
|
|
324
|
+
get canCommands() {
|
|
325
|
+
return this._editor()?.can();
|
|
326
|
+
}
|
|
327
|
+
isActive(command, attrs) {
|
|
328
|
+
this.version();
|
|
329
|
+
const editor = this._editor();
|
|
330
|
+
return editor ? isTextEditorCommandActive(editor, command, attrs) : false;
|
|
331
|
+
}
|
|
332
|
+
can(command, attrs) {
|
|
333
|
+
this.version();
|
|
334
|
+
if (!this.editable())
|
|
335
|
+
return false;
|
|
336
|
+
const editor = this._editor();
|
|
337
|
+
return editor ? canRunTextEditorCommand(editor, command, attrs) : false;
|
|
338
|
+
}
|
|
339
|
+
preserveSelection() {
|
|
340
|
+
const editor = this._editor();
|
|
341
|
+
if (!editor)
|
|
342
|
+
return;
|
|
343
|
+
const { from, to } = editor.state.selection;
|
|
344
|
+
this.preservedRange = { from, to };
|
|
345
|
+
}
|
|
346
|
+
clearPreservedSelection() {
|
|
347
|
+
this.preservedRange = null;
|
|
348
|
+
}
|
|
349
|
+
run(command, attrs) {
|
|
350
|
+
const editor = this._editor();
|
|
351
|
+
if (!editor || !this.editable())
|
|
352
|
+
return false;
|
|
353
|
+
this.restorePreservedSelection(editor);
|
|
354
|
+
return runTextEditorCommand(editor, command, attrs);
|
|
355
|
+
}
|
|
356
|
+
restorePreservedSelection(editor) {
|
|
357
|
+
const range = this.preservedRange;
|
|
358
|
+
if (!range)
|
|
359
|
+
return;
|
|
360
|
+
const max = editor.state.doc.content.size;
|
|
361
|
+
const from = Math.max(0, Math.min(range.from, max));
|
|
362
|
+
const to = Math.max(0, Math.min(range.to, max));
|
|
363
|
+
if (editor.state.selection.from === from && editor.state.selection.to === to)
|
|
364
|
+
return;
|
|
365
|
+
editor.commands.setTextSelection({ from, to });
|
|
366
|
+
}
|
|
367
|
+
getJSON() {
|
|
368
|
+
return this._editor()?.getJSON() ?? null;
|
|
369
|
+
}
|
|
370
|
+
getHTML() {
|
|
371
|
+
return this._editor()?.getHTML() ?? '';
|
|
372
|
+
}
|
|
373
|
+
getText(options) {
|
|
374
|
+
return this._editor()?.getText(options) ?? '';
|
|
375
|
+
}
|
|
376
|
+
setContent(content, emitUpdate = false) {
|
|
377
|
+
return this._editor()?.commands.setContent(content, { emitUpdate }) ?? false;
|
|
378
|
+
}
|
|
379
|
+
insertContent(value) {
|
|
380
|
+
return this._editor()?.chain().focus().insertContent(value).run() ?? false;
|
|
381
|
+
}
|
|
382
|
+
clearContent() {
|
|
383
|
+
return this._editor()?.commands.clearContent() ?? false;
|
|
384
|
+
}
|
|
385
|
+
focus() {
|
|
386
|
+
return this._editor()?.commands.focus() ?? false;
|
|
387
|
+
}
|
|
388
|
+
blur() {
|
|
389
|
+
return this._editor()?.commands.blur() ?? false;
|
|
390
|
+
}
|
|
391
|
+
isEmpty() {
|
|
392
|
+
return this._editor()?.isEmpty ?? true;
|
|
393
|
+
}
|
|
394
|
+
isFocused() {
|
|
395
|
+
return this._editor()?.isFocused ?? false;
|
|
396
|
+
}
|
|
397
|
+
isEditable() {
|
|
398
|
+
return this._editor()?.isEditable ?? false;
|
|
399
|
+
}
|
|
400
|
+
setEditable(editable) {
|
|
401
|
+
const editor = this._editor();
|
|
402
|
+
if (!editor || editor.isEditable === editable)
|
|
403
|
+
return;
|
|
404
|
+
editor.setEditable(editable, false);
|
|
405
|
+
this.refresh();
|
|
406
|
+
}
|
|
407
|
+
setZoom(value) {
|
|
408
|
+
if (!Number.isFinite(value))
|
|
409
|
+
return;
|
|
410
|
+
this.zoom.set(Math.min(AX_TEXT_EDITOR_ZOOM_MAX, Math.max(AX_TEXT_EDITOR_ZOOM_MIN, Math.round(value))));
|
|
411
|
+
}
|
|
412
|
+
zoomIn(step = 10) {
|
|
413
|
+
this.setZoom(this.zoom() + step);
|
|
414
|
+
}
|
|
415
|
+
zoomOut(step = 10) {
|
|
416
|
+
this.setZoom(this.zoom() - step);
|
|
417
|
+
}
|
|
418
|
+
fitToPage() {
|
|
419
|
+
const editor = this._editor();
|
|
420
|
+
if (!editor) {
|
|
421
|
+
this.setZoom(100);
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
const prose = editor.view.dom;
|
|
425
|
+
const viewport = prose.closest('ax-text-editor-content') ?? prose.parentElement;
|
|
426
|
+
if (!viewport) {
|
|
427
|
+
this.setZoom(100);
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
const factor = Math.max(this.zoom() / 100, 0.01);
|
|
431
|
+
const unscaledWidth = prose.scrollWidth / factor;
|
|
432
|
+
const available = viewport.clientWidth;
|
|
433
|
+
if (unscaledWidth <= 0 || available <= 0 || unscaledWidth <= available) {
|
|
434
|
+
this.setZoom(100);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
this.setZoom(Math.floor((available / unscaledWidth) * 100));
|
|
438
|
+
}
|
|
439
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
440
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorService }); }
|
|
441
|
+
}
|
|
442
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorService, decorators: [{
|
|
443
|
+
type: Injectable
|
|
444
|
+
}] });
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Marker base for projected editor tools and slots.
|
|
448
|
+
*/
|
|
449
|
+
class AXTextEditorSlot {
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const TOGGLE_COMMANDS = new Set([
|
|
453
|
+
'bold',
|
|
454
|
+
'italic',
|
|
455
|
+
'underline',
|
|
456
|
+
'strike',
|
|
457
|
+
'bulletList',
|
|
458
|
+
'orderedList',
|
|
459
|
+
'superscript',
|
|
460
|
+
'subscript',
|
|
461
|
+
'blockquote',
|
|
462
|
+
'code',
|
|
463
|
+
'codeBlock',
|
|
464
|
+
'direction',
|
|
465
|
+
]);
|
|
466
|
+
class AXTextEditorCommandComponent extends AXTextEditorSlot {
|
|
467
|
+
constructor() {
|
|
468
|
+
super(...arguments);
|
|
469
|
+
this.editorService = inject(AXTextEditorService);
|
|
470
|
+
this.command = input.required(/* @ts-ignore */
|
|
471
|
+
...(ngDevMode ? [{ debugName: "command" }] : /* istanbul ignore next */ []));
|
|
472
|
+
this.attrs = input({}, /* @ts-ignore */
|
|
473
|
+
...(ngDevMode ? [{ debugName: "attrs" }] : /* istanbul ignore next */ []));
|
|
474
|
+
this.icon = input('', /* @ts-ignore */
|
|
475
|
+
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
476
|
+
this.label = input('', /* @ts-ignore */
|
|
477
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
478
|
+
this.toggleable = computed(() => TOGGLE_COMMANDS.has(this.command()), /* @ts-ignore */
|
|
479
|
+
...(ngDevMode ? [{ debugName: "toggleable" }] : /* istanbul ignore next */ []));
|
|
480
|
+
this.active = computed(() => this.editorService.isActive(this.command(), this.attrs()), /* @ts-ignore */
|
|
481
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
482
|
+
this.enabled = computed(() => this.editorService.can(this.command(), this.attrs()), /* @ts-ignore */
|
|
483
|
+
...(ngDevMode ? [{ debugName: "enabled" }] : /* istanbul ignore next */ []));
|
|
484
|
+
}
|
|
485
|
+
execute() {
|
|
486
|
+
this.editorService.run(this.command(), this.attrs());
|
|
487
|
+
}
|
|
488
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorCommandComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
489
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: AXTextEditorCommandComponent, isStandalone: true, selector: "ax-text-editor-command", inputs: { command: { classPropertyName: "command", publicName: "command", isSignal: true, isRequired: true, transformFunction: null }, attrs: { classPropertyName: "attrs", publicName: "attrs", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.title": "label()" } }, providers: [
|
|
490
|
+
{ provide: AXComponent, useExisting: AXTextEditorCommandComponent },
|
|
491
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorCommandComponent },
|
|
492
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
493
|
+
<ax-button
|
|
494
|
+
class="ax-sm"
|
|
495
|
+
look="blank"
|
|
496
|
+
[iconOnly]="true"
|
|
497
|
+
[text]="label()"
|
|
498
|
+
[toggleable]="toggleable()"
|
|
499
|
+
[selected]="active()"
|
|
500
|
+
[disabled]="!enabled()"
|
|
501
|
+
(onClick)="execute()"
|
|
502
|
+
>
|
|
503
|
+
@if (icon()) {
|
|
504
|
+
<ax-icon class="ax-icon {{ icon() }}"></ax-icon>
|
|
505
|
+
}
|
|
506
|
+
</ax-button>
|
|
507
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
508
|
+
}
|
|
509
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorCommandComponent, decorators: [{
|
|
510
|
+
type: Component,
|
|
511
|
+
args: [{
|
|
512
|
+
selector: 'ax-text-editor-command',
|
|
513
|
+
template: `
|
|
514
|
+
<ax-button
|
|
515
|
+
class="ax-sm"
|
|
516
|
+
look="blank"
|
|
517
|
+
[iconOnly]="true"
|
|
518
|
+
[text]="label()"
|
|
519
|
+
[toggleable]="toggleable()"
|
|
520
|
+
[selected]="active()"
|
|
521
|
+
[disabled]="!enabled()"
|
|
522
|
+
(onClick)="execute()"
|
|
523
|
+
>
|
|
524
|
+
@if (icon()) {
|
|
525
|
+
<ax-icon class="ax-icon {{ icon() }}"></ax-icon>
|
|
526
|
+
}
|
|
527
|
+
</ax-button>
|
|
528
|
+
`,
|
|
529
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
530
|
+
encapsulation: ViewEncapsulation.None,
|
|
531
|
+
host: {
|
|
532
|
+
'[attr.title]': 'label()',
|
|
533
|
+
},
|
|
534
|
+
imports: [AXButtonComponent, AXDecoratorIconComponent],
|
|
535
|
+
providers: [
|
|
536
|
+
{ provide: AXComponent, useExisting: AXTextEditorCommandComponent },
|
|
537
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorCommandComponent },
|
|
538
|
+
],
|
|
539
|
+
}]
|
|
540
|
+
}], propDecorators: { command: [{ type: i0.Input, args: [{ isSignal: true, alias: "command", required: true }] }], attrs: [{ type: i0.Input, args: [{ isSignal: true, alias: "attrs", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }] } });
|
|
541
|
+
|
|
542
|
+
const Superscript = Mark.create({
|
|
543
|
+
name: 'superscript',
|
|
544
|
+
excludes: 'subscript',
|
|
545
|
+
parseHTML() {
|
|
546
|
+
return [{ tag: 'sup' }];
|
|
547
|
+
},
|
|
548
|
+
renderHTML({ HTMLAttributes }) {
|
|
549
|
+
return ['sup', mergeAttributes(HTMLAttributes), 0];
|
|
550
|
+
},
|
|
551
|
+
addCommands() {
|
|
552
|
+
return {
|
|
553
|
+
toggleSuperscript: () => ({ commands }) => commands.toggleMark(this.name),
|
|
554
|
+
};
|
|
555
|
+
},
|
|
556
|
+
});
|
|
557
|
+
const Subscript = Mark.create({
|
|
558
|
+
name: 'subscript',
|
|
559
|
+
excludes: 'superscript',
|
|
560
|
+
parseHTML() {
|
|
561
|
+
return [{ tag: 'sub' }];
|
|
562
|
+
},
|
|
563
|
+
renderHTML({ HTMLAttributes }) {
|
|
564
|
+
return ['sub', mergeAttributes(HTMLAttributes), 0];
|
|
565
|
+
},
|
|
566
|
+
addCommands() {
|
|
567
|
+
return {
|
|
568
|
+
toggleSubscript: () => ({ commands }) => commands.toggleMark(this.name),
|
|
569
|
+
};
|
|
570
|
+
},
|
|
571
|
+
});
|
|
572
|
+
const keepSelectionKey = new PluginKey('axKeepSelection');
|
|
573
|
+
const KeepSelection = Extension.create({
|
|
574
|
+
name: 'keepSelection',
|
|
575
|
+
addProseMirrorPlugins() {
|
|
576
|
+
return [
|
|
577
|
+
new Plugin({
|
|
578
|
+
key: keepSelectionKey,
|
|
579
|
+
state: {
|
|
580
|
+
init() {
|
|
581
|
+
return DecorationSet.empty;
|
|
582
|
+
},
|
|
583
|
+
apply(tr, set) {
|
|
584
|
+
const meta = tr.getMeta(keepSelectionKey);
|
|
585
|
+
if (meta === 'clear')
|
|
586
|
+
return DecorationSet.empty;
|
|
587
|
+
if (meta && meta.from !== meta.to) {
|
|
588
|
+
return DecorationSet.create(tr.doc, [
|
|
589
|
+
Decoration.inline(meta.from, meta.to, { class: 'ax-text-editor-kept-selection' }),
|
|
590
|
+
]);
|
|
591
|
+
}
|
|
592
|
+
return set.map(tr.mapping, tr.doc);
|
|
593
|
+
},
|
|
594
|
+
},
|
|
595
|
+
props: {
|
|
596
|
+
decorations(state) {
|
|
597
|
+
return keepSelectionKey.getState(state);
|
|
598
|
+
},
|
|
599
|
+
handleDOMEvents: {
|
|
600
|
+
blur(view) {
|
|
601
|
+
const { from, to } = view.state.selection;
|
|
602
|
+
if (from !== to) {
|
|
603
|
+
view.dispatch(view.state.tr.setMeta(keepSelectionKey, { from, to }));
|
|
604
|
+
}
|
|
605
|
+
return false;
|
|
606
|
+
},
|
|
607
|
+
focus(view) {
|
|
608
|
+
const decorations = keepSelectionKey.getState(view.state);
|
|
609
|
+
if (decorations?.find().length) {
|
|
610
|
+
view.dispatch(view.state.tr.setMeta(keepSelectionKey, 'clear'));
|
|
611
|
+
}
|
|
612
|
+
return false;
|
|
613
|
+
},
|
|
614
|
+
},
|
|
615
|
+
},
|
|
616
|
+
}),
|
|
617
|
+
];
|
|
618
|
+
},
|
|
619
|
+
});
|
|
620
|
+
const TextDirection = Extension.create({
|
|
621
|
+
name: 'textDirection',
|
|
622
|
+
addGlobalAttributes() {
|
|
623
|
+
return [
|
|
624
|
+
{
|
|
625
|
+
types: ['paragraph', 'heading'],
|
|
626
|
+
attributes: {
|
|
627
|
+
dir: {
|
|
628
|
+
default: null,
|
|
629
|
+
parseHTML: (element) => element.getAttribute('dir'),
|
|
630
|
+
renderHTML: (attributes) => (attributes['dir'] ? { dir: attributes['dir'] } : {}),
|
|
631
|
+
},
|
|
632
|
+
},
|
|
633
|
+
},
|
|
634
|
+
];
|
|
635
|
+
},
|
|
636
|
+
});
|
|
637
|
+
function createTextEditorExtensions(placeholder = '') {
|
|
638
|
+
const placeholderFn = typeof placeholder === 'function' ? placeholder : () => placeholder;
|
|
639
|
+
return [
|
|
640
|
+
StarterKit.configure({
|
|
641
|
+
heading: {
|
|
642
|
+
levels: [1, 2, 3],
|
|
643
|
+
HTMLAttributes: {
|
|
644
|
+
class: 'ax-text-editor-heading',
|
|
645
|
+
},
|
|
646
|
+
},
|
|
647
|
+
link: {
|
|
648
|
+
openOnClick: false,
|
|
649
|
+
HTMLAttributes: {
|
|
650
|
+
class: 'ax-text-editor-link',
|
|
651
|
+
},
|
|
652
|
+
},
|
|
653
|
+
code: {
|
|
654
|
+
HTMLAttributes: {
|
|
655
|
+
class: 'ax-text-editor-code',
|
|
656
|
+
},
|
|
657
|
+
},
|
|
658
|
+
codeBlock: {
|
|
659
|
+
HTMLAttributes: {
|
|
660
|
+
class: 'ax-text-editor-code-block',
|
|
661
|
+
},
|
|
662
|
+
},
|
|
663
|
+
bulletList: {
|
|
664
|
+
HTMLAttributes: {
|
|
665
|
+
class: 'ax-text-editor-bullet-list',
|
|
666
|
+
},
|
|
667
|
+
},
|
|
668
|
+
orderedList: {
|
|
669
|
+
HTMLAttributes: {
|
|
670
|
+
class: 'ax-text-editor-ordered-list',
|
|
671
|
+
},
|
|
672
|
+
},
|
|
673
|
+
listItem: {
|
|
674
|
+
HTMLAttributes: {
|
|
675
|
+
class: 'ax-text-editor-list-item',
|
|
676
|
+
},
|
|
677
|
+
},
|
|
678
|
+
}),
|
|
679
|
+
Superscript,
|
|
680
|
+
Subscript,
|
|
681
|
+
TextStyle,
|
|
682
|
+
Color,
|
|
683
|
+
Highlight.configure({ multicolor: true }),
|
|
684
|
+
TextAlign.configure({
|
|
685
|
+
types: ['heading', 'paragraph'],
|
|
686
|
+
}),
|
|
687
|
+
TextDirection,
|
|
688
|
+
KeepSelection,
|
|
689
|
+
TableKit.configure({
|
|
690
|
+
table: {
|
|
691
|
+
resizable: true,
|
|
692
|
+
lastColumnResizable: true,
|
|
693
|
+
cellMinWidth: 64,
|
|
694
|
+
HTMLAttributes: {
|
|
695
|
+
class: 'ax-text-editor-table',
|
|
696
|
+
},
|
|
697
|
+
},
|
|
698
|
+
}),
|
|
699
|
+
Placeholder.configure({
|
|
700
|
+
placeholder: placeholderFn,
|
|
701
|
+
showOnlyCurrent: true,
|
|
702
|
+
}),
|
|
703
|
+
];
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
class AXTextEditorContentComponent extends AXTextEditorSlot {
|
|
707
|
+
constructor() {
|
|
708
|
+
super();
|
|
709
|
+
this.editorService = inject(AXTextEditorService);
|
|
710
|
+
this.elementRef = inject((ElementRef));
|
|
711
|
+
this.platformId = inject(PLATFORM_ID);
|
|
712
|
+
this.editor = null;
|
|
713
|
+
afterNextRender(() => this.createEditor());
|
|
714
|
+
effect(() => {
|
|
715
|
+
if (!this.editorService.editor())
|
|
716
|
+
return;
|
|
717
|
+
this.editorService.setEditable(this.editorService.editable());
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
host() {
|
|
721
|
+
return this.editorService.getHost();
|
|
722
|
+
}
|
|
723
|
+
ngOnDestroy() {
|
|
724
|
+
this.editor?.destroy();
|
|
725
|
+
this.editor = null;
|
|
726
|
+
this.editorService.setEditor(null);
|
|
727
|
+
}
|
|
728
|
+
createEditor() {
|
|
729
|
+
if (!isPlatformBrowser(this.platformId) || this.editor)
|
|
730
|
+
return;
|
|
731
|
+
const host = this.host();
|
|
732
|
+
const element = this.elementRef.nativeElement.querySelector('.ax-text-editor-surface');
|
|
733
|
+
if (!host || !element)
|
|
734
|
+
return;
|
|
735
|
+
this.editor = new Editor({
|
|
736
|
+
element,
|
|
737
|
+
extensions: createTextEditorExtensions(() => this.host()?.placeHolder() ?? ''),
|
|
738
|
+
content: this.toContent(host.value()),
|
|
739
|
+
editable: this.editorService.editable(),
|
|
740
|
+
editorProps: {
|
|
741
|
+
attributes: {
|
|
742
|
+
class: 'ax-text-editor-prose',
|
|
743
|
+
},
|
|
744
|
+
handleDOMEvents: {
|
|
745
|
+
mousedown: () => {
|
|
746
|
+
this.editorService.clearPreservedSelection();
|
|
747
|
+
return false;
|
|
748
|
+
},
|
|
749
|
+
},
|
|
750
|
+
},
|
|
751
|
+
onUpdate: () => this.emitValue(),
|
|
752
|
+
onSelectionUpdate: () => this.editorService.refresh(),
|
|
753
|
+
onTransaction: () => this.editorService.refresh(),
|
|
754
|
+
onFocus: () => this.host()?.notifyFocus(),
|
|
755
|
+
onBlur: () => this.host()?.notifyBlur(),
|
|
756
|
+
});
|
|
757
|
+
this.editorService.setEditor(this.editor);
|
|
758
|
+
}
|
|
759
|
+
emitValue() {
|
|
760
|
+
const host = this.host();
|
|
761
|
+
const next = this.serialize();
|
|
762
|
+
if (!host || isEqual(next, host.value())) {
|
|
763
|
+
this.editorService.refresh();
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
host.notifyValue(next);
|
|
767
|
+
this.editorService.refresh();
|
|
768
|
+
}
|
|
769
|
+
serialize() {
|
|
770
|
+
if (!this.editor || this.editor.isEmpty)
|
|
771
|
+
return null;
|
|
772
|
+
return this.host()?.outputFormat() === 'html' ? this.editor.getHTML() : this.editor.getJSON();
|
|
773
|
+
}
|
|
774
|
+
toContent(value) {
|
|
775
|
+
if (value == null || value === '')
|
|
776
|
+
return '';
|
|
777
|
+
return value;
|
|
778
|
+
}
|
|
779
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
780
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.6", type: AXTextEditorContentComponent, isStandalone: true, selector: "ax-text-editor-content", providers: [
|
|
781
|
+
{ provide: AXComponent, useExisting: AXTextEditorContentComponent },
|
|
782
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorContentComponent },
|
|
783
|
+
], usesInheritance: true, ngImport: i0, template: `<div class="ax-text-editor-surface" #surface></div>`, isInline: true, styles: ["@layer properties;@layer components{ax-text-editor-content{position:relative;display:block;width:100%;max-width:100%;min-width:calc(var(--spacing, .25rem) * 0)}.ax-text-editor-surface{width:100%;min-width:calc(var(--spacing, .25rem) * 0)}.ax-text-editor-prose{width:100%;min-width:calc(var(--spacing, .25rem) * 0);padding-inline:calc(var(--spacing, .25rem) * 4);padding-block:calc(var(--spacing, .25rem) * 2);--tw-outline-style: none;outline-style:none;min-height:var( --ax-comp-text-editor-min-height, calc(var(--ax-comp-text-editor-initial-line, 6) * 1.5em + 1.5rem) );color:var(--ax-comp-text-editor-text-color, var(--ax-sys-color-on-surface, inherit));zoom:var(--ax-comp-text-editor-zoom, 1)}.ax-text-editor-prose a{color:rgba(var(--ax-sys-color-primary-600));text-decoration-line:underline;text-underline-offset:2px;text-decoration-thickness:1px}.ax-text-editor-prose a:hover{color:rgba(var(--ax-sys-color-primary-700));text-decoration-thickness:2px}.ax-text-editor-prose blockquote{margin-block:calc(var(--spacing, .25rem) * 2);padding-inline:calc(var(--spacing, .25rem) * 4);padding-block:calc(var(--spacing, .25rem) * 1);border-inline-start:3px solid var(--ax-sys-color-primary, #3b82f6);color:var(--ax-comp-text-editor-text-color, currentColor)}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-prose blockquote{color:color-mix(in oklab,var(--ax-comp-text-editor-text-color, currentColor) 72%,transparent)}}.ax-text-editor-prose blockquote p{margin:0}.ax-text-editor-prose pre,.ax-text-editor-prose pre.ax-text-editor-code-block{margin-block:calc(var(--spacing, .25rem) * 2);display:block;width:100%;overflow-x:auto;border-radius:var(--radius-xl, .75rem);padding-inline:calc(var(--spacing, .25rem) * 4);padding-block:calc(var(--spacing, .25rem) * 3);background-color:var(--ax-comp-text-editor-code-bg-color, rgba(var(--ax-sys-color-surface)));border:0;color:inherit;font-family:inherit;white-space:pre-wrap}.ax-text-editor-prose pre code{display:block;border-radius:0;border-style:var(--tw-border-style);border-width:0px;background-color:transparent;padding:calc(var(--spacing, .25rem) * 0);color:inherit;font-family:inherit;font-size:inherit}.ax-text-editor-prose p.is-empty:first-child:before,.ax-text-editor-prose p.is-editor-empty:first-child:before{pointer-events:none;float:left;height:calc(var(--spacing, .25rem) * 0);content:attr(data-placeholder);color:var(--ax-comp-text-editor-placeholder-color, currentColor)}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-prose p.is-empty:first-child:before,.ax-text-editor-prose p.is-editor-empty:first-child:before{color:var(--ax-comp-text-editor-placeholder-color, color-mix(in oklab, currentColor 45%, transparent))}}.ax-text-editor-prose sup{font-size:.75em;line-height:0;position:relative;top:-.4em;vertical-align:baseline}.ax-text-editor-prose sub{font-size:.75em;line-height:0;position:relative;bottom:-.2em;vertical-align:baseline}.ax-text-editor-prose table{width:100%;border-collapse:collapse;border:1px solid var(--ax-comp-text-editor-table-border-color, var(--ax-sys-color-border-lightest, #e5e7eb))}.ax-text-editor-prose th,.ax-text-editor-prose td{position:relative;min-width:calc(var(--spacing, .25rem) * 16);padding-inline:calc(var(--spacing, .25rem) * 2);padding-block:calc(var(--spacing, .25rem) * 1);vertical-align:top;border:1px solid var(--ax-comp-text-editor-table-border-color, var(--ax-sys-color-border-lightest, #e5e7eb))}.ax-text-editor-prose .selectedCell{background:var(--ax-sys-color-primary, #3b82f6)}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-prose .selectedCell{background:color-mix(in oklab,var(--ax-sys-color-primary, #3b82f6) 16%,transparent)}}.ax-text-editor-prose .column-resize-handle{pointer-events:none;position:absolute;inset-inline-end:calc(var(--spacing, .25rem) * -.5);top:calc(var(--spacing, .25rem) * 0);bottom:calc(var(--spacing, .25rem) * 0);width:calc(var(--spacing, .25rem) * 1);background:var(--ax-sys-color-primary, #3b82f6)}.ax-text-editor-prose .tableWrapper{margin-block:calc(var(--spacing, .25rem) * 2);overflow-x:auto}.resize-cursor{cursor:col-resize}}ax-text-editor .ax-text-editor-prose :not(pre)>code,ax-text-editor .ax-text-editor-prose code.ax-text-editor-code{display:inline;border-radius:.5rem;padding:.25rem .625rem;background-color:var(--ax-comp-text-editor-code-bg-color, rgba(var(--ax-sys-color-surface)));border:1px solid var(--ax-comp-text-editor-code-border-color, rgba(var(--ax-sys-color-border-surface)));color:inherit;font-family:inherit;font-size:.875em}ax-text-editor .ax-text-editor-prose pre code{display:block;border:0;border-radius:0;padding:0;background-color:transparent;color:inherit;font-family:inherit;font-size:inherit}ax-text-editor .ax-text-editor-prose ul,ax-text-editor .ax-text-editor-prose ul.ax-text-editor-bullet-list{list-style-type:disc!important;list-style-position:outside;margin-block:.5em;padding-inline-start:1.75rem}ax-text-editor .ax-text-editor-prose ol,ax-text-editor .ax-text-editor-prose ol.ax-text-editor-ordered-list{list-style-type:decimal!important;list-style-position:outside;margin-block:.5em;padding-inline-start:1.75rem}ax-text-editor .ax-text-editor-prose ul ul{list-style-type:circle!important}ax-text-editor .ax-text-editor-prose ol ol{list-style-type:lower-alpha!important}ax-text-editor .ax-text-editor-prose li{display:list-item!important}ax-text-editor .ax-text-editor-prose li p{margin:0}ax-text-editor .ax-text-editor-prose .ax-text-editor-kept-selection{background-color:var(--ax-sys-color-primary, #3b82f6)}@supports (color: color-mix(in lab,red,red)){ax-text-editor .ax-text-editor-prose .ax-text-editor-kept-selection{background-color:color-mix(in oklab,var(--ax-sys-color-primary, #3b82f6) 28%,transparent)}}ax-text-editor .ax-text-editor-prose p{margin-block:.35em;font-size:1em;font-weight:400}ax-text-editor .ax-text-editor-prose h1,ax-text-editor .ax-text-editor-prose h2,ax-text-editor .ax-text-editor-prose h3{margin-block:.6em .35em;letter-spacing:-.02em;color:inherit}ax-text-editor .ax-text-editor-prose h1{font-size:2.5rem!important;font-weight:600!important;line-height:1.2}ax-text-editor .ax-text-editor-prose h2{font-size:2rem!important;font-weight:600!important;line-height:1.25}ax-text-editor .ax-text-editor-prose h3{font-size:1.5rem!important;font-weight:600!important;line-height:1.3}ax-text-editor .ax-text-editor-prose>:first-child{margin-top:0}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
784
|
+
}
|
|
785
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorContentComponent, decorators: [{
|
|
786
|
+
type: Component,
|
|
787
|
+
args: [{ selector: 'ax-text-editor-content', template: `<div class="ax-text-editor-surface" #surface></div>`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
788
|
+
{ provide: AXComponent, useExisting: AXTextEditorContentComponent },
|
|
789
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorContentComponent },
|
|
790
|
+
], styles: ["@layer properties;@layer components{ax-text-editor-content{position:relative;display:block;width:100%;max-width:100%;min-width:calc(var(--spacing, .25rem) * 0)}.ax-text-editor-surface{width:100%;min-width:calc(var(--spacing, .25rem) * 0)}.ax-text-editor-prose{width:100%;min-width:calc(var(--spacing, .25rem) * 0);padding-inline:calc(var(--spacing, .25rem) * 4);padding-block:calc(var(--spacing, .25rem) * 2);--tw-outline-style: none;outline-style:none;min-height:var( --ax-comp-text-editor-min-height, calc(var(--ax-comp-text-editor-initial-line, 6) * 1.5em + 1.5rem) );color:var(--ax-comp-text-editor-text-color, var(--ax-sys-color-on-surface, inherit));zoom:var(--ax-comp-text-editor-zoom, 1)}.ax-text-editor-prose a{color:rgba(var(--ax-sys-color-primary-600));text-decoration-line:underline;text-underline-offset:2px;text-decoration-thickness:1px}.ax-text-editor-prose a:hover{color:rgba(var(--ax-sys-color-primary-700));text-decoration-thickness:2px}.ax-text-editor-prose blockquote{margin-block:calc(var(--spacing, .25rem) * 2);padding-inline:calc(var(--spacing, .25rem) * 4);padding-block:calc(var(--spacing, .25rem) * 1);border-inline-start:3px solid var(--ax-sys-color-primary, #3b82f6);color:var(--ax-comp-text-editor-text-color, currentColor)}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-prose blockquote{color:color-mix(in oklab,var(--ax-comp-text-editor-text-color, currentColor) 72%,transparent)}}.ax-text-editor-prose blockquote p{margin:0}.ax-text-editor-prose pre,.ax-text-editor-prose pre.ax-text-editor-code-block{margin-block:calc(var(--spacing, .25rem) * 2);display:block;width:100%;overflow-x:auto;border-radius:var(--radius-xl, .75rem);padding-inline:calc(var(--spacing, .25rem) * 4);padding-block:calc(var(--spacing, .25rem) * 3);background-color:var(--ax-comp-text-editor-code-bg-color, rgba(var(--ax-sys-color-surface)));border:0;color:inherit;font-family:inherit;white-space:pre-wrap}.ax-text-editor-prose pre code{display:block;border-radius:0;border-style:var(--tw-border-style);border-width:0px;background-color:transparent;padding:calc(var(--spacing, .25rem) * 0);color:inherit;font-family:inherit;font-size:inherit}.ax-text-editor-prose p.is-empty:first-child:before,.ax-text-editor-prose p.is-editor-empty:first-child:before{pointer-events:none;float:left;height:calc(var(--spacing, .25rem) * 0);content:attr(data-placeholder);color:var(--ax-comp-text-editor-placeholder-color, currentColor)}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-prose p.is-empty:first-child:before,.ax-text-editor-prose p.is-editor-empty:first-child:before{color:var(--ax-comp-text-editor-placeholder-color, color-mix(in oklab, currentColor 45%, transparent))}}.ax-text-editor-prose sup{font-size:.75em;line-height:0;position:relative;top:-.4em;vertical-align:baseline}.ax-text-editor-prose sub{font-size:.75em;line-height:0;position:relative;bottom:-.2em;vertical-align:baseline}.ax-text-editor-prose table{width:100%;border-collapse:collapse;border:1px solid var(--ax-comp-text-editor-table-border-color, var(--ax-sys-color-border-lightest, #e5e7eb))}.ax-text-editor-prose th,.ax-text-editor-prose td{position:relative;min-width:calc(var(--spacing, .25rem) * 16);padding-inline:calc(var(--spacing, .25rem) * 2);padding-block:calc(var(--spacing, .25rem) * 1);vertical-align:top;border:1px solid var(--ax-comp-text-editor-table-border-color, var(--ax-sys-color-border-lightest, #e5e7eb))}.ax-text-editor-prose .selectedCell{background:var(--ax-sys-color-primary, #3b82f6)}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-prose .selectedCell{background:color-mix(in oklab,var(--ax-sys-color-primary, #3b82f6) 16%,transparent)}}.ax-text-editor-prose .column-resize-handle{pointer-events:none;position:absolute;inset-inline-end:calc(var(--spacing, .25rem) * -.5);top:calc(var(--spacing, .25rem) * 0);bottom:calc(var(--spacing, .25rem) * 0);width:calc(var(--spacing, .25rem) * 1);background:var(--ax-sys-color-primary, #3b82f6)}.ax-text-editor-prose .tableWrapper{margin-block:calc(var(--spacing, .25rem) * 2);overflow-x:auto}.resize-cursor{cursor:col-resize}}ax-text-editor .ax-text-editor-prose :not(pre)>code,ax-text-editor .ax-text-editor-prose code.ax-text-editor-code{display:inline;border-radius:.5rem;padding:.25rem .625rem;background-color:var(--ax-comp-text-editor-code-bg-color, rgba(var(--ax-sys-color-surface)));border:1px solid var(--ax-comp-text-editor-code-border-color, rgba(var(--ax-sys-color-border-surface)));color:inherit;font-family:inherit;font-size:.875em}ax-text-editor .ax-text-editor-prose pre code{display:block;border:0;border-radius:0;padding:0;background-color:transparent;color:inherit;font-family:inherit;font-size:inherit}ax-text-editor .ax-text-editor-prose ul,ax-text-editor .ax-text-editor-prose ul.ax-text-editor-bullet-list{list-style-type:disc!important;list-style-position:outside;margin-block:.5em;padding-inline-start:1.75rem}ax-text-editor .ax-text-editor-prose ol,ax-text-editor .ax-text-editor-prose ol.ax-text-editor-ordered-list{list-style-type:decimal!important;list-style-position:outside;margin-block:.5em;padding-inline-start:1.75rem}ax-text-editor .ax-text-editor-prose ul ul{list-style-type:circle!important}ax-text-editor .ax-text-editor-prose ol ol{list-style-type:lower-alpha!important}ax-text-editor .ax-text-editor-prose li{display:list-item!important}ax-text-editor .ax-text-editor-prose li p{margin:0}ax-text-editor .ax-text-editor-prose .ax-text-editor-kept-selection{background-color:var(--ax-sys-color-primary, #3b82f6)}@supports (color: color-mix(in lab,red,red)){ax-text-editor .ax-text-editor-prose .ax-text-editor-kept-selection{background-color:color-mix(in oklab,var(--ax-sys-color-primary, #3b82f6) 28%,transparent)}}ax-text-editor .ax-text-editor-prose p{margin-block:.35em;font-size:1em;font-weight:400}ax-text-editor .ax-text-editor-prose h1,ax-text-editor .ax-text-editor-prose h2,ax-text-editor .ax-text-editor-prose h3{margin-block:.6em .35em;letter-spacing:-.02em;color:inherit}ax-text-editor .ax-text-editor-prose h1{font-size:2.5rem!important;font-weight:600!important;line-height:1.2}ax-text-editor .ax-text-editor-prose h2{font-size:2rem!important;font-weight:600!important;line-height:1.25}ax-text-editor .ax-text-editor-prose h3{font-size:1.5rem!important;font-weight:600!important;line-height:1.3}ax-text-editor .ax-text-editor-prose>:first-child{margin-top:0}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
791
|
+
}], ctorParameters: () => [] });
|
|
792
|
+
|
|
793
|
+
class AXTextEditorComponent extends classes((MXInputBaseValueComponent), MXLookComponent) {
|
|
794
|
+
constructor() {
|
|
795
|
+
super();
|
|
796
|
+
this.editorService = inject(AXTextEditorService);
|
|
797
|
+
this.destroyRef = inject(DestroyRef);
|
|
798
|
+
this.projected = contentChild(AXTextEditorContentComponent, /* @ts-ignore */
|
|
799
|
+
...(ngDevMode ? [{ debugName: "projected" }] : /* istanbul ignore next */ []));
|
|
800
|
+
this.syncingFromEditor = false;
|
|
801
|
+
this.placeHolder = input('', /* @ts-ignore */
|
|
802
|
+
...(ngDevMode ? [{ debugName: "placeHolder" }] : /* istanbul ignore next */ []));
|
|
803
|
+
this.outputFormat = input('json', /* @ts-ignore */
|
|
804
|
+
...(ngDevMode ? [{ debugName: "outputFormat" }] : /* istanbul ignore next */ []));
|
|
805
|
+
this.initialLine = input(6, /* @ts-ignore */
|
|
806
|
+
...(ngDevMode ? [{ debugName: "initialLine" }] : /* istanbul ignore next */ []));
|
|
807
|
+
this.zoomFactor = computed(() => this.editorService.zoomFactor(), /* @ts-ignore */
|
|
808
|
+
...(ngDevMode ? [{ debugName: "zoomFactor" }] : /* istanbul ignore next */ []));
|
|
809
|
+
this.projectedContent = computed(() => this.projected() != null, /* @ts-ignore */
|
|
810
|
+
...(ngDevMode ? [{ debugName: "projectedContent" }] : /* istanbul ignore next */ []));
|
|
811
|
+
this.editorService.bindHost({
|
|
812
|
+
placeHolder: () => this.placeHolder(),
|
|
813
|
+
outputFormat: () => this.outputFormat(),
|
|
814
|
+
value: () => this.value,
|
|
815
|
+
disabled: () => this.disabled,
|
|
816
|
+
readonly: () => this.readonly,
|
|
817
|
+
notifyFocus: (event) => this.notifyEditorFocus(event),
|
|
818
|
+
notifyBlur: (event) => this.notifyEditorBlur(event),
|
|
819
|
+
notifyValue: (value) => this.notifyEditorValue(value),
|
|
820
|
+
});
|
|
821
|
+
this.disabledChange.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.editorService.syncHostState());
|
|
822
|
+
this.readonlyChange.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.editorService.syncHostState());
|
|
823
|
+
}
|
|
824
|
+
getEditor() {
|
|
825
|
+
return this.editorService.editor();
|
|
826
|
+
}
|
|
827
|
+
getEditorService() {
|
|
828
|
+
return this.editorService;
|
|
829
|
+
}
|
|
830
|
+
/** @ignore */
|
|
831
|
+
notifyEditorFocus(event) {
|
|
832
|
+
this.emitOnFocusEvent(event);
|
|
833
|
+
}
|
|
834
|
+
/** @ignore */
|
|
835
|
+
notifyEditorBlur(event) {
|
|
836
|
+
this.emitOnBlurEvent(event);
|
|
837
|
+
}
|
|
838
|
+
/** @ignore */
|
|
839
|
+
notifyEditorValue(value) {
|
|
840
|
+
this.syncingFromEditor = true;
|
|
841
|
+
this.value = value;
|
|
842
|
+
this.syncingFromEditor = false;
|
|
843
|
+
}
|
|
844
|
+
internalValueChanged(value) {
|
|
845
|
+
if (this.syncingFromEditor)
|
|
846
|
+
return;
|
|
847
|
+
const editor = this.editorService.editor();
|
|
848
|
+
if (!editor)
|
|
849
|
+
return;
|
|
850
|
+
if (editor.isEmpty && (value == null || value === ''))
|
|
851
|
+
return;
|
|
852
|
+
this.editorService.setContent(value == null ? '' : value, false);
|
|
853
|
+
}
|
|
854
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
855
|
+
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: { 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: [
|
|
856
|
+
AXTextEditorService,
|
|
857
|
+
{ provide: AXComponent, useExisting: AXTextEditorComponent },
|
|
858
|
+
{ provide: AXFocusableComponent, useExisting: AXTextEditorComponent },
|
|
859
|
+
{ provide: AXValuableComponent, useExisting: AXTextEditorComponent },
|
|
860
|
+
{
|
|
861
|
+
provide: NG_VALUE_ACCESSOR,
|
|
862
|
+
useExisting: forwardRef(() => AXTextEditorComponent),
|
|
863
|
+
multi: true,
|
|
864
|
+
},
|
|
865
|
+
], queries: [{ propertyName: "projected", first: true, predicate: AXTextEditorContentComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, 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</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"], dependencies: [{ kind: "component", type: AXTextEditorContentComponent, selector: "ax-text-editor-content" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
866
|
+
}
|
|
867
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorComponent, decorators: [{
|
|
868
|
+
type: Component,
|
|
869
|
+
args: [{ selector: 'ax-text-editor', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, inputs: ['disabled', 'tabIndex', 'readonly', 'value', 'state', 'name', 'look'], outputs: [
|
|
870
|
+
'onBlur',
|
|
871
|
+
'onFocus',
|
|
872
|
+
'valueChange',
|
|
873
|
+
'stateChange',
|
|
874
|
+
'onValueChanged',
|
|
875
|
+
'readonlyChange',
|
|
876
|
+
'disabledChange',
|
|
877
|
+
], host: {
|
|
878
|
+
'[style.--ax-comp-text-editor-initial-line]': 'initialLine()',
|
|
879
|
+
'[style.--ax-comp-text-editor-zoom]': 'zoomFactor()',
|
|
880
|
+
'[class.ax-state-disabled]': 'disabled',
|
|
881
|
+
'[class.ax-state-readonly]': 'readonly && !disabled',
|
|
882
|
+
class: 'ax-text-editor',
|
|
883
|
+
}, providers: [
|
|
884
|
+
AXTextEditorService,
|
|
885
|
+
{ provide: AXComponent, useExisting: AXTextEditorComponent },
|
|
886
|
+
{ provide: AXFocusableComponent, useExisting: AXTextEditorComponent },
|
|
887
|
+
{ provide: AXValuableComponent, useExisting: AXTextEditorComponent },
|
|
888
|
+
{
|
|
889
|
+
provide: NG_VALUE_ACCESSOR,
|
|
890
|
+
useExisting: forwardRef(() => AXTextEditorComponent),
|
|
891
|
+
multi: true,
|
|
892
|
+
},
|
|
893
|
+
], 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</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"] }]
|
|
894
|
+
}], 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 }] }] } });
|
|
895
|
+
|
|
896
|
+
class AXTextEditorToolbarComponent extends AXTextEditorSlot {
|
|
897
|
+
constructor() {
|
|
898
|
+
super(...arguments);
|
|
899
|
+
this.editorService = inject(AXTextEditorService);
|
|
900
|
+
this.orientation = input('horizontal', /* @ts-ignore */
|
|
901
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
902
|
+
}
|
|
903
|
+
onMouseDown(event) {
|
|
904
|
+
const target = event.target;
|
|
905
|
+
if (target?.closest('input, textarea, select, [contenteditable="true"]'))
|
|
906
|
+
return;
|
|
907
|
+
this.editorService.preserveSelection();
|
|
908
|
+
event.preventDefault();
|
|
909
|
+
}
|
|
910
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorToolbarComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
911
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: AXTextEditorToolbarComponent, isStandalone: true, selector: "ax-text-editor-toolbar", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mousedown": "onMouseDown($event)" }, properties: { "class.ax-orientation-vertical": "orientation() === \"vertical\"", "class.ax-orientation-horizontal": "orientation() === \"horizontal\"" }, classAttribute: "ax-text-editor-toolbar" }, providers: [
|
|
912
|
+
{ provide: AXComponent, useExisting: AXTextEditorToolbarComponent },
|
|
913
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorToolbarComponent },
|
|
914
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
915
|
+
<div class="ax-text-editor-toolbar-content">
|
|
916
|
+
<ng-content select="ax-prefix"></ng-content>
|
|
917
|
+
<div class="ax-text-editor-toolbar-tools" axHorizontalScroll [orientation]="orientation()">
|
|
918
|
+
<ng-content></ng-content>
|
|
919
|
+
</div>
|
|
920
|
+
<ng-content select="ax-suffix"></ng-content>
|
|
921
|
+
</div>
|
|
922
|
+
`, isInline: true, styles: ["@layer properties;@layer components{ax-text-editor-toolbar{position:relative;display:block;width:100%;max-width:100%;min-width:calc(var(--spacing, .25rem) * 0);overflow-x:hidden;overflow-y:visible}ax-text-editor-toolbar>.ax-text-editor-toolbar-content{display:flex;width:100%;max-width:100%;min-width:calc(var(--spacing, .25rem) * 0);flex-wrap:nowrap;align-items:center;gap:calc(var(--spacing, .25rem) * 1);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:rgba(var(--ax-sys-color-border-lightest-surface));padding-inline:calc(var(--spacing, .25rem) * 1);padding-block:calc(var(--spacing, .25rem) * .5)}ax-text-editor-toolbar>.ax-text-editor-toolbar-content ax-prefix{display:flex;flex-shrink:0;align-items:center;gap:calc(var(--spacing, .25rem) * 1);padding-inline:calc(var(--spacing, .25rem) * 1)}ax-text-editor-toolbar>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools{display:flex;min-width:calc(var(--spacing, .25rem) * 0);flex:1;flex-wrap:nowrap;align-items:center;gap:calc(var(--spacing, .25rem) * 1);overflow-x:auto;overflow-y:hidden;padding:calc(var(--spacing, .25rem) * 1);overscroll-behavior-x:contain;scrollbar-width:none;-ms-overflow-style:none}ax-text-editor-toolbar>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools::-webkit-scrollbar{display:none}ax-text-editor-toolbar>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools>*{display:flex;flex-shrink:0;align-items:center;gap:calc(var(--spacing, .25rem) * 1)}ax-text-editor-toolbar>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools ax-dropdown-button{width:auto}ax-text-editor-toolbar>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools>ax-divider{margin-inline:calc(var(--spacing, .25rem) * 1);display:block;min-height:calc(var(--spacing, .25rem) * 6);width:1px;align-self:stretch;background-color:rgba(var(--ax-sys-color-border-lightest-surface))}ax-text-editor-toolbar>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools ax-button button.ax-state-selected{background-color:var(--ax-comp-bg-lighter, var(--color-surface));color:var(--ax-comp-text-lighter, var(--color-on-surface))}ax-text-editor-toolbar>.ax-text-editor-toolbar-content ax-suffix{margin-inline-start:auto;display:flex;flex-shrink:0;align-items:center;gap:calc(var(--spacing, .25rem) * 1);padding-inline:calc(var(--spacing, .25rem) * 1)}ax-text-editor-toolbar.ax-orientation-vertical{display:flex;width:auto;max-width:none;flex-direction:column;overflow:hidden}ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content{min-height:calc(var(--spacing, .25rem) * 0);flex:1;flex-direction:column;align-items:stretch;gap:calc(var(--spacing, .25rem) * 1);border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px;border-bottom-style:var(--tw-border-style);border-bottom-width:0px;padding-inline:calc(var(--spacing, .25rem) * .5);padding-block:calc(var(--spacing, .25rem) * 1)}ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content ax-prefix,ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content ax-suffix{flex-direction:column;align-items:center;gap:calc(var(--spacing, .25rem) * 1);padding-inline:calc(var(--spacing, .25rem) * 0)}ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content ax-suffix{margin-inline-start:calc(var(--spacing, .25rem) * 0);margin-top:auto}ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools{min-height:calc(var(--spacing, .25rem) * 0);flex:1;flex-direction:column;align-items:center;gap:calc(var(--spacing, .25rem) * 1);overflow-x:hidden;overflow-y:auto;padding:calc(var(--spacing, .25rem) * 1);overscroll-behavior-y:contain}ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools>*{flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 1)}ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools>ax-divider{margin-inline:calc(var(--spacing, .25rem) * 0);margin-block:calc(var(--spacing, .25rem) * 1);height:1px;min-height:1px;width:calc(var(--spacing, .25rem) * 6);min-width:calc(var(--spacing, .25rem) * 6);align-self:center}ax-text-editor-toolbar.ax-orientation-vertical .ax-text-editor-zoom-value{min-width:calc(var(--spacing, .25rem) * 0)}}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "directive", type: AXHorizontalScrollDirective, selector: "[axHorizontalScroll]", inputs: ["disabled", "orientation", "speed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
923
|
+
}
|
|
924
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorToolbarComponent, decorators: [{
|
|
925
|
+
type: Component,
|
|
926
|
+
args: [{ selector: 'ax-text-editor-toolbar', template: `
|
|
927
|
+
<div class="ax-text-editor-toolbar-content">
|
|
928
|
+
<ng-content select="ax-prefix"></ng-content>
|
|
929
|
+
<div class="ax-text-editor-toolbar-tools" axHorizontalScroll [orientation]="orientation()">
|
|
930
|
+
<ng-content></ng-content>
|
|
931
|
+
</div>
|
|
932
|
+
<ng-content select="ax-suffix"></ng-content>
|
|
933
|
+
</div>
|
|
934
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
935
|
+
class: 'ax-text-editor-toolbar',
|
|
936
|
+
'[class.ax-orientation-vertical]': 'orientation() === "vertical"',
|
|
937
|
+
'[class.ax-orientation-horizontal]': 'orientation() === "horizontal"',
|
|
938
|
+
'(mousedown)': 'onMouseDown($event)',
|
|
939
|
+
}, imports: [AXHorizontalScrollDirective], providers: [
|
|
940
|
+
{ provide: AXComponent, useExisting: AXTextEditorToolbarComponent },
|
|
941
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorToolbarComponent },
|
|
942
|
+
], styles: ["@layer properties;@layer components{ax-text-editor-toolbar{position:relative;display:block;width:100%;max-width:100%;min-width:calc(var(--spacing, .25rem) * 0);overflow-x:hidden;overflow-y:visible}ax-text-editor-toolbar>.ax-text-editor-toolbar-content{display:flex;width:100%;max-width:100%;min-width:calc(var(--spacing, .25rem) * 0);flex-wrap:nowrap;align-items:center;gap:calc(var(--spacing, .25rem) * 1);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:rgba(var(--ax-sys-color-border-lightest-surface));padding-inline:calc(var(--spacing, .25rem) * 1);padding-block:calc(var(--spacing, .25rem) * .5)}ax-text-editor-toolbar>.ax-text-editor-toolbar-content ax-prefix{display:flex;flex-shrink:0;align-items:center;gap:calc(var(--spacing, .25rem) * 1);padding-inline:calc(var(--spacing, .25rem) * 1)}ax-text-editor-toolbar>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools{display:flex;min-width:calc(var(--spacing, .25rem) * 0);flex:1;flex-wrap:nowrap;align-items:center;gap:calc(var(--spacing, .25rem) * 1);overflow-x:auto;overflow-y:hidden;padding:calc(var(--spacing, .25rem) * 1);overscroll-behavior-x:contain;scrollbar-width:none;-ms-overflow-style:none}ax-text-editor-toolbar>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools::-webkit-scrollbar{display:none}ax-text-editor-toolbar>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools>*{display:flex;flex-shrink:0;align-items:center;gap:calc(var(--spacing, .25rem) * 1)}ax-text-editor-toolbar>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools ax-dropdown-button{width:auto}ax-text-editor-toolbar>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools>ax-divider{margin-inline:calc(var(--spacing, .25rem) * 1);display:block;min-height:calc(var(--spacing, .25rem) * 6);width:1px;align-self:stretch;background-color:rgba(var(--ax-sys-color-border-lightest-surface))}ax-text-editor-toolbar>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools ax-button button.ax-state-selected{background-color:var(--ax-comp-bg-lighter, var(--color-surface));color:var(--ax-comp-text-lighter, var(--color-on-surface))}ax-text-editor-toolbar>.ax-text-editor-toolbar-content ax-suffix{margin-inline-start:auto;display:flex;flex-shrink:0;align-items:center;gap:calc(var(--spacing, .25rem) * 1);padding-inline:calc(var(--spacing, .25rem) * 1)}ax-text-editor-toolbar.ax-orientation-vertical{display:flex;width:auto;max-width:none;flex-direction:column;overflow:hidden}ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content{min-height:calc(var(--spacing, .25rem) * 0);flex:1;flex-direction:column;align-items:stretch;gap:calc(var(--spacing, .25rem) * 1);border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px;border-bottom-style:var(--tw-border-style);border-bottom-width:0px;padding-inline:calc(var(--spacing, .25rem) * .5);padding-block:calc(var(--spacing, .25rem) * 1)}ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content ax-prefix,ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content ax-suffix{flex-direction:column;align-items:center;gap:calc(var(--spacing, .25rem) * 1);padding-inline:calc(var(--spacing, .25rem) * 0)}ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content ax-suffix{margin-inline-start:calc(var(--spacing, .25rem) * 0);margin-top:auto}ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools{min-height:calc(var(--spacing, .25rem) * 0);flex:1;flex-direction:column;align-items:center;gap:calc(var(--spacing, .25rem) * 1);overflow-x:hidden;overflow-y:auto;padding:calc(var(--spacing, .25rem) * 1);overscroll-behavior-y:contain}ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools>*{flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 1)}ax-text-editor-toolbar.ax-orientation-vertical>.ax-text-editor-toolbar-content .ax-text-editor-toolbar-tools>ax-divider{margin-inline:calc(var(--spacing, .25rem) * 0);margin-block:calc(var(--spacing, .25rem) * 1);height:1px;min-height:1px;width:calc(var(--spacing, .25rem) * 6);min-width:calc(var(--spacing, .25rem) * 6);align-self:center}ax-text-editor-toolbar.ax-orientation-vertical .ax-text-editor-zoom-value{min-width:calc(var(--spacing, .25rem) * 0)}}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
943
|
+
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }] } });
|
|
944
|
+
|
|
945
|
+
class AXTextEditorAlignmentComponent extends AXTextEditorSlot {
|
|
946
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorAlignmentComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
947
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.6", type: AXTextEditorAlignmentComponent, isStandalone: true, selector: "ax-text-editor-alignment", providers: [
|
|
948
|
+
{ provide: AXComponent, useExisting: AXTextEditorAlignmentComponent },
|
|
949
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorAlignmentComponent },
|
|
950
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
951
|
+
<ax-text-editor-command command="align" [attrs]="{ align: 'left' }" icon="ax-icon-align-left" label="Align left" />
|
|
952
|
+
<ax-text-editor-command
|
|
953
|
+
command="align"
|
|
954
|
+
[attrs]="{ align: 'center' }"
|
|
955
|
+
icon="ax-icon-align-center"
|
|
956
|
+
label="Align center"
|
|
957
|
+
/>
|
|
958
|
+
<ax-text-editor-command command="align" [attrs]="{ align: 'right' }" icon="ax-icon-align-right" label="Align right" />
|
|
959
|
+
<ax-text-editor-command command="align" [attrs]="{ align: 'justify' }" icon="ax-icon-align-justify" label="Justify" />
|
|
960
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AXTextEditorCommandComponent, selector: "ax-text-editor-command", inputs: ["command", "attrs", "icon", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
961
|
+
}
|
|
962
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorAlignmentComponent, decorators: [{
|
|
963
|
+
type: Component,
|
|
964
|
+
args: [{
|
|
965
|
+
selector: 'ax-text-editor-alignment',
|
|
966
|
+
template: `
|
|
967
|
+
<ax-text-editor-command command="align" [attrs]="{ align: 'left' }" icon="ax-icon-align-left" label="Align left" />
|
|
968
|
+
<ax-text-editor-command
|
|
969
|
+
command="align"
|
|
970
|
+
[attrs]="{ align: 'center' }"
|
|
971
|
+
icon="ax-icon-align-center"
|
|
972
|
+
label="Align center"
|
|
973
|
+
/>
|
|
974
|
+
<ax-text-editor-command command="align" [attrs]="{ align: 'right' }" icon="ax-icon-align-right" label="Align right" />
|
|
975
|
+
<ax-text-editor-command command="align" [attrs]="{ align: 'justify' }" icon="ax-icon-align-justify" label="Justify" />
|
|
976
|
+
`,
|
|
977
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
978
|
+
encapsulation: ViewEncapsulation.None,
|
|
979
|
+
imports: [AXTextEditorCommandComponent],
|
|
980
|
+
providers: [
|
|
981
|
+
{ provide: AXComponent, useExisting: AXTextEditorAlignmentComponent },
|
|
982
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorAlignmentComponent },
|
|
983
|
+
],
|
|
984
|
+
}]
|
|
985
|
+
}] });
|
|
986
|
+
|
|
987
|
+
class AXTextEditorBlocksComponent extends AXTextEditorSlot {
|
|
988
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorBlocksComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
989
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.6", type: AXTextEditorBlocksComponent, isStandalone: true, selector: "ax-text-editor-blocks", providers: [
|
|
990
|
+
{ provide: AXComponent, useExisting: AXTextEditorBlocksComponent },
|
|
991
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorBlocksComponent },
|
|
992
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
993
|
+
<ax-text-editor-command command="codeBlock" icon="ax-icon-code-block" label="Code block" />
|
|
994
|
+
<ax-text-editor-command command="horizontalRule" icon="ax-icon-horizontal-rule" label="Horizontal rule" />
|
|
995
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AXTextEditorCommandComponent, selector: "ax-text-editor-command", inputs: ["command", "attrs", "icon", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
996
|
+
}
|
|
997
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorBlocksComponent, decorators: [{
|
|
998
|
+
type: Component,
|
|
999
|
+
args: [{
|
|
1000
|
+
selector: 'ax-text-editor-blocks',
|
|
1001
|
+
template: `
|
|
1002
|
+
<ax-text-editor-command command="codeBlock" icon="ax-icon-code-block" label="Code block" />
|
|
1003
|
+
<ax-text-editor-command command="horizontalRule" icon="ax-icon-horizontal-rule" label="Horizontal rule" />
|
|
1004
|
+
`,
|
|
1005
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1006
|
+
encapsulation: ViewEncapsulation.None,
|
|
1007
|
+
imports: [AXTextEditorCommandComponent],
|
|
1008
|
+
providers: [
|
|
1009
|
+
{ provide: AXComponent, useExisting: AXTextEditorBlocksComponent },
|
|
1010
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorBlocksComponent },
|
|
1011
|
+
],
|
|
1012
|
+
}]
|
|
1013
|
+
}] });
|
|
1014
|
+
|
|
1015
|
+
class AXTextEditorColorSwatchesComponent extends AXTextEditorSlot {
|
|
1016
|
+
constructor() {
|
|
1017
|
+
super(...arguments);
|
|
1018
|
+
this.editorService = inject(AXTextEditorService);
|
|
1019
|
+
this.textColors = input([], /* @ts-ignore */
|
|
1020
|
+
...(ngDevMode ? [{ debugName: "textColors" }] : /* istanbul ignore next */ []));
|
|
1021
|
+
this.backgroundColors = input([], /* @ts-ignore */
|
|
1022
|
+
...(ngDevMode ? [{ debugName: "backgroundColors" }] : /* istanbul ignore next */ []));
|
|
1023
|
+
this.recentColors = model([], /* @ts-ignore */
|
|
1024
|
+
...(ngDevMode ? [{ debugName: "recentColors" }] : /* istanbul ignore next */ []));
|
|
1025
|
+
this.resolvedTextColors = computed(() => this.textColors().length ? this.textColors() : AX_TEXT_EDITOR_DEFAULT_TEXT_COLORS, /* @ts-ignore */
|
|
1026
|
+
...(ngDevMode ? [{ debugName: "resolvedTextColors" }] : /* istanbul ignore next */ []));
|
|
1027
|
+
this.resolvedBackgroundColors = computed(() => this.backgroundColors().length ? this.backgroundColors() : AX_TEXT_EDITOR_DEFAULT_BACKGROUND_COLORS, /* @ts-ignore */
|
|
1028
|
+
...(ngDevMode ? [{ debugName: "resolvedBackgroundColors" }] : /* istanbul ignore next */ []));
|
|
1029
|
+
}
|
|
1030
|
+
isTextSelected(color) {
|
|
1031
|
+
return sameColor(this.editorService.textColor(), color);
|
|
1032
|
+
}
|
|
1033
|
+
isBackgroundSelected(color) {
|
|
1034
|
+
return sameColor(this.editorService.highlightColor(), color);
|
|
1035
|
+
}
|
|
1036
|
+
applyText(color) {
|
|
1037
|
+
this.editorService.run('color', { color });
|
|
1038
|
+
this.remember({ color, kind: 'text' });
|
|
1039
|
+
}
|
|
1040
|
+
applyBackground(color) {
|
|
1041
|
+
this.editorService.run('highlight', { color });
|
|
1042
|
+
this.remember({ color, kind: 'background' });
|
|
1043
|
+
}
|
|
1044
|
+
applyRecent(item) {
|
|
1045
|
+
if (item.kind === 'text')
|
|
1046
|
+
this.applyText(item.color);
|
|
1047
|
+
else
|
|
1048
|
+
this.applyBackground(item.color);
|
|
1049
|
+
}
|
|
1050
|
+
remember(item) {
|
|
1051
|
+
const next = [item, ...this.recentColors().filter((entry) => entry.kind !== item.kind || !sameColor(entry.color, item.color))];
|
|
1052
|
+
this.recentColors.set(next.slice(0, 8));
|
|
1053
|
+
}
|
|
1054
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorColorSwatchesComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1055
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: AXTextEditorColorSwatchesComponent, isStandalone: true, selector: "ax-text-editor-color-swatches", inputs: { textColors: { classPropertyName: "textColors", publicName: "textColors", isSignal: true, isRequired: false, transformFunction: null }, backgroundColors: { classPropertyName: "backgroundColors", publicName: "backgroundColors", isSignal: true, isRequired: false, transformFunction: null }, recentColors: { classPropertyName: "recentColors", publicName: "recentColors", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { recentColors: "recentColorsChange" }, providers: [
|
|
1056
|
+
{ provide: AXComponent, useExisting: AXTextEditorColorSwatchesComponent },
|
|
1057
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorColorSwatchesComponent },
|
|
1058
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
1059
|
+
<ax-dropdown-button class="ax-sm" look="blank" mode="dropdown" [iconOnly]="true" text="Colors">
|
|
1060
|
+
<ax-prefix>
|
|
1061
|
+
<span
|
|
1062
|
+
class="ax-text-editor-swatches-trigger"
|
|
1063
|
+
[style.color]="editorService.textColor() || 'currentColor'"
|
|
1064
|
+
[style.background-color]="editorService.highlightColor() || 'transparent'"
|
|
1065
|
+
>
|
|
1066
|
+
A
|
|
1067
|
+
</span>
|
|
1068
|
+
</ax-prefix>
|
|
1069
|
+
<div class="ax-text-editor-swatches-panel" (click)="$event.stopPropagation()" (mousedown)="$event.stopPropagation()">
|
|
1070
|
+
@if (recentColors().length) {
|
|
1071
|
+
<div class="ax-text-editor-swatches-section">
|
|
1072
|
+
<div class="ax-text-editor-swatches-title">Recently Used</div>
|
|
1073
|
+
<div class="ax-text-editor-swatches-row">
|
|
1074
|
+
@for (item of recentColors(); track item.kind + item.color) {
|
|
1075
|
+
<button
|
|
1076
|
+
type="button"
|
|
1077
|
+
class="ax-text-editor-swatch"
|
|
1078
|
+
[class.ax-text-editor-swatch-letter]="item.kind === 'text'"
|
|
1079
|
+
[class.ax-text-editor-swatch-dot]="item.kind === 'background'"
|
|
1080
|
+
[style.background-color]="item.kind === 'background' ? item.color : null"
|
|
1081
|
+
[attr.title]="item.color"
|
|
1082
|
+
(click)="applyRecent(item)"
|
|
1083
|
+
>
|
|
1084
|
+
@if (item.kind === 'text') {
|
|
1085
|
+
<span [style.color]="item.color">A</span>
|
|
1086
|
+
}
|
|
1087
|
+
</button>
|
|
1088
|
+
}
|
|
1089
|
+
</div>
|
|
1090
|
+
</div>
|
|
1091
|
+
}
|
|
1092
|
+
<div class="ax-text-editor-swatches-section">
|
|
1093
|
+
<div class="ax-text-editor-swatches-title">Text Color</div>
|
|
1094
|
+
<div class="ax-text-editor-swatches-row">
|
|
1095
|
+
@for (color of resolvedTextColors(); track color) {
|
|
1096
|
+
<button
|
|
1097
|
+
type="button"
|
|
1098
|
+
class="ax-text-editor-swatch ax-text-editor-swatch-letter"
|
|
1099
|
+
[class.ax-state-selected]="isTextSelected(color)"
|
|
1100
|
+
[attr.title]="color"
|
|
1101
|
+
(click)="applyText(color)"
|
|
1102
|
+
>
|
|
1103
|
+
<span [style.color]="color">A</span>
|
|
1104
|
+
</button>
|
|
1105
|
+
}
|
|
1106
|
+
</div>
|
|
1107
|
+
</div>
|
|
1108
|
+
<div class="ax-text-editor-swatches-section">
|
|
1109
|
+
<div class="ax-text-editor-swatches-title">Highlight Color</div>
|
|
1110
|
+
<div class="ax-text-editor-swatches-row">
|
|
1111
|
+
@for (color of resolvedBackgroundColors(); track color) {
|
|
1112
|
+
<button
|
|
1113
|
+
type="button"
|
|
1114
|
+
class="ax-text-editor-swatch ax-text-editor-swatch-dot"
|
|
1115
|
+
[class.ax-state-selected]="isBackgroundSelected(color)"
|
|
1116
|
+
[style.background-color]="color"
|
|
1117
|
+
[attr.title]="color"
|
|
1118
|
+
(click)="applyBackground(color)"
|
|
1119
|
+
></button>
|
|
1120
|
+
}
|
|
1121
|
+
</div>
|
|
1122
|
+
</div>
|
|
1123
|
+
</div>
|
|
1124
|
+
</ax-dropdown-button>
|
|
1125
|
+
`, isInline: true, styles: ["@layer properties;@layer components{ax-text-editor-color-swatches{position:relative;z-index:20;display:inline-flex;align-items:center}.ax-text-editor-swatches-trigger{display:inline-flex;height:calc(var(--spacing, .25rem) * 6);width:calc(var(--spacing, .25rem) * 6);align-items:center;justify-content:center;border-radius:var(--radius-sm, .25rem);font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-font-weight: var(--font-weight-semibold, 600);font-weight:var(--font-weight-semibold, 600)}ax-text-editor-color-swatches ax-dropdown-button ax-suffix{display:none}.ax-overlay-pane:has(.ax-text-editor-swatches-panel){width:max-content;min-width:0}.ax-text-editor-swatches-panel{display:flex;width:max-content;flex-direction:column;gap:12px;padding:12px}.ax-text-editor-swatches-section{display:flex;flex-direction:column;gap:8px}.ax-text-editor-swatches-title{font-size:13px;font-weight:500;line-height:1.25;color:#374151}.ax-text-editor-swatches-row{display:grid;grid-template-columns:repeat(4,28px);gap:8px 10px}.ax-text-editor-swatch{display:inline-flex;width:28px;height:28px;flex-shrink:0;cursor:pointer;align-items:center;justify-content:center;padding:0;border:1px solid transparent;border-radius:9999px;background:transparent}.ax-text-editor-swatch-letter{border-color:#d1d5db;background:#fff;font-size:13px;font-weight:600;line-height:1}.ax-text-editor-swatch-dot{border-color:#e5e7eb}.ax-text-editor-swatch.ax-state-selected{box-shadow:0 0 0 2px var(--ax-sys-color-primary, #8b5cf6)}}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight: initial}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: AXDropdownButtonComponent, selector: "ax-dropdown-button", inputs: ["disabled", "size", "text", "selected", "color", "look", "type", "mode", "iconOnly"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "lookChange", "colorChange", "disabledChange"] }, { kind: "component", type: AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1126
|
+
}
|
|
1127
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorColorSwatchesComponent, decorators: [{
|
|
1128
|
+
type: Component,
|
|
1129
|
+
args: [{ selector: 'ax-text-editor-color-swatches', template: `
|
|
1130
|
+
<ax-dropdown-button class="ax-sm" look="blank" mode="dropdown" [iconOnly]="true" text="Colors">
|
|
1131
|
+
<ax-prefix>
|
|
1132
|
+
<span
|
|
1133
|
+
class="ax-text-editor-swatches-trigger"
|
|
1134
|
+
[style.color]="editorService.textColor() || 'currentColor'"
|
|
1135
|
+
[style.background-color]="editorService.highlightColor() || 'transparent'"
|
|
1136
|
+
>
|
|
1137
|
+
A
|
|
1138
|
+
</span>
|
|
1139
|
+
</ax-prefix>
|
|
1140
|
+
<div class="ax-text-editor-swatches-panel" (click)="$event.stopPropagation()" (mousedown)="$event.stopPropagation()">
|
|
1141
|
+
@if (recentColors().length) {
|
|
1142
|
+
<div class="ax-text-editor-swatches-section">
|
|
1143
|
+
<div class="ax-text-editor-swatches-title">Recently Used</div>
|
|
1144
|
+
<div class="ax-text-editor-swatches-row">
|
|
1145
|
+
@for (item of recentColors(); track item.kind + item.color) {
|
|
1146
|
+
<button
|
|
1147
|
+
type="button"
|
|
1148
|
+
class="ax-text-editor-swatch"
|
|
1149
|
+
[class.ax-text-editor-swatch-letter]="item.kind === 'text'"
|
|
1150
|
+
[class.ax-text-editor-swatch-dot]="item.kind === 'background'"
|
|
1151
|
+
[style.background-color]="item.kind === 'background' ? item.color : null"
|
|
1152
|
+
[attr.title]="item.color"
|
|
1153
|
+
(click)="applyRecent(item)"
|
|
1154
|
+
>
|
|
1155
|
+
@if (item.kind === 'text') {
|
|
1156
|
+
<span [style.color]="item.color">A</span>
|
|
1157
|
+
}
|
|
1158
|
+
</button>
|
|
1159
|
+
}
|
|
1160
|
+
</div>
|
|
1161
|
+
</div>
|
|
1162
|
+
}
|
|
1163
|
+
<div class="ax-text-editor-swatches-section">
|
|
1164
|
+
<div class="ax-text-editor-swatches-title">Text Color</div>
|
|
1165
|
+
<div class="ax-text-editor-swatches-row">
|
|
1166
|
+
@for (color of resolvedTextColors(); track color) {
|
|
1167
|
+
<button
|
|
1168
|
+
type="button"
|
|
1169
|
+
class="ax-text-editor-swatch ax-text-editor-swatch-letter"
|
|
1170
|
+
[class.ax-state-selected]="isTextSelected(color)"
|
|
1171
|
+
[attr.title]="color"
|
|
1172
|
+
(click)="applyText(color)"
|
|
1173
|
+
>
|
|
1174
|
+
<span [style.color]="color">A</span>
|
|
1175
|
+
</button>
|
|
1176
|
+
}
|
|
1177
|
+
</div>
|
|
1178
|
+
</div>
|
|
1179
|
+
<div class="ax-text-editor-swatches-section">
|
|
1180
|
+
<div class="ax-text-editor-swatches-title">Highlight Color</div>
|
|
1181
|
+
<div class="ax-text-editor-swatches-row">
|
|
1182
|
+
@for (color of resolvedBackgroundColors(); track color) {
|
|
1183
|
+
<button
|
|
1184
|
+
type="button"
|
|
1185
|
+
class="ax-text-editor-swatch ax-text-editor-swatch-dot"
|
|
1186
|
+
[class.ax-state-selected]="isBackgroundSelected(color)"
|
|
1187
|
+
[style.background-color]="color"
|
|
1188
|
+
[attr.title]="color"
|
|
1189
|
+
(click)="applyBackground(color)"
|
|
1190
|
+
></button>
|
|
1191
|
+
}
|
|
1192
|
+
</div>
|
|
1193
|
+
</div>
|
|
1194
|
+
</div>
|
|
1195
|
+
</ax-dropdown-button>
|
|
1196
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [AXDropdownButtonComponent, AXDecoratorGenericComponent], providers: [
|
|
1197
|
+
{ provide: AXComponent, useExisting: AXTextEditorColorSwatchesComponent },
|
|
1198
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorColorSwatchesComponent },
|
|
1199
|
+
], styles: ["@layer properties;@layer components{ax-text-editor-color-swatches{position:relative;z-index:20;display:inline-flex;align-items:center}.ax-text-editor-swatches-trigger{display:inline-flex;height:calc(var(--spacing, .25rem) * 6);width:calc(var(--spacing, .25rem) * 6);align-items:center;justify-content:center;border-radius:var(--radius-sm, .25rem);font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-font-weight: var(--font-weight-semibold, 600);font-weight:var(--font-weight-semibold, 600)}ax-text-editor-color-swatches ax-dropdown-button ax-suffix{display:none}.ax-overlay-pane:has(.ax-text-editor-swatches-panel){width:max-content;min-width:0}.ax-text-editor-swatches-panel{display:flex;width:max-content;flex-direction:column;gap:12px;padding:12px}.ax-text-editor-swatches-section{display:flex;flex-direction:column;gap:8px}.ax-text-editor-swatches-title{font-size:13px;font-weight:500;line-height:1.25;color:#374151}.ax-text-editor-swatches-row{display:grid;grid-template-columns:repeat(4,28px);gap:8px 10px}.ax-text-editor-swatch{display:inline-flex;width:28px;height:28px;flex-shrink:0;cursor:pointer;align-items:center;justify-content:center;padding:0;border:1px solid transparent;border-radius:9999px;background:transparent}.ax-text-editor-swatch-letter{border-color:#d1d5db;background:#fff;font-size:13px;font-weight:600;line-height:1}.ax-text-editor-swatch-dot{border-color:#e5e7eb}.ax-text-editor-swatch.ax-state-selected{box-shadow:0 0 0 2px var(--ax-sys-color-primary, #8b5cf6)}}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight: initial}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
1200
|
+
}], propDecorators: { textColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "textColors", required: false }] }], backgroundColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "backgroundColors", required: false }] }], recentColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "recentColors", required: false }] }, { type: i0.Output, args: ["recentColorsChange"] }] } });
|
|
1201
|
+
function sameColor(left, right) {
|
|
1202
|
+
return (left ?? '').replaceAll(' ', '').toLowerCase() === right.replaceAll(' ', '').toLowerCase();
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
class AXTextEditorColorsComponent extends AXTextEditorSlot {
|
|
1206
|
+
constructor() {
|
|
1207
|
+
super(...arguments);
|
|
1208
|
+
this.editorService = inject(AXTextEditorService);
|
|
1209
|
+
}
|
|
1210
|
+
setColor(color) {
|
|
1211
|
+
if (color)
|
|
1212
|
+
this.editorService.run('color', { color });
|
|
1213
|
+
else
|
|
1214
|
+
this.editorService.run('color');
|
|
1215
|
+
}
|
|
1216
|
+
setHighlight(color) {
|
|
1217
|
+
if (color)
|
|
1218
|
+
this.editorService.run('highlight', { color });
|
|
1219
|
+
else
|
|
1220
|
+
this.editorService.run('highlight');
|
|
1221
|
+
}
|
|
1222
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorColorsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1223
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.6", type: AXTextEditorColorsComponent, isStandalone: true, selector: "ax-text-editor-colors", providers: [
|
|
1224
|
+
{ provide: AXComponent, useExisting: AXTextEditorColorsComponent },
|
|
1225
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorColorsComponent },
|
|
1226
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
1227
|
+
<ax-dropdown-button class="ax-sm" look="blank" mode="dropdown" [iconOnly]="true" text="Text color">
|
|
1228
|
+
<ax-prefix class="ax-text-editor-color-trigger">
|
|
1229
|
+
<ax-icon class="ax-icon ax-icon-color-palette"></ax-icon>
|
|
1230
|
+
<ax-badge
|
|
1231
|
+
text=""
|
|
1232
|
+
class="ax-text-editor-color-badge"
|
|
1233
|
+
[look]="editorService.textColor() ? 'solid' : 'outline'"
|
|
1234
|
+
[style.background-color]="editorService.textColor()"
|
|
1235
|
+
></ax-badge>
|
|
1236
|
+
</ax-prefix>
|
|
1237
|
+
<ax-color-palette
|
|
1238
|
+
class="ax-text-editor-color-palette"
|
|
1239
|
+
[ngModel]="editorService.textColor()"
|
|
1240
|
+
(ngModelChange)="setColor($event)"
|
|
1241
|
+
>
|
|
1242
|
+
<ax-color-palette-picker></ax-color-palette-picker>
|
|
1243
|
+
<ax-color-palette-swatches></ax-color-palette-swatches>
|
|
1244
|
+
<ax-color-palette-input></ax-color-palette-input>
|
|
1245
|
+
</ax-color-palette>
|
|
1246
|
+
</ax-dropdown-button>
|
|
1247
|
+
|
|
1248
|
+
<ax-dropdown-button class="ax-sm" look="blank" mode="dropdown" [iconOnly]="true" text="Highlight">
|
|
1249
|
+
<ax-prefix class="ax-text-editor-color-trigger">
|
|
1250
|
+
<ax-icon class="ax-icon ax-icon-highlight"></ax-icon>
|
|
1251
|
+
<ax-badge
|
|
1252
|
+
text=""
|
|
1253
|
+
class="ax-text-editor-color-badge"
|
|
1254
|
+
[look]="editorService.highlightColor() ? 'solid' : 'outline'"
|
|
1255
|
+
[style.background-color]="editorService.highlightColor()"
|
|
1256
|
+
></ax-badge>
|
|
1257
|
+
</ax-prefix>
|
|
1258
|
+
<ax-color-palette
|
|
1259
|
+
class="ax-text-editor-color-palette"
|
|
1260
|
+
[ngModel]="editorService.highlightColor()"
|
|
1261
|
+
(ngModelChange)="setHighlight($event)"
|
|
1262
|
+
>
|
|
1263
|
+
<ax-color-palette-picker></ax-color-palette-picker>
|
|
1264
|
+
<ax-color-palette-swatches></ax-color-palette-swatches>
|
|
1265
|
+
<ax-color-palette-input></ax-color-palette-input>
|
|
1266
|
+
</ax-color-palette>
|
|
1267
|
+
</ax-dropdown-button>
|
|
1268
|
+
`, isInline: true, styles: ["@layer components{ax-text-editor-colors{position:relative;z-index:20;display:flex;align-items:center;gap:calc(var(--spacing, .25rem) * 1)}.ax-text-editor-color-trigger{display:inline-flex;align-items:center;gap:calc(var(--spacing, .25rem) * 1)}.ax-text-editor-color-badge{pointer-events:none;box-shadow:inset 0 0 0 1px currentColor}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-color-badge{box-shadow:inset 0 0 0 1px color-mix(in oklab,currentColor 25%,transparent)}}.ax-text-editor-color-palette{width:calc(var(--spacing, .25rem) * 72);max-width:min(18rem,calc(100vw - 2rem));padding:calc(var(--spacing, .25rem) * 2)}@media(min-width:48rem){.ax-text-editor-color-palette{width:calc(var(--spacing, .25rem) * 80)}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: AXDropdownButtonComponent, selector: "ax-dropdown-button", inputs: ["disabled", "size", "text", "selected", "color", "look", "type", "mode", "iconOnly"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "lookChange", "colorChange", "disabledChange"] }, { kind: "component", type: AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: AXBadgeComponent, selector: "ax-badge", inputs: ["color", "look", "text"] }, { kind: "component", type: AXColorPaletteComponent, selector: "ax-color-palette", inputs: ["disabled", "tabIndex", "readonly", "value", "state", "name"], outputs: ["onBlur", "onFocus", "valueChange", "stateChange", "onValueChanged", "readonlyChange", "disabledChange"] }, { kind: "component", type: AXColorPalettePickerComponent, selector: "ax-color-palette-picker" }, { kind: "component", type: AXColorPaletteSwatchesComponent, selector: "ax-color-palette-swatches, ax-color-palette-favorite", inputs: ["colors"] }, { kind: "component", type: AXColorPaletteInputComponent, selector: "ax-color-palette-input" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1269
|
+
}
|
|
1270
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorColorsComponent, decorators: [{
|
|
1271
|
+
type: Component,
|
|
1272
|
+
args: [{ selector: 'ax-text-editor-colors', template: `
|
|
1273
|
+
<ax-dropdown-button class="ax-sm" look="blank" mode="dropdown" [iconOnly]="true" text="Text color">
|
|
1274
|
+
<ax-prefix class="ax-text-editor-color-trigger">
|
|
1275
|
+
<ax-icon class="ax-icon ax-icon-color-palette"></ax-icon>
|
|
1276
|
+
<ax-badge
|
|
1277
|
+
text=""
|
|
1278
|
+
class="ax-text-editor-color-badge"
|
|
1279
|
+
[look]="editorService.textColor() ? 'solid' : 'outline'"
|
|
1280
|
+
[style.background-color]="editorService.textColor()"
|
|
1281
|
+
></ax-badge>
|
|
1282
|
+
</ax-prefix>
|
|
1283
|
+
<ax-color-palette
|
|
1284
|
+
class="ax-text-editor-color-palette"
|
|
1285
|
+
[ngModel]="editorService.textColor()"
|
|
1286
|
+
(ngModelChange)="setColor($event)"
|
|
1287
|
+
>
|
|
1288
|
+
<ax-color-palette-picker></ax-color-palette-picker>
|
|
1289
|
+
<ax-color-palette-swatches></ax-color-palette-swatches>
|
|
1290
|
+
<ax-color-palette-input></ax-color-palette-input>
|
|
1291
|
+
</ax-color-palette>
|
|
1292
|
+
</ax-dropdown-button>
|
|
1293
|
+
|
|
1294
|
+
<ax-dropdown-button class="ax-sm" look="blank" mode="dropdown" [iconOnly]="true" text="Highlight">
|
|
1295
|
+
<ax-prefix class="ax-text-editor-color-trigger">
|
|
1296
|
+
<ax-icon class="ax-icon ax-icon-highlight"></ax-icon>
|
|
1297
|
+
<ax-badge
|
|
1298
|
+
text=""
|
|
1299
|
+
class="ax-text-editor-color-badge"
|
|
1300
|
+
[look]="editorService.highlightColor() ? 'solid' : 'outline'"
|
|
1301
|
+
[style.background-color]="editorService.highlightColor()"
|
|
1302
|
+
></ax-badge>
|
|
1303
|
+
</ax-prefix>
|
|
1304
|
+
<ax-color-palette
|
|
1305
|
+
class="ax-text-editor-color-palette"
|
|
1306
|
+
[ngModel]="editorService.highlightColor()"
|
|
1307
|
+
(ngModelChange)="setHighlight($event)"
|
|
1308
|
+
>
|
|
1309
|
+
<ax-color-palette-picker></ax-color-palette-picker>
|
|
1310
|
+
<ax-color-palette-swatches></ax-color-palette-swatches>
|
|
1311
|
+
<ax-color-palette-input></ax-color-palette-input>
|
|
1312
|
+
</ax-color-palette>
|
|
1313
|
+
</ax-dropdown-button>
|
|
1314
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
1315
|
+
AXDropdownButtonComponent,
|
|
1316
|
+
AXDecoratorGenericComponent,
|
|
1317
|
+
AXDecoratorIconComponent,
|
|
1318
|
+
AXBadgeComponent,
|
|
1319
|
+
AXColorPaletteComponent,
|
|
1320
|
+
AXColorPalettePickerComponent,
|
|
1321
|
+
AXColorPaletteSwatchesComponent,
|
|
1322
|
+
AXColorPaletteInputComponent,
|
|
1323
|
+
FormsModule,
|
|
1324
|
+
], providers: [
|
|
1325
|
+
{ provide: AXComponent, useExisting: AXTextEditorColorsComponent },
|
|
1326
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorColorsComponent },
|
|
1327
|
+
], styles: ["@layer components{ax-text-editor-colors{position:relative;z-index:20;display:flex;align-items:center;gap:calc(var(--spacing, .25rem) * 1)}.ax-text-editor-color-trigger{display:inline-flex;align-items:center;gap:calc(var(--spacing, .25rem) * 1)}.ax-text-editor-color-badge{pointer-events:none;box-shadow:inset 0 0 0 1px currentColor}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-color-badge{box-shadow:inset 0 0 0 1px color-mix(in oklab,currentColor 25%,transparent)}}.ax-text-editor-color-palette{width:calc(var(--spacing, .25rem) * 72);max-width:min(18rem,calc(100vw - 2rem));padding:calc(var(--spacing, .25rem) * 2)}@media(min-width:48rem){.ax-text-editor-color-palette{width:calc(var(--spacing, .25rem) * 80)}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
1328
|
+
}] });
|
|
1329
|
+
|
|
1330
|
+
class AXTextEditorFontStyleComponent extends AXTextEditorSlot {
|
|
1331
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorFontStyleComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1332
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.6", type: AXTextEditorFontStyleComponent, isStandalone: true, selector: "ax-text-editor-font-style", providers: [
|
|
1333
|
+
{ provide: AXComponent, useExisting: AXTextEditorFontStyleComponent },
|
|
1334
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorFontStyleComponent },
|
|
1335
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
1336
|
+
<ax-text-editor-command command="bold" icon="ax-icon-bold" label="Bold" />
|
|
1337
|
+
<ax-text-editor-command command="italic" icon="ax-icon-italic" label="Italic" />
|
|
1338
|
+
<ax-text-editor-command command="underline" icon="ax-icon-under-line" label="Underline" />
|
|
1339
|
+
<ax-text-editor-command command="strike" icon="ax-icon-strike" label="Strikethrough" />
|
|
1340
|
+
<ax-text-editor-command command="code" icon="ax-icon-code" label="Code" />
|
|
1341
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AXTextEditorCommandComponent, selector: "ax-text-editor-command", inputs: ["command", "attrs", "icon", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1342
|
+
}
|
|
1343
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorFontStyleComponent, decorators: [{
|
|
1344
|
+
type: Component,
|
|
1345
|
+
args: [{
|
|
1346
|
+
selector: 'ax-text-editor-font-style',
|
|
1347
|
+
template: `
|
|
1348
|
+
<ax-text-editor-command command="bold" icon="ax-icon-bold" label="Bold" />
|
|
1349
|
+
<ax-text-editor-command command="italic" icon="ax-icon-italic" label="Italic" />
|
|
1350
|
+
<ax-text-editor-command command="underline" icon="ax-icon-under-line" label="Underline" />
|
|
1351
|
+
<ax-text-editor-command command="strike" icon="ax-icon-strike" label="Strikethrough" />
|
|
1352
|
+
<ax-text-editor-command command="code" icon="ax-icon-code" label="Code" />
|
|
1353
|
+
`,
|
|
1354
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1355
|
+
encapsulation: ViewEncapsulation.None,
|
|
1356
|
+
imports: [AXTextEditorCommandComponent],
|
|
1357
|
+
providers: [
|
|
1358
|
+
{ provide: AXComponent, useExisting: AXTextEditorFontStyleComponent },
|
|
1359
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorFontStyleComponent },
|
|
1360
|
+
],
|
|
1361
|
+
}]
|
|
1362
|
+
}] });
|
|
1363
|
+
|
|
1364
|
+
class AXTextEditorHeadingComponent extends AXTextEditorSlot {
|
|
1365
|
+
constructor() {
|
|
1366
|
+
super(...arguments);
|
|
1367
|
+
this.editorService = inject(AXTextEditorService);
|
|
1368
|
+
this.editorReady = computed(() => this.editorService.editor() != null, /* @ts-ignore */
|
|
1369
|
+
...(ngDevMode ? [{ debugName: "editorReady" }] : /* istanbul ignore next */ []));
|
|
1370
|
+
this.isParagraphSelected = computed(() => this.editorService.isActive('paragraph'), /* @ts-ignore */
|
|
1371
|
+
...(ngDevMode ? [{ debugName: "isParagraphSelected" }] : /* istanbul ignore next */ []));
|
|
1372
|
+
this.isH1 = computed(() => this.editorService.isActive('heading', { level: 1 }), /* @ts-ignore */
|
|
1373
|
+
...(ngDevMode ? [{ debugName: "isH1" }] : /* istanbul ignore next */ []));
|
|
1374
|
+
this.isH2 = computed(() => this.editorService.isActive('heading', { level: 2 }), /* @ts-ignore */
|
|
1375
|
+
...(ngDevMode ? [{ debugName: "isH2" }] : /* istanbul ignore next */ []));
|
|
1376
|
+
this.isH3 = computed(() => this.editorService.isActive('heading', { level: 3 }), /* @ts-ignore */
|
|
1377
|
+
...(ngDevMode ? [{ debugName: "isH3" }] : /* istanbul ignore next */ []));
|
|
1378
|
+
this.currentLabel = computed(() => {
|
|
1379
|
+
if (this.isH1())
|
|
1380
|
+
return 'H1';
|
|
1381
|
+
if (this.isH2())
|
|
1382
|
+
return 'H2';
|
|
1383
|
+
if (this.isH3())
|
|
1384
|
+
return 'H3';
|
|
1385
|
+
return 'Paragraph';
|
|
1386
|
+
}, /* @ts-ignore */
|
|
1387
|
+
...(ngDevMode ? [{ debugName: "currentLabel" }] : /* istanbul ignore next */ []));
|
|
1388
|
+
}
|
|
1389
|
+
onSelect(event) {
|
|
1390
|
+
const data = (event.data ?? {});
|
|
1391
|
+
const level = Number(data.level);
|
|
1392
|
+
if (level === 1 || level === 2 || level === 3) {
|
|
1393
|
+
this.editorService.run('heading', { level });
|
|
1394
|
+
}
|
|
1395
|
+
else {
|
|
1396
|
+
this.editorService.run('paragraph');
|
|
1397
|
+
}
|
|
1398
|
+
setTimeout(() => this.editorService.focus());
|
|
1399
|
+
}
|
|
1400
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorHeadingComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1401
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.6", type: AXTextEditorHeadingComponent, isStandalone: true, selector: "ax-text-editor-heading", providers: [
|
|
1402
|
+
{ provide: AXComponent, useExisting: AXTextEditorHeadingComponent },
|
|
1403
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorHeadingComponent },
|
|
1404
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
1405
|
+
<ax-dropdown-button
|
|
1406
|
+
class="ax-sm"
|
|
1407
|
+
look="blank"
|
|
1408
|
+
mode="dropdown"
|
|
1409
|
+
[iconOnly]="true"
|
|
1410
|
+
text="Paragraph"
|
|
1411
|
+
[disabled]="!editorReady()"
|
|
1412
|
+
[attr.title]="currentLabel()"
|
|
1413
|
+
>
|
|
1414
|
+
<ax-prefix>
|
|
1415
|
+
<ax-icon class="ax-icon ax-icon-paragraph"></ax-icon>
|
|
1416
|
+
</ax-prefix>
|
|
1417
|
+
<ax-button-item-list (mousedown)="$event.preventDefault()" (onItemClick)="onSelect($event)">
|
|
1418
|
+
<ax-button-item text="Paragraph" [data]="{ level: null }" [selected]="isParagraphSelected()"></ax-button-item>
|
|
1419
|
+
<ax-button-item text="Heading 1" [data]="{ level: 1 }" [selected]="isH1()"></ax-button-item>
|
|
1420
|
+
<ax-button-item text="Heading 2" [data]="{ level: 2 }" [selected]="isH2()"></ax-button-item>
|
|
1421
|
+
<ax-button-item text="Heading 3" [data]="{ level: 3 }" [selected]="isH3()"></ax-button-item>
|
|
1422
|
+
</ax-button-item-list>
|
|
1423
|
+
</ax-dropdown-button>
|
|
1424
|
+
<ax-text-editor-command command="direction" [attrs]="{ direction: 'ltr' }" icon="ax-icon-ltr" label="LTR" />
|
|
1425
|
+
<ax-text-editor-command command="direction" [attrs]="{ direction: 'rtl' }" icon="ax-icon-rtl" label="RTL" />
|
|
1426
|
+
`, isInline: true, styles: ["ax-text-editor-heading .ax-icon-rtl{transform:scaleX(-1)}\n"], dependencies: [{ kind: "component", type: AXDropdownButtonComponent, selector: "ax-dropdown-button", inputs: ["disabled", "size", "text", "selected", "color", "look", "type", "mode", "iconOnly"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "lookChange", "colorChange", "disabledChange"] }, { kind: "component", type: AXButtonItemListComponent, selector: "ax-button-item-list", inputs: ["items", "closeParentOnClick", "lockOnLoading"], outputs: ["onItemClick"] }, { kind: "component", type: AXButtonItemComponent, selector: "ax-button-item", inputs: ["color", "disabled", "text", "selected", "divided", "data", "name"], outputs: ["onClick", "onFocus", "onBlur", "disabledChange"] }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "component", type: AXTextEditorCommandComponent, selector: "ax-text-editor-command", inputs: ["command", "attrs", "icon", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1427
|
+
}
|
|
1428
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorHeadingComponent, decorators: [{
|
|
1429
|
+
type: Component,
|
|
1430
|
+
args: [{ selector: 'ax-text-editor-heading', template: `
|
|
1431
|
+
<ax-dropdown-button
|
|
1432
|
+
class="ax-sm"
|
|
1433
|
+
look="blank"
|
|
1434
|
+
mode="dropdown"
|
|
1435
|
+
[iconOnly]="true"
|
|
1436
|
+
text="Paragraph"
|
|
1437
|
+
[disabled]="!editorReady()"
|
|
1438
|
+
[attr.title]="currentLabel()"
|
|
1439
|
+
>
|
|
1440
|
+
<ax-prefix>
|
|
1441
|
+
<ax-icon class="ax-icon ax-icon-paragraph"></ax-icon>
|
|
1442
|
+
</ax-prefix>
|
|
1443
|
+
<ax-button-item-list (mousedown)="$event.preventDefault()" (onItemClick)="onSelect($event)">
|
|
1444
|
+
<ax-button-item text="Paragraph" [data]="{ level: null }" [selected]="isParagraphSelected()"></ax-button-item>
|
|
1445
|
+
<ax-button-item text="Heading 1" [data]="{ level: 1 }" [selected]="isH1()"></ax-button-item>
|
|
1446
|
+
<ax-button-item text="Heading 2" [data]="{ level: 2 }" [selected]="isH2()"></ax-button-item>
|
|
1447
|
+
<ax-button-item text="Heading 3" [data]="{ level: 3 }" [selected]="isH3()"></ax-button-item>
|
|
1448
|
+
</ax-button-item-list>
|
|
1449
|
+
</ax-dropdown-button>
|
|
1450
|
+
<ax-text-editor-command command="direction" [attrs]="{ direction: 'ltr' }" icon="ax-icon-ltr" label="LTR" />
|
|
1451
|
+
<ax-text-editor-command command="direction" [attrs]="{ direction: 'rtl' }" icon="ax-icon-rtl" label="RTL" />
|
|
1452
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
1453
|
+
AXDropdownButtonComponent,
|
|
1454
|
+
AXButtonItemListComponent,
|
|
1455
|
+
AXButtonItemComponent,
|
|
1456
|
+
AXDecoratorIconComponent,
|
|
1457
|
+
AXDecoratorGenericComponent,
|
|
1458
|
+
AXTextEditorCommandComponent,
|
|
1459
|
+
], providers: [
|
|
1460
|
+
{ provide: AXComponent, useExisting: AXTextEditorHeadingComponent },
|
|
1461
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorHeadingComponent },
|
|
1462
|
+
], styles: ["ax-text-editor-heading .ax-icon-rtl{transform:scaleX(-1)}\n"] }]
|
|
1463
|
+
}] });
|
|
1464
|
+
|
|
1465
|
+
class AXTextEditorHistoryComponent extends AXTextEditorSlot {
|
|
1466
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorHistoryComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1467
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.6", type: AXTextEditorHistoryComponent, isStandalone: true, selector: "ax-text-editor-history", providers: [
|
|
1468
|
+
{ provide: AXComponent, useExisting: AXTextEditorHistoryComponent },
|
|
1469
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorHistoryComponent },
|
|
1470
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
1471
|
+
<ax-text-editor-command command="undo" icon="ax-icon-undo" label="Undo" />
|
|
1472
|
+
<ax-text-editor-command command="redo" icon="ax-icon-redo" label="Redo" />
|
|
1473
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AXTextEditorCommandComponent, selector: "ax-text-editor-command", inputs: ["command", "attrs", "icon", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1474
|
+
}
|
|
1475
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorHistoryComponent, decorators: [{
|
|
1476
|
+
type: Component,
|
|
1477
|
+
args: [{
|
|
1478
|
+
selector: 'ax-text-editor-history',
|
|
1479
|
+
template: `
|
|
1480
|
+
<ax-text-editor-command command="undo" icon="ax-icon-undo" label="Undo" />
|
|
1481
|
+
<ax-text-editor-command command="redo" icon="ax-icon-redo" label="Redo" />
|
|
1482
|
+
`,
|
|
1483
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1484
|
+
encapsulation: ViewEncapsulation.None,
|
|
1485
|
+
imports: [AXTextEditorCommandComponent],
|
|
1486
|
+
providers: [
|
|
1487
|
+
{ provide: AXComponent, useExisting: AXTextEditorHistoryComponent },
|
|
1488
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorHistoryComponent },
|
|
1489
|
+
],
|
|
1490
|
+
}]
|
|
1491
|
+
}] });
|
|
1492
|
+
|
|
1493
|
+
class AXTextEditorLinkComponent extends AXTextEditorSlot {
|
|
1494
|
+
constructor() {
|
|
1495
|
+
super(...arguments);
|
|
1496
|
+
this.editorService = inject(AXTextEditorService);
|
|
1497
|
+
this.dropdown = viewChild('dropdown', /* @ts-ignore */
|
|
1498
|
+
...(ngDevMode ? [{ debugName: "dropdown" }] : /* istanbul ignore next */ []));
|
|
1499
|
+
this.href = signal('', /* @ts-ignore */
|
|
1500
|
+
...(ngDevMode ? [{ debugName: "href" }] : /* istanbul ignore next */ []));
|
|
1501
|
+
this.active = computed(() => this.editorService.isActive('link'), /* @ts-ignore */
|
|
1502
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
1503
|
+
this.savedFrom = 0;
|
|
1504
|
+
this.savedTo = 0;
|
|
1505
|
+
}
|
|
1506
|
+
syncHref() {
|
|
1507
|
+
const editor = this.editorService.editor();
|
|
1508
|
+
this.savedFrom = editor?.state.selection.from ?? 0;
|
|
1509
|
+
this.savedTo = editor?.state.selection.to ?? 0;
|
|
1510
|
+
this.href.set(editor?.getAttributes('link')?.['href'] ?? '');
|
|
1511
|
+
}
|
|
1512
|
+
apply() {
|
|
1513
|
+
const editor = this.editorService.editor();
|
|
1514
|
+
const value = this.href().trim();
|
|
1515
|
+
if (!value) {
|
|
1516
|
+
this.remove();
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
editor?.chain().setTextSelection({ from: this.savedFrom, to: this.savedTo }).run();
|
|
1520
|
+
this.editorService.run('link', { href: value });
|
|
1521
|
+
this.dropdown()?.close();
|
|
1522
|
+
}
|
|
1523
|
+
remove() {
|
|
1524
|
+
const editor = this.editorService.editor();
|
|
1525
|
+
editor?.chain().setTextSelection({ from: this.savedFrom, to: this.savedTo }).run();
|
|
1526
|
+
this.editorService.run('unlink');
|
|
1527
|
+
this.href.set('');
|
|
1528
|
+
this.dropdown()?.close();
|
|
1529
|
+
}
|
|
1530
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorLinkComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1531
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.6", type: AXTextEditorLinkComponent, isStandalone: true, selector: "ax-text-editor-link", providers: [
|
|
1532
|
+
{ provide: AXComponent, useExisting: AXTextEditorLinkComponent },
|
|
1533
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorLinkComponent },
|
|
1534
|
+
], viewQueries: [{ propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
1535
|
+
<ax-dropdown-button
|
|
1536
|
+
#dropdown
|
|
1537
|
+
class="ax-sm"
|
|
1538
|
+
look="blank"
|
|
1539
|
+
mode="dropdown"
|
|
1540
|
+
[iconOnly]="true"
|
|
1541
|
+
text="Link"
|
|
1542
|
+
[selected]="active()"
|
|
1543
|
+
[attr.title]="'Link'"
|
|
1544
|
+
(onClick)="syncHref()"
|
|
1545
|
+
>
|
|
1546
|
+
<ax-prefix>
|
|
1547
|
+
<ax-icon class="ax-icon ax-icon-link"></ax-icon>
|
|
1548
|
+
</ax-prefix>
|
|
1549
|
+
<div class="ax-text-editor-link-panel" (click)="$event.stopPropagation()" (mousedown)="$event.stopPropagation()">
|
|
1550
|
+
<input
|
|
1551
|
+
class="ax-text-editor-link-input"
|
|
1552
|
+
type="url"
|
|
1553
|
+
placeholder="https://"
|
|
1554
|
+
[ngModel]="href()"
|
|
1555
|
+
(ngModelChange)="href.set($event)"
|
|
1556
|
+
(keydown.enter)="apply(); $event.preventDefault()"
|
|
1557
|
+
/>
|
|
1558
|
+
<ax-button class="ax-xs" look="solid" color="primary" text="Apply" (onClick)="apply()"></ax-button>
|
|
1559
|
+
<ax-button class="ax-xs" look="blank" text="Remove" (onClick)="remove()"></ax-button>
|
|
1560
|
+
</div>
|
|
1561
|
+
</ax-dropdown-button>
|
|
1562
|
+
`, isInline: true, styles: ["@layer properties;@layer components{.ax-text-editor-link-panel{display:flex;align-items:center;gap:calc(var(--spacing, .25rem) * 1);border-radius:var(--ax-sys-border-radius);background-color:rgba(var(--ax-sys-color-lightest-surface));padding:calc(var(--spacing, .25rem) * 2);--tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ax-text-editor-link-input{min-width:calc(var(--spacing, .25rem) * 40);border-radius:var(--ax-sys-border-radius);border-style:var(--tw-border-style);border-width:1px;border-color:rgba(var(--ax-sys-color-border-lightest-surface));background-color:transparent;padding-inline:calc(var(--spacing, .25rem) * 2);padding-block:calc(var(--spacing, .25rem) * 1);font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-outline-style: none;outline-style:none}}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000;--tw-border-style: solid}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: AXDropdownButtonComponent, selector: "ax-dropdown-button", inputs: ["disabled", "size", "text", "selected", "color", "look", "type", "mode", "iconOnly"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "lookChange", "colorChange", "disabledChange"] }, { kind: "component", type: AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1563
|
+
}
|
|
1564
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorLinkComponent, decorators: [{
|
|
1565
|
+
type: Component,
|
|
1566
|
+
args: [{ selector: 'ax-text-editor-link', template: `
|
|
1567
|
+
<ax-dropdown-button
|
|
1568
|
+
#dropdown
|
|
1569
|
+
class="ax-sm"
|
|
1570
|
+
look="blank"
|
|
1571
|
+
mode="dropdown"
|
|
1572
|
+
[iconOnly]="true"
|
|
1573
|
+
text="Link"
|
|
1574
|
+
[selected]="active()"
|
|
1575
|
+
[attr.title]="'Link'"
|
|
1576
|
+
(onClick)="syncHref()"
|
|
1577
|
+
>
|
|
1578
|
+
<ax-prefix>
|
|
1579
|
+
<ax-icon class="ax-icon ax-icon-link"></ax-icon>
|
|
1580
|
+
</ax-prefix>
|
|
1581
|
+
<div class="ax-text-editor-link-panel" (click)="$event.stopPropagation()" (mousedown)="$event.stopPropagation()">
|
|
1582
|
+
<input
|
|
1583
|
+
class="ax-text-editor-link-input"
|
|
1584
|
+
type="url"
|
|
1585
|
+
placeholder="https://"
|
|
1586
|
+
[ngModel]="href()"
|
|
1587
|
+
(ngModelChange)="href.set($event)"
|
|
1588
|
+
(keydown.enter)="apply(); $event.preventDefault()"
|
|
1589
|
+
/>
|
|
1590
|
+
<ax-button class="ax-xs" look="solid" color="primary" text="Apply" (onClick)="apply()"></ax-button>
|
|
1591
|
+
<ax-button class="ax-xs" look="blank" text="Remove" (onClick)="remove()"></ax-button>
|
|
1592
|
+
</div>
|
|
1593
|
+
</ax-dropdown-button>
|
|
1594
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
1595
|
+
AXDropdownButtonComponent,
|
|
1596
|
+
AXButtonComponent,
|
|
1597
|
+
AXDecoratorIconComponent,
|
|
1598
|
+
AXDecoratorGenericComponent,
|
|
1599
|
+
FormsModule,
|
|
1600
|
+
], providers: [
|
|
1601
|
+
{ provide: AXComponent, useExisting: AXTextEditorLinkComponent },
|
|
1602
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorLinkComponent },
|
|
1603
|
+
], styles: ["@layer properties;@layer components{.ax-text-editor-link-panel{display:flex;align-items:center;gap:calc(var(--spacing, .25rem) * 1);border-radius:var(--ax-sys-border-radius);background-color:rgba(var(--ax-sys-color-lightest-surface));padding:calc(var(--spacing, .25rem) * 2);--tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ax-text-editor-link-input{min-width:calc(var(--spacing, .25rem) * 40);border-radius:var(--ax-sys-border-radius);border-style:var(--tw-border-style);border-width:1px;border-color:rgba(var(--ax-sys-color-border-lightest-surface));background-color:transparent;padding-inline:calc(var(--spacing, .25rem) * 2);padding-block:calc(var(--spacing, .25rem) * 1);font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-outline-style: none;outline-style:none}}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000;--tw-border-style: solid}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
1604
|
+
}], propDecorators: { dropdown: [{ type: i0.ViewChild, args: ['dropdown', { isSignal: true }] }] } });
|
|
1605
|
+
|
|
1606
|
+
class AXTextEditorListComponent extends AXTextEditorSlot {
|
|
1607
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorListComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1608
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.6", type: AXTextEditorListComponent, isStandalone: true, selector: "ax-text-editor-list", providers: [
|
|
1609
|
+
{ provide: AXComponent, useExisting: AXTextEditorListComponent },
|
|
1610
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorListComponent },
|
|
1611
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
1612
|
+
<ax-text-editor-command command="bulletList" icon="ax-icon-un-order-list" label="Bullet list" />
|
|
1613
|
+
<ax-text-editor-command command="orderedList" icon="ax-icon-order-list" label="Ordered list" />
|
|
1614
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AXTextEditorCommandComponent, selector: "ax-text-editor-command", inputs: ["command", "attrs", "icon", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1615
|
+
}
|
|
1616
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorListComponent, decorators: [{
|
|
1617
|
+
type: Component,
|
|
1618
|
+
args: [{
|
|
1619
|
+
selector: 'ax-text-editor-list',
|
|
1620
|
+
template: `
|
|
1621
|
+
<ax-text-editor-command command="bulletList" icon="ax-icon-un-order-list" label="Bullet list" />
|
|
1622
|
+
<ax-text-editor-command command="orderedList" icon="ax-icon-order-list" label="Ordered list" />
|
|
1623
|
+
`,
|
|
1624
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1625
|
+
encapsulation: ViewEncapsulation.None,
|
|
1626
|
+
imports: [AXTextEditorCommandComponent],
|
|
1627
|
+
providers: [
|
|
1628
|
+
{ provide: AXComponent, useExisting: AXTextEditorListComponent },
|
|
1629
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorListComponent },
|
|
1630
|
+
],
|
|
1631
|
+
}]
|
|
1632
|
+
}] });
|
|
1633
|
+
|
|
1634
|
+
class AXTextEditorTableComponent extends AXTextEditorSlot {
|
|
1635
|
+
constructor() {
|
|
1636
|
+
super(...arguments);
|
|
1637
|
+
this.editorService = inject(AXTextEditorService);
|
|
1638
|
+
this.dropdown = viewChild('dropdown', /* @ts-ignore */
|
|
1639
|
+
...(ngDevMode ? [{ debugName: "dropdown" }] : /* istanbul ignore next */ []));
|
|
1640
|
+
this.cells = [1, 2, 3, 4, 5, 6, 7, 8];
|
|
1641
|
+
this.hover = signal({ rows: 0, cols: 0 }, /* @ts-ignore */
|
|
1642
|
+
...(ngDevMode ? [{ debugName: "hover" }] : /* istanbul ignore next */ []));
|
|
1643
|
+
this.sizeLabel = computed(() => {
|
|
1644
|
+
const { rows, cols } = this.hover();
|
|
1645
|
+
return rows && cols ? `${rows} × ${cols}` : 'Insert table';
|
|
1646
|
+
}, /* @ts-ignore */
|
|
1647
|
+
...(ngDevMode ? [{ debugName: "sizeLabel" }] : /* istanbul ignore next */ []));
|
|
1648
|
+
}
|
|
1649
|
+
isHighlighted(row, col) {
|
|
1650
|
+
const hover = this.hover();
|
|
1651
|
+
return hover.rows > 0 && hover.cols > 0 && row <= hover.rows && col <= hover.cols;
|
|
1652
|
+
}
|
|
1653
|
+
insert(rows, cols) {
|
|
1654
|
+
this.editorService.run('insertTable', { rows, cols, withHeaderRow: false });
|
|
1655
|
+
this.dropdown()?.close();
|
|
1656
|
+
}
|
|
1657
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1658
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: AXTextEditorTableComponent, isStandalone: true, selector: "ax-text-editor-table", providers: [
|
|
1659
|
+
{ provide: AXComponent, useExisting: AXTextEditorTableComponent },
|
|
1660
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorTableComponent },
|
|
1661
|
+
], viewQueries: [{ propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
1662
|
+
<ax-dropdown-button #dropdown class="ax-sm" look="blank" mode="dropdown" [iconOnly]="true" text="Insert table">
|
|
1663
|
+
<ax-prefix>
|
|
1664
|
+
<ax-icon class="ax-icon ax-icon-table"></ax-icon>
|
|
1665
|
+
</ax-prefix>
|
|
1666
|
+
<div class="ax-text-editor-table-picker" (mousedown)="$event.preventDefault()" (mouseleave)="hover.set({ rows: 0, cols: 0 })">
|
|
1667
|
+
<div class="ax-text-editor-table-grid">
|
|
1668
|
+
@for (row of cells; track row) {
|
|
1669
|
+
@for (col of cells; track col) {
|
|
1670
|
+
<button
|
|
1671
|
+
type="button"
|
|
1672
|
+
class="ax-text-editor-table-cell"
|
|
1673
|
+
[class.ax-state-active]="isHighlighted(row, col)"
|
|
1674
|
+
(mouseenter)="hover.set({ rows: row, cols: col })"
|
|
1675
|
+
(click)="insert(row, col)"
|
|
1676
|
+
></button>
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
</div>
|
|
1680
|
+
<div class="ax-text-editor-table-size">{{ sizeLabel() }}</div>
|
|
1681
|
+
</div>
|
|
1682
|
+
</ax-dropdown-button>
|
|
1683
|
+
`, isInline: true, styles: ["@layer properties;@layer components{.ax-text-editor-table-picker{min-width:calc(var(--spacing, .25rem) * 44);padding:calc(var(--spacing, .25rem) * 2)}.ax-text-editor-table-grid{display:grid;grid-template-columns:repeat(8,1.125rem);gap:.25rem}.ax-text-editor-table-cell{width:calc(var(--spacing, .25rem) * 4);height:calc(var(--spacing, .25rem) * 4);border-radius:var(--radius-sm, .25rem);border-style:var(--tw-border-style);border-width:1px;border-color:rgba(var(--ax-sys-color-border-lightest-surface));background-color:rgba(var(--ax-sys-color-lightest-surface));padding:calc(var(--spacing, .25rem) * 0)}.ax-text-editor-table-cell.ax-state-active{border-color:var(--ax-sys-color-primary, #3b82f6);background:var(--ax-sys-color-primary, #3b82f6)}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-table-cell.ax-state-active{background:color-mix(in oklab,var(--ax-sys-color-primary, #3b82f6) 18%,white)}}.ax-text-editor-table-size{margin-top:calc(var(--spacing, .25rem) * 2);text-align:center;font-size:var(--text-xs, .75rem);line-height:var(--tw-leading, var(--text-xs--line-height, calc(1 / .75)));color:currentColor}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-table-size{color:color-mix(in oklab,currentColor 70%,transparent)}}}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: AXDropdownButtonComponent, selector: "ax-dropdown-button", inputs: ["disabled", "size", "text", "selected", "color", "look", "type", "mode", "iconOnly"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "lookChange", "colorChange", "disabledChange"] }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1684
|
+
}
|
|
1685
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorTableComponent, decorators: [{
|
|
1686
|
+
type: Component,
|
|
1687
|
+
args: [{ selector: 'ax-text-editor-table', template: `
|
|
1688
|
+
<ax-dropdown-button #dropdown class="ax-sm" look="blank" mode="dropdown" [iconOnly]="true" text="Insert table">
|
|
1689
|
+
<ax-prefix>
|
|
1690
|
+
<ax-icon class="ax-icon ax-icon-table"></ax-icon>
|
|
1691
|
+
</ax-prefix>
|
|
1692
|
+
<div class="ax-text-editor-table-picker" (mousedown)="$event.preventDefault()" (mouseleave)="hover.set({ rows: 0, cols: 0 })">
|
|
1693
|
+
<div class="ax-text-editor-table-grid">
|
|
1694
|
+
@for (row of cells; track row) {
|
|
1695
|
+
@for (col of cells; track col) {
|
|
1696
|
+
<button
|
|
1697
|
+
type="button"
|
|
1698
|
+
class="ax-text-editor-table-cell"
|
|
1699
|
+
[class.ax-state-active]="isHighlighted(row, col)"
|
|
1700
|
+
(mouseenter)="hover.set({ rows: row, cols: col })"
|
|
1701
|
+
(click)="insert(row, col)"
|
|
1702
|
+
></button>
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
</div>
|
|
1706
|
+
<div class="ax-text-editor-table-size">{{ sizeLabel() }}</div>
|
|
1707
|
+
</div>
|
|
1708
|
+
</ax-dropdown-button>
|
|
1709
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [AXDropdownButtonComponent, AXDecoratorIconComponent, AXDecoratorGenericComponent], providers: [
|
|
1710
|
+
{ provide: AXComponent, useExisting: AXTextEditorTableComponent },
|
|
1711
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorTableComponent },
|
|
1712
|
+
], styles: ["@layer properties;@layer components{.ax-text-editor-table-picker{min-width:calc(var(--spacing, .25rem) * 44);padding:calc(var(--spacing, .25rem) * 2)}.ax-text-editor-table-grid{display:grid;grid-template-columns:repeat(8,1.125rem);gap:.25rem}.ax-text-editor-table-cell{width:calc(var(--spacing, .25rem) * 4);height:calc(var(--spacing, .25rem) * 4);border-radius:var(--radius-sm, .25rem);border-style:var(--tw-border-style);border-width:1px;border-color:rgba(var(--ax-sys-color-border-lightest-surface));background-color:rgba(var(--ax-sys-color-lightest-surface));padding:calc(var(--spacing, .25rem) * 0)}.ax-text-editor-table-cell.ax-state-active{border-color:var(--ax-sys-color-primary, #3b82f6);background:var(--ax-sys-color-primary, #3b82f6)}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-table-cell.ax-state-active{background:color-mix(in oklab,var(--ax-sys-color-primary, #3b82f6) 18%,white)}}.ax-text-editor-table-size{margin-top:calc(var(--spacing, .25rem) * 2);text-align:center;font-size:var(--text-xs, .75rem);line-height:var(--tw-leading, var(--text-xs--line-height, calc(1 / .75)));color:currentColor}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-table-size{color:color-mix(in oklab,currentColor 70%,transparent)}}}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
1713
|
+
}], propDecorators: { dropdown: [{ type: i0.ViewChild, args: ['dropdown', { isSignal: true }] }] } });
|
|
1714
|
+
|
|
1715
|
+
class AXTextEditorScriptComponent extends AXTextEditorSlot {
|
|
1716
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorScriptComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1717
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.6", type: AXTextEditorScriptComponent, isStandalone: true, selector: "ax-text-editor-script", providers: [
|
|
1718
|
+
{ provide: AXComponent, useExisting: AXTextEditorScriptComponent },
|
|
1719
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorScriptComponent },
|
|
1720
|
+
], usesInheritance: true, ngImport: i0, template: `
|
|
1721
|
+
<ax-text-editor-command command="superscript" icon="ax-icon-superscript" label="Superscript" />
|
|
1722
|
+
<ax-text-editor-command command="subscript" icon="ax-icon-subscript" label="Subscript" />
|
|
1723
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AXTextEditorCommandComponent, selector: "ax-text-editor-command", inputs: ["command", "attrs", "icon", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1724
|
+
}
|
|
1725
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorScriptComponent, decorators: [{
|
|
1726
|
+
type: Component,
|
|
1727
|
+
args: [{
|
|
1728
|
+
selector: 'ax-text-editor-script',
|
|
1729
|
+
template: `
|
|
1730
|
+
<ax-text-editor-command command="superscript" icon="ax-icon-superscript" label="Superscript" />
|
|
1731
|
+
<ax-text-editor-command command="subscript" icon="ax-icon-subscript" label="Subscript" />
|
|
1732
|
+
`,
|
|
1733
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1734
|
+
encapsulation: ViewEncapsulation.None,
|
|
1735
|
+
imports: [AXTextEditorCommandComponent],
|
|
1736
|
+
providers: [
|
|
1737
|
+
{ provide: AXComponent, useExisting: AXTextEditorScriptComponent },
|
|
1738
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorScriptComponent },
|
|
1739
|
+
],
|
|
1740
|
+
}]
|
|
1741
|
+
}] });
|
|
1742
|
+
|
|
1743
|
+
class AXTextEditorZoomComponent extends AXTextEditorSlot {
|
|
1744
|
+
constructor() {
|
|
1745
|
+
super(...arguments);
|
|
1746
|
+
this.editorService = inject(AXTextEditorService);
|
|
1747
|
+
this.dropdown = viewChild('dropdown', /* @ts-ignore */
|
|
1748
|
+
...(ngDevMode ? [{ debugName: "dropdown" }] : /* istanbul ignore next */ []));
|
|
1749
|
+
this.presets = AX_TEXT_EDITOR_ZOOM_PRESETS;
|
|
1750
|
+
this.draft = signal('100', /* @ts-ignore */
|
|
1751
|
+
...(ngDevMode ? [{ debugName: "draft" }] : /* istanbul ignore next */ []));
|
|
1752
|
+
this.zoomLabel = computed(() => `${this.editorService.zoom()}%`, /* @ts-ignore */
|
|
1753
|
+
...(ngDevMode ? [{ debugName: "zoomLabel" }] : /* istanbul ignore next */ []));
|
|
1754
|
+
this.canZoomOut = computed(() => this.editorService.zoom() > AX_TEXT_EDITOR_ZOOM_MIN, /* @ts-ignore */
|
|
1755
|
+
...(ngDevMode ? [{ debugName: "canZoomOut" }] : /* istanbul ignore next */ []));
|
|
1756
|
+
this.canZoomIn = computed(() => this.editorService.zoom() < AX_TEXT_EDITOR_ZOOM_MAX, /* @ts-ignore */
|
|
1757
|
+
...(ngDevMode ? [{ debugName: "canZoomIn" }] : /* istanbul ignore next */ []));
|
|
1758
|
+
}
|
|
1759
|
+
syncDraft() {
|
|
1760
|
+
this.draft.set(String(this.editorService.zoom()));
|
|
1761
|
+
}
|
|
1762
|
+
onDraftInput(event) {
|
|
1763
|
+
this.draft.set(event.target.value);
|
|
1764
|
+
}
|
|
1765
|
+
commitDraft() {
|
|
1766
|
+
const next = Number.parseInt(this.draft(), 10);
|
|
1767
|
+
if (Number.isFinite(next))
|
|
1768
|
+
this.editorService.setZoom(next);
|
|
1769
|
+
this.dropdown()?.close();
|
|
1770
|
+
}
|
|
1771
|
+
applyPreset(value) {
|
|
1772
|
+
this.editorService.setZoom(value);
|
|
1773
|
+
this.dropdown()?.close();
|
|
1774
|
+
}
|
|
1775
|
+
fitToPage() {
|
|
1776
|
+
this.editorService.fitToPage();
|
|
1777
|
+
this.dropdown()?.close();
|
|
1778
|
+
}
|
|
1779
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorZoomComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1780
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: AXTextEditorZoomComponent, isStandalone: true, selector: "ax-text-editor-zoom", host: { classAttribute: "ax-text-editor-zoom" }, providers: [
|
|
1781
|
+
{ provide: AXComponent, useExisting: AXTextEditorZoomComponent },
|
|
1782
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorZoomComponent },
|
|
1783
|
+
], viewQueries: [{ propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
1784
|
+
<ax-button
|
|
1785
|
+
class="ax-sm"
|
|
1786
|
+
look="blank"
|
|
1787
|
+
[iconOnly]="true"
|
|
1788
|
+
text="Zoom out"
|
|
1789
|
+
[disabled]="!canZoomOut()"
|
|
1790
|
+
(onClick)="editorService.zoomOut()"
|
|
1791
|
+
>
|
|
1792
|
+
<ax-icon class="fa-regular fa-minus"></ax-icon>
|
|
1793
|
+
</ax-button>
|
|
1794
|
+
<ax-dropdown-button
|
|
1795
|
+
#dropdown
|
|
1796
|
+
class="ax-sm ax-text-editor-zoom-value"
|
|
1797
|
+
look="blank"
|
|
1798
|
+
mode="dropdown"
|
|
1799
|
+
[text]="zoomLabel()"
|
|
1800
|
+
(onClick)="syncDraft()"
|
|
1801
|
+
>
|
|
1802
|
+
<div class="ax-text-editor-zoom-panel" (click)="$event.stopPropagation()" (mousedown)="$event.stopPropagation()">
|
|
1803
|
+
<input
|
|
1804
|
+
class="ax-text-editor-zoom-input"
|
|
1805
|
+
type="text"
|
|
1806
|
+
inputmode="numeric"
|
|
1807
|
+
[value]="draft()"
|
|
1808
|
+
(input)="onDraftInput($event)"
|
|
1809
|
+
(keydown.enter)="commitDraft(); $event.preventDefault()"
|
|
1810
|
+
/>
|
|
1811
|
+
<ax-button-item-list>
|
|
1812
|
+
<ax-button-item text="Fit to page" (onClick)="fitToPage()">
|
|
1813
|
+
<ax-prefix>
|
|
1814
|
+
<ax-icon class="fa-regular fa-expand"></ax-icon>
|
|
1815
|
+
</ax-prefix>
|
|
1816
|
+
</ax-button-item>
|
|
1817
|
+
@for (preset of presets; track preset) {
|
|
1818
|
+
<ax-button-item
|
|
1819
|
+
[text]="preset + '%'"
|
|
1820
|
+
[selected]="editorService.zoom() === preset"
|
|
1821
|
+
(onClick)="applyPreset(preset)"
|
|
1822
|
+
></ax-button-item>
|
|
1823
|
+
}
|
|
1824
|
+
</ax-button-item-list>
|
|
1825
|
+
</div>
|
|
1826
|
+
</ax-dropdown-button>
|
|
1827
|
+
<ax-button
|
|
1828
|
+
class="ax-sm"
|
|
1829
|
+
look="blank"
|
|
1830
|
+
[iconOnly]="true"
|
|
1831
|
+
text="Zoom in"
|
|
1832
|
+
[disabled]="!canZoomIn()"
|
|
1833
|
+
(onClick)="editorService.zoomIn()"
|
|
1834
|
+
>
|
|
1835
|
+
<ax-icon class="fa-regular fa-plus"></ax-icon>
|
|
1836
|
+
</ax-button>
|
|
1837
|
+
`, isInline: true, styles: ["@layer properties;@layer components{ax-text-editor-zoom{display:inline-flex;align-items:center}.ax-text-editor-zoom-value{min-width:calc(var(--spacing, .25rem) * 16)}.ax-text-editor-zoom-value ax-suffix,ax-text-editor-zoom ax-dropdown-button ax-suffix{display:none!important}.ax-text-editor-zoom-panel{display:flex;min-width:calc(var(--spacing, .25rem) * 44);flex-direction:column;gap:calc(var(--spacing, .25rem) * 1);border-radius:var(--ax-sys-border-radius);background-color:rgba(var(--ax-sys-color-lightest-surface));padding:calc(var(--spacing, .25rem) * 2);--tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ax-text-editor-zoom-input{width:100%;border-radius:var(--ax-sys-border-radius);border-style:var(--tw-border-style);border-width:1px;border-color:rgba(var(--ax-sys-color-border-lightest-surface));background-color:transparent;padding-inline:calc(var(--spacing, .25rem) * 2);padding-block:calc(var(--spacing, .25rem) * 1);text-align:center;font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-outline-style: none;outline-style:none}.ax-text-editor-zoom-input:focus{border-color:var(--ax-sys-color-primary, #8b5cf6);box-shadow:0 0 0 2px var(--ax-sys-color-primary, #8b5cf6)}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-zoom-input:focus{box-shadow:0 0 0 2px color-mix(in oklab,var(--ax-sys-color-primary, #8b5cf6) 35%,transparent)}}}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000;--tw-border-style: solid}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXDropdownButtonComponent, selector: "ax-dropdown-button", inputs: ["disabled", "size", "text", "selected", "color", "look", "type", "mode", "iconOnly"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "lookChange", "colorChange", "disabledChange"] }, { kind: "component", type: AXButtonItemListComponent, selector: "ax-button-item-list", inputs: ["items", "closeParentOnClick", "lockOnLoading"], outputs: ["onItemClick"] }, { kind: "component", type: AXButtonItemComponent, selector: "ax-button-item", inputs: ["color", "disabled", "text", "selected", "divided", "data", "name"], outputs: ["onClick", "onFocus", "onBlur", "disabledChange"] }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1838
|
+
}
|
|
1839
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorZoomComponent, decorators: [{
|
|
1840
|
+
type: Component,
|
|
1841
|
+
args: [{ selector: 'ax-text-editor-zoom', template: `
|
|
1842
|
+
<ax-button
|
|
1843
|
+
class="ax-sm"
|
|
1844
|
+
look="blank"
|
|
1845
|
+
[iconOnly]="true"
|
|
1846
|
+
text="Zoom out"
|
|
1847
|
+
[disabled]="!canZoomOut()"
|
|
1848
|
+
(onClick)="editorService.zoomOut()"
|
|
1849
|
+
>
|
|
1850
|
+
<ax-icon class="fa-regular fa-minus"></ax-icon>
|
|
1851
|
+
</ax-button>
|
|
1852
|
+
<ax-dropdown-button
|
|
1853
|
+
#dropdown
|
|
1854
|
+
class="ax-sm ax-text-editor-zoom-value"
|
|
1855
|
+
look="blank"
|
|
1856
|
+
mode="dropdown"
|
|
1857
|
+
[text]="zoomLabel()"
|
|
1858
|
+
(onClick)="syncDraft()"
|
|
1859
|
+
>
|
|
1860
|
+
<div class="ax-text-editor-zoom-panel" (click)="$event.stopPropagation()" (mousedown)="$event.stopPropagation()">
|
|
1861
|
+
<input
|
|
1862
|
+
class="ax-text-editor-zoom-input"
|
|
1863
|
+
type="text"
|
|
1864
|
+
inputmode="numeric"
|
|
1865
|
+
[value]="draft()"
|
|
1866
|
+
(input)="onDraftInput($event)"
|
|
1867
|
+
(keydown.enter)="commitDraft(); $event.preventDefault()"
|
|
1868
|
+
/>
|
|
1869
|
+
<ax-button-item-list>
|
|
1870
|
+
<ax-button-item text="Fit to page" (onClick)="fitToPage()">
|
|
1871
|
+
<ax-prefix>
|
|
1872
|
+
<ax-icon class="fa-regular fa-expand"></ax-icon>
|
|
1873
|
+
</ax-prefix>
|
|
1874
|
+
</ax-button-item>
|
|
1875
|
+
@for (preset of presets; track preset) {
|
|
1876
|
+
<ax-button-item
|
|
1877
|
+
[text]="preset + '%'"
|
|
1878
|
+
[selected]="editorService.zoom() === preset"
|
|
1879
|
+
(onClick)="applyPreset(preset)"
|
|
1880
|
+
></ax-button-item>
|
|
1881
|
+
}
|
|
1882
|
+
</ax-button-item-list>
|
|
1883
|
+
</div>
|
|
1884
|
+
</ax-dropdown-button>
|
|
1885
|
+
<ax-button
|
|
1886
|
+
class="ax-sm"
|
|
1887
|
+
look="blank"
|
|
1888
|
+
[iconOnly]="true"
|
|
1889
|
+
text="Zoom in"
|
|
1890
|
+
[disabled]="!canZoomIn()"
|
|
1891
|
+
(onClick)="editorService.zoomIn()"
|
|
1892
|
+
>
|
|
1893
|
+
<ax-icon class="fa-regular fa-plus"></ax-icon>
|
|
1894
|
+
</ax-button>
|
|
1895
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
1896
|
+
class: 'ax-text-editor-zoom',
|
|
1897
|
+
}, imports: [
|
|
1898
|
+
AXButtonComponent,
|
|
1899
|
+
AXDropdownButtonComponent,
|
|
1900
|
+
AXButtonItemListComponent,
|
|
1901
|
+
AXButtonItemComponent,
|
|
1902
|
+
AXDecoratorIconComponent,
|
|
1903
|
+
AXDecoratorGenericComponent,
|
|
1904
|
+
], providers: [
|
|
1905
|
+
{ provide: AXComponent, useExisting: AXTextEditorZoomComponent },
|
|
1906
|
+
{ provide: AXTextEditorSlot, useExisting: AXTextEditorZoomComponent },
|
|
1907
|
+
], styles: ["@layer properties;@layer components{ax-text-editor-zoom{display:inline-flex;align-items:center}.ax-text-editor-zoom-value{min-width:calc(var(--spacing, .25rem) * 16)}.ax-text-editor-zoom-value ax-suffix,ax-text-editor-zoom ax-dropdown-button ax-suffix{display:none!important}.ax-text-editor-zoom-panel{display:flex;min-width:calc(var(--spacing, .25rem) * 44);flex-direction:column;gap:calc(var(--spacing, .25rem) * 1);border-radius:var(--ax-sys-border-radius);background-color:rgba(var(--ax-sys-color-lightest-surface));padding:calc(var(--spacing, .25rem) * 2);--tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ax-text-editor-zoom-input{width:100%;border-radius:var(--ax-sys-border-radius);border-style:var(--tw-border-style);border-width:1px;border-color:rgba(var(--ax-sys-color-border-lightest-surface));background-color:transparent;padding-inline:calc(var(--spacing, .25rem) * 2);padding-block:calc(var(--spacing, .25rem) * 1);text-align:center;font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-outline-style: none;outline-style:none}.ax-text-editor-zoom-input:focus{border-color:var(--ax-sys-color-primary, #8b5cf6);box-shadow:0 0 0 2px var(--ax-sys-color-primary, #8b5cf6)}@supports (color: color-mix(in lab,red,red)){.ax-text-editor-zoom-input:focus{box-shadow:0 0 0 2px color-mix(in oklab,var(--ax-sys-color-primary, #8b5cf6) 35%,transparent)}}}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000;--tw-border-style: solid}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
1908
|
+
}], propDecorators: { dropdown: [{ type: i0.ViewChild, args: ['dropdown', { isSignal: true }] }] } });
|
|
1909
|
+
|
|
1910
|
+
const COMPONENTS = [
|
|
1911
|
+
AXTextEditorComponent,
|
|
1912
|
+
AXTextEditorToolbarComponent,
|
|
1913
|
+
AXTextEditorContentComponent,
|
|
1914
|
+
AXTextEditorCommandComponent,
|
|
1915
|
+
AXTextEditorHistoryComponent,
|
|
1916
|
+
AXTextEditorHeadingComponent,
|
|
1917
|
+
AXTextEditorFontStyleComponent,
|
|
1918
|
+
AXTextEditorAlignmentComponent,
|
|
1919
|
+
AXTextEditorColorsComponent,
|
|
1920
|
+
AXTextEditorColorSwatchesComponent,
|
|
1921
|
+
AXTextEditorListComponent,
|
|
1922
|
+
AXTextEditorLinkComponent,
|
|
1923
|
+
AXTextEditorBlocksComponent,
|
|
1924
|
+
AXTextEditorTableComponent,
|
|
1925
|
+
AXTextEditorScriptComponent,
|
|
1926
|
+
AXTextEditorZoomComponent,
|
|
1927
|
+
];
|
|
1928
|
+
class AXTextEditorModule {
|
|
1929
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1930
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorModule, imports: [AXTextEditorComponent,
|
|
1931
|
+
AXTextEditorToolbarComponent,
|
|
1932
|
+
AXTextEditorContentComponent,
|
|
1933
|
+
AXTextEditorCommandComponent,
|
|
1934
|
+
AXTextEditorHistoryComponent,
|
|
1935
|
+
AXTextEditorHeadingComponent,
|
|
1936
|
+
AXTextEditorFontStyleComponent,
|
|
1937
|
+
AXTextEditorAlignmentComponent,
|
|
1938
|
+
AXTextEditorColorsComponent,
|
|
1939
|
+
AXTextEditorColorSwatchesComponent,
|
|
1940
|
+
AXTextEditorListComponent,
|
|
1941
|
+
AXTextEditorLinkComponent,
|
|
1942
|
+
AXTextEditorBlocksComponent,
|
|
1943
|
+
AXTextEditorTableComponent,
|
|
1944
|
+
AXTextEditorScriptComponent,
|
|
1945
|
+
AXTextEditorZoomComponent], exports: [AXTextEditorComponent,
|
|
1946
|
+
AXTextEditorToolbarComponent,
|
|
1947
|
+
AXTextEditorContentComponent,
|
|
1948
|
+
AXTextEditorCommandComponent,
|
|
1949
|
+
AXTextEditorHistoryComponent,
|
|
1950
|
+
AXTextEditorHeadingComponent,
|
|
1951
|
+
AXTextEditorFontStyleComponent,
|
|
1952
|
+
AXTextEditorAlignmentComponent,
|
|
1953
|
+
AXTextEditorColorsComponent,
|
|
1954
|
+
AXTextEditorColorSwatchesComponent,
|
|
1955
|
+
AXTextEditorListComponent,
|
|
1956
|
+
AXTextEditorLinkComponent,
|
|
1957
|
+
AXTextEditorBlocksComponent,
|
|
1958
|
+
AXTextEditorTableComponent,
|
|
1959
|
+
AXTextEditorScriptComponent,
|
|
1960
|
+
AXTextEditorZoomComponent] }); }
|
|
1961
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorModule, imports: [AXTextEditorCommandComponent,
|
|
1962
|
+
AXTextEditorHistoryComponent,
|
|
1963
|
+
AXTextEditorHeadingComponent,
|
|
1964
|
+
AXTextEditorFontStyleComponent,
|
|
1965
|
+
AXTextEditorAlignmentComponent,
|
|
1966
|
+
AXTextEditorColorsComponent,
|
|
1967
|
+
AXTextEditorColorSwatchesComponent,
|
|
1968
|
+
AXTextEditorListComponent,
|
|
1969
|
+
AXTextEditorLinkComponent,
|
|
1970
|
+
AXTextEditorBlocksComponent,
|
|
1971
|
+
AXTextEditorTableComponent,
|
|
1972
|
+
AXTextEditorScriptComponent,
|
|
1973
|
+
AXTextEditorZoomComponent] }); }
|
|
1974
|
+
}
|
|
1975
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorModule, decorators: [{
|
|
1976
|
+
type: NgModule,
|
|
1977
|
+
args: [{
|
|
1978
|
+
imports: [...COMPONENTS],
|
|
1979
|
+
exports: [...COMPONENTS],
|
|
1980
|
+
}]
|
|
1981
|
+
}] });
|
|
1982
|
+
|
|
1983
|
+
/**
|
|
1984
|
+
* Generated bundle index. Do not edit.
|
|
1985
|
+
*/
|
|
1986
|
+
|
|
1987
|
+
export { AXTextEditorAlignmentComponent, AXTextEditorBlocksComponent, AXTextEditorColorSwatchesComponent, AXTextEditorColorsComponent, AXTextEditorCommandComponent, AXTextEditorComponent, AXTextEditorContentComponent, AXTextEditorFontStyleComponent, AXTextEditorHeadingComponent, AXTextEditorHistoryComponent, AXTextEditorLinkComponent, AXTextEditorListComponent, AXTextEditorModule, AXTextEditorScriptComponent, AXTextEditorService, AXTextEditorSlot, AXTextEditorTableComponent, AXTextEditorToolbarComponent, AXTextEditorZoomComponent, AX_TEXT_EDITOR_DEFAULT_BACKGROUND_COLORS, AX_TEXT_EDITOR_DEFAULT_TEXT_COLORS, AX_TEXT_EDITOR_ZOOM_MAX, AX_TEXT_EDITOR_ZOOM_MIN, AX_TEXT_EDITOR_ZOOM_PRESETS, canRunTextEditorCommand, createTextEditorExtensions, isTextEditorCommandActive, runTextEditorCommand };
|
|
1988
|
+
//# sourceMappingURL=acorex-components-text-editor.mjs.map
|