@shival99/z-ui 2.0.2 → 2.0.3
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/shival99-z-ui-components-z-editor.mjs +988 -204
- package/fesm2022/shival99-z-ui-components-z-editor.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-input.mjs +456 -16
- package/fesm2022/shival99-z-ui-components-z-input.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-tooltip.mjs +22 -7
- package/fesm2022/shival99-z-ui-components-z-tooltip.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-i18n.mjs +34 -0
- package/fesm2022/shival99-z-ui-i18n.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-utils.mjs +752 -1
- package/fesm2022/shival99-z-ui-utils.mjs.map +1 -1
- package/package.json +1 -1
- package/types/shival99-z-ui-components-z-autocomplete.d.ts +1 -1
- package/types/shival99-z-ui-components-z-calendar.d.ts +4 -4
- package/types/shival99-z-ui-components-z-editor.d.ts +142 -8
- package/types/shival99-z-ui-components-z-input.d.ts +83 -0
- package/types/shival99-z-ui-components-z-select.d.ts +1 -1
- package/types/shival99-z-ui-components-z-table.d.ts +1 -1
- package/types/shival99-z-ui-components-z-tooltip.d.ts +1 -0
- package/types/shival99-z-ui-utils.d.ts +18 -2
|
@@ -7,21 +7,26 @@ import { TranslatePipe } from '@ngx-translate/core';
|
|
|
7
7
|
import { ZButtonComponent } from '@shival99/z-ui/components/z-button';
|
|
8
8
|
import { ZIconComponent } from '@shival99/z-ui/components/z-icon';
|
|
9
9
|
import { ZInputComponent } from '@shival99/z-ui/components/z-input';
|
|
10
|
-
import {
|
|
10
|
+
import { ZPopoverDirective } from '@shival99/z-ui/components/z-popover';
|
|
11
|
+
import { ZTooltipDirective } from '@shival99/z-ui/components/z-tooltip';
|
|
11
12
|
import { ZTranslateService } from '@shival99/z-ui/services';
|
|
12
|
-
import { zTransform, zUuid, zMergeClasses, zCreateEvent } from '@shival99/z-ui/utils';
|
|
13
|
-
import { Editor } from '@tiptap/core';
|
|
13
|
+
import { zTransform, zUuid, Z_EMOJI_SHEET, zMergeClasses, zCreateEvent, Z_EMOJI_KEYWORDS } from '@shival99/z-ui/utils';
|
|
14
|
+
import { Editor, posToDOMRect } from '@tiptap/core';
|
|
15
|
+
import BubbleMenu from '@tiptap/extension-bubble-menu';
|
|
14
16
|
import Code from '@tiptap/extension-code';
|
|
15
17
|
import HorizontalRule from '@tiptap/extension-horizontal-rule';
|
|
16
|
-
import Image from '@tiptap/extension-image';
|
|
17
18
|
import Link from '@tiptap/extension-link';
|
|
18
19
|
import Mention from '@tiptap/extension-mention';
|
|
19
20
|
import Placeholder from '@tiptap/extension-placeholder';
|
|
20
21
|
import TextAlign from '@tiptap/extension-text-align';
|
|
22
|
+
import { TextStyle, Color, BackgroundColor } from '@tiptap/extension-text-style';
|
|
23
|
+
import FontSize from '@tiptap/extension-text-style/font-size';
|
|
21
24
|
import Underline from '@tiptap/extension-underline';
|
|
22
25
|
import { Markdown } from '@tiptap/markdown';
|
|
26
|
+
import { TextSelection } from '@tiptap/pm/state';
|
|
23
27
|
import StarterKit from '@tiptap/starter-kit';
|
|
24
28
|
import { merge, filter } from 'rxjs';
|
|
29
|
+
import ImageResize from 'tiptap-extension-resize-image';
|
|
25
30
|
import { cva } from 'class-variance-authority';
|
|
26
31
|
|
|
27
32
|
const Z_EDITOR_DEFAULT_TOOLBAR = [
|
|
@@ -32,17 +37,192 @@ const Z_EDITOR_DEFAULT_TOOLBAR = [
|
|
|
32
37
|
{ id: 'underline', icon: 'lucideUnderline', label: 'Underline' },
|
|
33
38
|
{ id: 'strike', icon: 'lucideStrikethrough', label: 'Strike' },
|
|
34
39
|
{ id: 'code', icon: 'lucideCode', label: 'Code' },
|
|
35
|
-
{ id: '
|
|
36
|
-
{ id: 'heading2', icon: 'lucideHeading2', label: 'Heading 2' },
|
|
40
|
+
{ id: 'blockStyle', icon: 'lucidePilcrow', label: 'Block style' },
|
|
37
41
|
{ id: 'bulletList', icon: 'lucideList', label: 'Bullet list' },
|
|
38
42
|
{ id: 'orderedList', icon: 'lucideListOrdered', label: 'Ordered list' },
|
|
39
43
|
{ id: 'blockquote', icon: 'lucideQuote', label: 'Blockquote' },
|
|
40
44
|
{ id: 'codeBlock', icon: 'lucideFileCode', label: 'Code block' },
|
|
41
45
|
{ id: 'link', icon: 'lucideLink', label: 'Link' },
|
|
42
46
|
{ id: 'image', icon: 'lucideImage', label: 'Image' },
|
|
47
|
+
{ id: 'emoji', icon: 'lucideSmilePlus', label: 'Emoji' },
|
|
48
|
+
{ id: 'textColor', icon: 'lucidePalette', label: 'Text color' },
|
|
49
|
+
{ id: 'backgroundColor', icon: 'lucideHighlighter', label: 'Background color' },
|
|
50
|
+
{ id: 'align', icon: 'lucideAlignLeft', label: 'Align' },
|
|
43
51
|
{ id: 'horizontalRule', icon: 'lucideMinus', label: 'Horizontal rule' },
|
|
44
52
|
{ id: 'clearFormatting', icon: 'lucideRemoveFormatting', label: 'Clear formatting' },
|
|
45
53
|
];
|
|
54
|
+
const Z_EDITOR_COLOR_SWATCHES = [
|
|
55
|
+
'#000000',
|
|
56
|
+
'#111827',
|
|
57
|
+
'#374151',
|
|
58
|
+
'#6b7280',
|
|
59
|
+
'#9ca3af',
|
|
60
|
+
'#ffffff',
|
|
61
|
+
'#7f1d1d',
|
|
62
|
+
'#ef4444',
|
|
63
|
+
'#f97316',
|
|
64
|
+
'#f59e0b',
|
|
65
|
+
'#eab308',
|
|
66
|
+
'#365314',
|
|
67
|
+
'#22c55e',
|
|
68
|
+
'#0f766e',
|
|
69
|
+
'#06b6d4',
|
|
70
|
+
'#1d4ed8',
|
|
71
|
+
'#3b82f6',
|
|
72
|
+
'#8b5cf6',
|
|
73
|
+
'#6d28d9',
|
|
74
|
+
'#ec4899',
|
|
75
|
+
];
|
|
76
|
+
const Z_EDITOR_BACKGROUND_SWATCHES = [
|
|
77
|
+
'#ffffff',
|
|
78
|
+
'#f9fafb',
|
|
79
|
+
'#f3f4f6',
|
|
80
|
+
'#e5e7eb',
|
|
81
|
+
'#d1d5db',
|
|
82
|
+
'#fef3c7',
|
|
83
|
+
'#fde68a',
|
|
84
|
+
'#ffedd5',
|
|
85
|
+
'#fed7aa',
|
|
86
|
+
'#fee2e2',
|
|
87
|
+
'#fecaca',
|
|
88
|
+
'#fce7f3',
|
|
89
|
+
'#fbcfe8',
|
|
90
|
+
'#ede9fe',
|
|
91
|
+
'#ddd6fe',
|
|
92
|
+
'#dbeafe',
|
|
93
|
+
'#bfdbfe',
|
|
94
|
+
'#cffafe',
|
|
95
|
+
'#a5f3fc',
|
|
96
|
+
'#dcfce7',
|
|
97
|
+
];
|
|
98
|
+
const Z_EDITOR_SLASH_COMMANDS = [
|
|
99
|
+
{
|
|
100
|
+
id: 'text',
|
|
101
|
+
command: 'paragraph',
|
|
102
|
+
icon: 'lucideType',
|
|
103
|
+
label: 'Text',
|
|
104
|
+
description: 'Plain paragraph text',
|
|
105
|
+
group: 'Formatting',
|
|
106
|
+
aliases: ['paragraph', 'p'],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: 'standard',
|
|
110
|
+
command: 'paragraph',
|
|
111
|
+
icon: 'lucideType',
|
|
112
|
+
label: 'Standard',
|
|
113
|
+
description: '',
|
|
114
|
+
group: 'Formatting',
|
|
115
|
+
aliases: ['standard', 'normal'],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: 'small',
|
|
119
|
+
command: 'small',
|
|
120
|
+
icon: 'lucideCaseLower',
|
|
121
|
+
label: 'Small',
|
|
122
|
+
description: '',
|
|
123
|
+
group: 'Formatting',
|
|
124
|
+
aliases: ['small', 'caption'],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: 'heading-1',
|
|
128
|
+
command: 'heading1',
|
|
129
|
+
icon: 'lucideHeading1',
|
|
130
|
+
label: 'Heading 1',
|
|
131
|
+
description: 'Large section heading',
|
|
132
|
+
group: 'Formatting',
|
|
133
|
+
aliases: ['h1', 'title'],
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: 'heading-2',
|
|
137
|
+
command: 'heading2',
|
|
138
|
+
icon: 'lucideHeading2',
|
|
139
|
+
label: 'Heading 2',
|
|
140
|
+
description: 'Medium section heading',
|
|
141
|
+
group: 'Formatting',
|
|
142
|
+
aliases: ['h2', 'subtitle'],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: 'heading-3',
|
|
146
|
+
command: 'heading3',
|
|
147
|
+
icon: 'lucideHeading3',
|
|
148
|
+
label: 'Heading 3',
|
|
149
|
+
description: 'Small section heading',
|
|
150
|
+
group: 'Formatting',
|
|
151
|
+
aliases: ['h3'],
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 'heading-4',
|
|
155
|
+
command: 'heading4',
|
|
156
|
+
icon: 'lucideHeading4',
|
|
157
|
+
label: 'Heading 4',
|
|
158
|
+
description: '',
|
|
159
|
+
group: 'Formatting',
|
|
160
|
+
aliases: ['h4'],
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: 'bullet-list',
|
|
164
|
+
command: 'bulletList',
|
|
165
|
+
icon: 'lucideList',
|
|
166
|
+
label: 'Bullet list',
|
|
167
|
+
description: 'Unordered list',
|
|
168
|
+
group: 'Lists',
|
|
169
|
+
aliases: ['ul', 'list'],
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: 'ordered-list',
|
|
173
|
+
command: 'orderedList',
|
|
174
|
+
icon: 'lucideListOrdered',
|
|
175
|
+
label: 'Ordered list',
|
|
176
|
+
description: 'Numbered list',
|
|
177
|
+
group: 'Lists',
|
|
178
|
+
aliases: ['ol', 'number'],
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
id: 'alphabetical-list',
|
|
182
|
+
command: 'orderedList',
|
|
183
|
+
icon: 'lucideListOrdered',
|
|
184
|
+
label: 'Alphabetical list',
|
|
185
|
+
description: '',
|
|
186
|
+
group: 'Lists',
|
|
187
|
+
aliases: ['ordered', 'ol', 'number', 'alphabetical'],
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: 'blockquote',
|
|
191
|
+
command: 'blockquote',
|
|
192
|
+
icon: 'lucideQuote',
|
|
193
|
+
label: 'Blockquote',
|
|
194
|
+
description: 'Quote block',
|
|
195
|
+
group: 'Blocks',
|
|
196
|
+
aliases: ['quote'],
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
id: 'code-block',
|
|
200
|
+
command: 'codeBlock',
|
|
201
|
+
icon: 'lucideFileCode',
|
|
202
|
+
label: 'Code block',
|
|
203
|
+
description: 'Preformatted code',
|
|
204
|
+
group: 'Blocks',
|
|
205
|
+
aliases: ['code', 'pre'],
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: 'horizontal-rule',
|
|
209
|
+
command: 'horizontalRule',
|
|
210
|
+
icon: 'lucideMinus',
|
|
211
|
+
label: 'Divider',
|
|
212
|
+
description: 'Horizontal separator',
|
|
213
|
+
group: 'Insert',
|
|
214
|
+
aliases: ['hr', 'line', 'divider'],
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
id: 'image',
|
|
218
|
+
command: 'image',
|
|
219
|
+
icon: 'lucideImage',
|
|
220
|
+
label: 'Image',
|
|
221
|
+
description: 'Upload image',
|
|
222
|
+
group: 'Insert',
|
|
223
|
+
aliases: ['photo', 'picture'],
|
|
224
|
+
},
|
|
225
|
+
];
|
|
46
226
|
|
|
47
227
|
const zEditorVariants = cva([
|
|
48
228
|
'z-editor block w-full rounded-[0.375rem] border border-input bg-white shadow-xs',
|
|
@@ -79,6 +259,8 @@ class ZEditorComponent {
|
|
|
79
259
|
_destroyRef = inject(DestroyRef);
|
|
80
260
|
_zTranslate = inject(ZTranslateService);
|
|
81
261
|
_editorHost = viewChild.required('editorHost');
|
|
262
|
+
_floatingToolbar = viewChild.required('floatingToolbar');
|
|
263
|
+
_slashMenuScrollHost = viewChild('slashMenuScrollHost', ...(ngDevMode ? [{ debugName: "_slashMenuScrollHost" }] : []));
|
|
82
264
|
zOnChange = output();
|
|
83
265
|
zOnFocus = output();
|
|
84
266
|
zOnBlur = output();
|
|
@@ -105,7 +287,22 @@ class ZEditorComponent {
|
|
|
105
287
|
_isNgModel = signal(false, ...(ngDevMode ? [{ debugName: "_isNgModel" }] : []));
|
|
106
288
|
_selectionVersion = signal(0, ...(ngDevMode ? [{ debugName: "_selectionVersion" }] : []));
|
|
107
289
|
_plainText = signal('', ...(ngDevMode ? [{ debugName: "_plainText" }] : []));
|
|
108
|
-
|
|
290
|
+
slashMenuState = signal({
|
|
291
|
+
visible: false,
|
|
292
|
+
query: '',
|
|
293
|
+
from: 0,
|
|
294
|
+
to: 0,
|
|
295
|
+
left: 0,
|
|
296
|
+
top: 0,
|
|
297
|
+
}, ...(ngDevMode ? [{ debugName: "slashMenuState" }] : []));
|
|
298
|
+
slashMenuActiveIndex = signal(0, ...(ngDevMode ? [{ debugName: "slashMenuActiveIndex" }] : []));
|
|
299
|
+
linkPopoverState = signal({
|
|
300
|
+
visible: false,
|
|
301
|
+
left: 0,
|
|
302
|
+
top: 0,
|
|
303
|
+
width: 0,
|
|
304
|
+
height: 0,
|
|
305
|
+
}, ...(ngDevMode ? [{ debugName: "linkPopoverState" }] : []));
|
|
109
306
|
linkUrl = signal('', ...(ngDevMode ? [{ debugName: "linkUrl" }] : []));
|
|
110
307
|
activeLinkHref = signal('', ...(ngDevMode ? [{ debugName: "activeLinkHref" }] : []));
|
|
111
308
|
linkValidators = [
|
|
@@ -115,6 +312,33 @@ class ZEditorComponent {
|
|
|
115
312
|
validate: value => this._normalizeUrl(String(value ?? '')) !== '',
|
|
116
313
|
},
|
|
117
314
|
];
|
|
315
|
+
textColorSwatches = Z_EDITOR_COLOR_SWATCHES;
|
|
316
|
+
backgroundColorSwatches = Z_EDITOR_BACKGROUND_SWATCHES;
|
|
317
|
+
slashCommands = Z_EDITOR_SLASH_COMMANDS;
|
|
318
|
+
blockStyleOptions = [
|
|
319
|
+
{ command: 'paragraph', icon: 'lucidePilcrow', label: 'Paragraph' },
|
|
320
|
+
{ command: 'heading1', icon: 'lucideHeading1', label: 'Heading 1' },
|
|
321
|
+
{ command: 'heading2', icon: 'lucideHeading2', label: 'Heading 2' },
|
|
322
|
+
{ command: 'heading3', icon: 'lucideHeading3', label: 'Heading 3' },
|
|
323
|
+
{ command: 'heading4', icon: 'lucideHeading4', label: 'Heading 4' },
|
|
324
|
+
];
|
|
325
|
+
alignOptions = [
|
|
326
|
+
{ command: 'alignLeft', icon: 'lucideAlignLeft', label: 'Left' },
|
|
327
|
+
{ command: 'alignCenter', icon: 'lucideAlignCenter', label: 'Center' },
|
|
328
|
+
{ command: 'alignRight', icon: 'lucideAlignRight', label: 'Right' },
|
|
329
|
+
{ command: 'alignJustify', icon: 'lucideAlignJustify', label: 'Justify' },
|
|
330
|
+
];
|
|
331
|
+
_toolbarShortcutLabels = {
|
|
332
|
+
bold: 'Ctrl+B',
|
|
333
|
+
italic: 'Ctrl+I',
|
|
334
|
+
underline: 'Ctrl+U',
|
|
335
|
+
strike: 'Ctrl+Shift+S',
|
|
336
|
+
code: 'Ctrl+E',
|
|
337
|
+
link: 'Ctrl+K',
|
|
338
|
+
clearFormatting: 'Ctrl+\\',
|
|
339
|
+
undo: 'Ctrl+Z',
|
|
340
|
+
redo: 'Ctrl+Y',
|
|
341
|
+
};
|
|
118
342
|
uiState = signal({
|
|
119
343
|
touched: false,
|
|
120
344
|
dirty: false,
|
|
@@ -126,9 +350,58 @@ class ZEditorComponent {
|
|
|
126
350
|
_editor = null;
|
|
127
351
|
_pendingValue = '';
|
|
128
352
|
_linkSelection = null;
|
|
353
|
+
_linkAnchorElement = null;
|
|
354
|
+
_emojiPopoverControl = null;
|
|
355
|
+
_blockStylePopoverControl = null;
|
|
356
|
+
_alignPopoverControl = null;
|
|
357
|
+
_textColorPopoverControl = null;
|
|
358
|
+
_backgroundColorPopoverControl = null;
|
|
359
|
+
_slashMenuPopoverControl = null;
|
|
360
|
+
_dismissedSlashMenu = null;
|
|
361
|
+
_linkPopoverControl = null;
|
|
362
|
+
_resizeObserver = null;
|
|
363
|
+
_resizeListenerCleanup = null;
|
|
364
|
+
_bubbleMenuPositionFrame = null;
|
|
365
|
+
emojiCategories = Z_EMOJI_SHEET;
|
|
366
|
+
activeEmojiCategoryId = signal(this.emojiCategories[0]?.id ?? 'smileys-people', ...(ngDevMode ? [{ debugName: "activeEmojiCategoryId" }] : []));
|
|
367
|
+
emojiSearch = signal('', ...(ngDevMode ? [{ debugName: "emojiSearch" }] : []));
|
|
368
|
+
activeEmojiCategory = computed(() => this.emojiCategories.find(category => category.id === this.activeEmojiCategoryId()) ?? this.emojiCategories[0], ...(ngDevMode ? [{ debugName: "activeEmojiCategory" }] : []));
|
|
369
|
+
activeEmojiCategoryLabel = computed(() => this.activeEmojiCategory()?.labelKey ?? 'i18n_z_ui_emoji_category_smileys', ...(ngDevMode ? [{ debugName: "activeEmojiCategoryLabel" }] : []));
|
|
370
|
+
emojiSearchQuery = computed(() => this.emojiSearch().trim().toLowerCase(), ...(ngDevMode ? [{ debugName: "emojiSearchQuery" }] : []));
|
|
371
|
+
activeEmojis = computed(() => {
|
|
372
|
+
const query = this.emojiSearchQuery();
|
|
373
|
+
if (query) {
|
|
374
|
+
return this._searchEmojis(query);
|
|
375
|
+
}
|
|
376
|
+
return this.activeEmojiCategory()?.emojis ?? [];
|
|
377
|
+
}, ...(ngDevMode ? [{ debugName: "activeEmojis" }] : []));
|
|
378
|
+
hasEmojiResults = computed(() => this.activeEmojis().length > 0, ...(ngDevMode ? [{ debugName: "hasEmojiResults" }] : []));
|
|
129
379
|
isDisabled = computed(() => this._disabled() || this.zDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : []));
|
|
130
380
|
showToolbar = computed(() => this.zToolbar() !== false && !this.zReadonly() && !this.isDisabled(), ...(ngDevMode ? [{ debugName: "showToolbar" }] : []));
|
|
131
381
|
normalizedLinkUrl = computed(() => this._normalizeUrl(this.linkUrl()), ...(ngDevMode ? [{ debugName: "normalizedLinkUrl" }] : []));
|
|
382
|
+
activeTextColor = computed(() => this._getTextStyleAttribute('color') || '#111827', ...(ngDevMode ? [{ debugName: "activeTextColor" }] : []));
|
|
383
|
+
activeBackgroundColor = computed(() => this._getTextStyleAttribute('backgroundColor') || '#ffffff', ...(ngDevMode ? [{ debugName: "activeBackgroundColor" }] : []));
|
|
384
|
+
activeBlockStyle = computed(() => this._getActiveBlockStyle(), ...(ngDevMode ? [{ debugName: "activeBlockStyle" }] : []));
|
|
385
|
+
activeBlockStyleLabel = computed(() => this.blockStyleOptions.find(option => option.command === this.activeBlockStyle())?.label ?? 'Paragraph', ...(ngDevMode ? [{ debugName: "activeBlockStyleLabel" }] : []));
|
|
386
|
+
activeAlign = computed(() => this._getActiveAlign(), ...(ngDevMode ? [{ debugName: "activeAlign" }] : []));
|
|
387
|
+
activeAlignLabel = computed(() => this.alignOptions.find(option => option.command === this.activeAlign())?.label ?? 'Left', ...(ngDevMode ? [{ debugName: "activeAlignLabel" }] : []));
|
|
388
|
+
activeAlignIcon = computed(() => this.alignOptions.find(option => option.command === this.activeAlign())?.icon ?? 'lucideAlignLeft', ...(ngDevMode ? [{ debugName: "activeAlignIcon" }] : []));
|
|
389
|
+
filteredSlashCommands = computed(() => {
|
|
390
|
+
const query = this.slashMenuState().query.trim().toLowerCase();
|
|
391
|
+
const commands = this.slashCommands;
|
|
392
|
+
let matchedCommands = commands;
|
|
393
|
+
if (query) {
|
|
394
|
+
matchedCommands = commands.filter(item => {
|
|
395
|
+
const label = item.label.toLowerCase();
|
|
396
|
+
const description = item.description.toLowerCase();
|
|
397
|
+
return (label.includes(query) || description.includes(query) || item.aliases.some(alias => alias.includes(query)));
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
return matchedCommands.map((item, index) => ({
|
|
401
|
+
...item,
|
|
402
|
+
showGroupLabel: index === 0 || matchedCommands[index - 1]?.group !== item.group,
|
|
403
|
+
}));
|
|
404
|
+
}, ...(ngDevMode ? [{ debugName: "filteredSlashCommands" }] : []));
|
|
132
405
|
canApplyLink = computed(() => !!this.normalizedLinkUrl(), ...(ngDevMode ? [{ debugName: "canApplyLink" }] : []));
|
|
133
406
|
effectivePlaceholder = computed(() => {
|
|
134
407
|
this._zTranslate.currentLang();
|
|
@@ -146,6 +419,29 @@ class ZEditorComponent {
|
|
|
146
419
|
disabled: this._isToolbarCommandDisabled(item.id),
|
|
147
420
|
}));
|
|
148
421
|
}, ...(ngDevMode ? [{ debugName: "toolbarItems" }] : []));
|
|
422
|
+
floatingToolbarItems = computed(() => {
|
|
423
|
+
this._selectionVersion();
|
|
424
|
+
const itemIds = [
|
|
425
|
+
'bold',
|
|
426
|
+
'italic',
|
|
427
|
+
'underline',
|
|
428
|
+
'strike',
|
|
429
|
+
'code',
|
|
430
|
+
'blockStyle',
|
|
431
|
+
'clearFormatting',
|
|
432
|
+
'textColor',
|
|
433
|
+
'backgroundColor',
|
|
434
|
+
'align',
|
|
435
|
+
'link',
|
|
436
|
+
];
|
|
437
|
+
return Z_EDITOR_DEFAULT_TOOLBAR.filter(item => itemIds.includes(item.id)).map(item => ({
|
|
438
|
+
...item,
|
|
439
|
+
active: this._isToolbarCommandActive(item.id),
|
|
440
|
+
disabled: this._isToolbarCommandDisabled(item.id),
|
|
441
|
+
shortcut: this._toolbarShortcutLabels[item.id] ?? '',
|
|
442
|
+
tooltip: this._getToolbarTooltip(item.id, item.label),
|
|
443
|
+
}));
|
|
444
|
+
}, ...(ngDevMode ? [{ debugName: "floatingToolbarItems" }] : []));
|
|
149
445
|
_shouldShowValidation = computed(() => {
|
|
150
446
|
const control = this._formControl();
|
|
151
447
|
this._formStateVersion();
|
|
@@ -265,6 +561,7 @@ class ZEditorComponent {
|
|
|
265
561
|
this._selectionVersion.update(v => v + 1);
|
|
266
562
|
});
|
|
267
563
|
this._destroyRef.onDestroy(() => {
|
|
564
|
+
this._teardownBubbleMenuPositionUpdates();
|
|
268
565
|
this._editor?.destroy();
|
|
269
566
|
this._editor = null;
|
|
270
567
|
});
|
|
@@ -330,14 +627,25 @@ class ZEditorComponent {
|
|
|
330
627
|
case 'code':
|
|
331
628
|
editor.chain().focus().toggleCode().run();
|
|
332
629
|
break;
|
|
630
|
+
case 'blockStyle':
|
|
631
|
+
break;
|
|
333
632
|
case 'heading1':
|
|
334
633
|
editor.chain().focus().toggleHeading({ level: 1 }).run();
|
|
335
634
|
break;
|
|
336
635
|
case 'heading2':
|
|
337
636
|
editor.chain().focus().toggleHeading({ level: 2 }).run();
|
|
338
637
|
break;
|
|
638
|
+
case 'heading3':
|
|
639
|
+
editor.chain().focus().toggleHeading({ level: 3 }).run();
|
|
640
|
+
break;
|
|
641
|
+
case 'heading4':
|
|
642
|
+
editor.chain().focus().toggleHeading({ level: 4 }).run();
|
|
643
|
+
break;
|
|
644
|
+
case 'small':
|
|
645
|
+
editor.chain().focus().setParagraph().setFontSize('0.875rem').run();
|
|
646
|
+
break;
|
|
339
647
|
case 'paragraph':
|
|
340
|
-
editor.chain().focus().setParagraph().run();
|
|
648
|
+
editor.chain().focus().setParagraph().unsetFontSize().run();
|
|
341
649
|
break;
|
|
342
650
|
case 'bulletList':
|
|
343
651
|
editor.chain().focus().toggleBulletList().run();
|
|
@@ -360,6 +668,23 @@ class ZEditorComponent {
|
|
|
360
668
|
case 'image':
|
|
361
669
|
this._insertImage();
|
|
362
670
|
break;
|
|
671
|
+
case 'emoji':
|
|
672
|
+
case 'align':
|
|
673
|
+
case 'textColor':
|
|
674
|
+
case 'backgroundColor':
|
|
675
|
+
break;
|
|
676
|
+
case 'alignLeft':
|
|
677
|
+
this._setTextAlign('left');
|
|
678
|
+
break;
|
|
679
|
+
case 'alignCenter':
|
|
680
|
+
this._setTextAlign('center');
|
|
681
|
+
break;
|
|
682
|
+
case 'alignRight':
|
|
683
|
+
this._setTextAlign('right');
|
|
684
|
+
break;
|
|
685
|
+
case 'alignJustify':
|
|
686
|
+
this._setTextAlign('justify');
|
|
687
|
+
break;
|
|
363
688
|
case 'undo':
|
|
364
689
|
editor.chain().focus().undo().run();
|
|
365
690
|
break;
|
|
@@ -368,6 +693,7 @@ class ZEditorComponent {
|
|
|
368
693
|
break;
|
|
369
694
|
case 'clearFormatting':
|
|
370
695
|
editor.chain().focus().clearNodes().unsetAllMarks().run();
|
|
696
|
+
this._collapseSelectionToAnchor();
|
|
371
697
|
break;
|
|
372
698
|
}
|
|
373
699
|
this._refreshEditorState();
|
|
@@ -394,6 +720,7 @@ class ZEditorComponent {
|
|
|
394
720
|
code: false,
|
|
395
721
|
horizontalRule: false,
|
|
396
722
|
link: false,
|
|
723
|
+
underline: false,
|
|
397
724
|
dropcursor: {
|
|
398
725
|
color: 'var(--primary)',
|
|
399
726
|
width: 2,
|
|
@@ -404,8 +731,33 @@ class ZEditorComponent {
|
|
|
404
731
|
excludes: 'code',
|
|
405
732
|
}),
|
|
406
733
|
Underline,
|
|
734
|
+
TextStyle,
|
|
735
|
+
FontSize,
|
|
736
|
+
Color,
|
|
737
|
+
BackgroundColor,
|
|
738
|
+
BubbleMenu.configure({
|
|
739
|
+
element: this._floatingToolbar().nativeElement,
|
|
740
|
+
pluginKey: 'zEditorBubbleMenu',
|
|
741
|
+
updateDelay: 0,
|
|
742
|
+
options: {
|
|
743
|
+
strategy: 'fixed',
|
|
744
|
+
placement: 'top-start',
|
|
745
|
+
offset: 8,
|
|
746
|
+
flip: true,
|
|
747
|
+
shift: {
|
|
748
|
+
padding: 8,
|
|
749
|
+
},
|
|
750
|
+
},
|
|
751
|
+
getReferencedVirtualElement: () => this._getSelectionFloatingElement(),
|
|
752
|
+
shouldShow: ({ editor, from, to }) => editor.isEditable &&
|
|
753
|
+
!this.isDisabled() &&
|
|
754
|
+
!this.zReadonly() &&
|
|
755
|
+
from !== to &&
|
|
756
|
+
!editor.isActive('image') &&
|
|
757
|
+
editor.state.doc.textBetween(from, to).trim().length > 0,
|
|
758
|
+
}),
|
|
407
759
|
TextAlign.configure({
|
|
408
|
-
types: ['heading', 'paragraph'],
|
|
760
|
+
types: ['heading', 'paragraph', 'image'],
|
|
409
761
|
}),
|
|
410
762
|
Link.configure({
|
|
411
763
|
openOnClick: false,
|
|
@@ -413,7 +765,7 @@ class ZEditorComponent {
|
|
|
413
765
|
}),
|
|
414
766
|
HorizontalRule,
|
|
415
767
|
tiptapOptions.image !== false &&
|
|
416
|
-
|
|
768
|
+
this._createImageExtension(typeof tiptapOptions.image === 'boolean' ? {} : (tiptapOptions.image ?? {})),
|
|
417
769
|
tiptapOptions.mention !== false &&
|
|
418
770
|
Mention.configure({
|
|
419
771
|
HTMLAttributes: {
|
|
@@ -437,6 +789,8 @@ class ZEditorComponent {
|
|
|
437
789
|
autocapitalize: 'off',
|
|
438
790
|
translate: 'no',
|
|
439
791
|
},
|
|
792
|
+
handleKeyDown: (_view, event) => this._handleSlashMenuKeyDown(event) || this._handleEditorShortcutKeyDown(event),
|
|
793
|
+
handleClick: (view, _pos, event) => this._handleEditorClick(view, event),
|
|
440
794
|
},
|
|
441
795
|
onUpdate: () => this._handleEditorUpdate(),
|
|
442
796
|
onSelectionUpdate: () => this._refreshEditorState(),
|
|
@@ -445,6 +799,7 @@ class ZEditorComponent {
|
|
|
445
799
|
onBlur: () => this._handleBlur(),
|
|
446
800
|
});
|
|
447
801
|
this._refreshEditorState();
|
|
802
|
+
this._setupBubbleMenuPositionUpdates();
|
|
448
803
|
this._emitControl();
|
|
449
804
|
}
|
|
450
805
|
_handleEditorUpdate() {
|
|
@@ -464,6 +819,7 @@ class ZEditorComponent {
|
|
|
464
819
|
if (this.uiState().dirty) {
|
|
465
820
|
this.uiState.update(s => ({ ...s, touched: true }));
|
|
466
821
|
}
|
|
822
|
+
this._dismissCurrentSlashMenu();
|
|
467
823
|
this._onTouched();
|
|
468
824
|
const blurEvent = new FocusEvent('blur');
|
|
469
825
|
this.zOnBlur.emit(blurEvent);
|
|
@@ -546,6 +902,134 @@ class ZEditorComponent {
|
|
|
546
902
|
this._plainText.set(this._editor?.getText() ?? '');
|
|
547
903
|
this._selectionVersion.update(v => v + 1);
|
|
548
904
|
this._formStateVersion.update(v => v + 1);
|
|
905
|
+
this._syncSlashMenu();
|
|
906
|
+
this._syncLinkPopoverPosition();
|
|
907
|
+
}
|
|
908
|
+
_searchEmojis(query) {
|
|
909
|
+
const results = [];
|
|
910
|
+
for (const category of this.emojiCategories) {
|
|
911
|
+
for (const entry of category.emojis) {
|
|
912
|
+
const emoji = typeof entry === 'string' ? entry : entry.emoji;
|
|
913
|
+
const keywords = typeof entry === 'string' ? Z_EMOJI_KEYWORDS.get(entry) : entry.keywords;
|
|
914
|
+
const matchesKeywords = keywords?.some(kw => kw.includes(query)) ?? false;
|
|
915
|
+
if (matchesKeywords || emoji.includes(query)) {
|
|
916
|
+
results.push(emoji);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
return results;
|
|
921
|
+
}
|
|
922
|
+
_setupBubbleMenuPositionUpdates() {
|
|
923
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
924
|
+
this._resizeListenerCleanup = this._listenWindowResize();
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
const editorElement = this._editorHost().nativeElement;
|
|
928
|
+
this._resizeObserver = new ResizeObserver(() => this._requestBubbleMenuPositionUpdate());
|
|
929
|
+
this._resizeObserver.observe(editorElement);
|
|
930
|
+
const wrapperElement = editorElement.closest('.z-editor-wrapper');
|
|
931
|
+
if (wrapperElement instanceof HTMLElement) {
|
|
932
|
+
this._resizeObserver.observe(wrapperElement);
|
|
933
|
+
}
|
|
934
|
+
this._resizeListenerCleanup = this._listenWindowResize();
|
|
935
|
+
}
|
|
936
|
+
_listenWindowResize() {
|
|
937
|
+
const listener = (event) => {
|
|
938
|
+
if (event.type === 'scroll' && event.target instanceof Element && event.target.closest('.z-popover')) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
this._requestBubbleMenuPositionUpdate();
|
|
942
|
+
};
|
|
943
|
+
window.addEventListener('resize', listener, { passive: true });
|
|
944
|
+
window.addEventListener('scroll', listener, { passive: true, capture: true });
|
|
945
|
+
return () => {
|
|
946
|
+
window.removeEventListener('resize', listener);
|
|
947
|
+
window.removeEventListener('scroll', listener, { capture: true });
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
_teardownBubbleMenuPositionUpdates() {
|
|
951
|
+
this._resizeObserver?.disconnect();
|
|
952
|
+
this._resizeObserver = null;
|
|
953
|
+
this._resizeListenerCleanup?.();
|
|
954
|
+
this._resizeListenerCleanup = null;
|
|
955
|
+
if (this._bubbleMenuPositionFrame !== null) {
|
|
956
|
+
cancelAnimationFrame(this._bubbleMenuPositionFrame);
|
|
957
|
+
this._bubbleMenuPositionFrame = null;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
_requestBubbleMenuPositionUpdate() {
|
|
961
|
+
if (this._bubbleMenuPositionFrame !== null) {
|
|
962
|
+
return;
|
|
963
|
+
}
|
|
964
|
+
if (this._isAnyBubbleMenuPopoverOpen()) {
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
this._bubbleMenuPositionFrame = requestAnimationFrame(() => {
|
|
968
|
+
this._bubbleMenuPositionFrame = null;
|
|
969
|
+
this._editor?.view.dispatch(this._editor.state.tr.setMeta('zEditorBubbleMenu', 'updatePosition'));
|
|
970
|
+
this._syncLinkPopoverPosition();
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
_isAnyBubbleMenuPopoverOpen() {
|
|
974
|
+
return (!!this._blockStylePopoverControl?.isVisible() ||
|
|
975
|
+
!!this._alignPopoverControl?.isVisible() ||
|
|
976
|
+
!!this._textColorPopoverControl?.isVisible() ||
|
|
977
|
+
!!this._backgroundColorPopoverControl?.isVisible());
|
|
978
|
+
}
|
|
979
|
+
_syncLinkPopoverPosition() {
|
|
980
|
+
if (!this.linkPopoverState().visible) {
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
const rect = this._getLinkPopoverReferenceRect();
|
|
984
|
+
if (!rect) {
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
this.linkPopoverState.set({
|
|
988
|
+
visible: true,
|
|
989
|
+
left: rect.left,
|
|
990
|
+
top: rect.top,
|
|
991
|
+
width: rect.width,
|
|
992
|
+
height: rect.height,
|
|
993
|
+
});
|
|
994
|
+
requestAnimationFrame(() => {
|
|
995
|
+
if (this.linkPopoverState().visible) {
|
|
996
|
+
this._linkPopoverControl?.show();
|
|
997
|
+
}
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
_getSelectionFloatingElement() {
|
|
1001
|
+
const editor = this._editor;
|
|
1002
|
+
if (!editor) {
|
|
1003
|
+
return null;
|
|
1004
|
+
}
|
|
1005
|
+
// Freeze the bubble menu in place while any popover triggered from it is open,
|
|
1006
|
+
// so the popover (positioned relative to the bubble menu) does not flicker.
|
|
1007
|
+
if (this._isAnyBubbleMenuPopoverOpen()) {
|
|
1008
|
+
const toolbarRect = this._floatingToolbar().nativeElement.getBoundingClientRect();
|
|
1009
|
+
if (toolbarRect.width > 0) {
|
|
1010
|
+
return {
|
|
1011
|
+
getBoundingClientRect: () => toolbarRect,
|
|
1012
|
+
getClientRects: () => [toolbarRect],
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
const { from, to } = editor.state.selection;
|
|
1017
|
+
if (from === to) {
|
|
1018
|
+
return null;
|
|
1019
|
+
}
|
|
1020
|
+
const selectionRect = posToDOMRect(editor.view, from, to);
|
|
1021
|
+
const menuWidth = this._floatingToolbar().nativeElement.getBoundingClientRect().width;
|
|
1022
|
+
const activeAlign = this._getActiveAlignFromEditor(editor);
|
|
1023
|
+
const left = activeAlign === 'alignCenter'
|
|
1024
|
+
? selectionRect.left + selectionRect.width / 2 - menuWidth / 2
|
|
1025
|
+
: activeAlign === 'alignRight'
|
|
1026
|
+
? selectionRect.right - menuWidth
|
|
1027
|
+
: selectionRect.left;
|
|
1028
|
+
const rect = new DOMRect(Math.max(left, 0), selectionRect.top, menuWidth, selectionRect.height);
|
|
1029
|
+
return {
|
|
1030
|
+
getBoundingClientRect: () => rect,
|
|
1031
|
+
getClientRects: () => [rect],
|
|
1032
|
+
};
|
|
549
1033
|
}
|
|
550
1034
|
_isEditorEmpty() {
|
|
551
1035
|
const editor = this._editor;
|
|
@@ -589,8 +1073,16 @@ class ZEditorComponent {
|
|
|
589
1073
|
return editor.isActive('heading', { level: 1 });
|
|
590
1074
|
case 'heading2':
|
|
591
1075
|
return editor.isActive('heading', { level: 2 });
|
|
1076
|
+
case 'heading3':
|
|
1077
|
+
return editor.isActive('heading', { level: 3 });
|
|
1078
|
+
case 'heading4':
|
|
1079
|
+
return editor.isActive('heading', { level: 4 });
|
|
592
1080
|
case 'paragraph':
|
|
593
1081
|
return editor.isActive('paragraph');
|
|
1082
|
+
case 'blockStyle':
|
|
1083
|
+
return this.activeBlockStyle() !== 'paragraph';
|
|
1084
|
+
case 'align':
|
|
1085
|
+
return this.activeAlign() !== 'alignLeft';
|
|
594
1086
|
default:
|
|
595
1087
|
return false;
|
|
596
1088
|
}
|
|
@@ -607,24 +1099,328 @@ class ZEditorComponent {
|
|
|
607
1099
|
return !editor.can().redo();
|
|
608
1100
|
case 'link':
|
|
609
1101
|
return editor.state.selection.empty && !editor.isActive('link');
|
|
1102
|
+
case 'emoji':
|
|
1103
|
+
case 'blockStyle':
|
|
1104
|
+
case 'align':
|
|
1105
|
+
case 'textColor':
|
|
1106
|
+
case 'backgroundColor':
|
|
1107
|
+
return false;
|
|
610
1108
|
default:
|
|
611
1109
|
return false;
|
|
612
1110
|
}
|
|
613
1111
|
}
|
|
1112
|
+
onFloatingToolbarClick(command) {
|
|
1113
|
+
this.onToolbarClick(command);
|
|
1114
|
+
}
|
|
1115
|
+
_getToolbarTooltip(command, label) {
|
|
1116
|
+
const shortcut = this._toolbarShortcutLabels[command];
|
|
1117
|
+
return shortcut ? `${label} (${shortcut})` : label;
|
|
1118
|
+
}
|
|
1119
|
+
applySlashCommand(item) {
|
|
1120
|
+
const editor = this._editor;
|
|
1121
|
+
const { from, to } = this.slashMenuState();
|
|
1122
|
+
if (!editor) {
|
|
1123
|
+
return;
|
|
1124
|
+
}
|
|
1125
|
+
editor.chain().focus().deleteRange({ from, to }).run();
|
|
1126
|
+
this._hideSlashMenu();
|
|
1127
|
+
this.onToolbarClick(item.command);
|
|
1128
|
+
}
|
|
1129
|
+
applyBlockStyle(command) {
|
|
1130
|
+
this.onToolbarClick(command);
|
|
1131
|
+
this._blockStylePopoverControl?.close();
|
|
1132
|
+
}
|
|
1133
|
+
applyAlign(command) {
|
|
1134
|
+
this.onToolbarClick(command);
|
|
1135
|
+
this._alignPopoverControl?.close();
|
|
1136
|
+
}
|
|
1137
|
+
insertEmoji(emoji) {
|
|
1138
|
+
this._editor?.chain().focus().insertContent(emoji).run();
|
|
1139
|
+
this._refreshEditorState();
|
|
1140
|
+
}
|
|
1141
|
+
setEmojiCategory(categoryId) {
|
|
1142
|
+
this.activeEmojiCategoryId.set(categoryId);
|
|
1143
|
+
this.emojiSearch.set('');
|
|
1144
|
+
}
|
|
1145
|
+
onEmojiPopoverControl(control) {
|
|
1146
|
+
this._emojiPopoverControl = control;
|
|
1147
|
+
}
|
|
1148
|
+
onEmojiPopoverShow() {
|
|
1149
|
+
setTimeout(() => {
|
|
1150
|
+
const overlay = document.querySelector('.z-editor-emoji-popover');
|
|
1151
|
+
const input = overlay?.querySelector('input');
|
|
1152
|
+
input?.focus();
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
onBlockStylePopoverControl(control) {
|
|
1156
|
+
this._blockStylePopoverControl = control;
|
|
1157
|
+
}
|
|
1158
|
+
onAlignPopoverControl(control) {
|
|
1159
|
+
this._alignPopoverControl = control;
|
|
1160
|
+
}
|
|
1161
|
+
onTextColorPopoverControl(control) {
|
|
1162
|
+
this._textColorPopoverControl = control;
|
|
1163
|
+
}
|
|
1164
|
+
onBackgroundColorPopoverControl(control) {
|
|
1165
|
+
this._backgroundColorPopoverControl = control;
|
|
1166
|
+
}
|
|
1167
|
+
onSlashMenuPopoverControl(control) {
|
|
1168
|
+
this._slashMenuPopoverControl = control;
|
|
1169
|
+
}
|
|
1170
|
+
onSlashMenuPopoverHide() {
|
|
1171
|
+
this.slashMenuState.update(state => ({ ...state, visible: false }));
|
|
1172
|
+
this.slashMenuActiveIndex.set(0);
|
|
1173
|
+
}
|
|
1174
|
+
onLinkPopoverControl(control) {
|
|
1175
|
+
this._linkPopoverControl = control;
|
|
1176
|
+
}
|
|
1177
|
+
onLinkPopoverHide() {
|
|
1178
|
+
this.linkPopoverState.update(state => ({ ...state, visible: false }));
|
|
1179
|
+
this._linkAnchorElement = null;
|
|
1180
|
+
}
|
|
1181
|
+
setTextColor(color) {
|
|
1182
|
+
this._editor?.chain().focus().setColor(color).run();
|
|
1183
|
+
this._textColorPopoverControl?.close();
|
|
1184
|
+
this._refreshEditorState();
|
|
1185
|
+
}
|
|
1186
|
+
setTextColorFromEvent(event) {
|
|
1187
|
+
const input = event.target;
|
|
1188
|
+
this.setTextColor(input?.value ?? '');
|
|
1189
|
+
}
|
|
1190
|
+
unsetTextColor() {
|
|
1191
|
+
this._editor?.chain().focus().unsetColor().run();
|
|
1192
|
+
this._textColorPopoverControl?.close();
|
|
1193
|
+
this._refreshEditorState();
|
|
1194
|
+
}
|
|
1195
|
+
setBackgroundColor(color) {
|
|
1196
|
+
this._editor?.chain().focus().setBackgroundColor(color).run();
|
|
1197
|
+
this._backgroundColorPopoverControl?.close();
|
|
1198
|
+
this._refreshEditorState();
|
|
1199
|
+
}
|
|
1200
|
+
setBackgroundColorFromEvent(event) {
|
|
1201
|
+
const input = event.target;
|
|
1202
|
+
this.setBackgroundColor(input?.value ?? '');
|
|
1203
|
+
}
|
|
1204
|
+
unsetBackgroundColor() {
|
|
1205
|
+
this._editor?.chain().focus().unsetBackgroundColor().run();
|
|
1206
|
+
this._backgroundColorPopoverControl?.close();
|
|
1207
|
+
this._refreshEditorState();
|
|
1208
|
+
}
|
|
1209
|
+
_handleSlashMenuKeyDown(event) {
|
|
1210
|
+
if (!this.slashMenuState().visible) {
|
|
1211
|
+
return false;
|
|
1212
|
+
}
|
|
1213
|
+
const commands = this.filteredSlashCommands();
|
|
1214
|
+
if (event.key === 'Escape' || event.key === 'Tab') {
|
|
1215
|
+
this._hideSlashMenu();
|
|
1216
|
+
return event.key === 'Escape';
|
|
1217
|
+
}
|
|
1218
|
+
if (event.key === 'ArrowDown') {
|
|
1219
|
+
event.preventDefault();
|
|
1220
|
+
this.slashMenuActiveIndex.update(index => (commands.length ? (index + 1) % commands.length : 0));
|
|
1221
|
+
this._scrollActiveSlashMenuItemIntoView();
|
|
1222
|
+
return true;
|
|
1223
|
+
}
|
|
1224
|
+
if (event.key === 'ArrowUp') {
|
|
1225
|
+
event.preventDefault();
|
|
1226
|
+
this.slashMenuActiveIndex.update(index => commands.length ? (index - 1 + commands.length) % commands.length : 0);
|
|
1227
|
+
this._scrollActiveSlashMenuItemIntoView();
|
|
1228
|
+
return true;
|
|
1229
|
+
}
|
|
1230
|
+
if (event.key === 'Enter') {
|
|
1231
|
+
const item = commands[this.slashMenuActiveIndex()];
|
|
1232
|
+
if (!item) {
|
|
1233
|
+
return false;
|
|
1234
|
+
}
|
|
1235
|
+
event.preventDefault();
|
|
1236
|
+
this.applySlashCommand(item);
|
|
1237
|
+
return true;
|
|
1238
|
+
}
|
|
1239
|
+
return false;
|
|
1240
|
+
}
|
|
1241
|
+
_handleEditorShortcutKeyDown(event) {
|
|
1242
|
+
if (!this._editor || this.isDisabled() || this.zReadonly() || !this._isPrimaryShortcut(event)) {
|
|
1243
|
+
return false;
|
|
1244
|
+
}
|
|
1245
|
+
const key = event.key.toLowerCase();
|
|
1246
|
+
const command = this._getShortcutCommand(event, key);
|
|
1247
|
+
if (!command || this._isToolbarCommandDisabled(command)) {
|
|
1248
|
+
return false;
|
|
1249
|
+
}
|
|
1250
|
+
event.preventDefault();
|
|
1251
|
+
this.onToolbarClick(command);
|
|
1252
|
+
return true;
|
|
1253
|
+
}
|
|
1254
|
+
_getShortcutCommand(event, key) {
|
|
1255
|
+
if (!event.shiftKey) {
|
|
1256
|
+
switch (key) {
|
|
1257
|
+
case 'b':
|
|
1258
|
+
return 'bold';
|
|
1259
|
+
case 'i':
|
|
1260
|
+
return 'italic';
|
|
1261
|
+
case 'u':
|
|
1262
|
+
return 'underline';
|
|
1263
|
+
case 'e':
|
|
1264
|
+
return 'code';
|
|
1265
|
+
case 'k':
|
|
1266
|
+
return 'link';
|
|
1267
|
+
case '\\':
|
|
1268
|
+
return 'clearFormatting';
|
|
1269
|
+
case 'z':
|
|
1270
|
+
return 'undo';
|
|
1271
|
+
case 'y':
|
|
1272
|
+
return 'redo';
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
if (event.shiftKey && key === 's') {
|
|
1276
|
+
return 'strike';
|
|
1277
|
+
}
|
|
1278
|
+
return null;
|
|
1279
|
+
}
|
|
1280
|
+
_isPrimaryShortcut(event) {
|
|
1281
|
+
return (event.ctrlKey || event.metaKey) && !event.altKey;
|
|
1282
|
+
}
|
|
1283
|
+
_syncSlashMenu() {
|
|
1284
|
+
const editor = this._editor;
|
|
1285
|
+
if (!editor || !editor.isEditable || this.isDisabled() || this.zReadonly()) {
|
|
1286
|
+
this._hideSlashMenu();
|
|
1287
|
+
return;
|
|
1288
|
+
}
|
|
1289
|
+
const { selection } = editor.state;
|
|
1290
|
+
if (!selection.empty) {
|
|
1291
|
+
this._hideSlashMenu();
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
const { $from } = selection;
|
|
1295
|
+
const textBeforeCursor = $from.parent.textBetween(0, $from.parentOffset, '\0', '\0');
|
|
1296
|
+
const match = /(?:^|\s)\/([^\s/]*)$/.exec(textBeforeCursor);
|
|
1297
|
+
if (!match) {
|
|
1298
|
+
if (!this._isDismissedSlashStillPresent()) {
|
|
1299
|
+
this._dismissedSlashMenu = null;
|
|
1300
|
+
}
|
|
1301
|
+
this._hideSlashMenu();
|
|
1302
|
+
return;
|
|
1303
|
+
}
|
|
1304
|
+
const query = match[1] ?? '';
|
|
1305
|
+
const from = selection.from - query.length - 1;
|
|
1306
|
+
const to = selection.from;
|
|
1307
|
+
if (this._dismissedSlashMenu?.from === from &&
|
|
1308
|
+
this._dismissedSlashMenu.to === to &&
|
|
1309
|
+
this._dismissedSlashMenu.query === query) {
|
|
1310
|
+
this._hideSlashMenu();
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
if (this._dismissedSlashMenu) {
|
|
1314
|
+
this._dismissedSlashMenu = null;
|
|
1315
|
+
}
|
|
1316
|
+
const coords = editor.view.coordsAtPos(selection.from);
|
|
1317
|
+
if (this._slashMenuPopoverControl?.isVisible()) {
|
|
1318
|
+
this._slashMenuPopoverControl.closeImmediate();
|
|
1319
|
+
}
|
|
1320
|
+
this.slashMenuState.set({
|
|
1321
|
+
visible: true,
|
|
1322
|
+
query,
|
|
1323
|
+
from,
|
|
1324
|
+
to,
|
|
1325
|
+
left: coords.left,
|
|
1326
|
+
top: coords.bottom,
|
|
1327
|
+
});
|
|
1328
|
+
const commandsLength = this.filteredSlashCommands().length;
|
|
1329
|
+
if (this.slashMenuActiveIndex() >= commandsLength) {
|
|
1330
|
+
this.slashMenuActiveIndex.set(0);
|
|
1331
|
+
}
|
|
1332
|
+
requestAnimationFrame(() => {
|
|
1333
|
+
if (this.slashMenuState().visible) {
|
|
1334
|
+
this._slashMenuPopoverControl?.show();
|
|
1335
|
+
this._scrollActiveSlashMenuItemIntoView();
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
_scrollActiveSlashMenuItemIntoView() {
|
|
1340
|
+
requestAnimationFrame(() => {
|
|
1341
|
+
const scrollHost = this._slashMenuScrollHost()?.nativeElement;
|
|
1342
|
+
const activeIndex = this.slashMenuActiveIndex();
|
|
1343
|
+
const lastIndex = this.filteredSlashCommands().length - 1;
|
|
1344
|
+
if (!scrollHost) {
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
if (activeIndex === 0) {
|
|
1348
|
+
scrollHost.scrollTop = 0;
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
if (activeIndex === lastIndex) {
|
|
1352
|
+
scrollHost.scrollTop = scrollHost.scrollHeight - scrollHost.clientHeight;
|
|
1353
|
+
return;
|
|
1354
|
+
}
|
|
1355
|
+
const activeItem = scrollHost?.querySelector('.z-editor-slash-menu-item-active');
|
|
1356
|
+
if (!(activeItem instanceof HTMLElement)) {
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
activeItem.scrollIntoView({ block: 'nearest' });
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
_hideSlashMenu() {
|
|
1363
|
+
if (!this.slashMenuState().visible) {
|
|
1364
|
+
return;
|
|
1365
|
+
}
|
|
1366
|
+
this.slashMenuState.update(state => ({ ...state, visible: false }));
|
|
1367
|
+
this.slashMenuActiveIndex.set(0);
|
|
1368
|
+
this._slashMenuPopoverControl?.closeImmediate();
|
|
1369
|
+
}
|
|
1370
|
+
_dismissCurrentSlashMenu() {
|
|
1371
|
+
const { visible, query, from, to } = this.slashMenuState();
|
|
1372
|
+
if (visible) {
|
|
1373
|
+
this._dismissedSlashMenu = { query, from, to };
|
|
1374
|
+
this._hideSlashMenu();
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
const currentSlashMenuMatch = this._getCurrentSlashMenuMatch();
|
|
1378
|
+
if (currentSlashMenuMatch) {
|
|
1379
|
+
this._dismissedSlashMenu = currentSlashMenuMatch;
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
_getCurrentSlashMenuMatch() {
|
|
1383
|
+
const selection = this._editor?.state.selection;
|
|
1384
|
+
if (!selection?.empty) {
|
|
1385
|
+
return null;
|
|
1386
|
+
}
|
|
1387
|
+
const textBeforeCursor = selection.$from.parent.textBetween(0, selection.$from.parentOffset, '\0', '\0');
|
|
1388
|
+
const match = /(?:^|\s)\/([^\s/]*)$/.exec(textBeforeCursor);
|
|
1389
|
+
if (!match) {
|
|
1390
|
+
return null;
|
|
1391
|
+
}
|
|
1392
|
+
const query = match[1] ?? '';
|
|
1393
|
+
return {
|
|
1394
|
+
query,
|
|
1395
|
+
from: selection.from - query.length - 1,
|
|
1396
|
+
to: selection.from,
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
_isDismissedSlashStillPresent() {
|
|
1400
|
+
const dismissed = this._dismissedSlashMenu;
|
|
1401
|
+
const doc = this._editor?.state.doc;
|
|
1402
|
+
if (!dismissed || !doc || dismissed.from < 0 || dismissed.from >= doc.content.size) {
|
|
1403
|
+
return false;
|
|
1404
|
+
}
|
|
1405
|
+
return doc.textBetween(dismissed.from, dismissed.from + 1, '\0', '\0') === '/';
|
|
1406
|
+
}
|
|
614
1407
|
_toggleLink() {
|
|
615
1408
|
const editor = this._editor;
|
|
616
1409
|
if (!editor) {
|
|
617
1410
|
return;
|
|
618
1411
|
}
|
|
619
1412
|
const { from, to } = editor.state.selection;
|
|
1413
|
+
this._linkAnchorElement = null;
|
|
620
1414
|
this._linkSelection = { from, to };
|
|
621
1415
|
const href = String(editor.getAttributes('link')['href'] ?? '');
|
|
622
1416
|
this.activeLinkHref.set(href);
|
|
623
1417
|
this.linkUrl.set(href);
|
|
624
|
-
this.
|
|
1418
|
+
this._showLinkPopover();
|
|
625
1419
|
}
|
|
626
|
-
|
|
627
|
-
this.
|
|
1420
|
+
closeLinkPopover() {
|
|
1421
|
+
this.linkPopoverState.update(state => ({ ...state, visible: false }));
|
|
1422
|
+
this._linkAnchorElement = null;
|
|
1423
|
+
this._linkPopoverControl?.closeImmediate();
|
|
628
1424
|
}
|
|
629
1425
|
onLinkUrlChange(value) {
|
|
630
1426
|
this.linkUrl.set(String(value ?? ''));
|
|
@@ -637,7 +1433,7 @@ class ZEditorComponent {
|
|
|
637
1433
|
return;
|
|
638
1434
|
}
|
|
639
1435
|
editor.chain().focus().setTextSelection(selection).extendMarkRange('link').setLink({ href }).run();
|
|
640
|
-
this.
|
|
1436
|
+
this.closeLinkPopover();
|
|
641
1437
|
this._refreshEditorState();
|
|
642
1438
|
}
|
|
643
1439
|
_normalizeUrl(value) {
|
|
@@ -657,13 +1453,90 @@ class ZEditorComponent {
|
|
|
657
1453
|
const editor = this._editor;
|
|
658
1454
|
const selection = this._linkSelection;
|
|
659
1455
|
if (!editor || !selection) {
|
|
660
|
-
this.
|
|
1456
|
+
this.closeLinkPopover();
|
|
661
1457
|
return;
|
|
662
1458
|
}
|
|
663
1459
|
editor.chain().focus().setTextSelection(selection).extendMarkRange('link').unsetLink().run();
|
|
664
|
-
this.
|
|
1460
|
+
this.closeLinkPopover();
|
|
665
1461
|
this._refreshEditorState();
|
|
666
1462
|
}
|
|
1463
|
+
openActiveLink() {
|
|
1464
|
+
const href = this.activeLinkHref();
|
|
1465
|
+
if (!href) {
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
window.open(href, '_blank', 'noopener,noreferrer');
|
|
1469
|
+
}
|
|
1470
|
+
_handleEditorClick(view, event) {
|
|
1471
|
+
const target = event.target instanceof HTMLElement ? event.target : null;
|
|
1472
|
+
const link = target?.closest('a[href]');
|
|
1473
|
+
if (!(link instanceof HTMLAnchorElement) || this.isDisabled() || this.zReadonly()) {
|
|
1474
|
+
return false;
|
|
1475
|
+
}
|
|
1476
|
+
if (event.detail >= 2) {
|
|
1477
|
+
this.closeLinkPopover();
|
|
1478
|
+
return false;
|
|
1479
|
+
}
|
|
1480
|
+
const position = view.posAtCoords({ left: event.clientX, top: event.clientY });
|
|
1481
|
+
if (!position) {
|
|
1482
|
+
return false;
|
|
1483
|
+
}
|
|
1484
|
+
event.preventDefault();
|
|
1485
|
+
view.dispatch(view.state.tr.setSelection(TextSelection.near(view.state.doc.resolve(position.pos))));
|
|
1486
|
+
this._editor?.chain().focus().run();
|
|
1487
|
+
const selection = this._editor?.state.selection;
|
|
1488
|
+
if (!selection) {
|
|
1489
|
+
return true;
|
|
1490
|
+
}
|
|
1491
|
+
this._linkSelection = { from: selection.from, to: selection.to };
|
|
1492
|
+
this._linkAnchorElement = link;
|
|
1493
|
+
const href = link.href || link.getAttribute('href') || '';
|
|
1494
|
+
this.activeLinkHref.set(href);
|
|
1495
|
+
this.linkUrl.set(href);
|
|
1496
|
+
this._showLinkPopover();
|
|
1497
|
+
return true;
|
|
1498
|
+
}
|
|
1499
|
+
_showLinkPopover() {
|
|
1500
|
+
const rect = this._getLinkPopoverReferenceRect();
|
|
1501
|
+
if (!rect) {
|
|
1502
|
+
return;
|
|
1503
|
+
}
|
|
1504
|
+
this.linkPopoverState.set({
|
|
1505
|
+
visible: true,
|
|
1506
|
+
left: rect.left,
|
|
1507
|
+
top: rect.top,
|
|
1508
|
+
width: rect.width,
|
|
1509
|
+
height: rect.height,
|
|
1510
|
+
});
|
|
1511
|
+
requestAnimationFrame(() => {
|
|
1512
|
+
if (this.linkPopoverState().visible) {
|
|
1513
|
+
this._linkPopoverControl?.show();
|
|
1514
|
+
}
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
_getLinkPopoverReferenceRect() {
|
|
1518
|
+
const anchorRect = this._getLinkAnchorRect();
|
|
1519
|
+
if (anchorRect) {
|
|
1520
|
+
return anchorRect;
|
|
1521
|
+
}
|
|
1522
|
+
const editor = this._editor;
|
|
1523
|
+
const selection = this._linkSelection;
|
|
1524
|
+
if (!editor || !selection) {
|
|
1525
|
+
return null;
|
|
1526
|
+
}
|
|
1527
|
+
return posToDOMRect(editor.view, selection.from, selection.to);
|
|
1528
|
+
}
|
|
1529
|
+
_getLinkAnchorRect() {
|
|
1530
|
+
const anchor = this._linkAnchorElement;
|
|
1531
|
+
if (!anchor || !this._editorHost().nativeElement.contains(anchor)) {
|
|
1532
|
+
return null;
|
|
1533
|
+
}
|
|
1534
|
+
const rect = anchor.getBoundingClientRect();
|
|
1535
|
+
if (rect.width === 0 && rect.height === 0) {
|
|
1536
|
+
return null;
|
|
1537
|
+
}
|
|
1538
|
+
return rect;
|
|
1539
|
+
}
|
|
667
1540
|
_insertImage() {
|
|
668
1541
|
const editor = this._editor;
|
|
669
1542
|
if (!editor) {
|
|
@@ -697,6 +1570,99 @@ class ZEditorComponent {
|
|
|
697
1570
|
document.body.appendChild(input);
|
|
698
1571
|
input.click();
|
|
699
1572
|
}
|
|
1573
|
+
_setTextAlign(alignment) {
|
|
1574
|
+
const editor = this._editor;
|
|
1575
|
+
if (!editor) {
|
|
1576
|
+
return;
|
|
1577
|
+
}
|
|
1578
|
+
const command = alignment === 'left' ? editor.chain().focus().unsetTextAlign() : editor.chain().focus().setTextAlign(alignment);
|
|
1579
|
+
command.run();
|
|
1580
|
+
}
|
|
1581
|
+
_collapseSelectionToAnchor() {
|
|
1582
|
+
const editor = this._editor;
|
|
1583
|
+
if (!editor) {
|
|
1584
|
+
return;
|
|
1585
|
+
}
|
|
1586
|
+
const { from } = editor.state.selection;
|
|
1587
|
+
editor.commands.setTextSelection(from);
|
|
1588
|
+
editor.view.dispatch(editor.state.tr.setMeta('zEditorBubbleMenu', 'updatePosition'));
|
|
1589
|
+
}
|
|
1590
|
+
_getTextStyleAttribute(attribute) {
|
|
1591
|
+
this._selectionVersion();
|
|
1592
|
+
return String(this._editor?.getAttributes('textStyle')[attribute] ?? '');
|
|
1593
|
+
}
|
|
1594
|
+
_getActiveBlockStyle() {
|
|
1595
|
+
const editor = this._editor;
|
|
1596
|
+
this._selectionVersion();
|
|
1597
|
+
if (!editor) {
|
|
1598
|
+
return 'paragraph';
|
|
1599
|
+
}
|
|
1600
|
+
if (editor.isActive('heading', { level: 1 })) {
|
|
1601
|
+
return 'heading1';
|
|
1602
|
+
}
|
|
1603
|
+
if (editor.isActive('heading', { level: 2 })) {
|
|
1604
|
+
return 'heading2';
|
|
1605
|
+
}
|
|
1606
|
+
if (editor.isActive('heading', { level: 3 })) {
|
|
1607
|
+
return 'heading3';
|
|
1608
|
+
}
|
|
1609
|
+
if (editor.isActive('heading', { level: 4 })) {
|
|
1610
|
+
return 'heading4';
|
|
1611
|
+
}
|
|
1612
|
+
return 'paragraph';
|
|
1613
|
+
}
|
|
1614
|
+
_getActiveAlign() {
|
|
1615
|
+
const editor = this._editor;
|
|
1616
|
+
this._selectionVersion();
|
|
1617
|
+
if (!editor) {
|
|
1618
|
+
return 'alignLeft';
|
|
1619
|
+
}
|
|
1620
|
+
return this._getActiveAlignFromEditor(editor);
|
|
1621
|
+
}
|
|
1622
|
+
_getActiveAlignFromEditor(editor) {
|
|
1623
|
+
if (editor.isActive({ textAlign: 'center' })) {
|
|
1624
|
+
return 'alignCenter';
|
|
1625
|
+
}
|
|
1626
|
+
if (editor.isActive({ textAlign: 'right' })) {
|
|
1627
|
+
return 'alignRight';
|
|
1628
|
+
}
|
|
1629
|
+
if (editor.isActive({ textAlign: 'justify' })) {
|
|
1630
|
+
return 'alignJustify';
|
|
1631
|
+
}
|
|
1632
|
+
return 'alignLeft';
|
|
1633
|
+
}
|
|
1634
|
+
_createImageExtension(options) {
|
|
1635
|
+
return ImageResize.extend({
|
|
1636
|
+
addAttributes() {
|
|
1637
|
+
return {
|
|
1638
|
+
...this.parent?.(),
|
|
1639
|
+
textAlign: {
|
|
1640
|
+
default: null,
|
|
1641
|
+
parseHTML: element => element.style.textAlign || element.getAttribute('data-text-align') || null,
|
|
1642
|
+
renderHTML: attributes => {
|
|
1643
|
+
const textAlign = String(attributes['textAlign'] ?? '');
|
|
1644
|
+
if (!textAlign) {
|
|
1645
|
+
return {};
|
|
1646
|
+
}
|
|
1647
|
+
return {
|
|
1648
|
+
'data-text-align': textAlign,
|
|
1649
|
+
style: ZEditorComponent._getImageAlignStyle(textAlign),
|
|
1650
|
+
};
|
|
1651
|
+
},
|
|
1652
|
+
},
|
|
1653
|
+
};
|
|
1654
|
+
},
|
|
1655
|
+
}).configure(options);
|
|
1656
|
+
}
|
|
1657
|
+
static _getImageAlignStyle(textAlign) {
|
|
1658
|
+
if (textAlign === 'center') {
|
|
1659
|
+
return 'display: block; margin-left: auto; margin-right: auto;';
|
|
1660
|
+
}
|
|
1661
|
+
if (textAlign === 'right') {
|
|
1662
|
+
return 'display: block; margin-left: auto; margin-right: 0;';
|
|
1663
|
+
}
|
|
1664
|
+
return 'display: block; margin-left: 0; margin-right: auto;';
|
|
1665
|
+
}
|
|
700
1666
|
_placeholderConfig() {
|
|
701
1667
|
const { placeholder } = this.zTipTap();
|
|
702
1668
|
if (!placeholder || typeof placeholder === 'string') {
|
|
@@ -716,98 +1682,7 @@ class ZEditorComponent {
|
|
|
716
1682
|
useExisting: forwardRef(() => ZEditorComponent),
|
|
717
1683
|
multi: true,
|
|
718
1684
|
},
|
|
719
|
-
], viewQueries: [{ propertyName: "_editorHost", first: true, predicate: ["editorHost"], descendants: true, isSignal: true }], exportAs: ["zEditor"], ngImport: i0, template: `
|
|
720
|
-
<div [class]="wrapperClasses()" [class.z-editor-disabled]="isDisabled()" [class.z-editor-readonly]="zReadonly()">
|
|
721
|
-
@if (zLabel()) {
|
|
722
|
-
<label [for]="editorId" class="text-xs leading-none font-medium" [class]="zLabelClass()">
|
|
723
|
-
{{ zLabel() }}
|
|
724
|
-
@if (zRequired()) {
|
|
725
|
-
<span class="text-destructive! ml-0.5">*</span>
|
|
726
|
-
}
|
|
727
|
-
</label>
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
<div [class]="editorClasses()">
|
|
731
|
-
@if (showToolbar()) {
|
|
732
|
-
<div class="z-editor-toolbar" role="toolbar" [attr.aria-controls]="editorId">
|
|
733
|
-
@for (item of toolbarItems(); track item.id) {
|
|
734
|
-
<button
|
|
735
|
-
type="button"
|
|
736
|
-
class="z-editor-toolbar-button"
|
|
737
|
-
[class.z-editor-toolbar-button-active]="item.active"
|
|
738
|
-
[disabled]="item.disabled"
|
|
739
|
-
[attr.aria-label]="item.label"
|
|
740
|
-
[attr.title]="item.label"
|
|
741
|
-
(click)="onToolbarClick(item.id)"
|
|
742
|
-
>
|
|
743
|
-
<i z-icon [zType]="item.icon" zSize="16"></i>
|
|
744
|
-
</button>
|
|
745
|
-
}
|
|
746
|
-
</div>
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
<div
|
|
750
|
-
#editorHost
|
|
751
|
-
[id]="editorId"
|
|
752
|
-
class="z-editor-content"
|
|
753
|
-
role="textbox"
|
|
754
|
-
[attr.aria-multiline]="true"
|
|
755
|
-
[attr.aria-readonly]="isDisabled() || zReadonly()"
|
|
756
|
-
></div>
|
|
757
|
-
</div>
|
|
758
|
-
|
|
759
|
-
@if (hasError()) {
|
|
760
|
-
<p class="text-destructive animate-in fade-in slide-in-from-top-1 m-0 text-xs duration-200">
|
|
761
|
-
{{ errorMessage() }}
|
|
762
|
-
</p>
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
<z-modal
|
|
766
|
-
[(zVisible)]="linkModalVisible"
|
|
767
|
-
class="z-editor-link-modal"
|
|
768
|
-
zWidth="360px"
|
|
769
|
-
[zClosable]="false"
|
|
770
|
-
[zHideHeader]="true"
|
|
771
|
-
[zHideFooter]="true"
|
|
772
|
-
>
|
|
773
|
-
<ng-template z-modal-content>
|
|
774
|
-
<div class="space-y-4">
|
|
775
|
-
<z-input
|
|
776
|
-
zType="url"
|
|
777
|
-
zLabel="URL"
|
|
778
|
-
zPlaceholder="https://example.com"
|
|
779
|
-
[zRequired]="true"
|
|
780
|
-
[zValidators]="linkValidators"
|
|
781
|
-
[ngModel]="linkUrl()"
|
|
782
|
-
(ngModelChange)="onLinkUrlChange($event)"
|
|
783
|
-
(zOnEnter)="applyLink()"
|
|
784
|
-
/>
|
|
785
|
-
|
|
786
|
-
<div class="mt-4 flex items-center justify-between gap-2">
|
|
787
|
-
<button
|
|
788
|
-
type="button"
|
|
789
|
-
z-button
|
|
790
|
-
zType="ghost"
|
|
791
|
-
zSize="sm"
|
|
792
|
-
[zDisabled]="!activeLinkHref()"
|
|
793
|
-
(click)="removeLink()"
|
|
794
|
-
>
|
|
795
|
-
{{ 'i18n_z_ui_common_remove' | translate }}
|
|
796
|
-
</button>
|
|
797
|
-
<div class="flex items-center gap-2">
|
|
798
|
-
<button type="button" z-button zType="outline" zSize="sm" (click)="closeLinkModal()">
|
|
799
|
-
{{ 'i18n_z_ui_common_cancel' | translate }}
|
|
800
|
-
</button>
|
|
801
|
-
<button type="button" z-button zSize="sm" [zDisabled]="!canApplyLink()" (click)="applyLink()">
|
|
802
|
-
{{ 'i18n_z_ui_common_apply' | translate }}
|
|
803
|
-
</button>
|
|
804
|
-
</div>
|
|
805
|
-
</div>
|
|
806
|
-
</div>
|
|
807
|
-
</ng-template>
|
|
808
|
-
</z-modal>
|
|
809
|
-
</div>
|
|
810
|
-
`, isInline: true, styles: [".z-editor-wrapper .z-editor-toolbar{display:flex;flex-wrap:wrap;gap:.125rem;align-items:center;border-bottom:.0625rem solid var(--border);border-top-left-radius:.375rem;border-top-right-radius:.375rem;background-color:color-mix(in srgb,var(--muted) 30%,transparent);padding:.5rem}.z-editor-wrapper .z-editor-toolbar-button{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.25rem;padding:0;color:var(--muted-foreground);transition:background-color .15s ease,color .15s ease,opacity .15s ease}.z-editor-wrapper .z-editor-toolbar-button:hover:not(:disabled){background-color:var(--accent);color:var(--foreground)}.z-editor-wrapper .z-editor-toolbar-button:disabled{cursor:not-allowed;opacity:.45}.z-editor-wrapper .z-editor-toolbar-button.z-editor-toolbar-button-active{background-color:color-mix(in srgb,var(--primary) 10%,transparent);color:var(--primary)}.z-editor-wrapper .z-editor-content{border-bottom-right-radius:.375rem;border-bottom-left-radius:.375rem}.z-editor-wrapper .z-editor-prosemirror{width:100%;outline:none;padding:.75rem;color:var(--foreground)}.z-editor-wrapper .z-editor-prosemirror>*{margin-top:1.25rem;margin-bottom:1.25rem}.z-editor-wrapper .z-editor-prosemirror>:first-child{margin-top:0}.z-editor-wrapper .z-editor-prosemirror>:last-child{margin-bottom:0}.z-editor-wrapper .z-editor-prosemirror p{line-height:1.75}.z-editor-wrapper .z-editor-prosemirror a{border-bottom:.0625rem solid transparent;color:var(--primary);font-weight:500;transition:border-color .15s ease}.z-editor-wrapper .z-editor-prosemirror a:hover{border-color:var(--primary)}.z-editor-wrapper .z-editor-prosemirror .mention{color:var(--primary);font-weight:500}.z-editor-wrapper .z-editor-prosemirror :is(h1,h2,h3,h4,h5,h6){color:var(--foreground);font-weight:700;line-height:1.2}.z-editor-wrapper .z-editor-prosemirror h1{font-size:1.875rem}.z-editor-wrapper .z-editor-prosemirror h2{font-size:1.5rem}.z-editor-wrapper .z-editor-prosemirror h3{font-size:1.25rem}.z-editor-wrapper .z-editor-prosemirror h4{font-size:1.125rem}.z-editor-wrapper .z-editor-prosemirror h5,.z-editor-wrapper .z-editor-prosemirror h6{font-size:1rem}.z-editor-wrapper .z-editor-prosemirror blockquote{border-left:.25rem solid var(--border);padding-left:1rem;font-style:italic;color:var(--muted-foreground)}.z-editor-wrapper .z-editor-prosemirror [data-type=horizontalRule]{margin-top:2rem;margin-bottom:2rem;padding-top:.5rem;padding-bottom:.5rem}.z-editor-wrapper .z-editor-prosemirror hr{border:0;border-top:.0625rem solid var(--border)}.z-editor-wrapper .z-editor-prosemirror pre{overflow-x:auto;border:.0625rem solid var(--border);border-radius:.375rem;background-color:var(--muted);padding:.75rem 1rem;font-size:.875rem;line-height:1.5;white-space:pre-wrap;word-break:break-word}.z-editor-wrapper .z-editor-prosemirror pre code{display:inline;border:0;border-radius:0;background-color:transparent;padding:0;color:inherit;font:inherit}.z-editor-wrapper .z-editor-prosemirror code{display:inline-block;border:.0625rem solid var(--border);border-radius:.375rem;background-color:var(--muted);padding:.125rem .375rem;color:var(--foreground);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875em;font-weight:500}.z-editor-wrapper .z-editor-prosemirror :is(ul,ol){padding-left:1.5rem}.z-editor-wrapper .z-editor-prosemirror ul{list-style:disc}.z-editor-wrapper .z-editor-prosemirror ol{list-style:decimal}.z-editor-wrapper .z-editor-prosemirror li{margin-top:.375rem;margin-bottom:.375rem;padding-left:.375rem}.z-editor-wrapper .z-editor-prosemirror img{display:block;max-width:100%;border-radius:.375rem}.z-editor-wrapper .z-editor-prosemirror img.ProseMirror-selectednode{outline:.125rem solid var(--primary)}.z-editor-wrapper .z-editor-prosemirror .ProseMirror-selectednode:not(img):not(pre):not([data-node-view-wrapper]){background-color:color-mix(in srgb,var(--primary) 20%,transparent)}.z-editor-wrapper .z-editor-prosemirror :is(p,h1,h2,h3,h4,h5,h6).is-empty:before{float:left;height:0;color:var(--muted-foreground);content:attr(data-placeholder);pointer-events:none}.z-editor-placeholder-first-line .z-editor-wrapper .z-editor-prosemirror :is(p,h1,h2,h3,h4,h5,h6).is-empty:before{content:none}.z-editor-placeholder-first-line .z-editor-wrapper .z-editor-prosemirror :is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child:before{content:attr(data-placeholder)}.z-editor-wrapper.z-editor-disabled .z-editor-toolbar,.z-editor-wrapper.z-editor-disabled .z-editor-content{pointer-events:none}.z-editor-wrapper.z-editor-readonly .z-editor-toolbar{display:none}.z-editor-wrapper.z-editor-readonly .z-editor-content{border-radius:.375rem}.z-editor-wrapper.z-editor-readonly .z-editor-prosemirror{cursor:default}.z-editor-link-modal{padding-top:0;padding-bottom:0}.z-editor-link-modal .z-modal-scrollbar main{min-height:0;padding:1rem}\n"], dependencies: [{ 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"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: ZButtonComponent, selector: "z-button, button[z-button], a[z-button]", inputs: ["class", "zType", "zSize", "zShape", "zLabel", "zLoading", "zDisabled", "zTypeIcon", "zSizeIcon", "zStrokeWidthIcon", "zWave"], exportAs: ["zButton"] }, { kind: "component", type: ZIconComponent, selector: "z-icon, [z-icon]", inputs: ["class", "zType", "zSize", "zStrokeWidth", "zSvg"] }, { kind: "component", type: ZInputComponent, selector: "z-input", inputs: ["class", "zType", "zSize", "zAlign", "zLabel", "zLabelClass", "zPlaceholder", "zRequired", "zDisabled", "zReadonly", "zPrefix", "zSuffix", "zMin", "zMax", "zStep", "zShowArrows", "zMask", "zDecimalPlaces", "zAllowNegative", "zThousandSeparator", "zDecimalMarker", "zValidators", "zAsyncValidators", "zAsyncDebounce", "zAsyncValidateOn", "zShowPasswordToggle", "zSearch", "zDebounce", "zAutofocus", "zAutoComplete", "zAllowClear", "zAutoSizeContent", "zRows", "zResize", "zMaxLength", "zAutoSuggest", "zColorConfig"], outputs: ["zOnSearch", "zOnChange", "zOnBlur", "zOnFocus", "zOnKeydown", "zOnEnter", "zOnColorCollapse", "zControl", "zEvent"], exportAs: ["zInput"] }, { kind: "component", type: ZModalComponent, selector: "z-modal", inputs: ["class", "zVisible", "zTitle", "zDescription", "zWidth", "zClosable", "zMaskClosable", "zHideHeader", "zHideFooter", "zOkText", "zCancelText", "zOkDestructive", "zOkDisabled", "zLoading", "zContentLoading", "zSkeletonRows", "zOverlay"], outputs: ["zOk", "zCancel", "zAfterClose", "zScrollbar", "zVisibleChange"], exportAs: ["zModal"] }, { kind: "directive", type: ZModalContentDirective, selector: "[z-modal-content], [zModalContent]" }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1685
|
+
], viewQueries: [{ propertyName: "_editorHost", first: true, predicate: ["editorHost"], descendants: true, isSignal: true }, { propertyName: "_floatingToolbar", first: true, predicate: ["floatingToolbar"], descendants: true, isSignal: true }, { propertyName: "_slashMenuScrollHost", first: true, predicate: ["slashMenuScrollHost"], descendants: true, isSignal: true }], exportAs: ["zEditor"], ngImport: i0, template: "<div [class]=\"wrapperClasses()\" [class.z-editor-disabled]=\"isDisabled()\" [class.z-editor-readonly]=\"zReadonly()\">\n @if (zLabel()) {\n <label [for]=\"editorId\" class=\"text-xs leading-none font-medium\" [class]=\"zLabelClass()\">\n {{ zLabel() }}\n @if (zRequired()) {\n <span class=\"text-destructive! ml-0.5\">*</span>\n }\n </label>\n }\n\n <div [class]=\"editorClasses()\">\n @if (showToolbar()) {\n <div class=\"z-editor-toolbar\" role=\"toolbar\" [attr.aria-controls]=\"editorId\">\n @for (item of toolbarItems(); track item.id) {\n @switch (item.id) {\n @case ('emoji') {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"emojiPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-emoji-popover\"\n (zControl)=\"onEmojiPopoverControl($event)\"\n (zShow)=\"onEmojiPopoverShow()\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n @case ('blockStyle') {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"blockStylePopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-menu-popover\"\n (zControl)=\"onBlockStylePopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n @case ('textColor') {\n @let textColor = activeTextColor();\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"textColorPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-color-popover\"\n (zControl)=\"onTextColorPopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span class=\"z-editor-color-indicator\" [style.background]=\"textColor\"></span>\n </button>\n }\n @case ('backgroundColor') {\n @let bgColor = activeBackgroundColor();\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"backgroundColorPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-color-popover\"\n (zControl)=\"onBackgroundColorPopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span class=\"z-editor-color-indicator\" [style.background]=\"bgColor\"></span>\n </button>\n }\n @case ('align') {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"alignPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-menu-popover\"\n (zControl)=\"onAlignPopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\">\n <i z-icon [zType]=\"activeAlignIcon()\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n @default {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n [class.z-editor-toolbar-button-active]=\"item.active\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\"\n (click)=\"onToolbarClick(item.id)\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n }\n }\n </div>\n }\n\n <div\n #editorHost\n [id]=\"editorId\"\n class=\"z-editor-content\"\n role=\"textbox\"\n [attr.aria-multiline]=\"true\"\n [attr.aria-readonly]=\"isDisabled() || zReadonly()\"></div>\n </div>\n\n @if (hasError()) {\n <p class=\"text-destructive animate-in fade-in slide-in-from-top-1 m-0 text-xs duration-200\">\n {{ errorMessage() }}\n </p>\n }\n\n <ng-template #emojiPopover>\n @let emojiCategoryLabel =\n emojiSearchQuery() ? ('i18n_z_ui_emoji_search_results' | translate) : (activeEmojiCategoryLabel() | translate);\n @let activeCategoryId = activeEmojiCategoryId();\n <div class=\"z-editor-emoji-sheet\">\n <div class=\"z-editor-emoji-header\">\n <div class=\"z-editor-emoji-title mb-1\">\n <span class=\"z-editor-emoji-title-dot\" aria-hidden=\"true\"></span>\n <span>{{ emojiCategoryLabel }}</span>\n </div>\n <z-input\n class=\"z-editor-emoji-search\"\n zSize=\"sm\"\n [zSearch]=\"true\"\n [zDebounce]=\"150\"\n [zPlaceholder]=\"'i18n_z_ui_emoji_search_placeholder' | translate\"\n [ngModel]=\"emojiSearch()\"\n (zOnSearch)=\"emojiSearch.set($any($event))\" />\n </div>\n <div class=\"z-editor-emoji-body\">\n @if (hasEmojiResults()) {\n <div class=\"z-editor-emoji-grid\">\n @for (emoji of activeEmojis(); track emoji) {\n <button\n type=\"button\"\n class=\"z-editor-emoji-button\"\n [attr.aria-label]=\"emoji\"\n (click)=\"insertEmoji($any(emoji))\">\n {{ emoji }}\n </button>\n }\n </div>\n } @else {\n <div class=\"z-editor-emoji-empty\">\n <span class=\"z-editor-emoji-empty-icon\" aria-hidden=\"true\">\n <i z-icon zType=\"lucideSearchX\" zSize=\"14\" [zStrokeWidth]=\"2\"></i>\n </span>\n <span>{{ 'i18n_z_ui_emoji_no_results' | translate }}</span>\n </div>\n }\n </div>\n <div class=\"z-editor-emoji-footer\" role=\"tablist\">\n @for (category of emojiCategories; track category.id) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"z-editor-emoji-footer-button cursor-pointer!\"\n [class.z-editor-emoji-footer-button-active]=\"category.id === activeCategoryId\"\n [attr.aria-label]=\"category.labelKey | translate\"\n [attr.aria-selected]=\"category.id === activeCategoryId\"\n [attr.title]=\"category.labelKey | translate\"\n (click)=\"setEmojiCategory(category.id)\">\n <i z-icon [zType]=\"category.icon\" zSize=\"15\" [zStrokeWidth]=\"2\"></i>\n </button>\n }\n </div>\n </div>\n </ng-template>\n\n <ng-template #blockStylePopover>\n <div class=\"z-editor-menu-list\">\n @for (option of blockStyleOptions; track option.command) {\n <button\n type=\"button\"\n class=\"z-editor-menu-item\"\n [class.z-editor-menu-item-active]=\"activeBlockStyle() === option.command\"\n (click)=\"applyBlockStyle(option.command)\">\n <i z-icon [zType]=\"option.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span>{{ option.label }}</span>\n </button>\n }\n </div>\n </ng-template>\n\n <ng-template #alignPopover>\n <div class=\"z-editor-menu-list\">\n @for (option of alignOptions; track option.command) {\n <button\n type=\"button\"\n class=\"z-editor-menu-item\"\n [class.z-editor-menu-item-active]=\"activeAlign() === option.command\"\n (click)=\"applyAlign(option.command)\">\n <i z-icon [zType]=\"option.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span>{{ option.label }}</span>\n </button>\n }\n </div>\n </ng-template>\n\n <ng-template #textColorPopover>\n @let currentTextColor = activeTextColor();\n <div class=\"z-editor-color-grid\">\n @for (color of textColorSwatches; track color) {\n <button\n type=\"button\"\n class=\"z-editor-color-swatch\"\n [class.z-editor-color-swatch-active]=\"currentTextColor === color\"\n [style.background]=\"color\"\n [attr.aria-label]=\"'Text color ' + color\"\n (click)=\"setTextColor(color)\"></button>\n }\n <label class=\"z-editor-color-custom\">\n <input type=\"color\" [value]=\"currentTextColor\" (input)=\"setTextColorFromEvent($event)\" />\n {{ currentTextColor }}\n </label>\n <button type=\"button\" z-button zType=\"outline\" zSize=\"sm\" class=\"z-editor-color-reset\" (click)=\"unsetTextColor()\">\n Reset\n </button>\n </div>\n </ng-template>\n\n <ng-template #backgroundColorPopover>\n @let currentBgColor = activeBackgroundColor();\n <div class=\"z-editor-color-grid\">\n @for (color of backgroundColorSwatches; track color) {\n <button\n type=\"button\"\n class=\"z-editor-color-swatch\"\n [class.z-editor-color-swatch-active]=\"currentBgColor === color\"\n [style.background]=\"color\"\n [attr.aria-label]=\"'Background color ' + color\"\n (click)=\"setBackgroundColor(color)\"></button>\n }\n <label class=\"z-editor-color-custom\">\n <input type=\"color\" [value]=\"currentBgColor\" (input)=\"setBackgroundColorFromEvent($event)\" />\n {{ currentBgColor }}\n </label>\n <button\n type=\"button\"\n z-button\n zType=\"outline\"\n zSize=\"sm\"\n class=\"z-editor-color-reset\"\n (click)=\"unsetBackgroundColor()\">\n Reset\n </button>\n </div>\n </ng-template>\n\n <div #floatingToolbar class=\"z-editor-floating-toolbar\" role=\"toolbar\" [attr.aria-controls]=\"editorId\">\n @for (item of floatingToolbarItems(); track item.id) {\n @switch (item.id) {\n @case ('blockStyle') {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"blockStylePopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-menu-popover\"\n (zControl)=\"onBlockStylePopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"activeBlockStyleLabel()\"\n (mousedown)=\"$event.preventDefault()\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n @case ('textColor') {\n @let textColor = activeTextColor();\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"textColorPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-color-popover\"\n (zControl)=\"onTextColorPopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\"\n (mousedown)=\"$event.preventDefault()\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span class=\"z-editor-color-indicator\" [style.background]=\"textColor\"></span>\n </button>\n }\n @case ('backgroundColor') {\n @let bgColor = activeBackgroundColor();\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"backgroundColorPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-color-popover\"\n (zControl)=\"onBackgroundColorPopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\"\n (mousedown)=\"$event.preventDefault()\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span class=\"z-editor-color-indicator\" [style.background]=\"bgColor\"></span>\n </button>\n }\n @case ('align') {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"alignPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-menu-popover\"\n (zControl)=\"onAlignPopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"activeAlignLabel()\"\n (mousedown)=\"$event.preventDefault()\">\n <i z-icon [zType]=\"activeAlignIcon()\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n @default {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-tooltip\n [zContent]=\"item.tooltip\"\n zPosition=\"top\"\n [zAlwaysShow]=\"true\"\n [zDisabled]=\"item.disabled || !item.shortcut\"\n [class.z-editor-toolbar-button-active]=\"item.active\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onFloatingToolbarClick(item.id)\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n }\n }\n </div>\n\n <span\n class=\"z-editor-slash-menu-trigger\"\n z-popover\n [zPopoverContent]=\"slashMenuPopover\"\n zTrigger=\"manual\"\n zPosition=\"bottom-left\"\n zClass=\"z-editor-slash-popover\"\n [zOffset]=\"4\"\n [zPopoverWidth]=\"300\"\n [style.left.px]=\"slashMenuState().left\"\n [style.top.px]=\"slashMenuState().top\"\n (zControl)=\"onSlashMenuPopoverControl($event)\"\n (zHide)=\"onSlashMenuPopoverHide()\"></span>\n\n <ng-template #slashMenuPopover>\n @let slashActiveIndex = slashMenuActiveIndex();\n <div class=\"z-editor-slash-menu-shell\">\n <div #slashMenuScrollHost class=\"z-editor-slash-menu-scrollbar\">\n <div class=\"z-editor-slash-menu\" role=\"listbox\" [attr.aria-controls]=\"editorId\">\n @for (item of filteredSlashCommands(); track item.id) {\n @if (item.showGroupLabel) {\n <div class=\"z-editor-slash-menu-group\">\n {{ item.group }}\n </div>\n }\n <button\n type=\"button\"\n class=\"z-editor-slash-menu-item\"\n role=\"option\"\n [class.z-editor-slash-menu-item-active]=\"$index === slashActiveIndex\"\n [attr.aria-selected]=\"$index === slashActiveIndex\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"applySlashCommand(item)\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span class=\"z-editor-slash-menu-copy\">\n <span class=\"z-editor-slash-menu-label\">{{ item.label }}</span>\n </span>\n </button>\n } @empty {\n <div class=\"z-editor-slash-menu-empty\">\n <i z-icon zType=\"lucideSearchX\" zSize=\"28\" [zStrokeWidth]=\"1.8\"></i>\n <span>{{ 'i18n_z_ui_editor_no_commands' | translate }}</span>\n </div>\n }\n </div>\n </div>\n <div class=\"z-editor-slash-menu-footer\" aria-hidden=\"true\">\n <span>\n <kbd>\u2191\u2193</kbd>\n {{ 'i18n_z_ui_editor_shortcut_navigate' | translate }}\n </span>\n <span>\n <kbd>Esc</kbd>\n {{ 'i18n_z_ui_editor_shortcut_abort' | translate }}\n </span>\n <span>\n <kbd>\u21B5</kbd>\n {{ 'i18n_z_ui_editor_shortcut_select' | translate }}\n </span>\n </div>\n </div>\n </ng-template>\n\n <span\n class=\"z-editor-link-popover-trigger\"\n z-popover\n [zPopoverContent]=\"linkPopover\"\n zTrigger=\"manual\"\n zPosition=\"bottom-left\"\n zClass=\"z-editor-link-popover\"\n [zOffset]=\"6\"\n [zPopoverWidth]=\"320\"\n [style.left.px]=\"linkPopoverState().left\"\n [style.top.px]=\"linkPopoverState().top\"\n [style.width.px]=\"linkPopoverState().width\"\n [style.height.px]=\"linkPopoverState().height\"\n (zControl)=\"onLinkPopoverControl($event)\"\n (zHide)=\"onLinkPopoverHide()\"></span>\n\n <ng-template #linkPopover>\n <div class=\"z-editor-link-popover-content\">\n <ng-template #linkPrefix>\n <z-icon zType=\"lucideLink\" zSize=\"16\" class=\"text-muted-foreground\" />\n </ng-template>\n <z-input\n zType=\"url\"\n zSize=\"sm\"\n class=\"z-editor-link-popover-input\"\n [zPrefix]=\"linkPrefix\"\n zPlaceholder=\"https://example.com\"\n [zValidators]=\"linkValidators\"\n [ngModel]=\"linkUrl()\"\n (ngModelChange)=\"onLinkUrlChange($event)\"\n (zOnEnter)=\"applyLink()\" />\n <div class=\"z-editor-link-popover-actions\">\n <button\n type=\"button\"\n z-button\n zType=\"ghost\"\n zSize=\"sm\"\n [zDisabled]=\"!canApplyLink()\"\n (click)=\"applyLink()\"\n aria-label=\"Apply link\">\n <z-icon zType=\"lucideCheck\" zSize=\"16\" [zStrokeWidth]=\"2.5\" />\n </button>\n <button\n type=\"button\"\n z-button\n zType=\"ghost\"\n zSize=\"sm\"\n [zDisabled]=\"!activeLinkHref()\"\n (click)=\"openActiveLink()\"\n aria-label=\"Open link\">\n <z-icon zType=\"lucideExternalLink\" zSize=\"16\" [zStrokeWidth]=\"2.5\" />\n </button>\n <button\n type=\"button\"\n z-button\n zType=\"ghost-destructive\"\n zSize=\"sm\"\n [zDisabled]=\"!activeLinkHref()\"\n (click)=\"removeLink()\"\n aria-label=\"Remove link\">\n <z-icon zType=\"lucideUnlink\" zSize=\"16\" [zStrokeWidth]=\"2.5\" />\n </button>\n </div>\n </div>\n </ng-template>\n</div>\n", styles: [".z-editor-wrapper .z-editor-toolbar{display:flex;flex-wrap:wrap;gap:.125rem;align-items:center;border-bottom:.0625rem solid var(--border);border-top-left-radius:.375rem;border-top-right-radius:.375rem;background-color:color-mix(in srgb,var(--muted) 30%,transparent);padding:.5rem}.z-editor-wrapper .z-editor-toolbar-button{position:relative;display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.25rem;padding:0;color:var(--muted-foreground);transition:background-color .15s ease,color .15s ease,opacity .15s ease}.z-editor-wrapper .z-editor-toolbar-button:hover:not(:disabled){background-color:var(--accent);color:var(--foreground)}.z-editor-wrapper .z-editor-toolbar-button:disabled{cursor:not-allowed;opacity:.45}.z-editor-wrapper .z-editor-toolbar-button.z-editor-toolbar-button-active{background-color:color-mix(in srgb,var(--primary) 10%,transparent);color:var(--primary)}.z-editor-wrapper .z-editor-content{position:relative;border-bottom-right-radius:.375rem;border-bottom-left-radius:.375rem}.z-editor-wrapper .z-editor-prosemirror{width:100%;outline:none;padding:.75rem;color:var(--foreground)}.z-editor-wrapper .z-editor-prosemirror>*{margin-top:1.25rem;margin-bottom:1.25rem}.z-editor-wrapper .z-editor-prosemirror>:first-child{margin-top:0}.z-editor-wrapper .z-editor-prosemirror>:last-child{margin-bottom:0}.z-editor-wrapper .z-editor-prosemirror p{line-height:1.75}.z-editor-wrapper .z-editor-prosemirror a{border-bottom:.0625rem solid transparent;color:var(--primary);font-weight:500;cursor:pointer;transition:border-color .15s ease}.z-editor-wrapper .z-editor-prosemirror a:hover{border-color:var(--primary)}.z-editor-wrapper .z-editor-prosemirror .mention{color:var(--primary);font-weight:500}.z-editor-wrapper .z-editor-prosemirror :is(h1,h2,h3,h4,h5,h6){color:var(--foreground);font-weight:700;line-height:1.2}.z-editor-wrapper .z-editor-prosemirror h1{font-size:1.875rem}.z-editor-wrapper .z-editor-prosemirror h2{font-size:1.5rem}.z-editor-wrapper .z-editor-prosemirror h3{font-size:1.25rem}.z-editor-wrapper .z-editor-prosemirror h4{font-size:1.125rem}.z-editor-wrapper .z-editor-prosemirror h5,.z-editor-wrapper .z-editor-prosemirror h6{font-size:1rem}.z-editor-wrapper .z-editor-prosemirror blockquote{border-left:.25rem solid var(--border);padding-left:1rem;font-style:italic;color:var(--muted-foreground)}.z-editor-wrapper .z-editor-prosemirror [data-type=horizontalRule]{margin-top:2rem;margin-bottom:2rem;padding-top:.5rem;padding-bottom:.5rem}.z-editor-wrapper .z-editor-prosemirror hr{border:0;border-top:.0625rem solid var(--border)}.z-editor-wrapper .z-editor-prosemirror pre{overflow-x:auto;border:.0625rem solid var(--border);border-radius:.375rem;background-color:var(--muted);padding:.75rem 1rem;font-size:.875rem;line-height:1.5;white-space:pre-wrap;word-break:break-word}.z-editor-wrapper .z-editor-prosemirror pre code{display:inline;border:0;border-radius:0;background-color:transparent;padding:0;color:inherit;font:inherit}.z-editor-wrapper .z-editor-prosemirror code{display:inline-block;border:.0625rem solid var(--border);border-radius:.375rem;background-color:var(--muted);padding:.125rem .375rem;color:var(--foreground);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875em;font-weight:500}.z-editor-wrapper .z-editor-prosemirror :is(ul,ol){padding-left:1.5rem}.z-editor-wrapper .z-editor-prosemirror ul{list-style:disc}.z-editor-wrapper .z-editor-prosemirror ol{list-style:decimal}.z-editor-wrapper .z-editor-prosemirror li{margin-top:.375rem;margin-bottom:.375rem;padding-left:.375rem}.z-editor-wrapper .z-editor-prosemirror img{display:block;max-width:100%;border-radius:.375rem}.z-editor-wrapper .z-editor-prosemirror img[data-text-align=center]{margin-right:auto;margin-left:auto}.z-editor-wrapper .z-editor-prosemirror img[data-text-align=right]{margin-right:0;margin-left:auto}.z-editor-wrapper .z-editor-prosemirror img[data-text-align=left],.z-editor-wrapper .z-editor-prosemirror img[data-text-align=justify]{margin-right:auto;margin-left:0}.z-editor-wrapper .z-editor-prosemirror img.ProseMirror-selectednode{outline:.125rem solid var(--primary)}.z-editor-wrapper .z-editor-prosemirror .image-resizer{display:inline-flex;position:relative;flex-grow:0}.z-editor-wrapper .z-editor-prosemirror .image-resizer .resize-trigger{position:absolute;right:-6px;bottom:-9px;width:12px;height:12px;cursor:nwse-resize;border-radius:50%;background-color:var(--primary);opacity:0;transition:opacity .2s ease}.z-editor-wrapper .z-editor-prosemirror .image-resizer:hover .resize-trigger{opacity:1}.z-editor-wrapper .z-editor-prosemirror .image-resizer .image-alignment{display:flex;gap:4px;position:absolute;top:-32px;left:0;padding:4px;border-radius:6px;background-color:var(--popover);box-shadow:0 2px 8px #00000026;opacity:0;transition:opacity .2s ease;pointer-events:none}.z-editor-wrapper .z-editor-prosemirror .image-resizer:hover .image-alignment{opacity:1;pointer-events:auto}.z-editor-wrapper .z-editor-prosemirror .ProseMirror-selectednode:not(img):not(pre):not([data-node-view-wrapper]){background-color:color-mix(in srgb,var(--primary) 20%,transparent)}.z-editor-wrapper .z-editor-prosemirror :is(p,h1,h2,h3,h4,h5,h6).is-empty:before{float:left;height:0;color:var(--muted-foreground);content:attr(data-placeholder);pointer-events:none}.z-editor-placeholder-first-line .z-editor-wrapper .z-editor-prosemirror :is(p,h1,h2,h3,h4,h5,h6).is-empty:before{content:none}.z-editor-placeholder-first-line .z-editor-wrapper .z-editor-prosemirror :is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child:before{content:attr(data-placeholder)}.z-editor-wrapper.z-editor-disabled .z-editor-toolbar,.z-editor-wrapper.z-editor-disabled .z-editor-content{pointer-events:none}.z-editor-wrapper.z-editor-readonly .z-editor-toolbar{display:none}.z-editor-wrapper.z-editor-readonly .z-editor-content{border-radius:.375rem}.z-editor-wrapper.z-editor-readonly .z-editor-prosemirror{cursor:default}.z-editor-link-modal{padding-top:0;padding-bottom:0}.z-editor-link-modal .z-modal-scrollbar main{min-height:0;padding:1rem}.z-editor-emoji-popover{padding:0;overflow:hidden;box-shadow:0 .5rem 1.5rem -.25rem #0000002e,0 .25rem .5rem -.125rem #0000001a}.z-editor-color-popover{padding:.5rem}.z-editor-menu-popover{padding:.25rem}.z-editor-menu-list{display:flex;min-width:9rem;flex-direction:column;gap:.125rem}.z-editor-menu-item{display:flex;width:100%;cursor:pointer;align-items:center;gap:.5rem;border-radius:.25rem;padding:.375rem .5rem;color:var(--muted-foreground);font-size:.8125rem;line-height:1.25;transition:background-color .15s ease,color .15s ease}.z-editor-menu-item:hover,.z-editor-menu-item.z-editor-menu-item-active{background-color:var(--accent);color:var(--foreground)}.z-editor-color-indicator{position:absolute;right:.25rem;bottom:.1875rem;width:.75rem;height:.1875rem;border-radius:999px;box-shadow:0 0 0 .0625rem var(--border)}.z-editor-color-grid{display:grid;grid-template-columns:repeat(5,1.625rem);gap:.25rem}.z-editor-color-swatch{width:1.625rem;height:1.625rem;border:.0625rem solid var(--border);border-radius:.25rem;cursor:pointer;transition:border-color .15s ease,box-shadow .15s ease,transform .15s ease}.z-editor-color-swatch:hover{transform:translateY(-.0625rem);border-color:var(--ring)}.z-editor-color-swatch.z-editor-color-swatch-active{border-color:var(--primary);box-shadow:0 0 0 .125rem color-mix(in srgb,var(--primary) 20%,transparent)}.z-editor-color-custom{grid-column:1/-1;display:flex;height:1.875rem;cursor:pointer;align-items:center;gap:.5rem;border:.0625rem solid var(--border);border-radius:.25rem;padding:.25rem .5rem;color:var(--muted-foreground);font-size:.75rem;transition:border-color .15s ease,background-color .15s ease,color .15s ease}.z-editor-color-custom input{width:1.375rem;height:1.375rem;flex:none;cursor:pointer;border:0;padding:0;background:transparent}.z-editor-color-custom:hover{border-color:var(--ring);background-color:var(--accent);color:var(--foreground)}.z-editor-color-reset{grid-column:1/-1;width:100%;justify-content:center}.z-editor-floating-toolbar{display:inline-flex;align-items:center;gap:.125rem;border:.0625rem solid var(--border);border-radius:.25rem;background-color:var(--popover);padding:.375rem;box-shadow:0 .625rem 1.5rem -.75rem #00000059,0 .25rem .75rem -.5rem #0003;visibility:hidden;opacity:0;position:fixed;top:-10000px;left:-10000px;scale:.98;translate:0 .25rem;transform-origin:top left;transition:opacity .12s ease,visibility .12s ease,scale .16s ease,translate .16s ease}.z-editor-floating-toolbar[style*=\"visibility: visible\"]{animation:z-editor-floating-toolbar-in .16s cubic-bezier(.16,1,.3,1);scale:1;translate:0 0}@keyframes z-editor-floating-toolbar-in{0%{opacity:0;scale:.96;translate:0 .375rem}to{opacity:1;scale:1;translate:0 0}}.z-editor-slash-menu-trigger,.z-editor-link-popover-trigger{position:fixed;z-index:-1;width:.0625rem;height:.0625rem;pointer-events:none}.z-editor-link-popover{padding:.5rem}.z-editor-link-popover-content{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;column-gap:.5rem}.z-editor-link-popover-input{flex:1;min-width:0}.z-editor-link-popover-actions{display:inline-flex;align-self:start;align-items:center;gap:.125rem}.z-editor-slash-popover{box-sizing:border-box;padding:0;overflow:hidden}.z-editor-slash-menu-shell{box-sizing:border-box;display:flex;min-width:0;height:min(16rem,100vh - 4rem);flex-direction:column}.z-editor-slash-menu-scrollbar{box-sizing:border-box;display:block;min-width:0;min-height:0;flex:1;overflow-x:hidden;overflow-y:scroll;overscroll-behavior:contain}.z-editor-slash-menu{box-sizing:border-box;display:flex;min-width:0;min-height:100%;flex-direction:column;padding:.2rem;gap:.2rem;color:var(--popover-foreground)}.z-editor-slash-menu-group{margin:.25rem 0 .125rem;border-top:.0625rem solid var(--border);padding:.5rem .5rem .1875rem;color:var(--muted-foreground);font-size:.6875rem;font-weight:600;line-height:1;text-transform:uppercase}.z-editor-slash-menu-group:first-child{margin-top:0;border-top:0;padding-top:.5rem}.z-editor-slash-menu-item{box-sizing:border-box;display:flex;align-self:stretch;min-width:0;cursor:pointer;align-items:center;gap:.5rem;border-radius:.25rem;padding:.375rem .75rem;text-align:left;transition:background-color .15s ease,color .15s ease}.z-editor-slash-menu-item i{color:var(--muted-foreground);flex:none}.z-editor-slash-menu-item:hover,.z-editor-slash-menu-item.z-editor-slash-menu-item-active{background-color:var(--accent);color:var(--foreground)}.z-editor-slash-menu-copy{display:flex;min-width:0;align-items:center}.z-editor-slash-menu-label{color:var(--foreground);font-size:.8125rem;font-weight:500;line-height:1.2}.z-editor-slash-menu-empty{box-sizing:border-box;display:flex;align-self:stretch;max-width:100%;min-width:0;flex:1;flex-direction:column;align-items:center;justify-content:center;gap:.625rem;padding:1rem;color:var(--muted-foreground);font-size:.8125rem;line-height:1.15;text-align:center}.z-editor-slash-menu-empty i{color:var(--muted-foreground);flex:none}.z-editor-slash-menu-footer{box-sizing:border-box;display:flex;min-width:0;flex:none;align-items:center;gap:.75rem;border-top:.0625rem solid var(--border);padding:.375rem .625rem;color:var(--popover-foreground);font-size:.75rem;font-weight:500;line-height:1;white-space:nowrap}.z-editor-slash-menu-footer span{display:inline-flex;align-items:center;gap:.25rem}.z-editor-slash-menu-footer kbd{color:var(--foreground);font:inherit}.z-editor-emoji-sheet{display:flex;width:18rem;max-width:85vw;height:20rem;max-height:70vh;flex-direction:column;overflow:hidden;background-color:var(--popover);color:var(--popover-foreground)}.z-editor-emoji-header{display:flex;flex-direction:column;gap:.5rem;padding:.75rem .75rem .625rem;flex:none}.z-editor-emoji-title{display:flex;align-items:center;gap:.375rem;padding-inline:.25rem;color:var(--foreground);font-size:.8125rem;font-weight:600;line-height:1;letter-spacing:-.005em}.z-editor-emoji-title-dot{display:inline-block;width:.375rem;height:.375rem;border-radius:999px;background-color:var(--primary);box-shadow:0 0 0 .1875rem color-mix(in srgb,var(--primary) 18%,transparent)}.z-editor-emoji-search{width:100%}.z-editor-emoji-body{flex:1 1 0;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--muted-foreground) 30%,transparent) transparent}.z-editor-emoji-body::-webkit-scrollbar{width:.375rem}.z-editor-emoji-body::-webkit-scrollbar-track{background:transparent}.z-editor-emoji-body::-webkit-scrollbar-thumb{border-radius:999px;background-color:color-mix(in srgb,var(--muted-foreground) 30%,transparent)}.z-editor-emoji-body::-webkit-scrollbar-thumb:hover{background-color:color-mix(in srgb,var(--muted-foreground) 55%,transparent)}.z-editor-emoji-grid{display:grid;grid-template-columns:repeat(8,1.875rem);justify-content:center;gap:.125rem;padding:.25rem .5rem .5rem}.z-editor-emoji-empty{display:flex;height:100%;min-height:10rem;flex-direction:column;align-items:center;justify-content:center;gap:.375rem;padding:1.5rem .75rem;color:var(--muted-foreground);font-size:.8125rem;text-align:center}.z-editor-emoji-empty-icon{display:inline-flex;align-items:center;justify-content:center;width:2.25rem;height:2.25rem;border-radius:999px;background-color:color-mix(in srgb,var(--muted) 70%,transparent);color:var(--muted-foreground)}.z-editor-emoji-button{display:inline-flex;align-items:center;justify-content:center;width:1.875rem;height:1.875rem;border-radius:.4375rem;font-family:\"Noto Color Emoji\",\"Apple Color Emoji\",\"Segoe UI Emoji\",Twemoji Mozilla,EmojiOne Color,\"Android Emoji\",sans-serif;font-size:1.1875rem;line-height:1;transition:background-color .12s ease,box-shadow .12s ease}.z-editor-emoji-button:hover{background-color:color-mix(in srgb,var(--accent) 80%,transparent);box-shadow:0 0 0 .0625rem color-mix(in srgb,var(--ring) 35%,transparent)}.z-editor-emoji-button:active{background-color:color-mix(in srgb,var(--primary) 18%,transparent);box-shadow:0 0 0 .0625rem color-mix(in srgb,var(--primary) 45%,transparent)}.z-editor-emoji-footer{position:relative;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));align-items:center;border-top:.0625rem solid color-mix(in srgb,var(--border) 70%,transparent);padding:.25rem;background-color:color-mix(in srgb,var(--muted) 35%,transparent);flex:none}.z-editor-emoji-footer-button{position:relative;display:inline-flex;align-items:center;justify-content:center;height:1.875rem;border-radius:.4375rem;color:var(--muted-foreground);transition:color .15s ease,background-color .15s ease}.z-editor-emoji-footer-button:after{content:\"\";position:absolute;bottom:.0625rem;left:50%;width:0;height:.125rem;border-radius:999px;background-color:var(--primary);transition:width .2s ease,transform .2s ease;transform:translate(-50%)}.z-editor-emoji-footer-button:hover{color:var(--foreground);background-color:color-mix(in srgb,var(--accent) 60%,transparent)}.z-editor-emoji-footer-button.z-editor-emoji-footer-button-active{color:var(--primary)}.z-editor-emoji-footer-button.z-editor-emoji-footer-button-active:after{width:.875rem}\n"], dependencies: [{ 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"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: ZButtonComponent, selector: "z-button, button[z-button], a[z-button]", inputs: ["class", "zType", "zSize", "zShape", "zLabel", "zLoading", "zDisabled", "zTypeIcon", "zSizeIcon", "zStrokeWidthIcon", "zWave"], exportAs: ["zButton"] }, { kind: "component", type: ZIconComponent, selector: "z-icon, [z-icon]", inputs: ["class", "zType", "zSize", "zStrokeWidth", "zSvg"] }, { kind: "component", type: ZInputComponent, selector: "z-input", inputs: ["class", "zType", "zSize", "zAlign", "zLabel", "zLabelClass", "zPlaceholder", "zRequired", "zDisabled", "zReadonly", "zPrefix", "zSuffix", "zMin", "zMax", "zStep", "zShowArrows", "zMask", "zDecimalPlaces", "zAllowNegative", "zThousandSeparator", "zDecimalMarker", "zValidators", "zAsyncValidators", "zAsyncDebounce", "zAsyncValidateOn", "zShowPasswordToggle", "zSearch", "zDebounce", "zAutofocus", "zAutoComplete", "zAllowClear", "zAutoSizeContent", "zRows", "zResize", "zMaxLength", "zAutoSuggest", "zColorConfig"], outputs: ["zOnSearch", "zOnChange", "zOnBlur", "zOnFocus", "zOnKeydown", "zOnEnter", "zOnColorCollapse", "zControl", "zEvent"], exportAs: ["zInput"] }, { kind: "directive", type: ZPopoverDirective, selector: "[z-popover]", inputs: ["zPopoverContent", "zPosition", "zTrigger", "zClass", "zShowDelay", "zHideDelay", "zDisabled", "zOffset", "zPopoverWidth", "zManualClose", "zScrollClose", "zShowArrow"], outputs: ["zShow", "zHide", "zHideStart", "zControl", "zPositionChange"], exportAs: ["zPopover"] }, { kind: "directive", type: ZTooltipDirective, selector: "[z-tooltip], [zTooltip]", inputs: ["zContent", "zPosition", "zTrigger", "zTooltipType", "zTooltipSize", "zClass", "zShowDelay", "zHideDelay", "zArrow", "zDisabled", "zOffset", "zAutoDetect", "zTriggerElement", "zAlwaysShow", "zMaxWidth"], outputs: ["zShow", "zHide"], exportAs: ["zTooltip"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
811
1686
|
}
|
|
812
1687
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZEditorComponent, decorators: [{
|
|
813
1688
|
type: Component,
|
|
@@ -817,108 +1692,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImpor
|
|
|
817
1692
|
ZButtonComponent,
|
|
818
1693
|
ZIconComponent,
|
|
819
1694
|
ZInputComponent,
|
|
820
|
-
|
|
821
|
-
|
|
1695
|
+
ZPopoverDirective,
|
|
1696
|
+
ZTooltipDirective,
|
|
822
1697
|
TranslatePipe,
|
|
823
|
-
], standalone: true,
|
|
824
|
-
<div [class]="wrapperClasses()" [class.z-editor-disabled]="isDisabled()" [class.z-editor-readonly]="zReadonly()">
|
|
825
|
-
@if (zLabel()) {
|
|
826
|
-
<label [for]="editorId" class="text-xs leading-none font-medium" [class]="zLabelClass()">
|
|
827
|
-
{{ zLabel() }}
|
|
828
|
-
@if (zRequired()) {
|
|
829
|
-
<span class="text-destructive! ml-0.5">*</span>
|
|
830
|
-
}
|
|
831
|
-
</label>
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
<div [class]="editorClasses()">
|
|
835
|
-
@if (showToolbar()) {
|
|
836
|
-
<div class="z-editor-toolbar" role="toolbar" [attr.aria-controls]="editorId">
|
|
837
|
-
@for (item of toolbarItems(); track item.id) {
|
|
838
|
-
<button
|
|
839
|
-
type="button"
|
|
840
|
-
class="z-editor-toolbar-button"
|
|
841
|
-
[class.z-editor-toolbar-button-active]="item.active"
|
|
842
|
-
[disabled]="item.disabled"
|
|
843
|
-
[attr.aria-label]="item.label"
|
|
844
|
-
[attr.title]="item.label"
|
|
845
|
-
(click)="onToolbarClick(item.id)"
|
|
846
|
-
>
|
|
847
|
-
<i z-icon [zType]="item.icon" zSize="16"></i>
|
|
848
|
-
</button>
|
|
849
|
-
}
|
|
850
|
-
</div>
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
<div
|
|
854
|
-
#editorHost
|
|
855
|
-
[id]="editorId"
|
|
856
|
-
class="z-editor-content"
|
|
857
|
-
role="textbox"
|
|
858
|
-
[attr.aria-multiline]="true"
|
|
859
|
-
[attr.aria-readonly]="isDisabled() || zReadonly()"
|
|
860
|
-
></div>
|
|
861
|
-
</div>
|
|
862
|
-
|
|
863
|
-
@if (hasError()) {
|
|
864
|
-
<p class="text-destructive animate-in fade-in slide-in-from-top-1 m-0 text-xs duration-200">
|
|
865
|
-
{{ errorMessage() }}
|
|
866
|
-
</p>
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
<z-modal
|
|
870
|
-
[(zVisible)]="linkModalVisible"
|
|
871
|
-
class="z-editor-link-modal"
|
|
872
|
-
zWidth="360px"
|
|
873
|
-
[zClosable]="false"
|
|
874
|
-
[zHideHeader]="true"
|
|
875
|
-
[zHideFooter]="true"
|
|
876
|
-
>
|
|
877
|
-
<ng-template z-modal-content>
|
|
878
|
-
<div class="space-y-4">
|
|
879
|
-
<z-input
|
|
880
|
-
zType="url"
|
|
881
|
-
zLabel="URL"
|
|
882
|
-
zPlaceholder="https://example.com"
|
|
883
|
-
[zRequired]="true"
|
|
884
|
-
[zValidators]="linkValidators"
|
|
885
|
-
[ngModel]="linkUrl()"
|
|
886
|
-
(ngModelChange)="onLinkUrlChange($event)"
|
|
887
|
-
(zOnEnter)="applyLink()"
|
|
888
|
-
/>
|
|
889
|
-
|
|
890
|
-
<div class="mt-4 flex items-center justify-between gap-2">
|
|
891
|
-
<button
|
|
892
|
-
type="button"
|
|
893
|
-
z-button
|
|
894
|
-
zType="ghost"
|
|
895
|
-
zSize="sm"
|
|
896
|
-
[zDisabled]="!activeLinkHref()"
|
|
897
|
-
(click)="removeLink()"
|
|
898
|
-
>
|
|
899
|
-
{{ 'i18n_z_ui_common_remove' | translate }}
|
|
900
|
-
</button>
|
|
901
|
-
<div class="flex items-center gap-2">
|
|
902
|
-
<button type="button" z-button zType="outline" zSize="sm" (click)="closeLinkModal()">
|
|
903
|
-
{{ 'i18n_z_ui_common_cancel' | translate }}
|
|
904
|
-
</button>
|
|
905
|
-
<button type="button" z-button zSize="sm" [zDisabled]="!canApplyLink()" (click)="applyLink()">
|
|
906
|
-
{{ 'i18n_z_ui_common_apply' | translate }}
|
|
907
|
-
</button>
|
|
908
|
-
</div>
|
|
909
|
-
</div>
|
|
910
|
-
</div>
|
|
911
|
-
</ng-template>
|
|
912
|
-
</z-modal>
|
|
913
|
-
</div>
|
|
914
|
-
`, providers: [
|
|
1698
|
+
], standalone: true, providers: [
|
|
915
1699
|
{
|
|
916
1700
|
provide: NG_VALUE_ACCESSOR,
|
|
917
1701
|
useExisting: forwardRef(() => ZEditorComponent),
|
|
918
1702
|
multi: true,
|
|
919
1703
|
},
|
|
920
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'zEditor', styles: [".z-editor-wrapper .z-editor-toolbar{display:flex;flex-wrap:wrap;gap:.125rem;align-items:center;border-bottom:.0625rem solid var(--border);border-top-left-radius:.375rem;border-top-right-radius:.375rem;background-color:color-mix(in srgb,var(--muted) 30%,transparent);padding:.5rem}.z-editor-wrapper .z-editor-toolbar-button{display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.25rem;padding:0;color:var(--muted-foreground);transition:background-color .15s ease,color .15s ease,opacity .15s ease}.z-editor-wrapper .z-editor-toolbar-button:hover:not(:disabled){background-color:var(--accent);color:var(--foreground)}.z-editor-wrapper .z-editor-toolbar-button:disabled{cursor:not-allowed;opacity:.45}.z-editor-wrapper .z-editor-toolbar-button.z-editor-toolbar-button-active{background-color:color-mix(in srgb,var(--primary) 10%,transparent);color:var(--primary)}.z-editor-wrapper .z-editor-content{border-bottom-right-radius:.375rem;border-bottom-left-radius:.375rem}.z-editor-wrapper .z-editor-prosemirror{width:100%;outline:none;padding:.75rem;color:var(--foreground)}.z-editor-wrapper .z-editor-prosemirror>*{margin-top:1.25rem;margin-bottom:1.25rem}.z-editor-wrapper .z-editor-prosemirror>:first-child{margin-top:0}.z-editor-wrapper .z-editor-prosemirror>:last-child{margin-bottom:0}.z-editor-wrapper .z-editor-prosemirror p{line-height:1.75}.z-editor-wrapper .z-editor-prosemirror a{border-bottom:.0625rem solid transparent;color:var(--primary);font-weight:500;transition:border-color .15s ease}.z-editor-wrapper .z-editor-prosemirror a:hover{border-color:var(--primary)}.z-editor-wrapper .z-editor-prosemirror .mention{color:var(--primary);font-weight:500}.z-editor-wrapper .z-editor-prosemirror :is(h1,h2,h3,h4,h5,h6){color:var(--foreground);font-weight:700;line-height:1.2}.z-editor-wrapper .z-editor-prosemirror h1{font-size:1.875rem}.z-editor-wrapper .z-editor-prosemirror h2{font-size:1.5rem}.z-editor-wrapper .z-editor-prosemirror h3{font-size:1.25rem}.z-editor-wrapper .z-editor-prosemirror h4{font-size:1.125rem}.z-editor-wrapper .z-editor-prosemirror h5,.z-editor-wrapper .z-editor-prosemirror h6{font-size:1rem}.z-editor-wrapper .z-editor-prosemirror blockquote{border-left:.25rem solid var(--border);padding-left:1rem;font-style:italic;color:var(--muted-foreground)}.z-editor-wrapper .z-editor-prosemirror [data-type=horizontalRule]{margin-top:2rem;margin-bottom:2rem;padding-top:.5rem;padding-bottom:.5rem}.z-editor-wrapper .z-editor-prosemirror hr{border:0;border-top:.0625rem solid var(--border)}.z-editor-wrapper .z-editor-prosemirror pre{overflow-x:auto;border:.0625rem solid var(--border);border-radius:.375rem;background-color:var(--muted);padding:.75rem 1rem;font-size:.875rem;line-height:1.5;white-space:pre-wrap;word-break:break-word}.z-editor-wrapper .z-editor-prosemirror pre code{display:inline;border:0;border-radius:0;background-color:transparent;padding:0;color:inherit;font:inherit}.z-editor-wrapper .z-editor-prosemirror code{display:inline-block;border:.0625rem solid var(--border);border-radius:.375rem;background-color:var(--muted);padding:.125rem .375rem;color:var(--foreground);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875em;font-weight:500}.z-editor-wrapper .z-editor-prosemirror :is(ul,ol){padding-left:1.5rem}.z-editor-wrapper .z-editor-prosemirror ul{list-style:disc}.z-editor-wrapper .z-editor-prosemirror ol{list-style:decimal}.z-editor-wrapper .z-editor-prosemirror li{margin-top:.375rem;margin-bottom:.375rem;padding-left:.375rem}.z-editor-wrapper .z-editor-prosemirror img{display:block;max-width:100%;border-radius:.375rem}.z-editor-wrapper .z-editor-prosemirror img.ProseMirror-selectednode{outline:.125rem solid var(--primary)}.z-editor-wrapper .z-editor-prosemirror .ProseMirror-selectednode:not(img):not(pre):not([data-node-view-wrapper]){background-color:color-mix(in srgb,var(--primary) 20%,transparent)}.z-editor-wrapper .z-editor-prosemirror :is(p,h1,h2,h3,h4,h5,h6).is-empty:before{float:left;height:0;color:var(--muted-foreground);content:attr(data-placeholder);pointer-events:none}.z-editor-placeholder-first-line .z-editor-wrapper .z-editor-prosemirror :is(p,h1,h2,h3,h4,h5,h6).is-empty:before{content:none}.z-editor-placeholder-first-line .z-editor-wrapper .z-editor-prosemirror :is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child:before{content:attr(data-placeholder)}.z-editor-wrapper.z-editor-disabled .z-editor-toolbar,.z-editor-wrapper.z-editor-disabled .z-editor-content{pointer-events:none}.z-editor-wrapper.z-editor-readonly .z-editor-toolbar{display:none}.z-editor-wrapper.z-editor-readonly .z-editor-content{border-radius:.375rem}.z-editor-wrapper.z-editor-readonly .z-editor-prosemirror{cursor:default}.z-editor-link-modal{padding-top:0;padding-bottom:0}.z-editor-link-modal .z-modal-scrollbar main{min-height:0;padding:1rem}\n"] }]
|
|
921
|
-
}], ctorParameters: () => [], propDecorators: { _editorHost: [{ type: i0.ViewChild, args: ['editorHost', { isSignal: true }] }], zOnChange: [{ type: i0.Output, args: ["zOnChange"] }], zOnFocus: [{ type: i0.Output, args: ["zOnFocus"] }], zOnBlur: [{ type: i0.Output, args: ["zOnBlur"] }], zControl: [{ type: i0.Output, args: ["zControl"] }], zEvent: [{ type: i0.Output, args: ["zEvent"] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], zSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "zSize", required: false }] }], zLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "zLabel", required: false }] }], zLabelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "zLabelClass", required: false }] }], zPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "zPlaceholder", required: false }] }], zRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "zRequired", required: false }] }], zDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "zDisabled", required: false }] }], zReadonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "zReadonly", required: false }] }], zContentType: [{ type: i0.Input, args: [{ isSignal: true, alias: "zContentType", required: false }] }], zToolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "zToolbar", required: false }] }], zTipTap: [{ type: i0.Input, args: [{ isSignal: true, alias: "zTipTap", required: false }] }], zValidators: [{ type: i0.Input, args: [{ isSignal: true, alias: "zValidators", required: false }] }] } });
|
|
1704
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'zEditor', template: "<div [class]=\"wrapperClasses()\" [class.z-editor-disabled]=\"isDisabled()\" [class.z-editor-readonly]=\"zReadonly()\">\n @if (zLabel()) {\n <label [for]=\"editorId\" class=\"text-xs leading-none font-medium\" [class]=\"zLabelClass()\">\n {{ zLabel() }}\n @if (zRequired()) {\n <span class=\"text-destructive! ml-0.5\">*</span>\n }\n </label>\n }\n\n <div [class]=\"editorClasses()\">\n @if (showToolbar()) {\n <div class=\"z-editor-toolbar\" role=\"toolbar\" [attr.aria-controls]=\"editorId\">\n @for (item of toolbarItems(); track item.id) {\n @switch (item.id) {\n @case ('emoji') {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"emojiPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-emoji-popover\"\n (zControl)=\"onEmojiPopoverControl($event)\"\n (zShow)=\"onEmojiPopoverShow()\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n @case ('blockStyle') {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"blockStylePopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-menu-popover\"\n (zControl)=\"onBlockStylePopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n @case ('textColor') {\n @let textColor = activeTextColor();\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"textColorPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-color-popover\"\n (zControl)=\"onTextColorPopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span class=\"z-editor-color-indicator\" [style.background]=\"textColor\"></span>\n </button>\n }\n @case ('backgroundColor') {\n @let bgColor = activeBackgroundColor();\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"backgroundColorPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-color-popover\"\n (zControl)=\"onBackgroundColorPopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span class=\"z-editor-color-indicator\" [style.background]=\"bgColor\"></span>\n </button>\n }\n @case ('align') {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"alignPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-menu-popover\"\n (zControl)=\"onAlignPopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\">\n <i z-icon [zType]=\"activeAlignIcon()\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n @default {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n [class.z-editor-toolbar-button-active]=\"item.active\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\"\n (click)=\"onToolbarClick(item.id)\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n }\n }\n </div>\n }\n\n <div\n #editorHost\n [id]=\"editorId\"\n class=\"z-editor-content\"\n role=\"textbox\"\n [attr.aria-multiline]=\"true\"\n [attr.aria-readonly]=\"isDisabled() || zReadonly()\"></div>\n </div>\n\n @if (hasError()) {\n <p class=\"text-destructive animate-in fade-in slide-in-from-top-1 m-0 text-xs duration-200\">\n {{ errorMessage() }}\n </p>\n }\n\n <ng-template #emojiPopover>\n @let emojiCategoryLabel =\n emojiSearchQuery() ? ('i18n_z_ui_emoji_search_results' | translate) : (activeEmojiCategoryLabel() | translate);\n @let activeCategoryId = activeEmojiCategoryId();\n <div class=\"z-editor-emoji-sheet\">\n <div class=\"z-editor-emoji-header\">\n <div class=\"z-editor-emoji-title mb-1\">\n <span class=\"z-editor-emoji-title-dot\" aria-hidden=\"true\"></span>\n <span>{{ emojiCategoryLabel }}</span>\n </div>\n <z-input\n class=\"z-editor-emoji-search\"\n zSize=\"sm\"\n [zSearch]=\"true\"\n [zDebounce]=\"150\"\n [zPlaceholder]=\"'i18n_z_ui_emoji_search_placeholder' | translate\"\n [ngModel]=\"emojiSearch()\"\n (zOnSearch)=\"emojiSearch.set($any($event))\" />\n </div>\n <div class=\"z-editor-emoji-body\">\n @if (hasEmojiResults()) {\n <div class=\"z-editor-emoji-grid\">\n @for (emoji of activeEmojis(); track emoji) {\n <button\n type=\"button\"\n class=\"z-editor-emoji-button\"\n [attr.aria-label]=\"emoji\"\n (click)=\"insertEmoji($any(emoji))\">\n {{ emoji }}\n </button>\n }\n </div>\n } @else {\n <div class=\"z-editor-emoji-empty\">\n <span class=\"z-editor-emoji-empty-icon\" aria-hidden=\"true\">\n <i z-icon zType=\"lucideSearchX\" zSize=\"14\" [zStrokeWidth]=\"2\"></i>\n </span>\n <span>{{ 'i18n_z_ui_emoji_no_results' | translate }}</span>\n </div>\n }\n </div>\n <div class=\"z-editor-emoji-footer\" role=\"tablist\">\n @for (category of emojiCategories; track category.id) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"z-editor-emoji-footer-button cursor-pointer!\"\n [class.z-editor-emoji-footer-button-active]=\"category.id === activeCategoryId\"\n [attr.aria-label]=\"category.labelKey | translate\"\n [attr.aria-selected]=\"category.id === activeCategoryId\"\n [attr.title]=\"category.labelKey | translate\"\n (click)=\"setEmojiCategory(category.id)\">\n <i z-icon [zType]=\"category.icon\" zSize=\"15\" [zStrokeWidth]=\"2\"></i>\n </button>\n }\n </div>\n </div>\n </ng-template>\n\n <ng-template #blockStylePopover>\n <div class=\"z-editor-menu-list\">\n @for (option of blockStyleOptions; track option.command) {\n <button\n type=\"button\"\n class=\"z-editor-menu-item\"\n [class.z-editor-menu-item-active]=\"activeBlockStyle() === option.command\"\n (click)=\"applyBlockStyle(option.command)\">\n <i z-icon [zType]=\"option.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span>{{ option.label }}</span>\n </button>\n }\n </div>\n </ng-template>\n\n <ng-template #alignPopover>\n <div class=\"z-editor-menu-list\">\n @for (option of alignOptions; track option.command) {\n <button\n type=\"button\"\n class=\"z-editor-menu-item\"\n [class.z-editor-menu-item-active]=\"activeAlign() === option.command\"\n (click)=\"applyAlign(option.command)\">\n <i z-icon [zType]=\"option.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span>{{ option.label }}</span>\n </button>\n }\n </div>\n </ng-template>\n\n <ng-template #textColorPopover>\n @let currentTextColor = activeTextColor();\n <div class=\"z-editor-color-grid\">\n @for (color of textColorSwatches; track color) {\n <button\n type=\"button\"\n class=\"z-editor-color-swatch\"\n [class.z-editor-color-swatch-active]=\"currentTextColor === color\"\n [style.background]=\"color\"\n [attr.aria-label]=\"'Text color ' + color\"\n (click)=\"setTextColor(color)\"></button>\n }\n <label class=\"z-editor-color-custom\">\n <input type=\"color\" [value]=\"currentTextColor\" (input)=\"setTextColorFromEvent($event)\" />\n {{ currentTextColor }}\n </label>\n <button type=\"button\" z-button zType=\"outline\" zSize=\"sm\" class=\"z-editor-color-reset\" (click)=\"unsetTextColor()\">\n Reset\n </button>\n </div>\n </ng-template>\n\n <ng-template #backgroundColorPopover>\n @let currentBgColor = activeBackgroundColor();\n <div class=\"z-editor-color-grid\">\n @for (color of backgroundColorSwatches; track color) {\n <button\n type=\"button\"\n class=\"z-editor-color-swatch\"\n [class.z-editor-color-swatch-active]=\"currentBgColor === color\"\n [style.background]=\"color\"\n [attr.aria-label]=\"'Background color ' + color\"\n (click)=\"setBackgroundColor(color)\"></button>\n }\n <label class=\"z-editor-color-custom\">\n <input type=\"color\" [value]=\"currentBgColor\" (input)=\"setBackgroundColorFromEvent($event)\" />\n {{ currentBgColor }}\n </label>\n <button\n type=\"button\"\n z-button\n zType=\"outline\"\n zSize=\"sm\"\n class=\"z-editor-color-reset\"\n (click)=\"unsetBackgroundColor()\">\n Reset\n </button>\n </div>\n </ng-template>\n\n <div #floatingToolbar class=\"z-editor-floating-toolbar\" role=\"toolbar\" [attr.aria-controls]=\"editorId\">\n @for (item of floatingToolbarItems(); track item.id) {\n @switch (item.id) {\n @case ('blockStyle') {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"blockStylePopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-menu-popover\"\n (zControl)=\"onBlockStylePopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"activeBlockStyleLabel()\"\n (mousedown)=\"$event.preventDefault()\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n @case ('textColor') {\n @let textColor = activeTextColor();\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"textColorPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-color-popover\"\n (zControl)=\"onTextColorPopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\"\n (mousedown)=\"$event.preventDefault()\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span class=\"z-editor-color-indicator\" [style.background]=\"textColor\"></span>\n </button>\n }\n @case ('backgroundColor') {\n @let bgColor = activeBackgroundColor();\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"backgroundColorPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-color-popover\"\n (zControl)=\"onBackgroundColorPopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\"\n (mousedown)=\"$event.preventDefault()\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span class=\"z-editor-color-indicator\" [style.background]=\"bgColor\"></span>\n </button>\n }\n @case ('align') {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-popover\n [zPopoverContent]=\"alignPopover\"\n zPosition=\"bottom-left\"\n zTrigger=\"click\"\n zClass=\"z-editor-menu-popover\"\n (zControl)=\"onAlignPopoverControl($event)\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"activeAlignLabel()\"\n (mousedown)=\"$event.preventDefault()\">\n <i z-icon [zType]=\"activeAlignIcon()\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n @default {\n <button\n type=\"button\"\n class=\"z-editor-toolbar-button\"\n z-tooltip\n [zContent]=\"item.tooltip\"\n zPosition=\"top\"\n [zAlwaysShow]=\"true\"\n [zDisabled]=\"item.disabled || !item.shortcut\"\n [class.z-editor-toolbar-button-active]=\"item.active\"\n [disabled]=\"item.disabled\"\n [attr.aria-label]=\"item.label\"\n [attr.title]=\"item.label\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onFloatingToolbarClick(item.id)\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n </button>\n }\n }\n }\n </div>\n\n <span\n class=\"z-editor-slash-menu-trigger\"\n z-popover\n [zPopoverContent]=\"slashMenuPopover\"\n zTrigger=\"manual\"\n zPosition=\"bottom-left\"\n zClass=\"z-editor-slash-popover\"\n [zOffset]=\"4\"\n [zPopoverWidth]=\"300\"\n [style.left.px]=\"slashMenuState().left\"\n [style.top.px]=\"slashMenuState().top\"\n (zControl)=\"onSlashMenuPopoverControl($event)\"\n (zHide)=\"onSlashMenuPopoverHide()\"></span>\n\n <ng-template #slashMenuPopover>\n @let slashActiveIndex = slashMenuActiveIndex();\n <div class=\"z-editor-slash-menu-shell\">\n <div #slashMenuScrollHost class=\"z-editor-slash-menu-scrollbar\">\n <div class=\"z-editor-slash-menu\" role=\"listbox\" [attr.aria-controls]=\"editorId\">\n @for (item of filteredSlashCommands(); track item.id) {\n @if (item.showGroupLabel) {\n <div class=\"z-editor-slash-menu-group\">\n {{ item.group }}\n </div>\n }\n <button\n type=\"button\"\n class=\"z-editor-slash-menu-item\"\n role=\"option\"\n [class.z-editor-slash-menu-item-active]=\"$index === slashActiveIndex\"\n [attr.aria-selected]=\"$index === slashActiveIndex\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"applySlashCommand(item)\">\n <i z-icon [zType]=\"item.icon\" zSize=\"16\" [zStrokeWidth]=\"2.5\"></i>\n <span class=\"z-editor-slash-menu-copy\">\n <span class=\"z-editor-slash-menu-label\">{{ item.label }}</span>\n </span>\n </button>\n } @empty {\n <div class=\"z-editor-slash-menu-empty\">\n <i z-icon zType=\"lucideSearchX\" zSize=\"28\" [zStrokeWidth]=\"1.8\"></i>\n <span>{{ 'i18n_z_ui_editor_no_commands' | translate }}</span>\n </div>\n }\n </div>\n </div>\n <div class=\"z-editor-slash-menu-footer\" aria-hidden=\"true\">\n <span>\n <kbd>\u2191\u2193</kbd>\n {{ 'i18n_z_ui_editor_shortcut_navigate' | translate }}\n </span>\n <span>\n <kbd>Esc</kbd>\n {{ 'i18n_z_ui_editor_shortcut_abort' | translate }}\n </span>\n <span>\n <kbd>\u21B5</kbd>\n {{ 'i18n_z_ui_editor_shortcut_select' | translate }}\n </span>\n </div>\n </div>\n </ng-template>\n\n <span\n class=\"z-editor-link-popover-trigger\"\n z-popover\n [zPopoverContent]=\"linkPopover\"\n zTrigger=\"manual\"\n zPosition=\"bottom-left\"\n zClass=\"z-editor-link-popover\"\n [zOffset]=\"6\"\n [zPopoverWidth]=\"320\"\n [style.left.px]=\"linkPopoverState().left\"\n [style.top.px]=\"linkPopoverState().top\"\n [style.width.px]=\"linkPopoverState().width\"\n [style.height.px]=\"linkPopoverState().height\"\n (zControl)=\"onLinkPopoverControl($event)\"\n (zHide)=\"onLinkPopoverHide()\"></span>\n\n <ng-template #linkPopover>\n <div class=\"z-editor-link-popover-content\">\n <ng-template #linkPrefix>\n <z-icon zType=\"lucideLink\" zSize=\"16\" class=\"text-muted-foreground\" />\n </ng-template>\n <z-input\n zType=\"url\"\n zSize=\"sm\"\n class=\"z-editor-link-popover-input\"\n [zPrefix]=\"linkPrefix\"\n zPlaceholder=\"https://example.com\"\n [zValidators]=\"linkValidators\"\n [ngModel]=\"linkUrl()\"\n (ngModelChange)=\"onLinkUrlChange($event)\"\n (zOnEnter)=\"applyLink()\" />\n <div class=\"z-editor-link-popover-actions\">\n <button\n type=\"button\"\n z-button\n zType=\"ghost\"\n zSize=\"sm\"\n [zDisabled]=\"!canApplyLink()\"\n (click)=\"applyLink()\"\n aria-label=\"Apply link\">\n <z-icon zType=\"lucideCheck\" zSize=\"16\" [zStrokeWidth]=\"2.5\" />\n </button>\n <button\n type=\"button\"\n z-button\n zType=\"ghost\"\n zSize=\"sm\"\n [zDisabled]=\"!activeLinkHref()\"\n (click)=\"openActiveLink()\"\n aria-label=\"Open link\">\n <z-icon zType=\"lucideExternalLink\" zSize=\"16\" [zStrokeWidth]=\"2.5\" />\n </button>\n <button\n type=\"button\"\n z-button\n zType=\"ghost-destructive\"\n zSize=\"sm\"\n [zDisabled]=\"!activeLinkHref()\"\n (click)=\"removeLink()\"\n aria-label=\"Remove link\">\n <z-icon zType=\"lucideUnlink\" zSize=\"16\" [zStrokeWidth]=\"2.5\" />\n </button>\n </div>\n </div>\n </ng-template>\n</div>\n", styles: [".z-editor-wrapper .z-editor-toolbar{display:flex;flex-wrap:wrap;gap:.125rem;align-items:center;border-bottom:.0625rem solid var(--border);border-top-left-radius:.375rem;border-top-right-radius:.375rem;background-color:color-mix(in srgb,var(--muted) 30%,transparent);padding:.5rem}.z-editor-wrapper .z-editor-toolbar-button{position:relative;display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;border-radius:.25rem;padding:0;color:var(--muted-foreground);transition:background-color .15s ease,color .15s ease,opacity .15s ease}.z-editor-wrapper .z-editor-toolbar-button:hover:not(:disabled){background-color:var(--accent);color:var(--foreground)}.z-editor-wrapper .z-editor-toolbar-button:disabled{cursor:not-allowed;opacity:.45}.z-editor-wrapper .z-editor-toolbar-button.z-editor-toolbar-button-active{background-color:color-mix(in srgb,var(--primary) 10%,transparent);color:var(--primary)}.z-editor-wrapper .z-editor-content{position:relative;border-bottom-right-radius:.375rem;border-bottom-left-radius:.375rem}.z-editor-wrapper .z-editor-prosemirror{width:100%;outline:none;padding:.75rem;color:var(--foreground)}.z-editor-wrapper .z-editor-prosemirror>*{margin-top:1.25rem;margin-bottom:1.25rem}.z-editor-wrapper .z-editor-prosemirror>:first-child{margin-top:0}.z-editor-wrapper .z-editor-prosemirror>:last-child{margin-bottom:0}.z-editor-wrapper .z-editor-prosemirror p{line-height:1.75}.z-editor-wrapper .z-editor-prosemirror a{border-bottom:.0625rem solid transparent;color:var(--primary);font-weight:500;cursor:pointer;transition:border-color .15s ease}.z-editor-wrapper .z-editor-prosemirror a:hover{border-color:var(--primary)}.z-editor-wrapper .z-editor-prosemirror .mention{color:var(--primary);font-weight:500}.z-editor-wrapper .z-editor-prosemirror :is(h1,h2,h3,h4,h5,h6){color:var(--foreground);font-weight:700;line-height:1.2}.z-editor-wrapper .z-editor-prosemirror h1{font-size:1.875rem}.z-editor-wrapper .z-editor-prosemirror h2{font-size:1.5rem}.z-editor-wrapper .z-editor-prosemirror h3{font-size:1.25rem}.z-editor-wrapper .z-editor-prosemirror h4{font-size:1.125rem}.z-editor-wrapper .z-editor-prosemirror h5,.z-editor-wrapper .z-editor-prosemirror h6{font-size:1rem}.z-editor-wrapper .z-editor-prosemirror blockquote{border-left:.25rem solid var(--border);padding-left:1rem;font-style:italic;color:var(--muted-foreground)}.z-editor-wrapper .z-editor-prosemirror [data-type=horizontalRule]{margin-top:2rem;margin-bottom:2rem;padding-top:.5rem;padding-bottom:.5rem}.z-editor-wrapper .z-editor-prosemirror hr{border:0;border-top:.0625rem solid var(--border)}.z-editor-wrapper .z-editor-prosemirror pre{overflow-x:auto;border:.0625rem solid var(--border);border-radius:.375rem;background-color:var(--muted);padding:.75rem 1rem;font-size:.875rem;line-height:1.5;white-space:pre-wrap;word-break:break-word}.z-editor-wrapper .z-editor-prosemirror pre code{display:inline;border:0;border-radius:0;background-color:transparent;padding:0;color:inherit;font:inherit}.z-editor-wrapper .z-editor-prosemirror code{display:inline-block;border:.0625rem solid var(--border);border-radius:.375rem;background-color:var(--muted);padding:.125rem .375rem;color:var(--foreground);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875em;font-weight:500}.z-editor-wrapper .z-editor-prosemirror :is(ul,ol){padding-left:1.5rem}.z-editor-wrapper .z-editor-prosemirror ul{list-style:disc}.z-editor-wrapper .z-editor-prosemirror ol{list-style:decimal}.z-editor-wrapper .z-editor-prosemirror li{margin-top:.375rem;margin-bottom:.375rem;padding-left:.375rem}.z-editor-wrapper .z-editor-prosemirror img{display:block;max-width:100%;border-radius:.375rem}.z-editor-wrapper .z-editor-prosemirror img[data-text-align=center]{margin-right:auto;margin-left:auto}.z-editor-wrapper .z-editor-prosemirror img[data-text-align=right]{margin-right:0;margin-left:auto}.z-editor-wrapper .z-editor-prosemirror img[data-text-align=left],.z-editor-wrapper .z-editor-prosemirror img[data-text-align=justify]{margin-right:auto;margin-left:0}.z-editor-wrapper .z-editor-prosemirror img.ProseMirror-selectednode{outline:.125rem solid var(--primary)}.z-editor-wrapper .z-editor-prosemirror .image-resizer{display:inline-flex;position:relative;flex-grow:0}.z-editor-wrapper .z-editor-prosemirror .image-resizer .resize-trigger{position:absolute;right:-6px;bottom:-9px;width:12px;height:12px;cursor:nwse-resize;border-radius:50%;background-color:var(--primary);opacity:0;transition:opacity .2s ease}.z-editor-wrapper .z-editor-prosemirror .image-resizer:hover .resize-trigger{opacity:1}.z-editor-wrapper .z-editor-prosemirror .image-resizer .image-alignment{display:flex;gap:4px;position:absolute;top:-32px;left:0;padding:4px;border-radius:6px;background-color:var(--popover);box-shadow:0 2px 8px #00000026;opacity:0;transition:opacity .2s ease;pointer-events:none}.z-editor-wrapper .z-editor-prosemirror .image-resizer:hover .image-alignment{opacity:1;pointer-events:auto}.z-editor-wrapper .z-editor-prosemirror .ProseMirror-selectednode:not(img):not(pre):not([data-node-view-wrapper]){background-color:color-mix(in srgb,var(--primary) 20%,transparent)}.z-editor-wrapper .z-editor-prosemirror :is(p,h1,h2,h3,h4,h5,h6).is-empty:before{float:left;height:0;color:var(--muted-foreground);content:attr(data-placeholder);pointer-events:none}.z-editor-placeholder-first-line .z-editor-wrapper .z-editor-prosemirror :is(p,h1,h2,h3,h4,h5,h6).is-empty:before{content:none}.z-editor-placeholder-first-line .z-editor-wrapper .z-editor-prosemirror :is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child:before{content:attr(data-placeholder)}.z-editor-wrapper.z-editor-disabled .z-editor-toolbar,.z-editor-wrapper.z-editor-disabled .z-editor-content{pointer-events:none}.z-editor-wrapper.z-editor-readonly .z-editor-toolbar{display:none}.z-editor-wrapper.z-editor-readonly .z-editor-content{border-radius:.375rem}.z-editor-wrapper.z-editor-readonly .z-editor-prosemirror{cursor:default}.z-editor-link-modal{padding-top:0;padding-bottom:0}.z-editor-link-modal .z-modal-scrollbar main{min-height:0;padding:1rem}.z-editor-emoji-popover{padding:0;overflow:hidden;box-shadow:0 .5rem 1.5rem -.25rem #0000002e,0 .25rem .5rem -.125rem #0000001a}.z-editor-color-popover{padding:.5rem}.z-editor-menu-popover{padding:.25rem}.z-editor-menu-list{display:flex;min-width:9rem;flex-direction:column;gap:.125rem}.z-editor-menu-item{display:flex;width:100%;cursor:pointer;align-items:center;gap:.5rem;border-radius:.25rem;padding:.375rem .5rem;color:var(--muted-foreground);font-size:.8125rem;line-height:1.25;transition:background-color .15s ease,color .15s ease}.z-editor-menu-item:hover,.z-editor-menu-item.z-editor-menu-item-active{background-color:var(--accent);color:var(--foreground)}.z-editor-color-indicator{position:absolute;right:.25rem;bottom:.1875rem;width:.75rem;height:.1875rem;border-radius:999px;box-shadow:0 0 0 .0625rem var(--border)}.z-editor-color-grid{display:grid;grid-template-columns:repeat(5,1.625rem);gap:.25rem}.z-editor-color-swatch{width:1.625rem;height:1.625rem;border:.0625rem solid var(--border);border-radius:.25rem;cursor:pointer;transition:border-color .15s ease,box-shadow .15s ease,transform .15s ease}.z-editor-color-swatch:hover{transform:translateY(-.0625rem);border-color:var(--ring)}.z-editor-color-swatch.z-editor-color-swatch-active{border-color:var(--primary);box-shadow:0 0 0 .125rem color-mix(in srgb,var(--primary) 20%,transparent)}.z-editor-color-custom{grid-column:1/-1;display:flex;height:1.875rem;cursor:pointer;align-items:center;gap:.5rem;border:.0625rem solid var(--border);border-radius:.25rem;padding:.25rem .5rem;color:var(--muted-foreground);font-size:.75rem;transition:border-color .15s ease,background-color .15s ease,color .15s ease}.z-editor-color-custom input{width:1.375rem;height:1.375rem;flex:none;cursor:pointer;border:0;padding:0;background:transparent}.z-editor-color-custom:hover{border-color:var(--ring);background-color:var(--accent);color:var(--foreground)}.z-editor-color-reset{grid-column:1/-1;width:100%;justify-content:center}.z-editor-floating-toolbar{display:inline-flex;align-items:center;gap:.125rem;border:.0625rem solid var(--border);border-radius:.25rem;background-color:var(--popover);padding:.375rem;box-shadow:0 .625rem 1.5rem -.75rem #00000059,0 .25rem .75rem -.5rem #0003;visibility:hidden;opacity:0;position:fixed;top:-10000px;left:-10000px;scale:.98;translate:0 .25rem;transform-origin:top left;transition:opacity .12s ease,visibility .12s ease,scale .16s ease,translate .16s ease}.z-editor-floating-toolbar[style*=\"visibility: visible\"]{animation:z-editor-floating-toolbar-in .16s cubic-bezier(.16,1,.3,1);scale:1;translate:0 0}@keyframes z-editor-floating-toolbar-in{0%{opacity:0;scale:.96;translate:0 .375rem}to{opacity:1;scale:1;translate:0 0}}.z-editor-slash-menu-trigger,.z-editor-link-popover-trigger{position:fixed;z-index:-1;width:.0625rem;height:.0625rem;pointer-events:none}.z-editor-link-popover{padding:.5rem}.z-editor-link-popover-content{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;column-gap:.5rem}.z-editor-link-popover-input{flex:1;min-width:0}.z-editor-link-popover-actions{display:inline-flex;align-self:start;align-items:center;gap:.125rem}.z-editor-slash-popover{box-sizing:border-box;padding:0;overflow:hidden}.z-editor-slash-menu-shell{box-sizing:border-box;display:flex;min-width:0;height:min(16rem,100vh - 4rem);flex-direction:column}.z-editor-slash-menu-scrollbar{box-sizing:border-box;display:block;min-width:0;min-height:0;flex:1;overflow-x:hidden;overflow-y:scroll;overscroll-behavior:contain}.z-editor-slash-menu{box-sizing:border-box;display:flex;min-width:0;min-height:100%;flex-direction:column;padding:.2rem;gap:.2rem;color:var(--popover-foreground)}.z-editor-slash-menu-group{margin:.25rem 0 .125rem;border-top:.0625rem solid var(--border);padding:.5rem .5rem .1875rem;color:var(--muted-foreground);font-size:.6875rem;font-weight:600;line-height:1;text-transform:uppercase}.z-editor-slash-menu-group:first-child{margin-top:0;border-top:0;padding-top:.5rem}.z-editor-slash-menu-item{box-sizing:border-box;display:flex;align-self:stretch;min-width:0;cursor:pointer;align-items:center;gap:.5rem;border-radius:.25rem;padding:.375rem .75rem;text-align:left;transition:background-color .15s ease,color .15s ease}.z-editor-slash-menu-item i{color:var(--muted-foreground);flex:none}.z-editor-slash-menu-item:hover,.z-editor-slash-menu-item.z-editor-slash-menu-item-active{background-color:var(--accent);color:var(--foreground)}.z-editor-slash-menu-copy{display:flex;min-width:0;align-items:center}.z-editor-slash-menu-label{color:var(--foreground);font-size:.8125rem;font-weight:500;line-height:1.2}.z-editor-slash-menu-empty{box-sizing:border-box;display:flex;align-self:stretch;max-width:100%;min-width:0;flex:1;flex-direction:column;align-items:center;justify-content:center;gap:.625rem;padding:1rem;color:var(--muted-foreground);font-size:.8125rem;line-height:1.15;text-align:center}.z-editor-slash-menu-empty i{color:var(--muted-foreground);flex:none}.z-editor-slash-menu-footer{box-sizing:border-box;display:flex;min-width:0;flex:none;align-items:center;gap:.75rem;border-top:.0625rem solid var(--border);padding:.375rem .625rem;color:var(--popover-foreground);font-size:.75rem;font-weight:500;line-height:1;white-space:nowrap}.z-editor-slash-menu-footer span{display:inline-flex;align-items:center;gap:.25rem}.z-editor-slash-menu-footer kbd{color:var(--foreground);font:inherit}.z-editor-emoji-sheet{display:flex;width:18rem;max-width:85vw;height:20rem;max-height:70vh;flex-direction:column;overflow:hidden;background-color:var(--popover);color:var(--popover-foreground)}.z-editor-emoji-header{display:flex;flex-direction:column;gap:.5rem;padding:.75rem .75rem .625rem;flex:none}.z-editor-emoji-title{display:flex;align-items:center;gap:.375rem;padding-inline:.25rem;color:var(--foreground);font-size:.8125rem;font-weight:600;line-height:1;letter-spacing:-.005em}.z-editor-emoji-title-dot{display:inline-block;width:.375rem;height:.375rem;border-radius:999px;background-color:var(--primary);box-shadow:0 0 0 .1875rem color-mix(in srgb,var(--primary) 18%,transparent)}.z-editor-emoji-search{width:100%}.z-editor-emoji-body{flex:1 1 0;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--muted-foreground) 30%,transparent) transparent}.z-editor-emoji-body::-webkit-scrollbar{width:.375rem}.z-editor-emoji-body::-webkit-scrollbar-track{background:transparent}.z-editor-emoji-body::-webkit-scrollbar-thumb{border-radius:999px;background-color:color-mix(in srgb,var(--muted-foreground) 30%,transparent)}.z-editor-emoji-body::-webkit-scrollbar-thumb:hover{background-color:color-mix(in srgb,var(--muted-foreground) 55%,transparent)}.z-editor-emoji-grid{display:grid;grid-template-columns:repeat(8,1.875rem);justify-content:center;gap:.125rem;padding:.25rem .5rem .5rem}.z-editor-emoji-empty{display:flex;height:100%;min-height:10rem;flex-direction:column;align-items:center;justify-content:center;gap:.375rem;padding:1.5rem .75rem;color:var(--muted-foreground);font-size:.8125rem;text-align:center}.z-editor-emoji-empty-icon{display:inline-flex;align-items:center;justify-content:center;width:2.25rem;height:2.25rem;border-radius:999px;background-color:color-mix(in srgb,var(--muted) 70%,transparent);color:var(--muted-foreground)}.z-editor-emoji-button{display:inline-flex;align-items:center;justify-content:center;width:1.875rem;height:1.875rem;border-radius:.4375rem;font-family:\"Noto Color Emoji\",\"Apple Color Emoji\",\"Segoe UI Emoji\",Twemoji Mozilla,EmojiOne Color,\"Android Emoji\",sans-serif;font-size:1.1875rem;line-height:1;transition:background-color .12s ease,box-shadow .12s ease}.z-editor-emoji-button:hover{background-color:color-mix(in srgb,var(--accent) 80%,transparent);box-shadow:0 0 0 .0625rem color-mix(in srgb,var(--ring) 35%,transparent)}.z-editor-emoji-button:active{background-color:color-mix(in srgb,var(--primary) 18%,transparent);box-shadow:0 0 0 .0625rem color-mix(in srgb,var(--primary) 45%,transparent)}.z-editor-emoji-footer{position:relative;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));align-items:center;border-top:.0625rem solid color-mix(in srgb,var(--border) 70%,transparent);padding:.25rem;background-color:color-mix(in srgb,var(--muted) 35%,transparent);flex:none}.z-editor-emoji-footer-button{position:relative;display:inline-flex;align-items:center;justify-content:center;height:1.875rem;border-radius:.4375rem;color:var(--muted-foreground);transition:color .15s ease,background-color .15s ease}.z-editor-emoji-footer-button:after{content:\"\";position:absolute;bottom:.0625rem;left:50%;width:0;height:.125rem;border-radius:999px;background-color:var(--primary);transition:width .2s ease,transform .2s ease;transform:translate(-50%)}.z-editor-emoji-footer-button:hover{color:var(--foreground);background-color:color-mix(in srgb,var(--accent) 60%,transparent)}.z-editor-emoji-footer-button.z-editor-emoji-footer-button-active{color:var(--primary)}.z-editor-emoji-footer-button.z-editor-emoji-footer-button-active:after{width:.875rem}\n"] }]
|
|
1705
|
+
}], ctorParameters: () => [], propDecorators: { _editorHost: [{ type: i0.ViewChild, args: ['editorHost', { isSignal: true }] }], _floatingToolbar: [{ type: i0.ViewChild, args: ['floatingToolbar', { isSignal: true }] }], _slashMenuScrollHost: [{ type: i0.ViewChild, args: ['slashMenuScrollHost', { isSignal: true }] }], zOnChange: [{ type: i0.Output, args: ["zOnChange"] }], zOnFocus: [{ type: i0.Output, args: ["zOnFocus"] }], zOnBlur: [{ type: i0.Output, args: ["zOnBlur"] }], zControl: [{ type: i0.Output, args: ["zControl"] }], zEvent: [{ type: i0.Output, args: ["zEvent"] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], zSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "zSize", required: false }] }], zLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "zLabel", required: false }] }], zLabelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "zLabelClass", required: false }] }], zPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "zPlaceholder", required: false }] }], zRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "zRequired", required: false }] }], zDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "zDisabled", required: false }] }], zReadonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "zReadonly", required: false }] }], zContentType: [{ type: i0.Input, args: [{ isSignal: true, alias: "zContentType", required: false }] }], zToolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "zToolbar", required: false }] }], zTipTap: [{ type: i0.Input, args: [{ isSignal: true, alias: "zTipTap", required: false }] }], zValidators: [{ type: i0.Input, args: [{ isSignal: true, alias: "zValidators", required: false }] }] } });
|
|
922
1706
|
|
|
923
1707
|
/**
|
|
924
1708
|
* Generated bundle index. Do not edit.
|