@ngstarter-ui/components 22.0.6 → 22.1.2
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/ai/component-registry.json +259 -172
- package/fesm2022/ngstarter-ui-components-comment-editor.mjs +781 -749
- package/fesm2022/ngstarter-ui-components-comment-editor.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-headless-editor.mjs +3689 -0
- package/fesm2022/ngstarter-ui-components-headless-editor.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-skeleton.mjs +27 -5
- package/fesm2022/ngstarter-ui-components-skeleton.mjs.map +1 -1
- package/package.json +5 -19
- package/styles/_tokens.scss +17 -2
- package/styles/themes/chalk.scss +1 -0
- package/types/ngstarter-ui-components-comment-editor.d.ts +150 -99
- package/types/ngstarter-ui-components-headless-editor.d.ts +795 -0
- package/types/ngstarter-ui-components-skeleton.d.ts +11 -1
- package/fesm2022/ngstarter-ui-components-text-editor.mjs +0 -1038
- package/fesm2022/ngstarter-ui-components-text-editor.mjs.map +0 -1
- package/types/ngstarter-ui-components-text-editor.d.ts +0 -192
|
@@ -1,642 +1,731 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken,
|
|
3
|
-
import { NodeView, Node, mergeAttributes, Mark, Editor } from '@tiptap/core';
|
|
4
|
-
import Document from '@tiptap/extension-document';
|
|
5
|
-
import Paragraph from '@tiptap/extension-paragraph';
|
|
6
|
-
import Text from '@tiptap/extension-text';
|
|
7
|
-
import Bold from '@tiptap/extension-bold';
|
|
8
|
-
import Italic from '@tiptap/extension-italic';
|
|
9
|
-
import Strike from '@tiptap/extension-strike';
|
|
10
|
-
import CodeBlock from '@tiptap/extension-code-block';
|
|
11
|
-
import { Blockquote } from '@tiptap/extension-blockquote';
|
|
12
|
-
import BulletList from '@tiptap/extension-bullet-list';
|
|
13
|
-
import OrderedList from '@tiptap/extension-ordered-list';
|
|
14
|
-
import ListItem from '@tiptap/extension-list-item';
|
|
15
|
-
import Link from '@tiptap/extension-link';
|
|
16
|
-
import Placeholder from '@tiptap/extension-placeholder';
|
|
17
|
-
import Youtube from '@tiptap/extension-youtube';
|
|
18
|
-
import BubbleMenu from '@tiptap/extension-bubble-menu';
|
|
19
|
-
import Code from '@tiptap/extension-code';
|
|
20
|
-
import History from '@tiptap/extension-history';
|
|
21
|
-
import Dropcursor from '@tiptap/extension-dropcursor';
|
|
22
|
-
import Image$1 from '@tiptap/extension-image';
|
|
23
|
-
import { isPlatformServer } from '@angular/common';
|
|
2
|
+
import { InjectionToken, inject, ElementRef, Renderer2, DOCUMENT, DestroyRef, viewChild, signal, model, input, booleanAttribute, output, computed, effect, untracked, afterNextRender, forwardRef, ChangeDetectionStrategy, Component, Directive } from '@angular/core';
|
|
24
3
|
import { Button } from '@ngstarter-ui/components/button';
|
|
25
|
-
import {
|
|
4
|
+
import { defineNgsHeadlessEditorPlugin, createNgsHeadlessEditorId, createNgsHeadlessEditorText, isNgsHeadlessEditorTextContent, normalizeNgsHeadlessEditorColor, NgsHeadlessEditor, NgsHeadlessEditorSurface, basicTextEditorPlugin, colorEditorPlugin, createNgsHeadlessEditorDocument, NGS_HEADLESS_EDITOR_TOGGLE_BOLD, NGS_HEADLESS_EDITOR_TOGGLE_ITALIC, NGS_HEADLESS_EDITOR_TOGGLE_STRIKE, NGS_HEADLESS_EDITOR_TOGGLE_CODE, ngsHeadlessEditorDocumentsEqual, getNgsHeadlessEditorBlockText, createNgsHeadlessEditorParagraph, getNgsHeadlessEditorDocumentText, NGS_HEADLESS_EDITOR_SET_TEXT_COLOR, NGS_HEADLESS_EDITOR_UNSET_TEXT_COLOR, NGS_HEADLESS_EDITOR_SET_BACKGROUND_COLOR, NGS_HEADLESS_EDITOR_UNSET_BACKGROUND_COLOR, provideNgsHeadlessEditor } from '@ngstarter-ui/components/headless-editor';
|
|
26
5
|
import * as i1 from '@ngstarter-ui/components/upload';
|
|
27
6
|
import { UploadTriggerDirective } from '@ngstarter-ui/components/upload';
|
|
28
7
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
29
8
|
import { DialogRef, DIALOG_DATA, DialogActions, DialogContent, DialogTitle, Dialog } from '@ngstarter-ui/components/dialog';
|
|
30
9
|
import * as i1$1 from '@angular/forms';
|
|
31
|
-
import { FormsModule
|
|
32
|
-
import { Input } from '@ngstarter-ui/components/input';
|
|
10
|
+
import { FormsModule } from '@angular/forms';
|
|
33
11
|
import { FormField, Label } from '@ngstarter-ui/components/form-field';
|
|
12
|
+
import { Input } from '@ngstarter-ui/components/input';
|
|
34
13
|
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
14
|
+
const NGS_COMMENT_EDITOR_TOGGLE_BLOCKQUOTE = toggleBlockCommand('toggle-blockquote', 'blockquote');
|
|
15
|
+
const NGS_COMMENT_EDITOR_TOGGLE_CODE_BLOCK = toggleBlockCommand('toggle-code-block', 'codeBlock');
|
|
16
|
+
const NGS_COMMENT_EDITOR_TOGGLE_BULLET_LIST = toggleBlockCommand('toggle-bullet-list', 'bulletList');
|
|
17
|
+
const NGS_COMMENT_EDITOR_TOGGLE_ORDERED_LIST = toggleBlockCommand('toggle-ordered-list', 'orderedList');
|
|
18
|
+
const NGS_COMMENT_EDITOR_SET_LINK = {
|
|
19
|
+
id: 'set-link',
|
|
20
|
+
execute: (editor, href) => editor.setMark('link', { href: normalizeLinkUrl(href) }),
|
|
21
|
+
enabled: (_editor, href) => !!href?.trim(),
|
|
22
|
+
active: editor => editor.isMarkActive('link')
|
|
23
|
+
};
|
|
24
|
+
const NGS_COMMENT_EDITOR_UNSET_LINK = {
|
|
25
|
+
id: 'unset-link',
|
|
26
|
+
execute: editor => editor.unsetMark('link'),
|
|
27
|
+
enabled: editor => editor.isMarkActive('link'),
|
|
28
|
+
active: editor => editor.isMarkActive('link')
|
|
29
|
+
};
|
|
30
|
+
function commentEditorPlugin() {
|
|
31
|
+
return defineNgsHeadlessEditorPlugin({
|
|
32
|
+
id: 'comment-editor-features',
|
|
33
|
+
blocks: [
|
|
34
|
+
textBlock('blockquote', 'blockquote'),
|
|
35
|
+
textBlock('codeBlock', 'pre', 'code'),
|
|
36
|
+
textBlock('bulletList', 'ul', 'li'),
|
|
37
|
+
textBlock('orderedList', 'ol', 'li'),
|
|
38
|
+
mediaBlock('image', 'figure', renderImage),
|
|
39
|
+
mediaBlock('imageUpload', 'figure', renderImageUpload),
|
|
40
|
+
mediaBlock('youtube', 'figure', renderYoutube)
|
|
41
|
+
],
|
|
42
|
+
marks: [
|
|
43
|
+
{
|
|
44
|
+
type: 'link',
|
|
45
|
+
tagName: 'a',
|
|
46
|
+
parseTags: ['a'],
|
|
47
|
+
applyAttributes: (element, mark) => {
|
|
48
|
+
const href = normalizeLinkUrl(String(mark.attrs?.['href'] ?? ''));
|
|
49
|
+
element.setAttribute('href', href);
|
|
50
|
+
element.setAttribute('target', '_blank');
|
|
51
|
+
element.setAttribute('rel', 'noopener noreferrer');
|
|
52
|
+
},
|
|
53
|
+
readAttributes: element => ({ href: element.getAttribute('href') ?? '' })
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 'singleEmoji',
|
|
57
|
+
tagName: 'span',
|
|
58
|
+
applyAttributes: element => element.classList.add('single-emoji')
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
commands: [
|
|
62
|
+
NGS_COMMENT_EDITOR_TOGGLE_BLOCKQUOTE,
|
|
63
|
+
NGS_COMMENT_EDITOR_TOGGLE_CODE_BLOCK,
|
|
64
|
+
NGS_COMMENT_EDITOR_TOGGLE_BULLET_LIST,
|
|
65
|
+
NGS_COMMENT_EDITOR_TOGGLE_ORDERED_LIST,
|
|
66
|
+
NGS_COMMENT_EDITOR_SET_LINK,
|
|
67
|
+
NGS_COMMENT_EDITOR_UNSET_LINK
|
|
68
|
+
],
|
|
69
|
+
keymap: [
|
|
70
|
+
{ key: 'Mod-Shift-7', command: NGS_COMMENT_EDITOR_TOGGLE_ORDERED_LIST },
|
|
71
|
+
{ key: 'Mod-Shift-8', command: NGS_COMMENT_EDITOR_TOGGLE_BULLET_LIST },
|
|
72
|
+
{ key: 'Mod-Shift-b', command: NGS_COMMENT_EDITOR_TOGGLE_BLOCKQUOTE },
|
|
73
|
+
{ key: 'Mod-Alt-c', command: NGS_COMMENT_EDITOR_TOGGLE_CODE_BLOCK }
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function createCommentEditorMediaBlock(type, attrs) {
|
|
78
|
+
return {
|
|
79
|
+
id: createNgsHeadlessEditorId(type),
|
|
80
|
+
type,
|
|
81
|
+
content: null,
|
|
82
|
+
attrs: { ...attrs }
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function normalizeLinkUrl(value) {
|
|
86
|
+
const url = value.trim();
|
|
87
|
+
if (!url) {
|
|
88
|
+
return '';
|
|
67
89
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.applicationRef.detachView(this.componentRef.hostView);
|
|
90
|
+
if (/^(https?:|mailto:|tel:)/i.test(url)) {
|
|
91
|
+
return url;
|
|
71
92
|
}
|
|
93
|
+
return `https://${url}`;
|
|
72
94
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
node: this.node,
|
|
82
|
-
// @ts-ignore
|
|
83
|
-
decorations: this.decorations,
|
|
84
|
-
selected: false,
|
|
85
|
-
extension: this.extension,
|
|
86
|
-
getPos: () => this.getPos(),
|
|
87
|
-
updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
|
|
88
|
-
deleteNode: () => this.deleteNode(),
|
|
89
|
-
};
|
|
90
|
-
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this);
|
|
91
|
-
this.editor.on('selectionUpdate', this.handleSelectionUpdate);
|
|
92
|
-
// create renderer
|
|
93
|
-
this.renderer = new AngularRenderer(this.component, injector, props);
|
|
94
|
-
// Register drag handler
|
|
95
|
-
if (this.extension.config.draggable) {
|
|
96
|
-
this.renderer.elementRef.nativeElement.ondragstart = (e) => {
|
|
97
|
-
this.onDragStart(e);
|
|
98
|
-
};
|
|
95
|
+
function normalizeYoutubeUrl(value) {
|
|
96
|
+
const url = normalizeLinkUrl(value);
|
|
97
|
+
try {
|
|
98
|
+
const parsed = new URL(url);
|
|
99
|
+
const host = parsed.hostname.replace(/^www\./, '');
|
|
100
|
+
let videoId = '';
|
|
101
|
+
if (host === 'youtu.be') {
|
|
102
|
+
videoId = parsed.pathname.slice(1).split('/')[0];
|
|
99
103
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
else if (host === 'youtube.com' || host === 'm.youtube.com' || host === 'youtube-nocookie.com') {
|
|
105
|
+
if (parsed.pathname.startsWith('/embed/')) {
|
|
106
|
+
videoId = parsed.pathname.split('/')[2] ?? '';
|
|
107
|
+
}
|
|
108
|
+
else if (parsed.pathname.startsWith('/shorts/')) {
|
|
109
|
+
videoId = parsed.pathname.split('/')[2] ?? '';
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
videoId = parsed.searchParams.get('v') ?? '';
|
|
113
|
+
}
|
|
109
114
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return this.renderer.dom;
|
|
115
|
+
return /^[\w-]{6,}$/.test(videoId)
|
|
116
|
+
? `https://www.youtube-nocookie.com/embed/${videoId}`
|
|
117
|
+
: null;
|
|
114
118
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
return this.contentDOMElement;
|
|
119
|
+
catch {
|
|
120
|
+
return null;
|
|
120
121
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
}
|
|
123
|
+
function toggleBlockCommand(id, type) {
|
|
124
|
+
return {
|
|
125
|
+
id,
|
|
126
|
+
execute: editor => editor.toggleBlock(type),
|
|
127
|
+
active: editor => editor.isBlockActive(type)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function textBlock(type, tagName, contentTagName) {
|
|
131
|
+
return {
|
|
132
|
+
type,
|
|
133
|
+
tagName,
|
|
134
|
+
contentTagName,
|
|
135
|
+
create: () => ({
|
|
136
|
+
id: createNgsHeadlessEditorId(type),
|
|
137
|
+
type,
|
|
138
|
+
content: [createNgsHeadlessEditorText()]
|
|
139
|
+
})
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function mediaBlock(type, tagName, render) {
|
|
143
|
+
return {
|
|
144
|
+
type,
|
|
145
|
+
tagName,
|
|
146
|
+
editable: false,
|
|
147
|
+
create: () => ({
|
|
148
|
+
id: createNgsHeadlessEditorId(type),
|
|
149
|
+
type,
|
|
150
|
+
content: null
|
|
151
|
+
}),
|
|
152
|
+
render,
|
|
153
|
+
isEmpty: () => false
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function renderImage(element, block) {
|
|
157
|
+
element.classList.add('ngs-comment-editor-media', 'ngs-comment-editor-image');
|
|
158
|
+
const image = element.ownerDocument.createElement('img');
|
|
159
|
+
image.src = String(block.attrs?.['src'] ?? '');
|
|
160
|
+
image.alt = String(block.attrs?.['alt'] ?? '');
|
|
161
|
+
image.loading = 'lazy';
|
|
162
|
+
element.append(image);
|
|
163
|
+
}
|
|
164
|
+
function renderImageUpload(element, block) {
|
|
165
|
+
element.classList.add('ngs-comment-editor-media', 'ngs-comment-editor-image-upload');
|
|
166
|
+
const image = element.ownerDocument.createElement('img');
|
|
167
|
+
image.src = String(block.attrs?.['src'] ?? '');
|
|
168
|
+
image.alt = '';
|
|
169
|
+
element.append(image);
|
|
170
|
+
const status = element.ownerDocument.createElement('span');
|
|
171
|
+
status.className = 'ngs-comment-editor-upload-status';
|
|
172
|
+
const error = String(block.attrs?.['error'] ?? '');
|
|
173
|
+
status.textContent = error || 'Uploading image…';
|
|
174
|
+
status.setAttribute('role', error ? 'alert' : 'status');
|
|
175
|
+
element.append(status);
|
|
176
|
+
}
|
|
177
|
+
function renderYoutube(element, block) {
|
|
178
|
+
element.classList.add('ngs-comment-editor-media', 'ngs-comment-editor-youtube');
|
|
179
|
+
const iframe = element.ownerDocument.createElement('iframe');
|
|
180
|
+
iframe.src = String(block.attrs?.['src'] ?? '');
|
|
181
|
+
iframe.title = 'YouTube video';
|
|
182
|
+
iframe.loading = 'lazy';
|
|
183
|
+
iframe.allow = 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture';
|
|
184
|
+
iframe.setAttribute('allowfullscreen', '');
|
|
185
|
+
element.append(iframe);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function serializeCommentEditorDocument(document) {
|
|
189
|
+
if (document.blocks.every(block => (isNgsHeadlessEditorTextContent(block.content) &&
|
|
190
|
+
block.content.every(run => run.text.trim().length === 0)))) {
|
|
191
|
+
return '';
|
|
128
192
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
193
|
+
return document.blocks.map(serializeBlock).filter(Boolean).join('');
|
|
194
|
+
}
|
|
195
|
+
function serializeBlock(block) {
|
|
196
|
+
const text = isNgsHeadlessEditorTextContent(block.content)
|
|
197
|
+
? block.content.map(serializeText).join('')
|
|
198
|
+
: '';
|
|
199
|
+
switch (block.type) {
|
|
200
|
+
case 'paragraph':
|
|
201
|
+
return `<p>${text || '<br>'}</p>`;
|
|
202
|
+
case 'blockquote':
|
|
203
|
+
return `<blockquote>${text || '<br>'}</blockquote>`;
|
|
204
|
+
case 'codeBlock':
|
|
205
|
+
return `<pre><code>${stripInlineMarkup(text) || '<br>'}</code></pre>`;
|
|
206
|
+
case 'bulletList':
|
|
207
|
+
return `<ul><li>${text || '<br>'}</li></ul>`;
|
|
208
|
+
case 'orderedList':
|
|
209
|
+
return `<ol><li>${text || '<br>'}</li></ol>`;
|
|
210
|
+
case 'image': {
|
|
211
|
+
const src = escapeAttribute(String(block.attrs?.['src'] ?? ''));
|
|
212
|
+
const alt = escapeAttribute(String(block.attrs?.['alt'] ?? ''));
|
|
213
|
+
return src ? `<img src="${src}" alt="${alt}">` : '';
|
|
133
214
|
}
|
|
134
|
-
|
|
135
|
-
|
|
215
|
+
case 'youtube': {
|
|
216
|
+
const src = escapeAttribute(String(block.attrs?.['src'] ?? ''));
|
|
217
|
+
return src
|
|
218
|
+
? `<div data-youtube-video><iframe src="${src}" title="YouTube video" loading="lazy" allowfullscreen></iframe></div>`
|
|
219
|
+
: '';
|
|
136
220
|
}
|
|
221
|
+
case 'imageUpload':
|
|
222
|
+
return '';
|
|
223
|
+
default:
|
|
224
|
+
return text ? `<div data-ngs-headless-editor-block-type="${escapeAttribute(block.type)}">${text}</div>` : '';
|
|
137
225
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
226
|
+
}
|
|
227
|
+
function serializeText(run) {
|
|
228
|
+
let value = escapeHtml(run.text);
|
|
229
|
+
for (const mark of run.marks) {
|
|
230
|
+
value = wrapMark(value, mark);
|
|
231
|
+
}
|
|
232
|
+
return value;
|
|
233
|
+
}
|
|
234
|
+
function wrapMark(value, mark) {
|
|
235
|
+
switch (mark.type) {
|
|
236
|
+
case 'bold':
|
|
237
|
+
return `<strong>${value}</strong>`;
|
|
238
|
+
case 'italic':
|
|
239
|
+
return `<em>${value}</em>`;
|
|
240
|
+
case 'strike':
|
|
241
|
+
return `<s>${value}</s>`;
|
|
242
|
+
case 'code':
|
|
243
|
+
return `<code>${value}</code>`;
|
|
244
|
+
case 'singleEmoji':
|
|
245
|
+
return `<span class="single-emoji">${value}</span>`;
|
|
246
|
+
case 'textColor': {
|
|
247
|
+
const color = normalizeNgsHeadlessEditorColor(String(mark.attrs?.['color'] ?? ''));
|
|
248
|
+
return color ? `<span style="color: ${escapeAttribute(color)}">${value}</span>` : value;
|
|
155
249
|
}
|
|
156
|
-
|
|
157
|
-
|
|
250
|
+
case 'backgroundColor': {
|
|
251
|
+
const color = normalizeNgsHeadlessEditorColor(String(mark.attrs?.['color'] ?? ''));
|
|
252
|
+
return color
|
|
253
|
+
? `<span style="background-color: ${escapeAttribute(color)}">${value}</span>`
|
|
254
|
+
: value;
|
|
158
255
|
}
|
|
159
|
-
|
|
160
|
-
|
|
256
|
+
case 'link': {
|
|
257
|
+
// The document may come from storage or an API: never trust the raw href.
|
|
258
|
+
const href = escapeAttribute(normalizeLinkUrl(String(mark.attrs?.['href'] ?? '')));
|
|
259
|
+
return href
|
|
260
|
+
? `<a href="${href}" target="_blank" rel="noopener noreferrer">${value}</a>`
|
|
261
|
+
: value;
|
|
161
262
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
updateProps();
|
|
165
|
-
return true;
|
|
166
|
-
}
|
|
167
|
-
selectNode() {
|
|
168
|
-
this.renderer.updateProps({ selected: true });
|
|
169
|
-
}
|
|
170
|
-
deselectNode() {
|
|
171
|
-
this.renderer.updateProps({ selected: false });
|
|
172
|
-
}
|
|
173
|
-
destroy() {
|
|
174
|
-
this.renderer.destroy();
|
|
175
|
-
this.editor.off('selectionUpdate', this.handleSelectionUpdate);
|
|
176
|
-
this.contentDOMElement = null;
|
|
263
|
+
default:
|
|
264
|
+
return value;
|
|
177
265
|
}
|
|
178
266
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
class AngularNodeView {
|
|
187
|
-
editor = input.required(/* @ts-ignore */
|
|
188
|
-
...(ngDevMode ? [{ debugName: "editor" }] : /* istanbul ignore next */ []));
|
|
189
|
-
node = input.required(/* @ts-ignore */
|
|
190
|
-
...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
191
|
-
decorations = input.required(/* @ts-ignore */
|
|
192
|
-
...(ngDevMode ? [{ debugName: "decorations" }] : /* istanbul ignore next */ []));
|
|
193
|
-
selected = input.required(/* @ts-ignore */
|
|
194
|
-
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
195
|
-
extension = input.required(/* @ts-ignore */
|
|
196
|
-
...(ngDevMode ? [{ debugName: "extension" }] : /* istanbul ignore next */ []));
|
|
197
|
-
getPos = input.required(/* @ts-ignore */
|
|
198
|
-
...(ngDevMode ? [{ debugName: "getPos" }] : /* istanbul ignore next */ []));
|
|
199
|
-
updateAttributes = input.required(/* @ts-ignore */
|
|
200
|
-
...(ngDevMode ? [{ debugName: "updateAttributes" }] : /* istanbul ignore next */ []));
|
|
201
|
-
deleteNode = input.required(/* @ts-ignore */
|
|
202
|
-
...(ngDevMode ? [{ debugName: "deleteNode" }] : /* istanbul ignore next */ []));
|
|
203
|
-
HTMLAttributes = input({}, /* @ts-ignore */
|
|
204
|
-
...(ngDevMode ? [{ debugName: "HTMLAttributes" }] : /* istanbul ignore next */ []));
|
|
205
|
-
innerDecorations = input(undefined, /* @ts-ignore */
|
|
206
|
-
...(ngDevMode ? [{ debugName: "innerDecorations" }] : /* istanbul ignore next */ []));
|
|
207
|
-
view = input(undefined, /* @ts-ignore */
|
|
208
|
-
...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
209
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: AngularNodeView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
210
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.7", type: AngularNodeView, isStandalone: true, selector: "ng-component", inputs: { editor: { classPropertyName: "editor", publicName: "editor", isSignal: true, isRequired: true, transformFunction: null }, node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, decorations: { classPropertyName: "decorations", publicName: "decorations", isSignal: true, isRequired: true, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: true, transformFunction: null }, extension: { classPropertyName: "extension", publicName: "extension", isSignal: true, isRequired: true, transformFunction: null }, getPos: { classPropertyName: "getPos", publicName: "getPos", isSignal: true, isRequired: true, transformFunction: null }, updateAttributes: { classPropertyName: "updateAttributes", publicName: "updateAttributes", isSignal: true, isRequired: true, transformFunction: null }, deleteNode: { classPropertyName: "deleteNode", publicName: "deleteNode", isSignal: true, isRequired: true, transformFunction: null }, HTMLAttributes: { classPropertyName: "HTMLAttributes", publicName: "HTMLAttributes", isSignal: true, isRequired: false, transformFunction: null }, innerDecorations: { classPropertyName: "innerDecorations", publicName: "innerDecorations", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
267
|
+
function escapeHtml(value) {
|
|
268
|
+
return value
|
|
269
|
+
.replaceAll('&', '&')
|
|
270
|
+
.replaceAll('<', '<')
|
|
271
|
+
.replaceAll('>', '>')
|
|
272
|
+
.replaceAll('"', '"')
|
|
273
|
+
.replaceAll("'", ''');
|
|
211
274
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
template: ''
|
|
218
|
-
}]
|
|
219
|
-
}], propDecorators: { editor: [{ type: i0.Input, args: [{ isSignal: true, alias: "editor", required: true }] }], node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: true }] }], decorations: [{ type: i0.Input, args: [{ isSignal: true, alias: "decorations", required: true }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: true }] }], extension: [{ type: i0.Input, args: [{ isSignal: true, alias: "extension", required: true }] }], getPos: [{ type: i0.Input, args: [{ isSignal: true, alias: "getPos", required: true }] }], updateAttributes: [{ type: i0.Input, args: [{ isSignal: true, alias: "updateAttributes", required: true }] }], deleteNode: [{ type: i0.Input, args: [{ isSignal: true, alias: "deleteNode", required: true }] }], HTMLAttributes: [{ type: i0.Input, args: [{ isSignal: true, alias: "HTMLAttributes", required: false }] }], innerDecorations: [{ type: i0.Input, args: [{ isSignal: true, alias: "innerDecorations", required: false }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }] } });
|
|
220
|
-
|
|
221
|
-
class ImageUploadingPlaceholder extends AngularNodeView {
|
|
222
|
-
src;
|
|
223
|
-
error;
|
|
224
|
-
_canceled = false;
|
|
225
|
-
ngOnInit() {
|
|
226
|
-
const uploadFn = this.extension().options['uploadFn'];
|
|
227
|
-
this.src = this.node().attrs['src'];
|
|
228
|
-
const blob = this._dataURItoBlob(this.src);
|
|
229
|
-
uploadFn(blob).then((src) => {
|
|
230
|
-
if (this._canceled) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
const image = new Image();
|
|
234
|
-
image.src = src;
|
|
235
|
-
image.onload = () => {
|
|
236
|
-
this.editor().chain().focus().setImage({ src }).run();
|
|
237
|
-
};
|
|
238
|
-
}, (error) => {
|
|
239
|
-
this.error = error;
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
ngOnDestroy() {
|
|
243
|
-
this._canceled = true;
|
|
244
|
-
}
|
|
245
|
-
_dataURItoBlob(dataURI) {
|
|
246
|
-
// convert base64 to raw binary data held in a string
|
|
247
|
-
// doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
|
|
248
|
-
const byteString = atob(dataURI.split(',')[1]);
|
|
249
|
-
// separate out the mime component
|
|
250
|
-
const mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
|
|
251
|
-
// write the bytes of the string to an ArrayBuffer
|
|
252
|
-
const ab = new ArrayBuffer(byteString.length);
|
|
253
|
-
const ia = new Uint8Array(ab);
|
|
254
|
-
for (var i = 0; i < byteString.length; i++) {
|
|
255
|
-
ia[i] = byteString.charCodeAt(i);
|
|
256
|
-
}
|
|
257
|
-
return new Blob([ab], { type: mimeString });
|
|
258
|
-
}
|
|
259
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ImageUploadingPlaceholder, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
260
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: ImageUploadingPlaceholder, isStandalone: true, selector: "ngs-image-uploading-placeholder", host: { properties: { "class.selected": "selected()" }, classAttribute: "ngs-image-uploading-placeholder" }, usesInheritance: true, ngImport: i0, template: "@if (src) {\n <div class=\"flex items-center justify-center relative\">\n @if (error) {\n <div class=\"absolute top-0 start-0 right-0 min-h-8 bg-error z-[2]\n text-on-error text-tiny flex items-center px-3\">{{ error }}</div>\n }\n <div class=\"w-max absolute start-1/2 top-1/2 z-[1] -translate-y-1/2 -translate-x-1/2\">\n @if (!error) {\n <ngs-progress-spinner />\n }\n </div>\n <img [src]=\"src\" alt=\"\" class=\"max-w-full opacity-70\">\n </div>\n}\n", styles: [":host{display:block}:host.selected{outline:var(--sys-tertiary) solid 4px}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: ProgressSpinner, selector: "ngs-progress-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["ngsProgressSpinner"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
275
|
+
function escapeAttribute(value) {
|
|
276
|
+
return escapeHtml(value);
|
|
277
|
+
}
|
|
278
|
+
function stripInlineMarkup(value) {
|
|
279
|
+
return value.replace(/<[^>]+>/g, '');
|
|
261
280
|
}
|
|
262
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: ImageUploadingPlaceholder, decorators: [{
|
|
263
|
-
type: Component,
|
|
264
|
-
args: [{ selector: 'ngs-image-uploading-placeholder', imports: [
|
|
265
|
-
ProgressSpinner
|
|
266
|
-
], changeDetection: ChangeDetectionStrategy.Eager, host: {
|
|
267
|
-
'class': 'ngs-image-uploading-placeholder',
|
|
268
|
-
'[class.selected]': 'selected()'
|
|
269
|
-
}, template: "@if (src) {\n <div class=\"flex items-center justify-center relative\">\n @if (error) {\n <div class=\"absolute top-0 start-0 right-0 min-h-8 bg-error z-[2]\n text-on-error text-tiny flex items-center px-3\">{{ error }}</div>\n }\n <div class=\"w-max absolute start-1/2 top-1/2 z-[1] -translate-y-1/2 -translate-x-1/2\">\n @if (!error) {\n <ngs-progress-spinner />\n }\n </div>\n <img [src]=\"src\" alt=\"\" class=\"max-w-full opacity-70\">\n </div>\n}\n", styles: [":host{display:block}:host.selected{outline:var(--sys-tertiary) solid 4px}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
270
|
-
}] });
|
|
271
|
-
|
|
272
|
-
const ImageUploadingPlaceholderExtension = (injector, options) => {
|
|
273
|
-
return Node.create({
|
|
274
|
-
name: 'imageUploadingPlaceholder',
|
|
275
|
-
draggable: false,
|
|
276
|
-
group: 'block',
|
|
277
|
-
addOptions() {
|
|
278
|
-
return {
|
|
279
|
-
uploadFn: options.uploadFn
|
|
280
|
-
};
|
|
281
|
-
},
|
|
282
|
-
addAttributes() {
|
|
283
|
-
return {
|
|
284
|
-
uploadId: {
|
|
285
|
-
default: ''
|
|
286
|
-
},
|
|
287
|
-
src: {
|
|
288
|
-
default: null
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
},
|
|
292
|
-
addCommands() {
|
|
293
|
-
return {
|
|
294
|
-
addImageUploadingPlaceholder: options => ({ commands }) => {
|
|
295
|
-
return commands.insertContent({
|
|
296
|
-
type: this.name,
|
|
297
|
-
attrs: {
|
|
298
|
-
src: options.src
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
},
|
|
302
|
-
};
|
|
303
|
-
},
|
|
304
|
-
addNodeView() {
|
|
305
|
-
return AngularNodeViewRenderer(ImageUploadingPlaceholder, { injector });
|
|
306
|
-
},
|
|
307
|
-
parseHTML() {
|
|
308
|
-
return [
|
|
309
|
-
{
|
|
310
|
-
tag: 'image-uploading-placeholder',
|
|
311
|
-
}
|
|
312
|
-
];
|
|
313
|
-
},
|
|
314
|
-
renderHTML({ HTMLAttributes }) {
|
|
315
|
-
return [
|
|
316
|
-
'image-uploading-placeholder', mergeAttributes(HTMLAttributes),
|
|
317
|
-
];
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
};
|
|
321
281
|
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
inclusive: false,
|
|
325
|
-
addOptions() {
|
|
326
|
-
return {
|
|
327
|
-
HTMLAttributes: {
|
|
328
|
-
class: 'single-emoji',
|
|
329
|
-
},
|
|
330
|
-
};
|
|
331
|
-
},
|
|
332
|
-
parseHTML() {
|
|
333
|
-
return [
|
|
334
|
-
{
|
|
335
|
-
tag: 'span.single-emoji',
|
|
336
|
-
},
|
|
337
|
-
];
|
|
338
|
-
},
|
|
339
|
-
renderHTML({ HTMLAttributes }) {
|
|
340
|
-
return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
341
|
-
},
|
|
342
|
-
});
|
|
282
|
+
const COMMENT_EDITOR = new InjectionToken('COMMENT_EDITOR');
|
|
283
|
+
const COMMENT_EDITOR_BUBBLE_MENU = new InjectionToken('COMMENT_EDITOR_BUBBLE_MENU');
|
|
343
284
|
|
|
344
285
|
class CommentEditor {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
286
|
+
editor = inject(NgsHeadlessEditor);
|
|
287
|
+
host = inject(ElementRef);
|
|
288
|
+
renderer = inject(Renderer2);
|
|
289
|
+
documentRef = inject(DOCUMENT);
|
|
290
|
+
destroyRef = inject(DestroyRef);
|
|
291
|
+
surface = viewChild.required(NgsHeadlessEditorSurface, /* @ts-ignore */
|
|
292
|
+
...(ngDevMode ? [{ debugName: "surface" }] : /* istanbul ignore next */ []));
|
|
293
|
+
bubbleMenuLayer = viewChild('bubbleMenuLayer', /* @ts-ignore */
|
|
294
|
+
...(ngDevMode ? [{ debugName: "bubbleMenuLayer" }] : /* istanbul ignore next */ []));
|
|
295
|
+
basicPlugin = basicTextEditorPlugin();
|
|
296
|
+
colorPlugin = colorEditorPlugin();
|
|
297
|
+
commentPlugin = commentEditorPlugin();
|
|
298
|
+
toolbarActive = signal(false, /* @ts-ignore */
|
|
299
|
+
...(ngDevMode ? [{ debugName: "toolbarActive" }] : /* istanbul ignore next */ []));
|
|
300
|
+
fullViewActive = signal(false, /* @ts-ignore */
|
|
301
|
+
...(ngDevMode ? [{ debugName: "fullViewActive" }] : /* istanbul ignore next */ []));
|
|
302
|
+
bubbleMenuFrame = null;
|
|
303
|
+
value = model(createNgsHeadlessEditorDocument(), /* @ts-ignore */
|
|
304
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
305
|
+
plugins = input([], /* @ts-ignore */
|
|
306
|
+
...(ngDevMode ? [{ debugName: "plugins" }] : /* istanbul ignore next */ []));
|
|
359
307
|
contentMaxHeight = input(/* @ts-ignore */
|
|
360
308
|
...(ngDevMode ? [undefined, { debugName: "contentMaxHeight" }] : /* istanbul ignore next */ []));
|
|
361
309
|
buttonCancelLabel = input('Cancel', /* @ts-ignore */
|
|
362
310
|
...(ngDevMode ? [{ debugName: "buttonCancelLabel" }] : /* istanbul ignore next */ []));
|
|
363
311
|
buttonSendLabel = input('Send', /* @ts-ignore */
|
|
364
312
|
...(ngDevMode ? [{ debugName: "buttonSendLabel" }] : /* istanbul ignore next */ []));
|
|
313
|
+
buttonSubmitLabel = input(/* @ts-ignore */
|
|
314
|
+
...(ngDevMode ? [undefined, { debugName: "buttonSubmitLabel" }] : /* istanbul ignore next */ []));
|
|
365
315
|
placeholder = input('Write something …', /* @ts-ignore */
|
|
366
316
|
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
317
|
+
ariaLabel = input('Comment editor', /* @ts-ignore */
|
|
318
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
367
319
|
toolbarAlwaysVisible = input(false, { ...(ngDevMode ? { debugName: "toolbarAlwaysVisible" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
368
320
|
fullViewMode = input(false, { ...(ngDevMode ? { debugName: "fullViewMode" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
369
321
|
cancelButtonAlwaysVisible = input(false, { ...(ngDevMode ? { debugName: "cancelButtonAlwaysVisible" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
370
322
|
allowEmptyContent = input(false, { ...(ngDevMode ? { debugName: "allowEmptyContent" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
323
|
+
allowEmpty = input(false, { ...(ngDevMode ? { debugName: "allowEmpty" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
371
324
|
autoClear = input(true, { ...(ngDevMode ? { debugName: "autoClear" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
372
|
-
loading = input(false, /*
|
|
373
|
-
...(ngDevMode ?
|
|
325
|
+
loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
326
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
327
|
+
readOnly = input(false, { ...(ngDevMode ? { debugName: "readOnly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
374
328
|
imageUploadFn = input(/* @ts-ignore */
|
|
375
329
|
...(ngDevMode ? [undefined, { debugName: "imageUploadFn" }] : /* istanbul ignore next */ []));
|
|
330
|
+
submitted = output();
|
|
376
331
|
sent = output();
|
|
377
332
|
canceled = output();
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
333
|
+
isEditorActivated = computed(() => this.fullViewActive() || this.fullViewMode(), /* @ts-ignore */
|
|
334
|
+
...(ngDevMode ? [{ debugName: "isEditorActivated" }] : /* istanbul ignore next */ []));
|
|
335
|
+
isToolbarVisible = computed(() => ((this.toolbarActive() || this.toolbarAlwaysVisible()) && this.isEditorActivated()), /* @ts-ignore */
|
|
336
|
+
...(ngDevMode ? [{ debugName: "isToolbarVisible" }] : /* istanbul ignore next */ []));
|
|
337
|
+
isBubbleMenuVisible = computed(() => {
|
|
338
|
+
const selection = this.editor.selection();
|
|
339
|
+
return this.editor.focused() && !!selection && (selection.anchor.blockId !== selection.focus.blockId ||
|
|
340
|
+
selection.anchor.offset !== selection.focus.offset);
|
|
341
|
+
}, /* @ts-ignore */
|
|
342
|
+
...(ngDevMode ? [{ debugName: "isBubbleMenuVisible" }] : /* istanbul ignore next */ []));
|
|
343
|
+
isCancelVisible = computed(() => ((this.fullViewActive() && !this.fullViewMode()) || this.cancelButtonAlwaysVisible()), /* @ts-ignore */
|
|
344
|
+
...(ngDevMode ? [{ debugName: "isCancelVisible" }] : /* istanbul ignore next */ []));
|
|
345
|
+
sendLabel = computed(() => this.buttonSubmitLabel() ?? this.buttonSendLabel(), /* @ts-ignore */
|
|
346
|
+
...(ngDevMode ? [{ debugName: "sendLabel" }] : /* istanbul ignore next */ []));
|
|
347
|
+
sendDisabled = computed(() => (this.disabled() ||
|
|
348
|
+
this.loading() ||
|
|
349
|
+
(!(this.allowEmpty() || this.allowEmptyContent()) && this.editor.empty())), /* @ts-ignore */
|
|
350
|
+
...(ngDevMode ? [{ debugName: "sendDisabled" }] : /* istanbul ignore next */ []));
|
|
351
|
+
commands = new Map([
|
|
352
|
+
['toggleBold', NGS_HEADLESS_EDITOR_TOGGLE_BOLD],
|
|
353
|
+
['toggleItalic', NGS_HEADLESS_EDITOR_TOGGLE_ITALIC],
|
|
354
|
+
['toggleStrike', NGS_HEADLESS_EDITOR_TOGGLE_STRIKE],
|
|
355
|
+
['toggleCode', NGS_HEADLESS_EDITOR_TOGGLE_CODE],
|
|
356
|
+
['toggleBlockquote', NGS_COMMENT_EDITOR_TOGGLE_BLOCKQUOTE],
|
|
357
|
+
['toggleCodeBlock', NGS_COMMENT_EDITOR_TOGGLE_CODE_BLOCK],
|
|
358
|
+
['toggleBulletList', NGS_COMMENT_EDITOR_TOGGLE_BULLET_LIST],
|
|
359
|
+
['toggleOrderedList', NGS_COMMENT_EDITOR_TOGGLE_ORDERED_LIST]
|
|
360
|
+
]);
|
|
361
|
+
api = {
|
|
362
|
+
isCommandDisabled: command => this.isCommandDisabled(command),
|
|
363
|
+
isActive: command => this.isActive(command),
|
|
364
|
+
runCommand: command => this.runCommand(command),
|
|
365
|
+
editor: () => this.editor,
|
|
366
|
+
document: () => this.editor.document(),
|
|
367
|
+
isToolbarActive: () => this.toolbarActive(),
|
|
368
|
+
toggleToolbar: () => this.toggleToolbar(),
|
|
369
|
+
showToolbar: () => this.showToolbar(),
|
|
370
|
+
hideToolbar: () => this.hideToolbar(),
|
|
371
|
+
isEditorActivated: () => this.isEditorActivated(),
|
|
372
|
+
showFullView: () => this.showFullView(),
|
|
373
|
+
hideFullView: () => this.hideFullView(),
|
|
374
|
+
insertText: text => this.insertText(text),
|
|
375
|
+
insertImage: file => this.insertImage(file),
|
|
376
|
+
insertYoutube: url => this.insertYoutube(url),
|
|
377
|
+
getMarkAttributes: type => this.editor.getActiveMark(type)?.attrs,
|
|
378
|
+
setTextColor: color => this.setTextColor(color),
|
|
379
|
+
unsetTextColor: () => this.unsetTextColor(),
|
|
380
|
+
setBackgroundColor: color => this.setBackgroundColor(color),
|
|
381
|
+
unsetBackgroundColor: () => this.unsetBackgroundColor(),
|
|
382
|
+
setLink: url => this.setLink(url),
|
|
383
|
+
unsetLink: () => this.unsetLink(),
|
|
384
|
+
clear: () => this.clear(),
|
|
385
|
+
focus: () => this.focus()
|
|
386
|
+
};
|
|
387
|
+
constructor() {
|
|
388
|
+
effect(() => {
|
|
389
|
+
this.editor.setPlugins([
|
|
390
|
+
this.basicPlugin,
|
|
391
|
+
this.colorPlugin,
|
|
392
|
+
this.commentPlugin,
|
|
393
|
+
...this.plugins()
|
|
394
|
+
]);
|
|
395
|
+
});
|
|
396
|
+
effect(() => {
|
|
397
|
+
const value = this.value();
|
|
398
|
+
untracked(() => {
|
|
399
|
+
if (!ngsHeadlessEditorDocumentsEqual(value, this.editor.document())) {
|
|
400
|
+
this.editor.setDocument(value);
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
effect(() => {
|
|
405
|
+
const document = this.editor.document();
|
|
406
|
+
if (this.editor.origin() !== 'external' && !ngsHeadlessEditorDocumentsEqual(document, this.value())) {
|
|
407
|
+
this.value.set(document);
|
|
405
408
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
const
|
|
412
|
-
if (
|
|
413
|
-
this.
|
|
414
|
-
type: 'text',
|
|
415
|
-
text,
|
|
416
|
-
marks: [{ type: 'singleEmoji' }]
|
|
417
|
-
}).run();
|
|
409
|
+
});
|
|
410
|
+
effect(() => {
|
|
411
|
+
this.editor.setReadOnly(this.disabled() || this.readOnly());
|
|
412
|
+
});
|
|
413
|
+
effect(() => {
|
|
414
|
+
const maxHeight = this.contentMaxHeight();
|
|
415
|
+
if (typeof maxHeight === 'number') {
|
|
416
|
+
this.renderer.setStyle(this.host.nativeElement, '--ngs-comment-editor-content-max-height', `${Math.max(0, maxHeight)}px`);
|
|
418
417
|
}
|
|
419
418
|
else {
|
|
420
|
-
this.
|
|
419
|
+
this.renderer.removeStyle(this.host.nativeElement, '--ngs-comment-editor-content-max-height');
|
|
421
420
|
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
421
|
+
});
|
|
422
|
+
effect(() => {
|
|
423
|
+
this.editor.selection();
|
|
424
|
+
this.editor.focused();
|
|
425
|
+
this.editor.revision();
|
|
426
|
+
const layer = this.bubbleMenuLayer();
|
|
427
|
+
if (layer && this.isBubbleMenuVisible()) {
|
|
428
|
+
untracked(() => this.scheduleBubbleMenuPosition());
|
|
428
429
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
430
|
+
});
|
|
431
|
+
afterNextRender(() => {
|
|
432
|
+
const windowRef = this.documentRef.defaultView;
|
|
433
|
+
if (!windowRef) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
const reposition = () => this.scheduleBubbleMenuPosition();
|
|
437
|
+
windowRef.addEventListener('resize', reposition);
|
|
438
|
+
this.documentRef.addEventListener('scroll', reposition, true);
|
|
439
|
+
this.destroyRef.onDestroy(() => {
|
|
440
|
+
windowRef.removeEventListener('resize', reposition);
|
|
441
|
+
this.documentRef.removeEventListener('scroll', reposition, true);
|
|
442
|
+
if (this.bubbleMenuFrame !== null) {
|
|
443
|
+
windowRef.cancelAnimationFrame(this.bubbleMenuFrame);
|
|
442
444
|
}
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
insertText(text) {
|
|
449
|
+
if (!text || this.disabled() || this.readOnly()) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
if (!this.editor.focused()) {
|
|
453
|
+
const lastTextBlock = [...this.editor.document().blocks]
|
|
454
|
+
.reverse()
|
|
455
|
+
.find(block => Array.isArray(block.content));
|
|
456
|
+
if (lastTextBlock) {
|
|
457
|
+
const offset = getNgsHeadlessEditorBlockText(lastTextBlock).length;
|
|
458
|
+
this.editor.setSelection({
|
|
459
|
+
anchor: { blockId: lastTextBlock.id, offset },
|
|
460
|
+
focus: { blockId: lastTextBlock.id, offset }
|
|
461
|
+
});
|
|
443
462
|
}
|
|
444
463
|
else {
|
|
445
|
-
|
|
464
|
+
const paragraph = createNgsHeadlessEditorParagraph();
|
|
465
|
+
this.editor.insertBlock(paragraph, true);
|
|
446
466
|
}
|
|
447
|
-
this.activateFullView();
|
|
448
467
|
}
|
|
468
|
+
const value = getNgsHeadlessEditorDocumentText(this.editor.document()).length > 0 && !this.editor.focused()
|
|
469
|
+
? ` ${text} `
|
|
470
|
+
: text;
|
|
471
|
+
const singleEmoji = isOnlyEmoji(text) && this.currentBlockIsEmpty();
|
|
472
|
+
if (singleEmoji) {
|
|
473
|
+
this.editor.setMark('singleEmoji');
|
|
474
|
+
}
|
|
475
|
+
this.editor.insertText(value, 'api');
|
|
476
|
+
if (singleEmoji) {
|
|
477
|
+
this.editor.unsetMark('singleEmoji');
|
|
478
|
+
}
|
|
479
|
+
this.showFullView();
|
|
480
|
+
queueMicrotask(() => this.focus());
|
|
449
481
|
}
|
|
450
482
|
isCommandDisabled(command) {
|
|
451
|
-
if (
|
|
452
|
-
|
|
483
|
+
if (command === 'toggleLink') {
|
|
484
|
+
const selection = this.editor.selection();
|
|
485
|
+
const collapsed = !selection || (selection.anchor.blockId === selection.focus.blockId &&
|
|
486
|
+
selection.anchor.offset === selection.focus.offset);
|
|
487
|
+
return this.editor.readOnly() || collapsed ? true : null;
|
|
453
488
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
489
|
+
const resolved = this.commands.get(command);
|
|
490
|
+
return !resolved || !this.editor.isCommandEnabled(resolved) ? true : null;
|
|
491
|
+
}
|
|
492
|
+
isActive(command) {
|
|
493
|
+
const markAliases = {
|
|
494
|
+
bold: 'bold',
|
|
495
|
+
italic: 'italic',
|
|
496
|
+
strike: 'strike',
|
|
497
|
+
code: 'code',
|
|
498
|
+
link: 'link'
|
|
499
|
+
};
|
|
500
|
+
if (markAliases[command]) {
|
|
501
|
+
return this.editor.isMarkActive(markAliases[command]);
|
|
460
502
|
}
|
|
503
|
+
const resolved = this.commands.get(command);
|
|
504
|
+
return resolved ? this.editor.isCommandActive(resolved) : false;
|
|
461
505
|
}
|
|
462
|
-
|
|
463
|
-
this.
|
|
506
|
+
runCommand(command) {
|
|
507
|
+
const resolved = this.commands.get(command);
|
|
508
|
+
if (resolved) {
|
|
509
|
+
this.editor.execute(resolved);
|
|
510
|
+
this.focus();
|
|
511
|
+
}
|
|
464
512
|
}
|
|
465
513
|
send(event) {
|
|
466
|
-
event
|
|
467
|
-
event
|
|
468
|
-
this.
|
|
514
|
+
event?.stopPropagation();
|
|
515
|
+
event?.preventDefault();
|
|
516
|
+
if (this.sendDisabled()) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
const document = this.editor.document();
|
|
520
|
+
this.submitted.emit(document);
|
|
521
|
+
this.sent.emit(serializeCommentEditorDocument(document));
|
|
469
522
|
if (this.autoClear()) {
|
|
470
|
-
this.
|
|
471
|
-
this.
|
|
523
|
+
this.toolbarActive.set(false);
|
|
524
|
+
this.fullViewActive.set(false);
|
|
472
525
|
this.clear();
|
|
473
526
|
}
|
|
474
527
|
}
|
|
528
|
+
submit(event) {
|
|
529
|
+
this.send(event);
|
|
530
|
+
}
|
|
531
|
+
cancel(event) {
|
|
532
|
+
event?.stopPropagation();
|
|
533
|
+
event?.preventDefault();
|
|
534
|
+
this.toolbarActive.set(false);
|
|
535
|
+
this.fullViewActive.set(false);
|
|
536
|
+
this.clear();
|
|
537
|
+
this.canceled.emit();
|
|
538
|
+
}
|
|
475
539
|
clear() {
|
|
476
|
-
this.
|
|
477
|
-
this.editor?.commands.clearContent(true);
|
|
540
|
+
this.editor.clear();
|
|
478
541
|
}
|
|
479
542
|
activateFullView(event) {
|
|
480
543
|
if (event) {
|
|
481
544
|
const target = event.target;
|
|
482
|
-
if (target.closest('button')) {
|
|
545
|
+
if (target.closest('button, a')) {
|
|
483
546
|
return;
|
|
484
547
|
}
|
|
485
548
|
}
|
|
486
549
|
this.showFullView();
|
|
487
550
|
}
|
|
488
551
|
showFullView() {
|
|
489
|
-
this.
|
|
552
|
+
this.fullViewActive.set(true);
|
|
490
553
|
}
|
|
491
554
|
hideFullView() {
|
|
492
|
-
this.
|
|
555
|
+
this.fullViewActive.set(false);
|
|
493
556
|
}
|
|
494
557
|
toggleToolbar() {
|
|
495
|
-
this.
|
|
558
|
+
this.toolbarActive.update(visible => !visible);
|
|
496
559
|
}
|
|
497
560
|
showToolbar() {
|
|
498
|
-
this.
|
|
561
|
+
this.toolbarActive.set(true);
|
|
499
562
|
}
|
|
500
563
|
hideToolbar() {
|
|
501
|
-
this.
|
|
564
|
+
this.toolbarActive.set(false);
|
|
502
565
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
event.preventDefault();
|
|
506
|
-
this.isToolbarVisible = false;
|
|
507
|
-
this.isFullViewVisible = false;
|
|
508
|
-
this.clear();
|
|
509
|
-
this.canceled.emit();
|
|
566
|
+
focus() {
|
|
567
|
+
this.surface().focus();
|
|
510
568
|
}
|
|
511
|
-
|
|
512
|
-
if (!
|
|
513
|
-
return;
|
|
569
|
+
setLink(url) {
|
|
570
|
+
if (!url.trim()) {
|
|
571
|
+
return this.unsetLink();
|
|
572
|
+
}
|
|
573
|
+
return this.editor.execute(NGS_COMMENT_EDITOR_SET_LINK, url);
|
|
574
|
+
}
|
|
575
|
+
setTextColor(color) {
|
|
576
|
+
return this.editor.execute(NGS_HEADLESS_EDITOR_SET_TEXT_COLOR, color);
|
|
577
|
+
}
|
|
578
|
+
unsetTextColor() {
|
|
579
|
+
return this.editor.execute(NGS_HEADLESS_EDITOR_UNSET_TEXT_COLOR);
|
|
580
|
+
}
|
|
581
|
+
setBackgroundColor(color) {
|
|
582
|
+
return this.editor.execute(NGS_HEADLESS_EDITOR_SET_BACKGROUND_COLOR, color);
|
|
583
|
+
}
|
|
584
|
+
unsetBackgroundColor() {
|
|
585
|
+
return this.editor.execute(NGS_HEADLESS_EDITOR_UNSET_BACKGROUND_COLOR);
|
|
586
|
+
}
|
|
587
|
+
unsetLink() {
|
|
588
|
+
return this.editor.execute(NGS_COMMENT_EDITOR_UNSET_LINK);
|
|
589
|
+
}
|
|
590
|
+
insertYoutube(url) {
|
|
591
|
+
const src = normalizeYoutubeUrl(url);
|
|
592
|
+
if (!src) {
|
|
593
|
+
return false;
|
|
594
|
+
}
|
|
595
|
+
const inserted = this.editor.insertBlock(createCommentEditorMediaBlock('youtube', { src }));
|
|
596
|
+
if (inserted) {
|
|
597
|
+
this.showFullView();
|
|
514
598
|
}
|
|
515
|
-
|
|
516
|
-
chainFocus[command]().run();
|
|
599
|
+
return inserted;
|
|
517
600
|
}
|
|
518
|
-
|
|
519
|
-
if (
|
|
601
|
+
insertImage(file) {
|
|
602
|
+
if (this.disabled() || this.readOnly()) {
|
|
520
603
|
return;
|
|
521
604
|
}
|
|
522
|
-
this.
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
Italic,
|
|
530
|
-
Strike,
|
|
531
|
-
Blockquote,
|
|
532
|
-
CodeBlock,
|
|
533
|
-
BulletList,
|
|
534
|
-
OrderedList,
|
|
535
|
-
ListItem,
|
|
536
|
-
Code,
|
|
537
|
-
History,
|
|
538
|
-
Dropcursor,
|
|
539
|
-
Youtube.configure({
|
|
540
|
-
controls: false,
|
|
541
|
-
nocookie: true,
|
|
542
|
-
}),
|
|
543
|
-
ImageUploadingPlaceholderExtension(this._injector, {
|
|
544
|
-
uploadFn: this.imageUploadFn(),
|
|
545
|
-
}),
|
|
546
|
-
Image$1.configure({
|
|
547
|
-
inline: true,
|
|
548
|
-
allowBase64: true
|
|
549
|
-
}),
|
|
550
|
-
SingleEmoji,
|
|
551
|
-
Link.configure({
|
|
552
|
-
openOnClick: false,
|
|
553
|
-
defaultProtocol: 'https',
|
|
554
|
-
}),
|
|
555
|
-
Placeholder.configure({
|
|
556
|
-
placeholder: this.placeholder()
|
|
557
|
-
}),
|
|
558
|
-
// FloatingMenu.configure({
|
|
559
|
-
// element: this._floatingMenu().nativeElement
|
|
560
|
-
// }),
|
|
561
|
-
BubbleMenu.configure({
|
|
562
|
-
pluginKey: 'imageBubbleMenu',
|
|
563
|
-
element: this._imageBubbleMenu().nativeElement,
|
|
564
|
-
shouldShow: ({ editor, view, state, oldState, from, to }) => {
|
|
565
|
-
// return editor.isActive('image');
|
|
566
|
-
return false;
|
|
567
|
-
},
|
|
568
|
-
}),
|
|
569
|
-
BubbleMenu.configure({
|
|
570
|
-
pluginKey: 'bubbleMenu',
|
|
571
|
-
element: this._bubbleMenu().nativeElement,
|
|
572
|
-
tippyOptions: {
|
|
573
|
-
appendTo: this._document.body,
|
|
574
|
-
zIndex: 999
|
|
575
|
-
},
|
|
576
|
-
shouldShow: ({ editor, view, state, oldState, from, to }) => {
|
|
577
|
-
return !editor.isActive('image') &&
|
|
578
|
-
!editor.isActive('youtube') &&
|
|
579
|
-
!editor.isActive('imageUploadingPlaceholder') &&
|
|
580
|
-
!editor.view.state.selection.empty;
|
|
581
|
-
},
|
|
582
|
-
})
|
|
583
|
-
],
|
|
584
|
-
content: '',
|
|
585
|
-
onUpdate: ({ editor }) => {
|
|
586
|
-
this._value = !editor.isEmpty ? editor.getHTML() : '';
|
|
587
|
-
this._cdr.markForCheck();
|
|
605
|
+
void this.readFile(file).then(preview => {
|
|
606
|
+
const block = createCommentEditorMediaBlock('imageUpload', {
|
|
607
|
+
src: preview,
|
|
608
|
+
status: 'uploading'
|
|
609
|
+
});
|
|
610
|
+
if (!this.editor.insertBlock(block)) {
|
|
611
|
+
return;
|
|
588
612
|
}
|
|
613
|
+
this.showFullView();
|
|
614
|
+
const upload = this.imageUploadFn();
|
|
615
|
+
const result = upload ? upload(file) : Promise.resolve(preview);
|
|
616
|
+
result.then(src => this.editor.updateBlock(block.id, {
|
|
617
|
+
type: 'image',
|
|
618
|
+
attrs: { src, alt: file.name }
|
|
619
|
+
}), error => this.editor.updateBlock(block.id, {
|
|
620
|
+
attrs: {
|
|
621
|
+
src: preview,
|
|
622
|
+
status: 'error',
|
|
623
|
+
error: error instanceof Error ? error.message : String(error)
|
|
624
|
+
}
|
|
625
|
+
}));
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
currentBlockIsEmpty() {
|
|
629
|
+
const selection = this.editor.selection();
|
|
630
|
+
const block = this.editor.document().blocks.find(item => item.id === selection?.focus.blockId);
|
|
631
|
+
return !!block && getNgsHeadlessEditorBlockText(block).length === 0;
|
|
632
|
+
}
|
|
633
|
+
readFile(file) {
|
|
634
|
+
return new Promise((resolve, reject) => {
|
|
635
|
+
const reader = new FileReader();
|
|
636
|
+
reader.onload = () => resolve(String(reader.result ?? ''));
|
|
637
|
+
reader.onerror = () => reject(reader.error ?? new Error('Unable to read image'));
|
|
638
|
+
reader.readAsDataURL(file);
|
|
589
639
|
});
|
|
590
|
-
|
|
640
|
+
}
|
|
641
|
+
scheduleBubbleMenuPosition() {
|
|
642
|
+
const windowRef = this.documentRef.defaultView;
|
|
643
|
+
if (!windowRef) {
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
if (this.bubbleMenuFrame !== null) {
|
|
647
|
+
windowRef.cancelAnimationFrame(this.bubbleMenuFrame);
|
|
648
|
+
}
|
|
649
|
+
this.bubbleMenuFrame = windowRef.requestAnimationFrame(() => {
|
|
650
|
+
this.bubbleMenuFrame = null;
|
|
651
|
+
this.positionBubbleMenu();
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
positionBubbleMenu() {
|
|
655
|
+
const layer = this.bubbleMenuLayer()?.nativeElement;
|
|
656
|
+
if (!layer) {
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
const selectionRect = this.surface().getSelectionRect();
|
|
660
|
+
if (!selectionRect || !this.isBubbleMenuVisible()) {
|
|
661
|
+
this.renderer.removeClass(layer, 'bubble-menu-positioned');
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
const viewportWidth = this.documentRef.documentElement.clientWidth;
|
|
665
|
+
const layerWidth = layer.getBoundingClientRect().width;
|
|
666
|
+
const edge = 8;
|
|
667
|
+
const halfWidth = layerWidth / 2;
|
|
668
|
+
const selectionCenter = selectionRect.left + selectionRect.width / 2;
|
|
669
|
+
const x = layerWidth + edge * 2 >= viewportWidth
|
|
670
|
+
? viewportWidth / 2
|
|
671
|
+
: Math.min(Math.max(selectionCenter, edge + halfWidth), viewportWidth - edge - halfWidth);
|
|
672
|
+
this.renderer.setStyle(layer, 'left', `${x}px`);
|
|
673
|
+
this.renderer.setStyle(layer, 'top', `${selectionRect.top}px`);
|
|
674
|
+
this.renderer.addClass(layer, 'bubble-menu-positioned');
|
|
591
675
|
}
|
|
592
676
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
593
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: CommentEditor, isStandalone: true, selector: "ngs-comment-editor", inputs: { contentMaxHeight: { classPropertyName: "contentMaxHeight", publicName: "contentMaxHeight", isSignal: true, isRequired: false, transformFunction: null }, buttonCancelLabel: { classPropertyName: "buttonCancelLabel", publicName: "buttonCancelLabel", isSignal: true, isRequired: false, transformFunction: null }, buttonSendLabel: { classPropertyName: "buttonSendLabel", publicName: "buttonSendLabel", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, toolbarAlwaysVisible: { classPropertyName: "toolbarAlwaysVisible", publicName: "toolbarAlwaysVisible", isSignal: true, isRequired: false, transformFunction: null }, fullViewMode: { classPropertyName: "fullViewMode", publicName: "fullViewMode", isSignal: true, isRequired: false, transformFunction: null }, cancelButtonAlwaysVisible: { classPropertyName: "cancelButtonAlwaysVisible", publicName: "cancelButtonAlwaysVisible", isSignal: true, isRequired: false, transformFunction: null }, allowEmptyContent: { classPropertyName: "allowEmptyContent", publicName: "allowEmptyContent", isSignal: true, isRequired: false, transformFunction: null }, autoClear: { classPropertyName: "autoClear", publicName: "autoClear", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, imageUploadFn: { classPropertyName: "imageUploadFn", publicName: "imageUploadFn", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sent: "sent", canceled: "canceled" }, host: { listeners: { "click": "activateFullView($event)" }, properties: { "class.full-view": "
|
|
677
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: CommentEditor, isStandalone: true, selector: "ngs-comment-editor", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, plugins: { classPropertyName: "plugins", publicName: "plugins", isSignal: true, isRequired: false, transformFunction: null }, contentMaxHeight: { classPropertyName: "contentMaxHeight", publicName: "contentMaxHeight", isSignal: true, isRequired: false, transformFunction: null }, buttonCancelLabel: { classPropertyName: "buttonCancelLabel", publicName: "buttonCancelLabel", isSignal: true, isRequired: false, transformFunction: null }, buttonSendLabel: { classPropertyName: "buttonSendLabel", publicName: "buttonSendLabel", isSignal: true, isRequired: false, transformFunction: null }, buttonSubmitLabel: { classPropertyName: "buttonSubmitLabel", publicName: "buttonSubmitLabel", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, toolbarAlwaysVisible: { classPropertyName: "toolbarAlwaysVisible", publicName: "toolbarAlwaysVisible", isSignal: true, isRequired: false, transformFunction: null }, fullViewMode: { classPropertyName: "fullViewMode", publicName: "fullViewMode", isSignal: true, isRequired: false, transformFunction: null }, cancelButtonAlwaysVisible: { classPropertyName: "cancelButtonAlwaysVisible", publicName: "cancelButtonAlwaysVisible", isSignal: true, isRequired: false, transformFunction: null }, allowEmptyContent: { classPropertyName: "allowEmptyContent", publicName: "allowEmptyContent", isSignal: true, isRequired: false, transformFunction: null }, allowEmpty: { classPropertyName: "allowEmpty", publicName: "allowEmpty", isSignal: true, isRequired: false, transformFunction: null }, autoClear: { classPropertyName: "autoClear", publicName: "autoClear", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, imageUploadFn: { classPropertyName: "imageUploadFn", publicName: "imageUploadFn", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", submitted: "submitted", sent: "sent", canceled: "canceled" }, host: { listeners: { "click": "activateFullView($event)" }, properties: { "class.full-view": "isEditorActivated()", "class.ngs-comment-editor-disabled": "disabled()" }, classAttribute: "ngs-comment-editor" }, providers: [
|
|
678
|
+
provideNgsHeadlessEditor(),
|
|
594
679
|
{
|
|
595
680
|
provide: COMMENT_EDITOR,
|
|
596
681
|
useExisting: forwardRef(() => CommentEditor)
|
|
597
682
|
}
|
|
598
|
-
], viewQueries: [{ propertyName: "
|
|
683
|
+
], viewQueries: [{ propertyName: "surface", first: true, predicate: NgsHeadlessEditorSurface, descendants: true, isSignal: true }, { propertyName: "bubbleMenuLayer", first: true, predicate: ["bubbleMenuLayer"], descendants: true, isSignal: true }], exportAs: ["ngsCommentEditor"], ngImport: i0, template: "@if (isToolbarVisible()) {\n <div class=\"toolbar\">\n <ng-content select=\"ngs-comment-editor-toolbar\"/>\n </div>\n}\n\n<div\n class=\"content\"\n ngsHeadlessEditorSurface\n [placeholder]=\"placeholder()\"\n [ariaLabel]=\"ariaLabel()\"\n [disabled]=\"disabled()\">\n</div>\n\n<div class=\"editor-content\">\n <ng-content/>\n</div>\n\n<div class=\"footer\">\n <div class=\"footer-tools\">\n <ng-content select=\"ngs-comment-editor-footer-bar\"/>\n </div>\n <div class=\"footer-actions\">\n @if (isCancelVisible()) {\n <button\n type=\"button\"\n ngsButton\n [disabled]=\"disabled() || loading()\"\n (click)=\"cancel($event)\">\n {{ buttonCancelLabel() }}\n </button>\n }\n <button\n type=\"button\"\n ngsButton=\"filled\"\n [disabled]=\"sendDisabled()\"\n [loading]=\"loading()\"\n (click)=\"send($event)\">\n {{ sendLabel() }}\n </button>\n </div>\n</div>\n\n@if (isBubbleMenuVisible()) {\n <div #bubbleMenuLayer class=\"bubble-menu-layer\">\n <ng-content select=\"ngs-comment-editor-bubble-menu\"/>\n </div>\n}\n", styles: [":host{--ngs-comment-editor-bg: transparent;--ngs-comment-editor-content-max-height: 9999px;display:block;position:relative;overflow:hidden;background:var(--ngs-comment-editor-bg)}:host .content{box-sizing:border-box;position:absolute;inset:0;height:calc(var(--spacing, .25rem) * 14);min-height:calc(var(--spacing, .25rem) * 10);padding:calc(var(--spacing, .25rem) * 4);outline:none;overflow:hidden;overflow-wrap:anywhere;white-space:pre-wrap;font-size:var(--ngs-font-size-sm);line-height:var(--ngs-line-height-base)}:host .content ::ng-deep [data-ngs-headless-editor-placeholder]{position:relative}:host .content ::ng-deep [data-ngs-headless-editor-placeholder]:before{content:attr(data-ngs-headless-editor-placeholder);color:var(--ngs-color-neutral-500);pointer-events:none;position:absolute;inset-block-start:0;inset-inline-start:0;font:inherit}:host .content ::ng-deep p,:host .content ::ng-deep blockquote,:host .content ::ng-deep pre,:host .content ::ng-deep ul,:host .content ::ng-deep ol{margin:0;min-height:1.5em}:host .content ::ng-deep p+p,:host .content ::ng-deep p+blockquote,:host .content ::ng-deep p+pre,:host .content ::ng-deep p+ul,:host .content ::ng-deep p+ol,:host .content ::ng-deep blockquote+p,:host .content ::ng-deep blockquote+blockquote,:host .content ::ng-deep blockquote+pre,:host .content ::ng-deep blockquote+ul,:host .content ::ng-deep blockquote+ol,:host .content ::ng-deep pre+p,:host .content ::ng-deep pre+blockquote,:host .content ::ng-deep pre+pre,:host .content ::ng-deep pre+ul,:host .content ::ng-deep pre+ol,:host .content ::ng-deep ul+p,:host .content ::ng-deep ul+blockquote,:host .content ::ng-deep ul+pre,:host .content ::ng-deep ul+ul,:host .content ::ng-deep ul+ol,:host .content ::ng-deep ol+p,:host .content ::ng-deep ol+blockquote,:host .content ::ng-deep ol+pre,:host .content ::ng-deep ol+ul,:host .content ::ng-deep ol+ol{margin-top:calc(var(--spacing, .25rem) * 2)}:host .content ::ng-deep blockquote{padding-inline-start:calc(var(--spacing, .25rem) * 3);border-inline-start:3px solid var(--ngs-color-border);color:var(--ngs-color-neutral-600)}:host .content ::ng-deep pre{padding:calc(var(--spacing, .25rem) * 3);border-radius:var(--ngs-radius-md);background:var(--ngs-color-surface-container-high);font-family:var(--ngs-font-family-mono);white-space:pre-wrap}:host .content ::ng-deep ul{list-style:disc;padding-inline-start:calc(var(--spacing, .25rem) * 6)}:host .content ::ng-deep ol{list-style:decimal;padding-inline-start:calc(var(--spacing, .25rem) * 6)}:host .content ::ng-deep code{padding:0 var(--spacing, .25rem);border-radius:var(--ngs-radius-xs);background:var(--ngs-color-surface-container-high);font-family:var(--ngs-font-family-mono)}:host .content ::ng-deep a[data-ngs-headless-editor-mark=link]{color:var(--ngs-color-primary);text-decoration-line:underline;text-decoration-thickness:1px;text-underline-offset:.15em;cursor:pointer}:host .content ::ng-deep .single-emoji{font-size:var(--ngs-font-size-3xl)}:host .content ::ng-deep .ngs-comment-editor-media{position:relative;display:flex;align-items:center;justify-content:center;margin:calc(var(--spacing, .25rem) * 6) 0;max-width:100%}:host .content ::ng-deep .ngs-comment-editor-media img{display:block;height:auto;max-width:100%}:host .content ::ng-deep .ngs-comment-editor-image-upload img{opacity:.7}:host .content ::ng-deep .ngs-comment-editor-image-upload .ngs-comment-editor-upload-status{position:absolute;inset-inline:calc(var(--spacing, .25rem) * 3);top:calc(var(--spacing, .25rem) * 3);padding:calc(var(--spacing, .25rem) * 2) calc(var(--spacing, .25rem) * 3);border-radius:var(--ngs-radius-sm);background:var(--ngs-color-surface-container-highest);color:var(--ngs-color-on-surface);font-size:var(--ngs-font-size-xs);box-shadow:var(--ngs-shadow-sm)}:host .content ::ng-deep .ngs-comment-editor-image-upload .ngs-comment-editor-upload-status[role=alert]{background:var(--ngs-color-danger);color:var(--ngs-color-on-danger)}:host .content ::ng-deep .ngs-comment-editor-youtube{background:var(--ngs-color-neutral-100);padding:calc(var(--spacing, .25rem) * 3)}:host .content ::ng-deep .ngs-comment-editor-youtube iframe{display:block;width:100%;min-width:200px;min-height:200px;aspect-ratio:16/9;border:0}:host .editor-content{padding:0 calc(var(--spacing, .25rem) * 4)}:host .editor-content:empty{display:none}:host .footer{height:calc(var(--spacing, .25rem) * 14);padding:0 calc(var(--spacing, .25rem) * 2.5);display:flex;align-items:center;justify-content:space-between}:host .footer-tools{display:flex;align-items:center;flex:1 1 auto;min-width:0;padding-inline-end:calc(var(--spacing, .25rem) * 3)}:host .footer-actions{display:flex;align-items:center;flex:none;gap:calc(var(--spacing, .25rem) * 2)}:host .toolbar{height:calc(var(--spacing, .25rem) * 14);padding:0 calc(var(--spacing, .25rem) * 3);display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--ngs-color-border)}:host .bubble-menu-layer{position:fixed;z-index:999;top:0;left:0;visibility:hidden;transform:translate(-50%,calc(-100% - calc(var(--spacing, .25rem) * 2)))}:host .bubble-menu-layer.bubble-menu-positioned{visibility:visible}:host .button.active{background:var(--ngs-color-neutral-200)}:host ::ng-deep .button.active{background:var(--ngs-color-neutral-200)}:host.full-view .content{position:static;height:auto;min-height:calc(var(--spacing, .25rem) * 12);max-height:var(--ngs-comment-editor-content-max-height);overflow-y:auto}:host.ngs-comment-editor-disabled{opacity:.7}:host-context(html.dark) .button.active{background:var(--ngs-color-neutral-650);color:var(--ngs-color-neutral-200)}:host-context(html.dark) ::ng-deep .button.active{background:var(--ngs-color-neutral-650);color:var(--ngs-color-neutral-200)}:host-context(html.dark) .content .ngs-comment-editor-youtube{background:var(--ngs-color-neutral-800)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: Button, selector: " button[ngsButton], button[ngsIconButton], a[ngsButton], a[ngsIconButton] ", inputs: ["ngsButton", "ngsIconButton", "loading", "disabled", "disabledInteractive", "disableRipple", "reverse", "fullWidth", "hideTextOnMobile"], exportAs: ["ngsButton"] }, { kind: "directive", type: NgsHeadlessEditorSurface, selector: "[ngsHeadlessEditorSurface]", inputs: ["placeholder", "ariaLabel", "disabled", "spellcheck"], exportAs: ["ngsHeadlessEditorSurface"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
599
684
|
}
|
|
600
685
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditor, decorators: [{
|
|
601
686
|
type: Component,
|
|
602
|
-
args: [{ selector: 'ngs-comment-editor', exportAs: 'ngsCommentEditor', imports: [
|
|
603
|
-
|
|
604
|
-
], providers: [
|
|
687
|
+
args: [{ selector: 'ngs-comment-editor', exportAs: 'ngsCommentEditor', imports: [Button, NgsHeadlessEditorSurface], providers: [
|
|
688
|
+
provideNgsHeadlessEditor(),
|
|
605
689
|
{
|
|
606
690
|
provide: COMMENT_EDITOR,
|
|
607
691
|
useExisting: forwardRef(() => CommentEditor)
|
|
608
692
|
}
|
|
609
|
-
], changeDetection: ChangeDetectionStrategy.
|
|
693
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
610
694
|
'class': 'ngs-comment-editor',
|
|
611
|
-
'[class.full-view]': '
|
|
695
|
+
'[class.full-view]': 'isEditorActivated()',
|
|
696
|
+
'[class.ngs-comment-editor-disabled]': 'disabled()',
|
|
612
697
|
'(click)': 'activateFullView($event)'
|
|
613
|
-
}, template: "@if (
|
|
614
|
-
}], propDecorators: {
|
|
698
|
+
}, template: "@if (isToolbarVisible()) {\n <div class=\"toolbar\">\n <ng-content select=\"ngs-comment-editor-toolbar\"/>\n </div>\n}\n\n<div\n class=\"content\"\n ngsHeadlessEditorSurface\n [placeholder]=\"placeholder()\"\n [ariaLabel]=\"ariaLabel()\"\n [disabled]=\"disabled()\">\n</div>\n\n<div class=\"editor-content\">\n <ng-content/>\n</div>\n\n<div class=\"footer\">\n <div class=\"footer-tools\">\n <ng-content select=\"ngs-comment-editor-footer-bar\"/>\n </div>\n <div class=\"footer-actions\">\n @if (isCancelVisible()) {\n <button\n type=\"button\"\n ngsButton\n [disabled]=\"disabled() || loading()\"\n (click)=\"cancel($event)\">\n {{ buttonCancelLabel() }}\n </button>\n }\n <button\n type=\"button\"\n ngsButton=\"filled\"\n [disabled]=\"sendDisabled()\"\n [loading]=\"loading()\"\n (click)=\"send($event)\">\n {{ sendLabel() }}\n </button>\n </div>\n</div>\n\n@if (isBubbleMenuVisible()) {\n <div #bubbleMenuLayer class=\"bubble-menu-layer\">\n <ng-content select=\"ngs-comment-editor-bubble-menu\"/>\n </div>\n}\n", styles: [":host{--ngs-comment-editor-bg: transparent;--ngs-comment-editor-content-max-height: 9999px;display:block;position:relative;overflow:hidden;background:var(--ngs-comment-editor-bg)}:host .content{box-sizing:border-box;position:absolute;inset:0;height:calc(var(--spacing, .25rem) * 14);min-height:calc(var(--spacing, .25rem) * 10);padding:calc(var(--spacing, .25rem) * 4);outline:none;overflow:hidden;overflow-wrap:anywhere;white-space:pre-wrap;font-size:var(--ngs-font-size-sm);line-height:var(--ngs-line-height-base)}:host .content ::ng-deep [data-ngs-headless-editor-placeholder]{position:relative}:host .content ::ng-deep [data-ngs-headless-editor-placeholder]:before{content:attr(data-ngs-headless-editor-placeholder);color:var(--ngs-color-neutral-500);pointer-events:none;position:absolute;inset-block-start:0;inset-inline-start:0;font:inherit}:host .content ::ng-deep p,:host .content ::ng-deep blockquote,:host .content ::ng-deep pre,:host .content ::ng-deep ul,:host .content ::ng-deep ol{margin:0;min-height:1.5em}:host .content ::ng-deep p+p,:host .content ::ng-deep p+blockquote,:host .content ::ng-deep p+pre,:host .content ::ng-deep p+ul,:host .content ::ng-deep p+ol,:host .content ::ng-deep blockquote+p,:host .content ::ng-deep blockquote+blockquote,:host .content ::ng-deep blockquote+pre,:host .content ::ng-deep blockquote+ul,:host .content ::ng-deep blockquote+ol,:host .content ::ng-deep pre+p,:host .content ::ng-deep pre+blockquote,:host .content ::ng-deep pre+pre,:host .content ::ng-deep pre+ul,:host .content ::ng-deep pre+ol,:host .content ::ng-deep ul+p,:host .content ::ng-deep ul+blockquote,:host .content ::ng-deep ul+pre,:host .content ::ng-deep ul+ul,:host .content ::ng-deep ul+ol,:host .content ::ng-deep ol+p,:host .content ::ng-deep ol+blockquote,:host .content ::ng-deep ol+pre,:host .content ::ng-deep ol+ul,:host .content ::ng-deep ol+ol{margin-top:calc(var(--spacing, .25rem) * 2)}:host .content ::ng-deep blockquote{padding-inline-start:calc(var(--spacing, .25rem) * 3);border-inline-start:3px solid var(--ngs-color-border);color:var(--ngs-color-neutral-600)}:host .content ::ng-deep pre{padding:calc(var(--spacing, .25rem) * 3);border-radius:var(--ngs-radius-md);background:var(--ngs-color-surface-container-high);font-family:var(--ngs-font-family-mono);white-space:pre-wrap}:host .content ::ng-deep ul{list-style:disc;padding-inline-start:calc(var(--spacing, .25rem) * 6)}:host .content ::ng-deep ol{list-style:decimal;padding-inline-start:calc(var(--spacing, .25rem) * 6)}:host .content ::ng-deep code{padding:0 var(--spacing, .25rem);border-radius:var(--ngs-radius-xs);background:var(--ngs-color-surface-container-high);font-family:var(--ngs-font-family-mono)}:host .content ::ng-deep a[data-ngs-headless-editor-mark=link]{color:var(--ngs-color-primary);text-decoration-line:underline;text-decoration-thickness:1px;text-underline-offset:.15em;cursor:pointer}:host .content ::ng-deep .single-emoji{font-size:var(--ngs-font-size-3xl)}:host .content ::ng-deep .ngs-comment-editor-media{position:relative;display:flex;align-items:center;justify-content:center;margin:calc(var(--spacing, .25rem) * 6) 0;max-width:100%}:host .content ::ng-deep .ngs-comment-editor-media img{display:block;height:auto;max-width:100%}:host .content ::ng-deep .ngs-comment-editor-image-upload img{opacity:.7}:host .content ::ng-deep .ngs-comment-editor-image-upload .ngs-comment-editor-upload-status{position:absolute;inset-inline:calc(var(--spacing, .25rem) * 3);top:calc(var(--spacing, .25rem) * 3);padding:calc(var(--spacing, .25rem) * 2) calc(var(--spacing, .25rem) * 3);border-radius:var(--ngs-radius-sm);background:var(--ngs-color-surface-container-highest);color:var(--ngs-color-on-surface);font-size:var(--ngs-font-size-xs);box-shadow:var(--ngs-shadow-sm)}:host .content ::ng-deep .ngs-comment-editor-image-upload .ngs-comment-editor-upload-status[role=alert]{background:var(--ngs-color-danger);color:var(--ngs-color-on-danger)}:host .content ::ng-deep .ngs-comment-editor-youtube{background:var(--ngs-color-neutral-100);padding:calc(var(--spacing, .25rem) * 3)}:host .content ::ng-deep .ngs-comment-editor-youtube iframe{display:block;width:100%;min-width:200px;min-height:200px;aspect-ratio:16/9;border:0}:host .editor-content{padding:0 calc(var(--spacing, .25rem) * 4)}:host .editor-content:empty{display:none}:host .footer{height:calc(var(--spacing, .25rem) * 14);padding:0 calc(var(--spacing, .25rem) * 2.5);display:flex;align-items:center;justify-content:space-between}:host .footer-tools{display:flex;align-items:center;flex:1 1 auto;min-width:0;padding-inline-end:calc(var(--spacing, .25rem) * 3)}:host .footer-actions{display:flex;align-items:center;flex:none;gap:calc(var(--spacing, .25rem) * 2)}:host .toolbar{height:calc(var(--spacing, .25rem) * 14);padding:0 calc(var(--spacing, .25rem) * 3);display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--ngs-color-border)}:host .bubble-menu-layer{position:fixed;z-index:999;top:0;left:0;visibility:hidden;transform:translate(-50%,calc(-100% - calc(var(--spacing, .25rem) * 2)))}:host .bubble-menu-layer.bubble-menu-positioned{visibility:visible}:host .button.active{background:var(--ngs-color-neutral-200)}:host ::ng-deep .button.active{background:var(--ngs-color-neutral-200)}:host.full-view .content{position:static;height:auto;min-height:calc(var(--spacing, .25rem) * 12);max-height:var(--ngs-comment-editor-content-max-height);overflow-y:auto}:host.ngs-comment-editor-disabled{opacity:.7}:host-context(html.dark) .button.active{background:var(--ngs-color-neutral-650);color:var(--ngs-color-neutral-200)}:host-context(html.dark) ::ng-deep .button.active{background:var(--ngs-color-neutral-650);color:var(--ngs-color-neutral-200)}:host-context(html.dark) .content .ngs-comment-editor-youtube{background:var(--ngs-color-neutral-800)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
699
|
+
}], ctorParameters: () => [], propDecorators: { surface: [{ type: i0.ViewChild, args: [i0.forwardRef(() => NgsHeadlessEditorSurface), { isSignal: true }] }], bubbleMenuLayer: [{ type: i0.ViewChild, args: ['bubbleMenuLayer', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], plugins: [{ type: i0.Input, args: [{ isSignal: true, alias: "plugins", required: false }] }], contentMaxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentMaxHeight", required: false }] }], buttonCancelLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonCancelLabel", required: false }] }], buttonSendLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonSendLabel", required: false }] }], buttonSubmitLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonSubmitLabel", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], toolbarAlwaysVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "toolbarAlwaysVisible", required: false }] }], fullViewMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullViewMode", required: false }] }], cancelButtonAlwaysVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "cancelButtonAlwaysVisible", required: false }] }], allowEmptyContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowEmptyContent", required: false }] }], allowEmpty: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowEmpty", required: false }] }], autoClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoClear", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readOnly", required: false }] }], imageUploadFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "imageUploadFn", required: false }] }], submitted: [{ type: i0.Output, args: ["submitted"] }], sent: [{ type: i0.Output, args: ["sent"] }], canceled: [{ type: i0.Output, args: ["canceled"] }] } });
|
|
700
|
+
function isOnlyEmoji(value) {
|
|
701
|
+
if (!value.trim()) {
|
|
702
|
+
return false;
|
|
703
|
+
}
|
|
704
|
+
return /^(?:\p{Extended_Pictographic}|\p{Emoji_Presentation}|[\u200d\ufe0f])+$/u.test(value.trim());
|
|
705
|
+
}
|
|
615
706
|
|
|
616
707
|
class CommentEditorDivider {
|
|
617
708
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorDivider, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
618
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorDivider, isStandalone: true, selector: "ngs-comment-editor-divider", ngImport: i0, template: "<div class=\"divider\"></div>\n", styles: [":host{display:block;padding:0 calc(var(--spacing, .25rem) * 2)}:host .divider{height:calc(var(--spacing, .25rem) * 6);background:var(--ngs-color-neutral-300)
|
|
709
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorDivider, isStandalone: true, selector: "ngs-comment-editor-divider", ngImport: i0, template: "<div class=\"divider\"></div>\n", styles: [":host{display:block;padding:0 calc(var(--spacing, .25rem) * 2)}:host .divider{width:1px;height:calc(var(--spacing, .25rem) * 6);background:var(--ngs-color-neutral-300)}:host-context(html.dark) .divider{background:var(--ngs-color-neutral-500)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
619
710
|
}
|
|
620
711
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorDivider, decorators: [{
|
|
621
712
|
type: Component,
|
|
622
|
-
args: [{ selector: 'ngs-comment-editor-divider',
|
|
713
|
+
args: [{ selector: 'ngs-comment-editor-divider', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"divider\"></div>\n", styles: [":host{display:block;padding:0 calc(var(--spacing, .25rem) * 2)}:host .divider{width:1px;height:calc(var(--spacing, .25rem) * 6);background:var(--ngs-color-neutral-300)}:host-context(html.dark) .divider{background:var(--ngs-color-neutral-500)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
623
714
|
}] });
|
|
624
715
|
|
|
625
716
|
class CommentEditorToolbar {
|
|
626
717
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorToolbar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
627
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorToolbar, isStandalone: true, selector: "ngs-comment-editor-toolbar", host: { classAttribute: "ngs-comment-editor-toolbar" }, exportAs: ["ngsCommentEditorToolbar"], ngImport: i0, template: "<ng-content select=\"[ngsCommentEditorCommand],ngs-comment-editor-divider\"
|
|
718
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorToolbar, isStandalone: true, selector: "ngs-comment-editor-toolbar", host: { classAttribute: "ngs-comment-editor-toolbar" }, exportAs: ["ngsCommentEditorToolbar"], ngImport: i0, template: "<ng-content select=\"[ngsCommentEditorCommand],ngs-comment-editor-divider\"/>\n", styles: [":host{display:flex;align-items:center;gap:calc(var(--spacing, .25rem) * .5)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
628
719
|
}
|
|
629
720
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorToolbar, decorators: [{
|
|
630
721
|
type: Component,
|
|
631
|
-
args: [{ selector: 'ngs-comment-editor-toolbar', exportAs: 'ngsCommentEditorToolbar', changeDetection: ChangeDetectionStrategy.
|
|
632
|
-
'class': 'ngs-comment-editor-toolbar',
|
|
633
|
-
}, template: "<ng-content select=\"[ngsCommentEditorCommand],ngs-comment-editor-divider\" />\n", styles: [":host{display:flex;align-items:center;gap:calc(var(--spacing, .25rem) * .5)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
722
|
+
args: [{ selector: 'ngs-comment-editor-toolbar', exportAs: 'ngsCommentEditorToolbar', changeDetection: ChangeDetectionStrategy.OnPush, host: { 'class': 'ngs-comment-editor-toolbar' }, template: "<ng-content select=\"[ngsCommentEditorCommand],ngs-comment-editor-divider\"/>\n", styles: [":host{display:flex;align-items:center;gap:calc(var(--spacing, .25rem) * .5)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
634
723
|
}] });
|
|
635
724
|
|
|
636
725
|
class CommentEditorBubbleMenu {
|
|
637
726
|
commentEditor = inject(COMMENT_EDITOR);
|
|
638
727
|
getLinkUrl() {
|
|
639
|
-
return (this.commentEditor.api.
|
|
728
|
+
return String(this.commentEditor.api.getMarkAttributes('link')?.['href'] ?? '') || null;
|
|
640
729
|
}
|
|
641
730
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorBubbleMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
642
731
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: CommentEditorBubbleMenu, isStandalone: true, selector: "ngs-comment-editor-bubble-menu", host: { classAttribute: "ngs-comment-editor-bubble-menu" }, providers: [
|
|
@@ -644,7 +733,7 @@ class CommentEditorBubbleMenu {
|
|
|
644
733
|
provide: COMMENT_EDITOR_BUBBLE_MENU,
|
|
645
734
|
useExisting: forwardRef(() => CommentEditorBubbleMenu)
|
|
646
735
|
}
|
|
647
|
-
], exportAs: ["ngsCommentEditorBubbleMenu"], ngImport: i0, template: "@if (
|
|
736
|
+
], exportAs: ["ngsCommentEditorBubbleMenu"], ngImport: i0, template: "@if (commentEditor.api.isActive('link') && getLinkUrl()) {\n <div class=\"link-row\">\n <div class=\"link-value\">\n <a [href]=\"getLinkUrl()\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"link\">\n {{ getLinkUrl() }}\n </a>\n </div>\n <div class=\"link-actions\">\n <ng-content select=\"[ngsCommentEditorCommandEditLink],[ngsCommentEditorCommandUnsetLink]\"/>\n </div>\n </div>\n}\n<div class=\"commands-row\">\n <ng-content select=\"[ngsCommentEditorCommand],ngs-comment-editor-divider\"/>\n</div>\n", styles: [":host{display:block;min-height:calc(var(--spacing, .25rem) * 12);padding-inline:calc(var(--spacing, .25rem) * 2);border-radius:var(--ngs-radius-xl);background:var(--ngs-color-neutral-950);color:var(--ngs-color-neutral-200);box-shadow:var(--ngs-shadow-sm)}:host .link-row{display:flex;align-items:center;gap:var(--spacing, .25rem);height:calc(var(--spacing, .25rem) * 11);border-bottom:1px solid var(--ngs-color-neutral-700)}:host .link-value{flex:1 1 auto;width:116px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ngs-font-size-sm)}:host .link-actions{display:flex;align-items:center;flex:none}:host .commands-row{display:flex;align-items:center;justify-content:center;height:calc(var(--spacing, .25rem) * 12);gap:calc(var(--spacing, .25rem) * .5)}:host .link{position:relative;top:1px;color:var(--ngs-color-tertiary-300)}:host .link:hover{color:var(--ngs-color-tertiary-100)}:host ::ng-deep .button{display:flex;align-items:center;justify-content:center;width:calc(var(--spacing, .25rem) * 10);height:calc(var(--spacing, .25rem) * 10);border-radius:calc(infinity * 1px);--ngs-icon-size: var(--ngs-font-size-xl)}:host ::ng-deep .button:hover,:host ::ng-deep .button.active{color:var(--ngs-color-tertiary-300);background:var(--ngs-color-neutral-700)}:host ::ng-deep .button:disabled{pointer-events:none;opacity:.7}:host-context(html.dark){background:var(--ngs-color-tertiary-200);color:var(--ngs-color-neutral-900)}:host-context(html.dark) .link{color:var(--ngs-color-tertiary-700)}:host-context(html.dark) .link:hover{color:var(--ngs-color-tertiary-800)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
648
737
|
}
|
|
649
738
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorBubbleMenu, decorators: [{
|
|
650
739
|
type: Component,
|
|
@@ -653,20 +742,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
653
742
|
provide: COMMENT_EDITOR_BUBBLE_MENU,
|
|
654
743
|
useExisting: forwardRef(() => CommentEditorBubbleMenu)
|
|
655
744
|
}
|
|
656
|
-
], changeDetection: ChangeDetectionStrategy.
|
|
657
|
-
'class': 'ngs-comment-editor-bubble-menu',
|
|
658
|
-
}, template: "@if (this.commentEditor.api.isActive('link') && getLinkUrl()) {\n <div class=\"flex items-center gap-1 h-11 border-b border-b-muted border-b-neutral-700\">\n <div class=\"grow text-sm overflow-hidden text-ellipsis whitespace-nowrap w-[116px]\">\n <a [href]=\"getLinkUrl()\" target=\"_blank\" class=\"link\">{{ getLinkUrl() }}</a>\n </div>\n <div class=\"flex items-center flex-none\">\n <ng-content select=\"[ngsCommentEditorCommandEditLink],[ngsCommentEditorCommandUnsetLink]\" />\n </div>\n </div>\n}\n<div class=\"h-12 flex items-center justify-center gap-0.5\">\n <ng-content select=\"[ngsCommentEditorCommand],ngs-comment-editor-divider\" />\n</div>\n", styles: [":host{display:block;box-shadow:var(--ngs-shadow-sm);background:var(--ngs-color-neutral-950);color:var(--ngs-color-neutral-200);min-height:calc(var(--spacing, .25rem) * 12);border-radius:var(--ngs-radius-xl);top:1px;padding-inline-start:calc(var(--spacing, .25rem) * 2);padding-inline-end:calc(var(--spacing, .25rem) * 2)}:host .button,:host ::ng-deep .button{width:calc(var(--spacing, .25rem) * 10);height:calc(var(--spacing, .25rem) * 10);display:flex;align-items:center;justify-content:center;border-radius:calc(infinity * 1px);--ngs-icon-size: var(--ngs-font-size-xl)}:host .button:hover,:host ::ng-deep .button:hover{color:var(--ngs-color-tertiary-300);background:var(--ngs-color-neutral-700);border-radius:calc(infinity * 1px);padding:calc(var(--spacing, .25rem) * 1.5)}:host .button.active,:host ::ng-deep .button.active{color:var(--ngs-color-tertiary-300);background:var(--ngs-color-neutral-700)}:host .button ngs-icon,:host ::ng-deep .button ngs-icon{width:calc(var(--spacing, .25rem) * 6);height:calc(var(--spacing, .25rem) * 6);font-size:var(--ngs-font-size-xl);line-height:1.25}:host .button:disabled,:host ::ng-deep .button:disabled{pointer-events:none;opacity:70%}:host .link{color:var(--ngs-color-tertiary-300);position:relative;top:1px}:host .link:hover{color:var(--ngs-color-tertiary-100)}:host-context(html.dark){background:var(--ngs-color-tertiary-200);color:var(--ngs-color-neutral-900)}:host-context(html.dark) .link{color:var(--ngs-color-tertiary-700)}:host-context(html.dark) .link:hover{color:var(--ngs-color-tertiary-800)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
745
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: { 'class': 'ngs-comment-editor-bubble-menu' }, template: "@if (commentEditor.api.isActive('link') && getLinkUrl()) {\n <div class=\"link-row\">\n <div class=\"link-value\">\n <a [href]=\"getLinkUrl()\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"link\">\n {{ getLinkUrl() }}\n </a>\n </div>\n <div class=\"link-actions\">\n <ng-content select=\"[ngsCommentEditorCommandEditLink],[ngsCommentEditorCommandUnsetLink]\"/>\n </div>\n </div>\n}\n<div class=\"commands-row\">\n <ng-content select=\"[ngsCommentEditorCommand],ngs-comment-editor-divider\"/>\n</div>\n", styles: [":host{display:block;min-height:calc(var(--spacing, .25rem) * 12);padding-inline:calc(var(--spacing, .25rem) * 2);border-radius:var(--ngs-radius-xl);background:var(--ngs-color-neutral-950);color:var(--ngs-color-neutral-200);box-shadow:var(--ngs-shadow-sm)}:host .link-row{display:flex;align-items:center;gap:var(--spacing, .25rem);height:calc(var(--spacing, .25rem) * 11);border-bottom:1px solid var(--ngs-color-neutral-700)}:host .link-value{flex:1 1 auto;width:116px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--ngs-font-size-sm)}:host .link-actions{display:flex;align-items:center;flex:none}:host .commands-row{display:flex;align-items:center;justify-content:center;height:calc(var(--spacing, .25rem) * 12);gap:calc(var(--spacing, .25rem) * .5)}:host .link{position:relative;top:1px;color:var(--ngs-color-tertiary-300)}:host .link:hover{color:var(--ngs-color-tertiary-100)}:host ::ng-deep .button{display:flex;align-items:center;justify-content:center;width:calc(var(--spacing, .25rem) * 10);height:calc(var(--spacing, .25rem) * 10);border-radius:calc(infinity * 1px);--ngs-icon-size: var(--ngs-font-size-xl)}:host ::ng-deep .button:hover,:host ::ng-deep .button.active{color:var(--ngs-color-tertiary-300);background:var(--ngs-color-neutral-700)}:host ::ng-deep .button:disabled{pointer-events:none;opacity:.7}:host-context(html.dark){background:var(--ngs-color-tertiary-200);color:var(--ngs-color-neutral-900)}:host-context(html.dark) .link{color:var(--ngs-color-tertiary-700)}:host-context(html.dark) .link:hover{color:var(--ngs-color-tertiary-800)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
659
746
|
}] });
|
|
660
747
|
|
|
661
748
|
class CommentEditorFooterBar {
|
|
662
749
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorFooterBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
663
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorFooterBar, isStandalone: true, selector: "ngs-comment-editor-footer-bar", host: { classAttribute: "ngs-comment-editor-footer-bar" }, exportAs: ["ngsCommentEditorFooterBar"], ngImport: i0, template: "<ng-content select=\"[ngsCommentEditorCommand],ngs-comment-editor-divider\"
|
|
750
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorFooterBar, isStandalone: true, selector: "ngs-comment-editor-footer-bar", host: { classAttribute: "ngs-comment-editor-footer-bar" }, exportAs: ["ngsCommentEditorFooterBar"], ngImport: i0, template: "<ng-content select=\"[ngsCommentEditorCommand],ngs-comment-editor-divider\"/>\n", styles: [":host{display:flex;align-items:center;justify-content:flex-end;width:100%;gap:calc(var(--spacing, .25rem) * .5)}:host-context(.ngs-comment-editor.full-view){justify-content:flex-start}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
664
751
|
}
|
|
665
752
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorFooterBar, decorators: [{
|
|
666
753
|
type: Component,
|
|
667
|
-
args: [{ selector: 'ngs-comment-editor-footer-bar', exportAs: 'ngsCommentEditorFooterBar', changeDetection: ChangeDetectionStrategy.
|
|
668
|
-
'class': 'ngs-comment-editor-footer-bar',
|
|
669
|
-
}, template: "<ng-content select=\"[ngsCommentEditorCommand],ngs-comment-editor-divider\" />\n", styles: [":host{display:flex;align-items:center;gap:calc(var(--spacing, .25rem) * .5);justify-content:flex-end;width:100%}:host-context(.ngs-comment-editor.full-view){justify-content:flex-start}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
754
|
+
args: [{ selector: 'ngs-comment-editor-footer-bar', exportAs: 'ngsCommentEditorFooterBar', changeDetection: ChangeDetectionStrategy.OnPush, host: { 'class': 'ngs-comment-editor-footer-bar' }, template: "<ng-content select=\"[ngsCommentEditorCommand],ngs-comment-editor-divider\"/>\n", styles: [":host{display:flex;align-items:center;justify-content:flex-end;width:100%;gap:calc(var(--spacing, .25rem) * .5)}:host-context(.ngs-comment-editor.full-view){justify-content:flex-start}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
670
755
|
}] });
|
|
671
756
|
|
|
672
757
|
class CommentEditorCommandDirective {
|
|
@@ -677,19 +762,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
677
762
|
type: Directive,
|
|
678
763
|
args: [{
|
|
679
764
|
selector: '[ngsCommentEditorCommand]',
|
|
680
|
-
host: {
|
|
681
|
-
'[class.button]': 'true'
|
|
682
|
-
}
|
|
765
|
+
host: { '[class.button]': 'true' }
|
|
683
766
|
}]
|
|
684
767
|
}] });
|
|
685
768
|
|
|
686
|
-
class
|
|
769
|
+
class CommentEditorCommandBase {
|
|
687
770
|
commentEditor = inject(COMMENT_EDITOR);
|
|
688
|
-
|
|
689
|
-
|
|
771
|
+
preserveSelection(event) {
|
|
772
|
+
event.preventDefault();
|
|
773
|
+
}
|
|
774
|
+
run(command, event) {
|
|
775
|
+
event?.preventDefault();
|
|
776
|
+
event?.stopPropagation();
|
|
777
|
+
this.commentEditor.api.runCommand(command);
|
|
690
778
|
}
|
|
691
|
-
|
|
692
|
-
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
class CommentEditorCommandBoldDirective extends CommentEditorCommandBase {
|
|
782
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandBoldDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
783
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandBoldDirective, isStandalone: true, selector: "[ngsCommentEditorCommandBold]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "run(\"toggleBold\", $event)" }, properties: { "attr.disabled": "commentEditor.api.isCommandDisabled(\"toggleBold\") ? \"\" : null", "class.active": "commentEditor.api.isActive(\"toggleBold\")" } }, exportAs: ["ngsCommentEditorCommandBold"], usesInheritance: true, ngImport: i0 });
|
|
693
784
|
}
|
|
694
785
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandBoldDirective, decorators: [{
|
|
695
786
|
type: Directive,
|
|
@@ -697,146 +788,126 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
697
788
|
selector: '[ngsCommentEditorCommandBold]',
|
|
698
789
|
exportAs: 'ngsCommentEditorCommandBold',
|
|
699
790
|
host: {
|
|
700
|
-
'[attr.disabled]':
|
|
701
|
-
'[class.active]':
|
|
702
|
-
'(
|
|
791
|
+
'[attr.disabled]': 'commentEditor.api.isCommandDisabled("toggleBold") ? "" : null',
|
|
792
|
+
'[class.active]': 'commentEditor.api.isActive("toggleBold")',
|
|
793
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
794
|
+
'(click)': 'run("toggleBold", $event)'
|
|
703
795
|
}
|
|
704
796
|
}]
|
|
705
797
|
}] });
|
|
706
798
|
|
|
707
|
-
class CommentEditorCommandItalicDirective {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
this.commentEditor.api.runCommand('toggleItalic');
|
|
711
|
-
}
|
|
712
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandItalicDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
713
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandItalicDirective, isStandalone: true, selector: "[ngsCommentEditorCommandItalic]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(commentEditor && commentEditor.api.isCommandDisabled('toggleItalic')) ? '' : null", "class.active": "commentEditor && commentEditor.api.isActive('italic')" } }, ngImport: i0 });
|
|
799
|
+
class CommentEditorCommandItalicDirective extends CommentEditorCommandBase {
|
|
800
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandItalicDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
801
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandItalicDirective, isStandalone: true, selector: "[ngsCommentEditorCommandItalic]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "run(\"toggleItalic\", $event)" }, properties: { "attr.disabled": "commentEditor.api.isCommandDisabled(\"toggleItalic\") ? \"\" : null", "class.active": "commentEditor.api.isActive(\"toggleItalic\")" } }, usesInheritance: true, ngImport: i0 });
|
|
714
802
|
}
|
|
715
803
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandItalicDirective, decorators: [{
|
|
716
804
|
type: Directive,
|
|
717
805
|
args: [{
|
|
718
806
|
selector: '[ngsCommentEditorCommandItalic]',
|
|
719
807
|
host: {
|
|
720
|
-
'[attr.disabled]':
|
|
721
|
-
'[class.active]':
|
|
722
|
-
'(
|
|
808
|
+
'[attr.disabled]': 'commentEditor.api.isCommandDisabled("toggleItalic") ? "" : null',
|
|
809
|
+
'[class.active]': 'commentEditor.api.isActive("toggleItalic")',
|
|
810
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
811
|
+
'(click)': 'run("toggleItalic", $event)'
|
|
723
812
|
}
|
|
724
813
|
}]
|
|
725
814
|
}] });
|
|
726
815
|
|
|
727
|
-
class CommentEditorCommandStrikeDirective {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
this.commentEditor.api.runCommand('toggleStrike');
|
|
731
|
-
}
|
|
732
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandStrikeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
733
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandStrikeDirective, isStandalone: true, selector: "[ngsCommentEditorCommandStrike]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(commentEditor && commentEditor.api.isCommandDisabled('toggleStrike')) ? '' : null", "class.active": "commentEditor && commentEditor.api.isActive('strike')" } }, ngImport: i0 });
|
|
816
|
+
class CommentEditorCommandStrikeDirective extends CommentEditorCommandBase {
|
|
817
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandStrikeDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
818
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandStrikeDirective, isStandalone: true, selector: "[ngsCommentEditorCommandStrike]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "run(\"toggleStrike\", $event)" }, properties: { "attr.disabled": "commentEditor.api.isCommandDisabled(\"toggleStrike\") ? \"\" : null", "class.active": "commentEditor.api.isActive(\"toggleStrike\")" } }, usesInheritance: true, ngImport: i0 });
|
|
734
819
|
}
|
|
735
820
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandStrikeDirective, decorators: [{
|
|
736
821
|
type: Directive,
|
|
737
822
|
args: [{
|
|
738
823
|
selector: '[ngsCommentEditorCommandStrike]',
|
|
739
824
|
host: {
|
|
740
|
-
'[attr.disabled]':
|
|
741
|
-
'[class.active]':
|
|
742
|
-
'(
|
|
825
|
+
'[attr.disabled]': 'commentEditor.api.isCommandDisabled("toggleStrike") ? "" : null',
|
|
826
|
+
'[class.active]': 'commentEditor.api.isActive("toggleStrike")',
|
|
827
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
828
|
+
'(click)': 'run("toggleStrike", $event)'
|
|
743
829
|
}
|
|
744
830
|
}]
|
|
745
831
|
}] });
|
|
746
832
|
|
|
747
|
-
class CommentEditorCommandBulletListDirective {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
this.commentEditor.api.runCommand('toggleBulletList');
|
|
751
|
-
}
|
|
752
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandBulletListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
753
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandBulletListDirective, isStandalone: true, selector: "[ngsCommentEditorCommandBulletList]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(commentEditor && commentEditor.api.isCommandDisabled('toggleBulletList')) ? '' : null", "class.active": "commentEditor && commentEditor.api.isActive('bulletList')" } }, ngImport: i0 });
|
|
833
|
+
class CommentEditorCommandBulletListDirective extends CommentEditorCommandBase {
|
|
834
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandBulletListDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
835
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandBulletListDirective, isStandalone: true, selector: "[ngsCommentEditorCommandBulletList]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "run(\"toggleBulletList\", $event)" }, properties: { "attr.disabled": "commentEditor.api.isCommandDisabled(\"toggleBulletList\") ? \"\" : null", "class.active": "commentEditor.api.isActive(\"toggleBulletList\")" } }, usesInheritance: true, ngImport: i0 });
|
|
754
836
|
}
|
|
755
837
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandBulletListDirective, decorators: [{
|
|
756
838
|
type: Directive,
|
|
757
839
|
args: [{
|
|
758
840
|
selector: '[ngsCommentEditorCommandBulletList]',
|
|
759
841
|
host: {
|
|
760
|
-
'[attr.disabled]':
|
|
761
|
-
'[class.active]':
|
|
762
|
-
'(
|
|
842
|
+
'[attr.disabled]': 'commentEditor.api.isCommandDisabled("toggleBulletList") ? "" : null',
|
|
843
|
+
'[class.active]': 'commentEditor.api.isActive("toggleBulletList")',
|
|
844
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
845
|
+
'(click)': 'run("toggleBulletList", $event)'
|
|
763
846
|
}
|
|
764
847
|
}]
|
|
765
848
|
}] });
|
|
766
849
|
|
|
767
|
-
class CommentEditorCommandOrderedListDirective {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
this.commentEditor.api.runCommand('toggleOrderedList');
|
|
771
|
-
}
|
|
772
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandOrderedListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
773
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandOrderedListDirective, isStandalone: true, selector: "[ngsCommentEditorCommandOrderedList]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(commentEditor && commentEditor.api.isCommandDisabled('toggleOrderedList')) ? '' : null", "class.active": "commentEditor && commentEditor.api.isActive('orderedList')" } }, ngImport: i0 });
|
|
850
|
+
class CommentEditorCommandOrderedListDirective extends CommentEditorCommandBase {
|
|
851
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandOrderedListDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
852
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandOrderedListDirective, isStandalone: true, selector: "[ngsCommentEditorCommandOrderedList]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "run(\"toggleOrderedList\", $event)" }, properties: { "attr.disabled": "commentEditor.api.isCommandDisabled(\"toggleOrderedList\") ? \"\" : null", "class.active": "commentEditor.api.isActive(\"toggleOrderedList\")" } }, usesInheritance: true, ngImport: i0 });
|
|
774
853
|
}
|
|
775
854
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandOrderedListDirective, decorators: [{
|
|
776
855
|
type: Directive,
|
|
777
856
|
args: [{
|
|
778
857
|
selector: '[ngsCommentEditorCommandOrderedList]',
|
|
779
858
|
host: {
|
|
780
|
-
'[attr.disabled]':
|
|
781
|
-
'[class.active]':
|
|
782
|
-
'(
|
|
859
|
+
'[attr.disabled]': 'commentEditor.api.isCommandDisabled("toggleOrderedList") ? "" : null',
|
|
860
|
+
'[class.active]': 'commentEditor.api.isActive("toggleOrderedList")',
|
|
861
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
862
|
+
'(click)': 'run("toggleOrderedList", $event)'
|
|
783
863
|
}
|
|
784
864
|
}]
|
|
785
865
|
}] });
|
|
786
866
|
|
|
787
|
-
class CommentEditorCommandBlockquoteDirective {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
this.commentEditor.api.runCommand('toggleBlockquote');
|
|
791
|
-
}
|
|
792
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandBlockquoteDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
793
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandBlockquoteDirective, isStandalone: true, selector: "[ngsCommentEditorCommandBlockquote]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(commentEditor && commentEditor.api.isCommandDisabled('toggleBlockquote')) ? '' : null", "class.active": "commentEditor && commentEditor.api.isActive('blockquote')" } }, ngImport: i0 });
|
|
867
|
+
class CommentEditorCommandBlockquoteDirective extends CommentEditorCommandBase {
|
|
868
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandBlockquoteDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
869
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandBlockquoteDirective, isStandalone: true, selector: "[ngsCommentEditorCommandBlockquote]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "run(\"toggleBlockquote\", $event)" }, properties: { "attr.disabled": "commentEditor.api.isCommandDisabled(\"toggleBlockquote\") ? \"\" : null", "class.active": "commentEditor.api.isActive(\"toggleBlockquote\")" } }, usesInheritance: true, ngImport: i0 });
|
|
794
870
|
}
|
|
795
871
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandBlockquoteDirective, decorators: [{
|
|
796
872
|
type: Directive,
|
|
797
873
|
args: [{
|
|
798
874
|
selector: '[ngsCommentEditorCommandBlockquote]',
|
|
799
875
|
host: {
|
|
800
|
-
'[attr.disabled]':
|
|
801
|
-
'[class.active]':
|
|
802
|
-
'(
|
|
876
|
+
'[attr.disabled]': 'commentEditor.api.isCommandDisabled("toggleBlockquote") ? "" : null',
|
|
877
|
+
'[class.active]': 'commentEditor.api.isActive("toggleBlockquote")',
|
|
878
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
879
|
+
'(click)': 'run("toggleBlockquote", $event)'
|
|
803
880
|
}
|
|
804
881
|
}]
|
|
805
882
|
}] });
|
|
806
883
|
|
|
807
|
-
class CommentEditorCommandCodeBlockDirective {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
this.commentEditor.api.runCommand('toggleCodeBlock');
|
|
811
|
-
}
|
|
812
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandCodeBlockDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
813
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandCodeBlockDirective, isStandalone: true, selector: "[ngsCommentEditorCommandCodeBlock]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(commentEditor && commentEditor.api.isCommandDisabled('toggleCodeBlock')) ? '' : null", "class.active": "commentEditor && commentEditor.api.isActive('codeBlock')" } }, ngImport: i0 });
|
|
884
|
+
class CommentEditorCommandCodeBlockDirective extends CommentEditorCommandBase {
|
|
885
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandCodeBlockDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
886
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandCodeBlockDirective, isStandalone: true, selector: "[ngsCommentEditorCommandCodeBlock]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "run(\"toggleCodeBlock\", $event)" }, properties: { "attr.disabled": "commentEditor.api.isCommandDisabled(\"toggleCodeBlock\") ? \"\" : null", "class.active": "commentEditor.api.isActive(\"toggleCodeBlock\")" } }, usesInheritance: true, ngImport: i0 });
|
|
814
887
|
}
|
|
815
888
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandCodeBlockDirective, decorators: [{
|
|
816
889
|
type: Directive,
|
|
817
890
|
args: [{
|
|
818
891
|
selector: '[ngsCommentEditorCommandCodeBlock]',
|
|
819
892
|
host: {
|
|
820
|
-
'[attr.disabled]':
|
|
821
|
-
'[class.active]':
|
|
822
|
-
'(
|
|
893
|
+
'[attr.disabled]': 'commentEditor.api.isCommandDisabled("toggleCodeBlock") ? "" : null',
|
|
894
|
+
'[class.active]': 'commentEditor.api.isActive("toggleCodeBlock")',
|
|
895
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
896
|
+
'(click)': 'run("toggleCodeBlock", $event)'
|
|
823
897
|
}
|
|
824
898
|
}]
|
|
825
899
|
}] });
|
|
826
900
|
|
|
827
901
|
class CommentEditorCommandImageDirective {
|
|
828
902
|
commentEditor = inject(COMMENT_EDITOR);
|
|
829
|
-
|
|
903
|
+
selectImage(event) {
|
|
830
904
|
const file = event.files[0];
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
const src = reader.result;
|
|
835
|
-
this.commentEditor.api.editor().chain().focus().addImageUploadingPlaceholder({ src, file }).run();
|
|
836
|
-
};
|
|
905
|
+
if (file) {
|
|
906
|
+
this.commentEditor.api.insertImage(file);
|
|
907
|
+
}
|
|
837
908
|
}
|
|
838
909
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandImageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
839
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandImageDirective, isStandalone: true, selector: "[ngsCommentEditorCommandImage]", host: { listeners: { "fileSelected": "
|
|
910
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandImageDirective, isStandalone: true, selector: "[ngsCommentEditorCommandImage]", host: { listeners: { "fileSelected": "selectImage($event)" }, properties: { "attr.accept": "\"image/*\"" } }, hostDirectives: [{ directive: i1.UploadTriggerDirective, outputs: ["fileSelected", "fileSelected"] }], ngImport: i0 });
|
|
840
911
|
}
|
|
841
912
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandImageDirective, decorators: [{
|
|
842
913
|
type: Directive,
|
|
@@ -850,235 +921,182 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
850
921
|
],
|
|
851
922
|
host: {
|
|
852
923
|
'[attr.accept]': '"image/*"',
|
|
853
|
-
'(fileSelected)':
|
|
924
|
+
'(fileSelected)': 'selectImage($event)'
|
|
854
925
|
}
|
|
855
926
|
}]
|
|
856
927
|
}] });
|
|
857
928
|
|
|
858
929
|
class YoutubeDialog {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
linkUrl = this.
|
|
862
|
-
isUpdate = !!this.
|
|
863
|
-
|
|
864
|
-
this.
|
|
930
|
+
dialogRef = inject(DialogRef);
|
|
931
|
+
data = inject(DIALOG_DATA);
|
|
932
|
+
linkUrl = this.data.linkUrl ?? '';
|
|
933
|
+
isUpdate = !!this.data.linkUrl;
|
|
934
|
+
submit() {
|
|
935
|
+
this.dialogRef.close(this.linkUrl.trim());
|
|
865
936
|
}
|
|
866
|
-
|
|
867
|
-
this.
|
|
937
|
+
cancel() {
|
|
938
|
+
this.dialogRef.close();
|
|
868
939
|
}
|
|
869
940
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: YoutubeDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
870
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
941
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: YoutubeDialog, isStandalone: true, selector: "ngs-comment-editor-youtube-dialog", ngImport: i0, template: "<form class=\"w-[500px] max-w-full\" (ngSubmit)=\"submit()\">\n <h3 ngs-dialog-title>{{ isUpdate ? 'Update YouTube' : 'Add YouTube' }}</h3>\n <ngs-dialog-content>\n <div class=\"pt-4\">\n <ngs-form-field class=\"w-full\">\n <ngs-label>Paste URL</ngs-label>\n <input name=\"linkUrl\" ngsInput [(ngModel)]=\"linkUrl\">\n </ngs-form-field>\n </div>\n </ngs-dialog-content>\n <div ngs-dialog-actions align=\"end\">\n <button type=\"button\" ngsButton (click)=\"cancel()\">Cancel</button>\n <button type=\"submit\" ngsButton=\"filled\" [disabled]=\"!linkUrl.trim()\">\n {{ isUpdate ? 'Save' : 'Add URL' }}\n </button>\n </div>\n</form>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: Button, selector: " button[ngsButton], button[ngsIconButton], a[ngsButton], a[ngsIconButton] ", inputs: ["ngsButton", "ngsIconButton", "loading", "disabled", "disabledInteractive", "disableRipple", "reverse", "fullWidth", "hideTextOnMobile"], exportAs: ["ngsButton"] }, { kind: "component", type: DialogActions, selector: "ngs-dialog-actions, [ngs-dialog-actions], [ngsDialogActions]", inputs: ["align"] }, { kind: "component", type: DialogContent, selector: "ngs-dialog-content,[ngs-dialog-content],[ngsDialogContent]" }, { kind: "component", type: DialogTitle, selector: "ngs-dialog-title, [ngs-dialog-title], [ngsDialogTitle]", inputs: ["id"], exportAs: ["ngsDialogTitle"] }, { kind: "component", type: FormField, selector: "ngs-form-field", inputs: ["labelMode", "subscriptHiddenIfEmpty", "sameHeightAsButton"], exportAs: ["ngsFormField"] }, { kind: "component", type: Label, selector: "ngs-label" }, { kind: "directive", type: Input, selector: "input[ngsInput], textarea[ngsInput]", inputs: ["id", "placeholder", "required", "disabled", "readonly", "errorStateMatcher"], exportAs: ["ngsInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
871
942
|
}
|
|
872
943
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: YoutubeDialog, decorators: [{
|
|
873
944
|
type: Component,
|
|
874
|
-
args: [{ selector: 'ngs-youtube', imports: [
|
|
945
|
+
args: [{ selector: 'ngs-comment-editor-youtube-dialog', imports: [
|
|
875
946
|
FormsModule,
|
|
876
947
|
Button,
|
|
877
948
|
DialogActions,
|
|
878
949
|
DialogContent,
|
|
879
950
|
DialogTitle,
|
|
880
951
|
FormField,
|
|
881
|
-
Input,
|
|
882
952
|
Label,
|
|
883
|
-
|
|
884
|
-
], changeDetection: ChangeDetectionStrategy.
|
|
953
|
+
Input
|
|
954
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<form class=\"w-[500px] max-w-full\" (ngSubmit)=\"submit()\">\n <h3 ngs-dialog-title>{{ isUpdate ? 'Update YouTube' : 'Add YouTube' }}</h3>\n <ngs-dialog-content>\n <div class=\"pt-4\">\n <ngs-form-field class=\"w-full\">\n <ngs-label>Paste URL</ngs-label>\n <input name=\"linkUrl\" ngsInput [(ngModel)]=\"linkUrl\">\n </ngs-form-field>\n </div>\n </ngs-dialog-content>\n <div ngs-dialog-actions align=\"end\">\n <button type=\"button\" ngsButton (click)=\"cancel()\">Cancel</button>\n <button type=\"submit\" ngsButton=\"filled\" [disabled]=\"!linkUrl.trim()\">\n {{ isUpdate ? 'Save' : 'Add URL' }}\n </button>\n </div>\n</form>\n" }]
|
|
885
955
|
}] });
|
|
886
956
|
|
|
887
957
|
class CommentEditorCommandYoutubeDirective {
|
|
958
|
+
destroyRef = inject(DestroyRef);
|
|
959
|
+
dialog = inject(Dialog);
|
|
888
960
|
commentEditor = inject(COMMENT_EDITOR);
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
});
|
|
897
|
-
dialogRef
|
|
961
|
+
preserveSelection(event) {
|
|
962
|
+
event.preventDefault();
|
|
963
|
+
}
|
|
964
|
+
open(event) {
|
|
965
|
+
event.preventDefault();
|
|
966
|
+
event.stopPropagation();
|
|
967
|
+
this.dialog.open(YoutubeDialog, { data: { linkUrl: '' } })
|
|
898
968
|
.afterClosed()
|
|
899
|
-
.pipe(takeUntilDestroyed(this.
|
|
900
|
-
.subscribe(
|
|
901
|
-
if (typeof linkUrl === '
|
|
902
|
-
|
|
969
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
970
|
+
.subscribe(linkUrl => {
|
|
971
|
+
if (typeof linkUrl === 'string' && linkUrl) {
|
|
972
|
+
this.commentEditor.api.insertYoutube(linkUrl);
|
|
973
|
+
this.commentEditor.api.focus();
|
|
903
974
|
}
|
|
904
|
-
this.commentEditor.api.editor().commands.setYoutubeVideo({
|
|
905
|
-
src: linkUrl
|
|
906
|
-
});
|
|
907
975
|
});
|
|
908
976
|
}
|
|
909
977
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandYoutubeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
910
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandYoutubeDirective, isStandalone: true, selector: "[ngsCommentEditorCommandYoutube]", host: { listeners: { "
|
|
978
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandYoutubeDirective, isStandalone: true, selector: "[ngsCommentEditorCommandYoutube]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "open($event)" } }, ngImport: i0 });
|
|
911
979
|
}
|
|
912
980
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandYoutubeDirective, decorators: [{
|
|
913
981
|
type: Directive,
|
|
914
982
|
args: [{
|
|
915
983
|
selector: '[ngsCommentEditorCommandYoutube]',
|
|
916
984
|
host: {
|
|
917
|
-
'
|
|
918
|
-
'
|
|
919
|
-
'(click)': `onClick()`
|
|
985
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
986
|
+
'(click)': 'open($event)'
|
|
920
987
|
}
|
|
921
988
|
}]
|
|
922
989
|
}] });
|
|
923
990
|
|
|
924
991
|
class LinkDialog {
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
linkUrl = this.
|
|
928
|
-
isUpdate = !!this.
|
|
929
|
-
|
|
930
|
-
this.
|
|
992
|
+
dialogRef = inject(DialogRef);
|
|
993
|
+
data = inject(DIALOG_DATA);
|
|
994
|
+
linkUrl = this.data.linkUrl ?? '';
|
|
995
|
+
isUpdate = !!this.data.linkUrl;
|
|
996
|
+
submit() {
|
|
997
|
+
this.dialogRef.close(this.linkUrl.trim());
|
|
931
998
|
}
|
|
932
|
-
|
|
933
|
-
this.
|
|
999
|
+
cancel() {
|
|
1000
|
+
this.dialogRef.close();
|
|
934
1001
|
}
|
|
935
1002
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: LinkDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
936
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1003
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: LinkDialog, isStandalone: true, selector: "ngs-comment-editor-link-dialog", ngImport: i0, template: "<form class=\"w-[500px] max-w-full\" (ngSubmit)=\"submit()\">\n <h3 ngs-dialog-title>{{ isUpdate ? 'Update Link' : 'Add Link' }}</h3>\n <ngs-dialog-content>\n <div class=\"pt-4\">\n <ngs-form-field class=\"w-full\">\n <ngs-label>Paste Link</ngs-label>\n <input name=\"linkUrl\" ngsInput [(ngModel)]=\"linkUrl\">\n </ngs-form-field>\n </div>\n </ngs-dialog-content>\n <div ngs-dialog-actions align=\"end\">\n <button type=\"button\" ngsButton (click)=\"cancel()\">Cancel</button>\n <button type=\"submit\" ngsButton=\"filled\" [disabled]=\"!linkUrl.trim()\">\n {{ isUpdate ? 'Save' : 'Add link' }}\n </button>\n </div>\n</form>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: Button, selector: " button[ngsButton], button[ngsIconButton], a[ngsButton], a[ngsIconButton] ", inputs: ["ngsButton", "ngsIconButton", "loading", "disabled", "disabledInteractive", "disableRipple", "reverse", "fullWidth", "hideTextOnMobile"], exportAs: ["ngsButton"] }, { kind: "component", type: DialogActions, selector: "ngs-dialog-actions, [ngs-dialog-actions], [ngsDialogActions]", inputs: ["align"] }, { kind: "component", type: DialogContent, selector: "ngs-dialog-content,[ngs-dialog-content],[ngsDialogContent]" }, { kind: "component", type: DialogTitle, selector: "ngs-dialog-title, [ngs-dialog-title], [ngsDialogTitle]", inputs: ["id"], exportAs: ["ngsDialogTitle"] }, { kind: "component", type: FormField, selector: "ngs-form-field", inputs: ["labelMode", "subscriptHiddenIfEmpty", "sameHeightAsButton"], exportAs: ["ngsFormField"] }, { kind: "component", type: Label, selector: "ngs-label" }, { kind: "directive", type: Input, selector: "input[ngsInput], textarea[ngsInput]", inputs: ["id", "placeholder", "required", "disabled", "readonly", "errorStateMatcher"], exportAs: ["ngsInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
937
1004
|
}
|
|
938
1005
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: LinkDialog, decorators: [{
|
|
939
1006
|
type: Component,
|
|
940
|
-
args: [{ selector: 'ngs-link', imports: [
|
|
1007
|
+
args: [{ selector: 'ngs-comment-editor-link-dialog', imports: [
|
|
1008
|
+
FormsModule,
|
|
941
1009
|
Button,
|
|
942
1010
|
DialogActions,
|
|
943
1011
|
DialogContent,
|
|
944
1012
|
DialogTitle,
|
|
945
1013
|
FormField,
|
|
946
|
-
Input,
|
|
947
1014
|
Label,
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
], changeDetection: ChangeDetectionStrategy.Eager, template: "<form class=\"w-[500px]\" (ngSubmit)=\"onSubmit()\">\n <h3 ngs-dialog-title>\n @if (isUpdate) {\n Update Link\n } @else {\n Add Link\n }</h3>\n <ngs-dialog-content>\n <div class=\"pt-4\">\n <ngs-form-field class=\"w-full\">\n <ngs-label>Paste Link</ngs-label>\n <input name=\"linkUrl\" ngsInput [(ngModel)]=\"linkUrl\">\n </ngs-form-field>\n </div>\n </ngs-dialog-content>\n <div ngs-dialog-actions align=\"end\">\n <button ngsButton (click)=\"_onNoClick()\">Cancel</button>\n <button type=\"submit\" ngsButton=\"filled\" color=\"primary\"\n cdkFocusInitial [disabled]=\"!linkUrl.trim() || null\">\n @if (isUpdate) {\n Save\n } @else {\n Add link\n }\n </button>\n </div>\n</form>\n", styles: ["/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
1015
|
+
Input
|
|
1016
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<form class=\"w-[500px] max-w-full\" (ngSubmit)=\"submit()\">\n <h3 ngs-dialog-title>{{ isUpdate ? 'Update Link' : 'Add Link' }}</h3>\n <ngs-dialog-content>\n <div class=\"pt-4\">\n <ngs-form-field class=\"w-full\">\n <ngs-label>Paste Link</ngs-label>\n <input name=\"linkUrl\" ngsInput [(ngModel)]=\"linkUrl\">\n </ngs-form-field>\n </div>\n </ngs-dialog-content>\n <div ngs-dialog-actions align=\"end\">\n <button type=\"button\" ngsButton (click)=\"cancel()\">Cancel</button>\n <button type=\"submit\" ngsButton=\"filled\" [disabled]=\"!linkUrl.trim()\">\n {{ isUpdate ? 'Save' : 'Add link' }}\n </button>\n </div>\n</form>\n" }]
|
|
951
1017
|
}] });
|
|
952
1018
|
|
|
953
1019
|
class CommentEditorCommandLinkDirective {
|
|
954
|
-
|
|
955
|
-
|
|
1020
|
+
destroyRef = inject(DestroyRef);
|
|
1021
|
+
dialog = inject(Dialog);
|
|
956
1022
|
commentEditor = inject(COMMENT_EDITOR);
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1023
|
+
preserveSelection(event) {
|
|
1024
|
+
event.preventDefault();
|
|
1025
|
+
}
|
|
1026
|
+
open(event) {
|
|
1027
|
+
event.preventDefault();
|
|
1028
|
+
event.stopPropagation();
|
|
1029
|
+
this.dialog.open(LinkDialog, {
|
|
961
1030
|
data: {
|
|
962
|
-
linkUrl: this.commentEditor.api.
|
|
1031
|
+
linkUrl: this.commentEditor.api.getMarkAttributes('link')?.['href'] ?? ''
|
|
963
1032
|
}
|
|
964
|
-
})
|
|
965
|
-
|
|
966
|
-
.
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
if (typeof linkUrl === 'undefined') {
|
|
971
|
-
return;
|
|
1033
|
+
}).afterClosed()
|
|
1034
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
1035
|
+
.subscribe(linkUrl => {
|
|
1036
|
+
if (typeof linkUrl === 'string') {
|
|
1037
|
+
this.commentEditor.api.setLink(linkUrl);
|
|
1038
|
+
this.commentEditor.api.focus();
|
|
972
1039
|
}
|
|
973
|
-
this._setLink(linkUrl);
|
|
974
1040
|
});
|
|
975
1041
|
}
|
|
976
|
-
_setLink(url) {
|
|
977
|
-
// cancelled
|
|
978
|
-
if (url === null) {
|
|
979
|
-
return;
|
|
980
|
-
}
|
|
981
|
-
// empty
|
|
982
|
-
if (url === '') {
|
|
983
|
-
this.commentEditor.api.editor()
|
|
984
|
-
.chain()
|
|
985
|
-
.focus()
|
|
986
|
-
.extendMarkRange('link')
|
|
987
|
-
.unsetLink()
|
|
988
|
-
.run();
|
|
989
|
-
return;
|
|
990
|
-
}
|
|
991
|
-
// update link
|
|
992
|
-
this.commentEditor.api.editor()
|
|
993
|
-
.chain()
|
|
994
|
-
.focus()
|
|
995
|
-
.extendMarkRange('link')
|
|
996
|
-
.setLink({ href: url })
|
|
997
|
-
.run();
|
|
998
|
-
}
|
|
999
1042
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandLinkDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1000
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandLinkDirective, isStandalone: true, selector: "[ngsCommentEditorCommandLink]", host: { listeners: { "click": "
|
|
1043
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandLinkDirective, isStandalone: true, selector: "[ngsCommentEditorCommandLink]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "open($event)" }, properties: { "attr.disabled": "commentEditor.api.isCommandDisabled(\"toggleLink\") ? \"\" : null", "class.active": "commentEditor.api.isActive(\"link\")" } }, ngImport: i0 });
|
|
1001
1044
|
}
|
|
1002
1045
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandLinkDirective, decorators: [{
|
|
1003
1046
|
type: Directive,
|
|
1004
1047
|
args: [{
|
|
1005
1048
|
selector: '[ngsCommentEditorCommandLink]',
|
|
1006
1049
|
host: {
|
|
1007
|
-
'[attr.disabled]':
|
|
1008
|
-
'[class.active]':
|
|
1009
|
-
'(
|
|
1050
|
+
'[attr.disabled]': 'commentEditor.api.isCommandDisabled("toggleLink") ? "" : null',
|
|
1051
|
+
'[class.active]': 'commentEditor.api.isActive("link")',
|
|
1052
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
1053
|
+
'(click)': 'open($event)'
|
|
1010
1054
|
}
|
|
1011
1055
|
}]
|
|
1012
1056
|
}] });
|
|
1013
1057
|
|
|
1014
|
-
class CommentEditorCommandCodeDirective {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
this.commentEditor.api.runCommand('toggleCode');
|
|
1018
|
-
}
|
|
1019
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandCodeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1020
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandCodeDirective, isStandalone: true, selector: "[ngsCommentEditorCommandCode]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(commentEditor && commentEditor.api.isCommandDisabled('toggleCode')) ? '' : null", "class.active": "commentEditor && commentEditor.api.isActive('code')" } }, ngImport: i0 });
|
|
1058
|
+
class CommentEditorCommandCodeDirective extends CommentEditorCommandBase {
|
|
1059
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandCodeDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1060
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandCodeDirective, isStandalone: true, selector: "[ngsCommentEditorCommandCode]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "run(\"toggleCode\", $event)" }, properties: { "attr.disabled": "commentEditor.api.isCommandDisabled(\"toggleCode\") ? \"\" : null", "class.active": "commentEditor.api.isActive(\"toggleCode\")" } }, usesInheritance: true, ngImport: i0 });
|
|
1021
1061
|
}
|
|
1022
1062
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandCodeDirective, decorators: [{
|
|
1023
1063
|
type: Directive,
|
|
1024
1064
|
args: [{
|
|
1025
1065
|
selector: '[ngsCommentEditorCommandCode]',
|
|
1026
1066
|
host: {
|
|
1027
|
-
'[attr.disabled]':
|
|
1028
|
-
'[class.active]':
|
|
1029
|
-
'(
|
|
1067
|
+
'[attr.disabled]': 'commentEditor.api.isCommandDisabled("toggleCode") ? "" : null',
|
|
1068
|
+
'[class.active]': 'commentEditor.api.isActive("toggleCode")',
|
|
1069
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
1070
|
+
'(click)': 'run("toggleCode", $event)'
|
|
1030
1071
|
}
|
|
1031
1072
|
}]
|
|
1032
1073
|
}] });
|
|
1033
1074
|
|
|
1034
1075
|
class CommentEditorCommandEditLinkDirective {
|
|
1035
|
-
|
|
1036
|
-
|
|
1076
|
+
destroyRef = inject(DestroyRef);
|
|
1077
|
+
dialog = inject(Dialog);
|
|
1037
1078
|
commentEditor = inject(COMMENT_EDITOR);
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1079
|
+
preserveSelection(event) {
|
|
1080
|
+
event.preventDefault();
|
|
1081
|
+
}
|
|
1082
|
+
open(event) {
|
|
1083
|
+
event.preventDefault();
|
|
1084
|
+
event.stopPropagation();
|
|
1085
|
+
this.dialog.open(LinkDialog, {
|
|
1042
1086
|
data: {
|
|
1043
|
-
linkUrl: this.commentEditor.api.
|
|
1087
|
+
linkUrl: this.commentEditor.api.getMarkAttributes('link')?.['href'] ?? ''
|
|
1044
1088
|
}
|
|
1045
|
-
})
|
|
1046
|
-
|
|
1047
|
-
.
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
if (typeof linkUrl === 'undefined') {
|
|
1052
|
-
return;
|
|
1089
|
+
}).afterClosed()
|
|
1090
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
1091
|
+
.subscribe(linkUrl => {
|
|
1092
|
+
if (typeof linkUrl === 'string') {
|
|
1093
|
+
this.commentEditor.api.setLink(linkUrl);
|
|
1094
|
+
this.commentEditor.api.focus();
|
|
1053
1095
|
}
|
|
1054
|
-
this._setLink(linkUrl);
|
|
1055
1096
|
});
|
|
1056
1097
|
}
|
|
1057
|
-
_setLink(url) {
|
|
1058
|
-
// cancelled
|
|
1059
|
-
if (url === null) {
|
|
1060
|
-
return;
|
|
1061
|
-
}
|
|
1062
|
-
// empty
|
|
1063
|
-
if (url === '') {
|
|
1064
|
-
this.commentEditor.api.editor()
|
|
1065
|
-
.chain()
|
|
1066
|
-
.focus()
|
|
1067
|
-
.extendMarkRange('link')
|
|
1068
|
-
.unsetLink()
|
|
1069
|
-
.run();
|
|
1070
|
-
return;
|
|
1071
|
-
}
|
|
1072
|
-
// update link
|
|
1073
|
-
this.commentEditor.api.editor()
|
|
1074
|
-
.chain()
|
|
1075
|
-
.focus()
|
|
1076
|
-
.extendMarkRange('link')
|
|
1077
|
-
.setLink({ href: url })
|
|
1078
|
-
.run();
|
|
1079
|
-
}
|
|
1080
1098
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandEditLinkDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1081
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandEditLinkDirective, isStandalone: true, selector: "[ngsCommentEditorCommandEditLink]", host: { listeners: { "click": "
|
|
1099
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandEditLinkDirective, isStandalone: true, selector: "[ngsCommentEditorCommandEditLink]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "open($event)" }, properties: { "class.button": "true" } }, ngImport: i0 });
|
|
1082
1100
|
}
|
|
1083
1101
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandEditLinkDirective, decorators: [{
|
|
1084
1102
|
type: Directive,
|
|
@@ -1086,18 +1104,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
1086
1104
|
selector: '[ngsCommentEditorCommandEditLink]',
|
|
1087
1105
|
host: {
|
|
1088
1106
|
'[class.button]': 'true',
|
|
1089
|
-
'(
|
|
1107
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
1108
|
+
'(click)': 'open($event)'
|
|
1090
1109
|
}
|
|
1091
1110
|
}]
|
|
1092
1111
|
}] });
|
|
1093
1112
|
|
|
1094
1113
|
class CommentEditorCommandUnsetLinkDirective {
|
|
1095
1114
|
commentEditor = inject(COMMENT_EDITOR);
|
|
1096
|
-
|
|
1097
|
-
|
|
1115
|
+
preserveSelection(event) {
|
|
1116
|
+
event.preventDefault();
|
|
1117
|
+
}
|
|
1118
|
+
unset(event) {
|
|
1119
|
+
event.preventDefault();
|
|
1120
|
+
event.stopPropagation();
|
|
1121
|
+
this.commentEditor.api.unsetLink();
|
|
1122
|
+
this.commentEditor.api.focus();
|
|
1098
1123
|
}
|
|
1099
1124
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandUnsetLinkDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1100
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandUnsetLinkDirective, isStandalone: true, selector: "[ngsCommentEditorCommandUnsetLink]", host: { listeners: { "click": "
|
|
1125
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandUnsetLinkDirective, isStandalone: true, selector: "[ngsCommentEditorCommandUnsetLink]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "unset($event)" }, properties: { "class.button": "true" } }, ngImport: i0 });
|
|
1101
1126
|
}
|
|
1102
1127
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandUnsetLinkDirective, decorators: [{
|
|
1103
1128
|
type: Directive,
|
|
@@ -1105,26 +1130,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
1105
1130
|
selector: '[ngsCommentEditorCommandUnsetLink]',
|
|
1106
1131
|
host: {
|
|
1107
1132
|
'[class.button]': 'true',
|
|
1108
|
-
'(
|
|
1133
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
1134
|
+
'(click)': 'unset($event)'
|
|
1109
1135
|
}
|
|
1110
1136
|
}]
|
|
1111
1137
|
}] });
|
|
1112
1138
|
|
|
1113
1139
|
class CommentEditorCommandToggleToolbarDirective {
|
|
1114
1140
|
commentEditor = inject(COMMENT_EDITOR);
|
|
1115
|
-
|
|
1141
|
+
preserveSelection(event) {
|
|
1142
|
+
event.preventDefault();
|
|
1143
|
+
}
|
|
1144
|
+
toggle(event) {
|
|
1145
|
+
event.preventDefault();
|
|
1146
|
+
event.stopPropagation();
|
|
1116
1147
|
this.commentEditor.api.toggleToolbar();
|
|
1117
1148
|
}
|
|
1118
1149
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandToggleToolbarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1119
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandToggleToolbarDirective, isStandalone: true, selector: "[ngsCommentEditorCommandToggleToolbar]", host: { listeners: { "click": "
|
|
1150
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: CommentEditorCommandToggleToolbarDirective, isStandalone: true, selector: "[ngsCommentEditorCommandToggleToolbar]", host: { listeners: { "mousedown": "preserveSelection($event)", "click": "toggle($event)" }, properties: { "class.active": "commentEditor.api.isToolbarActive()" } }, ngImport: i0 });
|
|
1120
1151
|
}
|
|
1121
1152
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CommentEditorCommandToggleToolbarDirective, decorators: [{
|
|
1122
1153
|
type: Directive,
|
|
1123
1154
|
args: [{
|
|
1124
1155
|
selector: '[ngsCommentEditorCommandToggleToolbar]',
|
|
1125
1156
|
host: {
|
|
1126
|
-
'[class.active]':
|
|
1127
|
-
'(
|
|
1157
|
+
'[class.active]': 'commentEditor.api.isToolbarActive()',
|
|
1158
|
+
'(mousedown)': 'preserveSelection($event)',
|
|
1159
|
+
'(click)': 'toggle($event)'
|
|
1128
1160
|
}
|
|
1129
1161
|
}]
|
|
1130
1162
|
}] });
|
|
@@ -1133,5 +1165,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
1133
1165
|
* Generated bundle index. Do not edit.
|
|
1134
1166
|
*/
|
|
1135
1167
|
|
|
1136
|
-
export { COMMENT_EDITOR, COMMENT_EDITOR_BUBBLE_MENU, CommentEditor, CommentEditorBubbleMenu, CommentEditorCommandBlockquoteDirective, CommentEditorCommandBoldDirective, CommentEditorCommandBulletListDirective, CommentEditorCommandCodeBlockDirective, CommentEditorCommandCodeDirective, CommentEditorCommandDirective, CommentEditorCommandEditLinkDirective, CommentEditorCommandImageDirective, CommentEditorCommandItalicDirective, CommentEditorCommandLinkDirective, CommentEditorCommandOrderedListDirective, CommentEditorCommandStrikeDirective, CommentEditorCommandToggleToolbarDirective, CommentEditorCommandUnsetLinkDirective, CommentEditorCommandYoutubeDirective, CommentEditorDivider, CommentEditorFooterBar, CommentEditorToolbar };
|
|
1168
|
+
export { COMMENT_EDITOR, COMMENT_EDITOR_BUBBLE_MENU, CommentEditor, CommentEditorBubbleMenu, CommentEditorCommandBlockquoteDirective, CommentEditorCommandBoldDirective, CommentEditorCommandBulletListDirective, CommentEditorCommandCodeBlockDirective, CommentEditorCommandCodeDirective, CommentEditorCommandDirective, CommentEditorCommandEditLinkDirective, CommentEditorCommandImageDirective, CommentEditorCommandItalicDirective, CommentEditorCommandLinkDirective, CommentEditorCommandOrderedListDirective, CommentEditorCommandStrikeDirective, CommentEditorCommandToggleToolbarDirective, CommentEditorCommandUnsetLinkDirective, CommentEditorCommandYoutubeDirective, CommentEditorDivider, CommentEditorFooterBar, CommentEditorToolbar, NGS_COMMENT_EDITOR_SET_LINK, NGS_COMMENT_EDITOR_TOGGLE_BLOCKQUOTE, NGS_COMMENT_EDITOR_TOGGLE_BULLET_LIST, NGS_COMMENT_EDITOR_TOGGLE_CODE_BLOCK, NGS_COMMENT_EDITOR_TOGGLE_ORDERED_LIST, NGS_COMMENT_EDITOR_UNSET_LINK, commentEditorPlugin, createCommentEditorMediaBlock, normalizeLinkUrl, normalizeYoutubeUrl, serializeCommentEditorDocument };
|
|
1137
1169
|
//# sourceMappingURL=ngstarter-ui-components-comment-editor.mjs.map
|