@ngstarter-ui/components 22.0.5 → 22.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1038 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, ApplicationRef, createComponent, ElementRef, input, ChangeDetectionStrategy, Component, inject, PLATFORM_ID, DOCUMENT, ChangeDetectorRef, Injector, viewChild, output, forwardRef, Directive, DestroyRef, numberAttribute } from '@angular/core';
3
- import { isPlatformServer } from '@angular/common';
4
- import { NodeView, Node, mergeAttributes, Editor } from '@tiptap/core';
5
- import Document from '@tiptap/extension-document';
6
- import Paragraph from '@tiptap/extension-paragraph';
7
- import Text from '@tiptap/extension-text';
8
- import Bold from '@tiptap/extension-bold';
9
- import Italic from '@tiptap/extension-italic';
10
- import Strike from '@tiptap/extension-strike';
11
- import { Blockquote } from '@tiptap/extension-blockquote';
12
- import CodeBlock from '@tiptap/extension-code-block';
13
- import BulletList from '@tiptap/extension-bullet-list';
14
- import OrderedList from '@tiptap/extension-ordered-list';
15
- import ListItem from '@tiptap/extension-list-item';
16
- import Code from '@tiptap/extension-code';
17
- import History from '@tiptap/extension-history';
18
- import Dropcursor from '@tiptap/extension-dropcursor';
19
- import Youtube from '@tiptap/extension-youtube';
20
- import Image$1 from '@tiptap/extension-image';
21
- import Link from '@tiptap/extension-link';
22
- import Placeholder from '@tiptap/extension-placeholder';
23
- import BubbleMenu from '@tiptap/extension-bubble-menu';
24
- import { FloatingMenu } from '@tiptap/extension-floating-menu';
25
- import { ProgressSpinner } from '@ngstarter-ui/components/spinner';
26
- import Heading from '@tiptap/extension-heading';
27
- import { HorizontalRule } from '@tiptap/extension-horizontal-rule';
28
- import { DialogRef, DIALOG_DATA, DialogActions, DialogContent, DialogTitle, Dialog } from '@ngstarter-ui/components/dialog';
29
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
30
- import { Input } from '@ngstarter-ui/components/input';
31
- import * as i1 from '@angular/forms';
32
- import { ReactiveFormsModule, FormsModule } from '@angular/forms';
33
- import { Button } from '@ngstarter-ui/components/button';
34
- import { FormField, Label } from '@ngstarter-ui/components/form-field';
35
- import * as i1$1 from '@ngstarter-ui/components/upload';
36
- import { UploadTriggerDirective } from '@ngstarter-ui/components/upload';
37
-
38
- const TEXT_EDITOR = new InjectionToken('TEXT_EDITOR');
39
- const TEXT_EDITOR_BUBBLE_MENU = new InjectionToken('TEXT_EDITOR_BUBBLE_MENU');
40
-
41
- class AngularRenderer {
42
- applicationRef;
43
- componentRef;
44
- constructor(ViewComponent, injector, props) {
45
- this.applicationRef = injector.get(ApplicationRef);
46
- this.componentRef = createComponent(ViewComponent, {
47
- environmentInjector: this.applicationRef.injector,
48
- elementInjector: injector,
49
- });
50
- // set input props to the component
51
- this.updateProps(props);
52
- this.applicationRef.attachView(this.componentRef.hostView);
53
- }
54
- get instance() {
55
- return this.componentRef.instance;
56
- }
57
- get elementRef() {
58
- return this.componentRef.injector.get(ElementRef);
59
- }
60
- get dom() {
61
- return this.elementRef.nativeElement;
62
- }
63
- updateProps(props) {
64
- Object.entries(props).forEach(([key, value]) => {
65
- this.componentRef.setInput(key, value);
66
- });
67
- }
68
- detectChanges() {
69
- this.componentRef.changeDetectorRef.detectChanges();
70
- }
71
- destroy() {
72
- this.componentRef.destroy();
73
- this.applicationRef.detachView(this.componentRef.hostView);
74
- }
75
- }
76
-
77
- class AngularNodeViewContainer extends NodeView {
78
- renderer;
79
- contentDOMElement;
80
- mount() {
81
- const injector = this.options.injector;
82
- const props = {
83
- editor: this.editor,
84
- node: this.node,
85
- // @ts-ignore
86
- decorations: this.decorations,
87
- selected: false,
88
- extension: this.extension,
89
- getPos: () => this.getPos(),
90
- updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
91
- deleteNode: () => this.deleteNode(),
92
- };
93
- this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this);
94
- this.editor.on('selectionUpdate', this.handleSelectionUpdate);
95
- // create renderer
96
- this.renderer = new AngularRenderer(this.component, injector, props);
97
- // Register drag handler
98
- if (this.extension.config.draggable) {
99
- this.renderer.elementRef.nativeElement.ondragstart = (e) => {
100
- this.onDragStart(e);
101
- };
102
- }
103
- this.contentDOMElement = this.node.isLeaf ? null : document.createElement(this.node.isInline ? 'span' : 'div');
104
- if (this.contentDOMElement) {
105
- // For some reason the whiteSpace prop is not inherited properly in Chrome and Safari
106
- // With this fix it seems to work fine
107
- // See: https://github.com/ueberdosis/tiptap/issues/1197
108
- this.contentDOMElement.style.whiteSpace = 'inherit';
109
- // Required for editable node views
110
- // The content won't be rendered if `editable` is set to `false`
111
- this.renderer.detectChanges();
112
- }
113
- this.appendContendDom();
114
- }
115
- get dom() {
116
- return this.renderer.dom;
117
- }
118
- get contentDOM() {
119
- if (this.node.isLeaf) {
120
- return null;
121
- }
122
- return this.contentDOMElement;
123
- }
124
- appendContendDom() {
125
- const contentElement = this.dom.querySelector('[data-node-view-content]');
126
- if (this.contentDOMElement
127
- && contentElement
128
- && !contentElement.contains(this.contentDOMElement)) {
129
- contentElement.appendChild(this.contentDOMElement);
130
- }
131
- }
132
- handleSelectionUpdate() {
133
- const { from, to } = this.editor.state.selection;
134
- if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {
135
- this.selectNode();
136
- }
137
- else {
138
- this.deselectNode();
139
- }
140
- }
141
- update(node, decorations) {
142
- const updateProps = () => {
143
- this.renderer.updateProps({ node, decorations });
144
- };
145
- if (this.options.update) {
146
- const oldNode = this.node;
147
- const oldDecorations = this.decorations;
148
- this.node = node;
149
- this.decorations = decorations;
150
- return this.options.update({
151
- oldNode,
152
- // @ts-ignore
153
- oldDecorations,
154
- newNode: node,
155
- newDecorations: decorations,
156
- updateProps: () => updateProps(),
157
- });
158
- }
159
- if (node.type !== this.node.type) {
160
- return false;
161
- }
162
- if (node === this.node && this.decorations === decorations) {
163
- return true;
164
- }
165
- this.node = node;
166
- this.decorations = decorations;
167
- updateProps();
168
- return true;
169
- }
170
- selectNode() {
171
- this.renderer.updateProps({ selected: true });
172
- }
173
- deselectNode() {
174
- this.renderer.updateProps({ selected: false });
175
- }
176
- destroy() {
177
- this.renderer.destroy();
178
- this.editor.off('selectionUpdate', this.handleSelectionUpdate);
179
- this.contentDOMElement = null;
180
- }
181
- }
182
- const AngularNodeViewRenderer = (ViewComponent, options) => {
183
- // @ts-ignore
184
- return (props) => {
185
- return new AngularNodeViewContainer(ViewComponent, props, options);
186
- };
187
- };
188
-
189
- class AngularNodeView {
190
- editor = input.required(/* @ts-ignore */
191
- ...(ngDevMode ? [{ debugName: "editor" }] : /* istanbul ignore next */ []));
192
- node = input.required(/* @ts-ignore */
193
- ...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
194
- decorations = input.required(/* @ts-ignore */
195
- ...(ngDevMode ? [{ debugName: "decorations" }] : /* istanbul ignore next */ []));
196
- selected = input.required(/* @ts-ignore */
197
- ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
198
- extension = input.required(/* @ts-ignore */
199
- ...(ngDevMode ? [{ debugName: "extension" }] : /* istanbul ignore next */ []));
200
- getPos = input.required(/* @ts-ignore */
201
- ...(ngDevMode ? [{ debugName: "getPos" }] : /* istanbul ignore next */ []));
202
- updateAttributes = input.required(/* @ts-ignore */
203
- ...(ngDevMode ? [{ debugName: "updateAttributes" }] : /* istanbul ignore next */ []));
204
- deleteNode = input.required(/* @ts-ignore */
205
- ...(ngDevMode ? [{ debugName: "deleteNode" }] : /* istanbul ignore next */ []));
206
- HTMLAttributes = input({}, /* @ts-ignore */
207
- ...(ngDevMode ? [{ debugName: "HTMLAttributes" }] : /* istanbul ignore next */ []));
208
- innerDecorations = input(undefined, /* @ts-ignore */
209
- ...(ngDevMode ? [{ debugName: "innerDecorations" }] : /* istanbul ignore next */ []));
210
- view = input(undefined, /* @ts-ignore */
211
- ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
212
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: AngularNodeView, deps: [], target: i0.ɵɵFactoryTarget.Component });
213
- 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 });
214
- }
215
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: AngularNodeView, decorators: [{
216
- type: Component,
217
- args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.Eager,
218
- template: '' }]
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" }, exportAs: ["ngsTextEditorUploadingPlaceholder"], 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 });
261
- }
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', exportAs: 'ngsTextEditorUploadingPlaceholder', 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
-
322
- class TextEditor {
323
- _platformId = inject(PLATFORM_ID);
324
- _document = inject(DOCUMENT);
325
- _cdr = inject(ChangeDetectorRef);
326
- _injector = inject(Injector);
327
- _content = viewChild.required('content', /* @ts-ignore */
328
- ...(ngDevMode ? [{ debugName: "_content" }] : /* istanbul ignore next */ []));
329
- _bubbleMenu = viewChild.required('bubbleMenu', /* @ts-ignore */
330
- ...(ngDevMode ? [{ debugName: "_bubbleMenu" }] : /* istanbul ignore next */ []));
331
- _imageBubbleMenu = viewChild.required('imageBubbleMenu', /* @ts-ignore */
332
- ...(ngDevMode ? [{ debugName: "_imageBubbleMenu" }] : /* istanbul ignore next */ []));
333
- _floatingMenu = viewChild.required('floatingMenu', /* @ts-ignore */
334
- ...(ngDevMode ? [{ debugName: "_floatingMenu" }] : /* istanbul ignore next */ []));
335
- _value = '';
336
- editor;
337
- content = input('', /* @ts-ignore */
338
- ...(ngDevMode ? [{ debugName: "content" }] : /* istanbul ignore next */ []));
339
- extensions = input([], /* @ts-ignore */
340
- ...(ngDevMode ? [{ debugName: "extensions" }] : /* istanbul ignore next */ []));
341
- contentMaxHeight = input(/* @ts-ignore */
342
- ...(ngDevMode ? [undefined, { debugName: "contentMaxHeight" }] : /* istanbul ignore next */ []));
343
- placeholder = input('Write something …', /* @ts-ignore */
344
- ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
345
- imageUploadFn = input(/* @ts-ignore */
346
- ...(ngDevMode ? [undefined, { debugName: "imageUploadFn" }] : /* istanbul ignore next */ []));
347
- contentChange = output();
348
- get api() {
349
- return {
350
- isCommandDisabled: (command, options) => this.isCommandDisabled(command, options),
351
- isActive: (command, options) => this.editor?.isActive(command, options),
352
- runCommand: (command, options) => this._runCommand(command, options),
353
- editor: () => this.editor
354
- };
355
- }
356
- ngOnInit() {
357
- if (isPlatformServer(this._platformId)) {
358
- return;
359
- }
360
- this._init();
361
- }
362
- isCommandDisabled(command, options) {
363
- if (!this.editor) {
364
- return true;
365
- }
366
- try {
367
- const canFocus = this.editor.can().chain().focus();
368
- return !canFocus[command](options).run() || null;
369
- }
370
- catch (e) {
371
- return true;
372
- }
373
- }
374
- ngOnDestroy() {
375
- this.editor?.destroy();
376
- }
377
- _runCommand(command, options) {
378
- if (!this.editor) {
379
- return;
380
- }
381
- const chainFocus = this.editor.chain().focus();
382
- chainFocus[command](options).run();
383
- }
384
- _init() {
385
- const extensions = [
386
- ...this.extensions(),
387
- Heading.configure({
388
- levels: [1, 2, 3],
389
- }),
390
- HorizontalRule,
391
- Document,
392
- Paragraph,
393
- Text,
394
- Bold,
395
- Italic,
396
- Strike,
397
- Blockquote,
398
- CodeBlock,
399
- BulletList,
400
- OrderedList,
401
- ListItem,
402
- Code,
403
- History,
404
- Dropcursor,
405
- Youtube.configure({
406
- controls: false,
407
- nocookie: true,
408
- }),
409
- ImageUploadingPlaceholderExtension(this._injector, {
410
- uploadFn: this.imageUploadFn(),
411
- }),
412
- Image$1.configure({
413
- inline: true,
414
- allowBase64: true
415
- }),
416
- Link.configure({
417
- openOnClick: false,
418
- defaultProtocol: 'https',
419
- }),
420
- Placeholder.configure({
421
- placeholder: this.placeholder()
422
- }),
423
- // BubbleMenu.configure({
424
- // element: this._imageBubbleMenu().nativeElement,
425
- // shouldShow: ({ editor, view, state, oldState, from, to }) => {
426
- // // return editor.isActive('image');
427
- // return false;
428
- // },
429
- // }),
430
- BubbleMenu.configure({
431
- element: this._bubbleMenu().nativeElement,
432
- tippyOptions: {
433
- appendTo: this._document.body,
434
- zIndex: 999
435
- },
436
- shouldShow: ({ editor, view, state, oldState, from, to }) => {
437
- return !editor.isActive('image') &&
438
- !editor.isActive('youtube') &&
439
- !editor.isActive('imageUploadingPlaceholder') &&
440
- !editor.view.state.selection.empty;
441
- },
442
- })
443
- ];
444
- if (this._floatingMenu()) {
445
- extensions.push(FloatingMenu.configure({
446
- element: this._floatingMenu().nativeElement
447
- }));
448
- }
449
- this.editor = new Editor({
450
- element: this._content().nativeElement,
451
- extensions,
452
- content: this.content(),
453
- onUpdate: ({ editor }) => {
454
- this._value = !editor.isEmpty ? editor.getHTML() : '';
455
- this.contentChange.emit(this._value);
456
- }
457
- });
458
- this._cdr.detectChanges();
459
- }
460
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
461
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", type: TextEditor, isStandalone: true, selector: "ngs-text-editor", inputs: { content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, extensions: { classPropertyName: "extensions", publicName: "extensions", isSignal: true, isRequired: false, transformFunction: null }, contentMaxHeight: { classPropertyName: "contentMaxHeight", publicName: "contentMaxHeight", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, imageUploadFn: { classPropertyName: "imageUploadFn", publicName: "imageUploadFn", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { contentChange: "contentChange" }, host: { classAttribute: "ngs-text-editor" }, providers: [
462
- {
463
- provide: TEXT_EDITOR,
464
- useExisting: forwardRef(() => TextEditor)
465
- }
466
- ], viewQueries: [{ propertyName: "_content", first: true, predicate: ["content"], descendants: true, isSignal: true }, { propertyName: "_bubbleMenu", first: true, predicate: ["bubbleMenu"], descendants: true, isSignal: true }, { propertyName: "_imageBubbleMenu", first: true, predicate: ["imageBubbleMenu"], descendants: true, isSignal: true }, { propertyName: "_floatingMenu", first: true, predicate: ["floatingMenu"], descendants: true, isSignal: true }], exportAs: ["ngsTextEditor"], ngImport: i0, template: "<ng-content select=\"ngs-text-editor-toolbar\"/>\n<div #content class=\"content prose dark:prose-invert max-w-full\"></div>\n<div #imageBubbleMenu class=\"ngs-text-editor-bubble-menu\"></div>\n<div #bubbleMenu>\n <ng-content select=\"ngs-text-editor-bubble-menu\"/>\n</div>\n<div #floatingMenu class=\"floating-menu\">\n <ng-content select=\"ngs-text-editor-floating-menu\"/>\n</div>\n", styles: [":host{--ngs-text-editor-bg: transparent;--ngs-text-editor-content-max-height: 9999px;--ngs-text-editor-content-padding: calc(var(--spacing, .25rem) * 6);display:block}:host:not([class*=bg-]){background:var(--ngs-text-editor-bg)}:host .floating-menu:empty{display:none}:host ::ng-deep .tippy-box{max-width:800px!important}:host .content ::ng-deep .tiptap{padding:var(--ngs-text-editor-content-padding);min-height:100%}:host .content ::ng-deep .tiptap:focus{outline:none}:host .content ::ng-deep .tiptap div[data-youtube-video]{cursor:move;background:var(--ngs-color-neutral-100);padding:calc(var(--spacing, .25rem) * 6);display:flex;align-items:center;justify-content:center}:host .content ::ng-deep .tiptap div[data-youtube-video] iframe{width:100%;aspect-ratio:16/9;border:none;display:block;min-height:200px;min-width:200px;outline:none}:host .content ::ng-deep .tiptap div[data-youtube-video].ProseMirror-selectednode iframe{outline:var(--sys-tertiary) solid 4px;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:host .content ::ng-deep .tiptap img{display:block;height:auto;margin:calc(var(--spacing, .25rem) * 6) 0;max-width:100%}:host .content ::ng-deep .tiptap img.ProseMirror-selectednode{outline:var(--sys-tertiary) solid 4px;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:host .content ::ng-deep .tiptap p.is-editor-empty:first-child:before{content:attr(data-placeholder);color:var(--ngs-color-neutral-500);float:left;height:0;pointer-events:none;font-size:var(--ngs-font-size-sm)}:host .content ::ng-deep .tiptap.ProseMirror-focused p.is-editor-empty:first-child:before{content:none}:host .content ::ng-deep .tiptap p.is-empty:before{content:attr(data-placeholder);color:var(--ngs-color-neutral-500);float:left;height:0;pointer-events:none;font-size:var(--ngs-font-size-sm)}:host .content ::ng-deep p:first-child,:host .content ::ng-deep pre:first-child{margin-top:0}:host .content ::ng-deep p:last-child,:host .content ::ng-deep pre:last-child{margin-bottom:0}:host .button.active,:host ::ng-deep .button.active{background:var(--ngs-color-neutral-100)}:host-context(html.dark) .button.active,:host-context(html.dark) ::ng-deep .button.active{background:var(--ngs-color-neutral-650);color:var(--ngs-color-neutral-200)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], changeDetection: i0.ChangeDetectionStrategy.Eager });
467
- }
468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditor, decorators: [{
469
- type: Component,
470
- args: [{ selector: 'ngs-text-editor', exportAs: 'ngsTextEditor', imports: [], providers: [
471
- {
472
- provide: TEXT_EDITOR,
473
- useExisting: forwardRef(() => TextEditor)
474
- }
475
- ], changeDetection: ChangeDetectionStrategy.Eager, host: {
476
- 'class': 'ngs-text-editor'
477
- }, template: "<ng-content select=\"ngs-text-editor-toolbar\"/>\n<div #content class=\"content prose dark:prose-invert max-w-full\"></div>\n<div #imageBubbleMenu class=\"ngs-text-editor-bubble-menu\"></div>\n<div #bubbleMenu>\n <ng-content select=\"ngs-text-editor-bubble-menu\"/>\n</div>\n<div #floatingMenu class=\"floating-menu\">\n <ng-content select=\"ngs-text-editor-floating-menu\"/>\n</div>\n", styles: [":host{--ngs-text-editor-bg: transparent;--ngs-text-editor-content-max-height: 9999px;--ngs-text-editor-content-padding: calc(var(--spacing, .25rem) * 6);display:block}:host:not([class*=bg-]){background:var(--ngs-text-editor-bg)}:host .floating-menu:empty{display:none}:host ::ng-deep .tippy-box{max-width:800px!important}:host .content ::ng-deep .tiptap{padding:var(--ngs-text-editor-content-padding);min-height:100%}:host .content ::ng-deep .tiptap:focus{outline:none}:host .content ::ng-deep .tiptap div[data-youtube-video]{cursor:move;background:var(--ngs-color-neutral-100);padding:calc(var(--spacing, .25rem) * 6);display:flex;align-items:center;justify-content:center}:host .content ::ng-deep .tiptap div[data-youtube-video] iframe{width:100%;aspect-ratio:16/9;border:none;display:block;min-height:200px;min-width:200px;outline:none}:host .content ::ng-deep .tiptap div[data-youtube-video].ProseMirror-selectednode iframe{outline:var(--sys-tertiary) solid 4px;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:host .content ::ng-deep .tiptap img{display:block;height:auto;margin:calc(var(--spacing, .25rem) * 6) 0;max-width:100%}:host .content ::ng-deep .tiptap img.ProseMirror-selectednode{outline:var(--sys-tertiary) solid 4px;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:host .content ::ng-deep .tiptap p.is-editor-empty:first-child:before{content:attr(data-placeholder);color:var(--ngs-color-neutral-500);float:left;height:0;pointer-events:none;font-size:var(--ngs-font-size-sm)}:host .content ::ng-deep .tiptap.ProseMirror-focused p.is-editor-empty:first-child:before{content:none}:host .content ::ng-deep .tiptap p.is-empty:before{content:attr(data-placeholder);color:var(--ngs-color-neutral-500);float:left;height:0;pointer-events:none;font-size:var(--ngs-font-size-sm)}:host .content ::ng-deep p:first-child,:host .content ::ng-deep pre:first-child{margin-top:0}:host .content ::ng-deep p:last-child,:host .content ::ng-deep pre:last-child{margin-bottom:0}:host .button.active,:host ::ng-deep .button.active{background:var(--ngs-color-neutral-100)}:host-context(html.dark) .button.active,:host-context(html.dark) ::ng-deep .button.active{background:var(--ngs-color-neutral-650);color:var(--ngs-color-neutral-200)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
478
- }], propDecorators: { _content: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }], _bubbleMenu: [{ type: i0.ViewChild, args: ['bubbleMenu', { isSignal: true }] }], _imageBubbleMenu: [{ type: i0.ViewChild, args: ['imageBubbleMenu', { isSignal: true }] }], _floatingMenu: [{ type: i0.ViewChild, args: ['floatingMenu', { isSignal: true }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: false }] }], extensions: [{ type: i0.Input, args: [{ isSignal: true, alias: "extensions", required: false }] }], contentMaxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentMaxHeight", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], imageUploadFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "imageUploadFn", required: false }] }], contentChange: [{ type: i0.Output, args: ["contentChange"] }] } });
479
-
480
- class TextEditorToolbar {
481
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorToolbar, deps: [], target: i0.ɵɵFactoryTarget.Component });
482
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorToolbar, isStandalone: true, selector: "ngs-text-editor-toolbar", exportAs: ["ngsTextEditorToolbar"], ngImport: i0, template: "<ng-content select=\"[ngsTextEditorCommand],ngs-text-editor-divider\"/>\n\n", styles: [":host{border-top-left-radius:inherit;border-top-right-radius:inherit;gap:calc(var(--spacing, .25rem) * .5);border-bottom:1px solid var(--ngs-color-border);height:calc(var(--spacing, .25rem) * 14);padding-left:calc(var(--spacing, .25rem) * 3);padding-right:calc(var(--spacing, .25rem) * 3);display:flex;align-items:center;z-index:1}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], changeDetection: i0.ChangeDetectionStrategy.Eager });
483
- }
484
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorToolbar, decorators: [{
485
- type: Component,
486
- args: [{ selector: 'ngs-text-editor-toolbar', exportAs: 'ngsTextEditorToolbar', imports: [], changeDetection: ChangeDetectionStrategy.Eager, template: "<ng-content select=\"[ngsTextEditorCommand],ngs-text-editor-divider\"/>\n\n", styles: [":host{border-top-left-radius:inherit;border-top-right-radius:inherit;gap:calc(var(--spacing, .25rem) * .5);border-bottom:1px solid var(--ngs-color-border);height:calc(var(--spacing, .25rem) * 14);padding-left:calc(var(--spacing, .25rem) * 3);padding-right:calc(var(--spacing, .25rem) * 3);display:flex;align-items:center;z-index:1}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
487
- }] });
488
-
489
- class TextEditorDivider {
490
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorDivider, deps: [], target: i0.ɵɵFactoryTarget.Component });
491
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorDivider, isStandalone: true, selector: "ngs-text-editor-divider", exportAs: ["ngsTextEditorDivider"], 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);width:1px}: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.Eager });
492
- }
493
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorDivider, decorators: [{
494
- type: Component,
495
- args: [{ selector: 'ngs-text-editor-divider', exportAs: 'ngsTextEditorDivider', imports: [], changeDetection: ChangeDetectionStrategy.Eager, 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);width:1px}:host-context(html.dark) .divider{background:var(--ngs-color-neutral-500)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
496
- }] });
497
-
498
- class TextEditorBubbleMenu {
499
- textEditor = inject(TEXT_EDITOR);
500
- getLinkUrl() {
501
- return (this.textEditor.api.editor()?.getAttributes('link')).href || null;
502
- }
503
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorBubbleMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
504
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: TextEditorBubbleMenu, isStandalone: true, selector: "ngs-text-editor-bubble-menu", providers: [
505
- {
506
- provide: TEXT_EDITOR_BUBBLE_MENU,
507
- useExisting: forwardRef(() => TextEditorBubbleMenu)
508
- }
509
- ], exportAs: ["emitTextEditorBubbleMenu"], ngImport: i0, template: "@if (this.textEditor.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=\"[ngsTextEditorCommandEditLink],[ngsCommentEditorCommandUnsetLink]\"/>\n </div>\n </div>\n}\n<div class=\"h-12 flex items-center justify-center gap-0.5\">\n <ng-content select=\"[ngsTextEditorCommand],ngs-text-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;--ngs-icon-size: var(--ngs-font-size-xl);border-radius:calc(infinity * 1px)}:host .button:hover,:host ::ng-deep .button:hover{color:var(--ngs-color-tertiary-300);background:var(--ngs-color-neutral-700);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"], changeDetection: i0.ChangeDetectionStrategy.Eager });
510
- }
511
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorBubbleMenu, decorators: [{
512
- type: Component,
513
- args: [{ selector: 'ngs-text-editor-bubble-menu', exportAs: 'emitTextEditorBubbleMenu', imports: [], providers: [
514
- {
515
- provide: TEXT_EDITOR_BUBBLE_MENU,
516
- useExisting: forwardRef(() => TextEditorBubbleMenu)
517
- }
518
- ], changeDetection: ChangeDetectionStrategy.Eager, template: "@if (this.textEditor.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=\"[ngsTextEditorCommandEditLink],[ngsCommentEditorCommandUnsetLink]\"/>\n </div>\n </div>\n}\n<div class=\"h-12 flex items-center justify-center gap-0.5\">\n <ng-content select=\"[ngsTextEditorCommand],ngs-text-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;--ngs-icon-size: var(--ngs-font-size-xl);border-radius:calc(infinity * 1px)}:host .button:hover,:host ::ng-deep .button:hover{color:var(--ngs-color-tertiary-300);background:var(--ngs-color-neutral-700);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"] }]
519
- }] });
520
-
521
- class TextEditorFloatingMenu {
522
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorFloatingMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
523
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorFloatingMenu, isStandalone: true, selector: "ngs-text-editor-floating-menu", host: { classAttribute: "ngs-text-editor-floating-menu" }, exportAs: ["ngsTextEditorFloatingMenu"], ngImport: i0, template: "<ng-content select=\"[ngsTextEditorCommand],ngs-text-editor-divider\"/>\n", styles: [":host{box-shadow:var(--ngs-shadow-sm);margin-left:calc(var(--spacing, .25rem) * 3);margin-right:calc(var(--spacing, .25rem) * 3);background:var(--sys-surface-container-lowest);padding:calc(var(--spacing, .25rem) * 1.5) calc(var(--spacing, .25rem) * 2);display:flex;align-items:center;flex-wrap:wrap;gap:calc(var(--spacing, .25rem) * .5);border:1px solid var(--ngs-color-border);border-radius:var(--ngs-radius-xl)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], changeDetection: i0.ChangeDetectionStrategy.Eager });
524
- }
525
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorFloatingMenu, decorators: [{
526
- type: Component,
527
- args: [{ selector: 'ngs-text-editor-floating-menu', exportAs: 'ngsTextEditorFloatingMenu', imports: [], changeDetection: ChangeDetectionStrategy.Eager, host: {
528
- 'class': 'ngs-text-editor-floating-menu'
529
- }, template: "<ng-content select=\"[ngsTextEditorCommand],ngs-text-editor-divider\"/>\n", styles: [":host{box-shadow:var(--ngs-shadow-sm);margin-left:calc(var(--spacing, .25rem) * 3);margin-right:calc(var(--spacing, .25rem) * 3);background:var(--sys-surface-container-lowest);padding:calc(var(--spacing, .25rem) * 1.5) calc(var(--spacing, .25rem) * 2);display:flex;align-items:center;flex-wrap:wrap;gap:calc(var(--spacing, .25rem) * .5);border:1px solid var(--ngs-color-border);border-radius:var(--ngs-radius-xl)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
530
- }] });
531
-
532
- class TextEditorCommandBlockquoteDirective {
533
- textEditor = inject(TEXT_EDITOR);
534
- onClick() {
535
- this.textEditor.api.runCommand('toggleBlockquote');
536
- }
537
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandBlockquoteDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
538
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandBlockquoteDirective, isStandalone: true, selector: "[ngsTextEditorCommandBlockquote]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(textEditor && textEditor.api.isCommandDisabled('toggleBlockquote')) ? '' : null", "class.active": "textEditor && textEditor.api.isActive('blockquote')" } }, exportAs: ["ngsTextEditorCommandBlockquote"], ngImport: i0 });
539
- }
540
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandBlockquoteDirective, decorators: [{
541
- type: Directive,
542
- args: [{
543
- selector: '[ngsTextEditorCommandBlockquote]',
544
- exportAs: 'ngsTextEditorCommandBlockquote',
545
- host: {
546
- '[attr.disabled]': `(textEditor && textEditor.api.isCommandDisabled('toggleBlockquote')) ? '' : null`,
547
- '[class.active]': `textEditor && textEditor.api.isActive('blockquote')`,
548
- '(click)': `onClick()`
549
- }
550
- }]
551
- }] });
552
-
553
- class TextEditorCommandBoldDirective {
554
- textEditor = inject(TEXT_EDITOR);
555
- onClick() {
556
- this.textEditor.api.runCommand('toggleBold');
557
- }
558
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandBoldDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
559
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandBoldDirective, isStandalone: true, selector: "[ngsTextEditorCommandBold]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(textEditor && textEditor.api.isCommandDisabled('toggleBold')) ? '' : null", "class.active": "textEditor && textEditor.api.isActive('bold')" } }, exportAs: ["ngsTextEditorCommandBold"], ngImport: i0 });
560
- }
561
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandBoldDirective, decorators: [{
562
- type: Directive,
563
- args: [{
564
- selector: '[ngsTextEditorCommandBold]',
565
- exportAs: 'ngsTextEditorCommandBold',
566
- host: {
567
- '[attr.disabled]': `(textEditor && textEditor.api.isCommandDisabled('toggleBold')) ? '' : null`,
568
- '[class.active]': `textEditor && textEditor.api.isActive('bold')`,
569
- '(click)': `onClick()`
570
- }
571
- }]
572
- }] });
573
-
574
- class TextEditorCommandBulletListDirective {
575
- textEditor = inject(TEXT_EDITOR);
576
- onClick() {
577
- this.textEditor.api.runCommand('toggleBulletList');
578
- }
579
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandBulletListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
580
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandBulletListDirective, isStandalone: true, selector: "[ngsTextEditorCommandBulletList]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(textEditor && textEditor.api.isCommandDisabled('toggleBulletList')) ? '' : null", "class.active": "textEditor && textEditor.api.isActive('bulletList')" } }, exportAs: ["ngsTextEditorCommandBulletList"], ngImport: i0 });
581
- }
582
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandBulletListDirective, decorators: [{
583
- type: Directive,
584
- args: [{
585
- selector: '[ngsTextEditorCommandBulletList]',
586
- exportAs: 'ngsTextEditorCommandBulletList',
587
- host: {
588
- '[attr.disabled]': `(textEditor && textEditor.api.isCommandDisabled('toggleBulletList')) ? '' : null`,
589
- '[class.active]': `textEditor && textEditor.api.isActive('bulletList')`,
590
- '(click)': `onClick()`
591
- }
592
- }]
593
- }] });
594
-
595
- class TextEditorCommandCodeBlockDirective {
596
- textEditor = inject(TEXT_EDITOR);
597
- onClick() {
598
- this.textEditor.api.runCommand('toggleCodeBlock');
599
- }
600
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandCodeBlockDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
601
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandCodeBlockDirective, isStandalone: true, selector: "[ngsTextEditorCommandCodeBlock]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(textEditor && textEditor.api.isCommandDisabled('toggleCodeBlock')) ? '' : null", "class.active": "textEditor && textEditor.api.isActive('codeBlock')" } }, exportAs: ["ngsTextEditorCommandCodeBlock"], ngImport: i0 });
602
- }
603
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandCodeBlockDirective, decorators: [{
604
- type: Directive,
605
- args: [{
606
- selector: '[ngsTextEditorCommandCodeBlock]',
607
- exportAs: 'ngsTextEditorCommandCodeBlock',
608
- host: {
609
- '[attr.disabled]': `(textEditor && textEditor.api.isCommandDisabled('toggleCodeBlock')) ? '' : null`,
610
- '[class.active]': `textEditor && textEditor.api.isActive('codeBlock')`,
611
- '(click)': `onClick()`
612
- }
613
- }]
614
- }] });
615
-
616
- class TextEditorCommandCodeDirective {
617
- textEditor = inject(TEXT_EDITOR);
618
- onClick() {
619
- this.textEditor.api.runCommand('toggleCode');
620
- }
621
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandCodeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
622
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandCodeDirective, isStandalone: true, selector: "[ngsTextEditorCommandCode]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(textEditor && textEditor.api.isCommandDisabled('toggleCode')) ? '' : null", "class.active": "textEditor && textEditor.api.isActive('code')" } }, exportAs: ["ngsTextEditorCommandCode"], ngImport: i0 });
623
- }
624
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandCodeDirective, decorators: [{
625
- type: Directive,
626
- args: [{
627
- selector: '[ngsTextEditorCommandCode]',
628
- exportAs: 'ngsTextEditorCommandCode',
629
- host: {
630
- '[attr.disabled]': `(textEditor && textEditor.api.isCommandDisabled('toggleCode')) ? '' : null`,
631
- '[class.active]': `textEditor && textEditor.api.isActive('code')`,
632
- '(click)': `onClick()`
633
- }
634
- }]
635
- }] });
636
-
637
- class LinkDialog {
638
- _dialogRef = inject(DialogRef);
639
- _data = inject(DIALOG_DATA);
640
- linkUrl = this._data.linkUrl || '';
641
- isUpdate = !!this._data.linkUrl;
642
- onSubmit() {
643
- this._dialogRef.close(this.linkUrl);
644
- }
645
- _onNoClick() {
646
- this._dialogRef.close();
647
- }
648
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: LinkDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
649
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: LinkDialog, isStandalone: true, selector: "ngs-link", exportAs: ["ngsLink"], ngImport: i0, 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"], 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: "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: "directive", type: Input, selector: "input[ngsInput], textarea[ngsInput]", inputs: ["id", "placeholder", "required", "disabled", "readonly", "errorStateMatcher"], exportAs: ["ngsInput"] }, { kind: "component", type: Label, selector: "ngs-label" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
650
- }
651
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: LinkDialog, decorators: [{
652
- type: Component,
653
- args: [{ selector: 'ngs-link', exportAs: 'ngsLink', imports: [
654
- Button,
655
- DialogActions,
656
- DialogContent,
657
- DialogTitle,
658
- FormField,
659
- Input,
660
- Label,
661
- ReactiveFormsModule,
662
- FormsModule
663
- ], 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"] }]
664
- }] });
665
-
666
- class TextEditorCommandEditLinkDirective {
667
- _destroyRef = inject(DestroyRef);
668
- _dialog = inject(Dialog);
669
- textEditor = inject(TEXT_EDITOR);
670
- setLinkActive = false;
671
- onClick() {
672
- this.setLinkActive = true;
673
- const dialogRef = this._dialog.open(LinkDialog, {
674
- data: {
675
- linkUrl: this.textEditor.api.editor().getAttributes('link').href
676
- }
677
- });
678
- dialogRef
679
- .afterClosed()
680
- .pipe(takeUntilDestroyed(this._destroyRef))
681
- .subscribe((linkUrl) => {
682
- this.setLinkActive = false;
683
- if (typeof linkUrl === 'undefined') {
684
- return;
685
- }
686
- this._setLink(linkUrl);
687
- });
688
- }
689
- _setLink(url) {
690
- // cancelled
691
- if (url === null) {
692
- return;
693
- }
694
- // empty
695
- if (url === '') {
696
- this.textEditor.api.editor()
697
- .chain()
698
- .focus()
699
- .extendMarkRange('link')
700
- .unsetLink()
701
- .run();
702
- return;
703
- }
704
- // update link
705
- this.textEditor.api.editor()
706
- .chain()
707
- .focus()
708
- .extendMarkRange('link')
709
- .setLink({ href: url })
710
- .run();
711
- }
712
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandEditLinkDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
713
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandEditLinkDirective, isStandalone: true, selector: "[ngsTextEditorCommandEditLink]", host: { listeners: { "click": "onClick()" }, properties: { "class.button": "true" } }, exportAs: ["ngsTextEditorCommandEditLink"], ngImport: i0 });
714
- }
715
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandEditLinkDirective, decorators: [{
716
- type: Directive,
717
- args: [{
718
- selector: '[ngsTextEditorCommandEditLink]',
719
- exportAs: 'ngsTextEditorCommandEditLink',
720
- host: {
721
- '[class.button]': 'true',
722
- '(click)': `onClick()`
723
- }
724
- }]
725
- }] });
726
-
727
- class TextEditorCommandImageDirective {
728
- textEditor = inject(TEXT_EDITOR);
729
- onImageSelected(event) {
730
- const file = event.files[0];
731
- const reader = new FileReader();
732
- reader.readAsDataURL(file);
733
- reader.onload = () => {
734
- const src = reader.result;
735
- this.textEditor.api.editor().chain().focus().addImageUploadingPlaceholder({ src, file }).run();
736
- };
737
- }
738
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandImageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
739
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandImageDirective, isStandalone: true, selector: "[ngsTextEditorCommandImage]", host: { listeners: { "fileSelected": "onImageSelected($event)" }, properties: { "attr.accept": "\"image/*\"" } }, exportAs: ["ngsTextEditorCommandImage"], hostDirectives: [{ directive: i1$1.UploadTriggerDirective, outputs: ["fileSelected", "fileSelected"] }], ngImport: i0 });
740
- }
741
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandImageDirective, decorators: [{
742
- type: Directive,
743
- args: [{
744
- selector: '[ngsTextEditorCommandImage]',
745
- exportAs: 'ngsTextEditorCommandImage',
746
- hostDirectives: [
747
- {
748
- directive: UploadTriggerDirective,
749
- outputs: ['fileSelected']
750
- }
751
- ],
752
- host: {
753
- '[attr.accept]': '"image/*"',
754
- '(fileSelected)': `onImageSelected($event)`
755
- }
756
- }]
757
- }] });
758
-
759
- class TextEditorCommandItalicDirective {
760
- textEditor = inject(TEXT_EDITOR);
761
- onClick() {
762
- this.textEditor.api.runCommand('toggleItalic');
763
- }
764
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandItalicDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
765
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandItalicDirective, isStandalone: true, selector: "[ngsTextEditorCommandItalic]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(textEditor && textEditor.api.isCommandDisabled('toggleItalic')) ? '' : null", "class.active": "textEditor && textEditor.api.isActive('italic')" } }, exportAs: ["ngsTextEditorCommandItalic"], ngImport: i0 });
766
- }
767
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandItalicDirective, decorators: [{
768
- type: Directive,
769
- args: [{
770
- selector: '[ngsTextEditorCommandItalic]',
771
- exportAs: 'ngsTextEditorCommandItalic',
772
- host: {
773
- '[attr.disabled]': `(textEditor && textEditor.api.isCommandDisabled('toggleItalic')) ? '' : null`,
774
- '[class.active]': `textEditor && textEditor.api.isActive('italic')`,
775
- '(click)': `onClick()`
776
- }
777
- }]
778
- }] });
779
-
780
- class TextEditorCommandDirective {
781
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
782
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandDirective, isStandalone: true, selector: "[ngsTextEditorCommand]", host: { properties: { "class.button": "true" } }, exportAs: ["ngsTextEditorCommand"], ngImport: i0 });
783
- }
784
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandDirective, decorators: [{
785
- type: Directive,
786
- args: [{
787
- selector: '[ngsTextEditorCommand]',
788
- exportAs: 'ngsTextEditorCommand',
789
- host: {
790
- '[class.button]': 'true'
791
- }
792
- }]
793
- }] });
794
-
795
- class YoutubeDialog {
796
- _dialogRef = inject(DialogRef);
797
- _data = inject(DIALOG_DATA);
798
- linkUrl = this._data.linkUrl || '';
799
- isUpdate = !!this._data.linkUrl;
800
- onSubmit() {
801
- this._dialogRef.close(this.linkUrl);
802
- }
803
- _onNoClick() {
804
- this._dialogRef.close();
805
- }
806
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: YoutubeDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
807
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: YoutubeDialog, isStandalone: true, selector: "ngs-youtube", exportAs: ["ngsYoutube"], ngImport: i0, template: "<form class=\"w-[500px]\" (ngSubmit)=\"onSubmit()\">\n <h3 ngs-dialog-title>\n @if (isUpdate) {\n Update Youtube\n } @else {\n Add Youtube\n }\n </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 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 url\n }\n </button>\n </div>\n</form>\n", styles: ["/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.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: "directive", type: Input, selector: "input[ngsInput], textarea[ngsInput]", inputs: ["id", "placeholder", "required", "disabled", "readonly", "errorStateMatcher"], exportAs: ["ngsInput"] }, { kind: "component", type: Label, selector: "ngs-label" }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.Eager });
808
- }
809
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: YoutubeDialog, decorators: [{
810
- type: Component,
811
- args: [{ selector: 'ngs-youtube', exportAs: 'ngsYoutube', imports: [
812
- FormsModule,
813
- Button,
814
- DialogActions,
815
- DialogContent,
816
- DialogTitle,
817
- FormField,
818
- Input,
819
- Label,
820
- ReactiveFormsModule
821
- ], changeDetection: ChangeDetectionStrategy.Eager, template: "<form class=\"w-[500px]\" (ngSubmit)=\"onSubmit()\">\n <h3 ngs-dialog-title>\n @if (isUpdate) {\n Update Youtube\n } @else {\n Add Youtube\n }\n </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 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 url\n }\n </button>\n </div>\n</form>\n", styles: ["/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
822
- }] });
823
-
824
- class TextEditorCommandYoutubeDirective {
825
- textEditor = inject(TEXT_EDITOR);
826
- _dialog = inject(Dialog);
827
- _destroyRef = inject(DestroyRef);
828
- onClick() {
829
- const dialogRef = this._dialog.open(YoutubeDialog, {
830
- data: {
831
- linkUrl: this.textEditor.api.editor().getAttributes('iframe').src
832
- }
833
- });
834
- dialogRef
835
- .afterClosed()
836
- .pipe(takeUntilDestroyed(this._destroyRef))
837
- .subscribe((linkUrl) => {
838
- if (typeof linkUrl === 'undefined') {
839
- return;
840
- }
841
- this.textEditor.api.editor().commands.setYoutubeVideo({
842
- src: linkUrl
843
- });
844
- });
845
- }
846
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandYoutubeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
847
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandYoutubeDirective, isStandalone: true, selector: "[ngsTextEditorCommandYoutube]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(textEditor && textEditor.api.isCommandDisabled('toggleBlockquote')) ? '' : null", "class.active": "textEditor && textEditor.api.isActive('blockquote')" } }, exportAs: ["ngsTextEditorCommandYoutube"], ngImport: i0 });
848
- }
849
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandYoutubeDirective, decorators: [{
850
- type: Directive,
851
- args: [{
852
- selector: '[ngsTextEditorCommandYoutube]',
853
- exportAs: 'ngsTextEditorCommandYoutube',
854
- host: {
855
- '[attr.disabled]': `(textEditor && textEditor.api.isCommandDisabled('toggleBlockquote')) ? '' : null`,
856
- '[class.active]': `textEditor && textEditor.api.isActive('blockquote')`,
857
- '(click)': `onClick()`
858
- }
859
- }]
860
- }] });
861
-
862
- class TextEditorCommandUnsetLinkDirective {
863
- textEditor = inject(TEXT_EDITOR);
864
- onClick() {
865
- this.textEditor.api.editor().commands.unsetLink();
866
- }
867
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandUnsetLinkDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
868
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandUnsetLinkDirective, isStandalone: true, selector: "[ngsTextEditorCommandUnsetLink]", host: { listeners: { "click": "onClick()" }, properties: { "class.button": "true" } }, exportAs: ["ngsTextEditorCommandUnsetLink"], ngImport: i0 });
869
- }
870
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandUnsetLinkDirective, decorators: [{
871
- type: Directive,
872
- args: [{
873
- selector: '[ngsTextEditorCommandUnsetLink]',
874
- exportAs: 'ngsTextEditorCommandUnsetLink',
875
- host: {
876
- '[class.button]': 'true',
877
- '(click)': `onClick()`
878
- }
879
- }]
880
- }] });
881
-
882
- class TextEditorCommandStrikeDirective {
883
- textEditor = inject(TEXT_EDITOR);
884
- onClick() {
885
- this.textEditor.api.runCommand('toggleStrike');
886
- }
887
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandStrikeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
888
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandStrikeDirective, isStandalone: true, selector: "[ngsTextEditorCommandStrike]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(textEditor && textEditor.api.isCommandDisabled('toggleStrike')) ? '' : null", "class.active": "textEditor && textEditor.api.isActive('strike')" } }, exportAs: ["ngsTextEditorCommandStrike"], ngImport: i0 });
889
- }
890
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandStrikeDirective, decorators: [{
891
- type: Directive,
892
- args: [{
893
- selector: '[ngsTextEditorCommandStrike]',
894
- exportAs: 'ngsTextEditorCommandStrike',
895
- host: {
896
- '[attr.disabled]': `(textEditor && textEditor.api.isCommandDisabled('toggleStrike')) ? '' : null`,
897
- '[class.active]': `textEditor && textEditor.api.isActive('strike')`,
898
- '(click)': `onClick()`
899
- }
900
- }]
901
- }] });
902
-
903
- class TextEditorCommandOrderedListDirective {
904
- textEditor = inject(TEXT_EDITOR);
905
- onClick() {
906
- this.textEditor.api.runCommand('toggleOrderedList');
907
- }
908
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandOrderedListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
909
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandOrderedListDirective, isStandalone: true, selector: "[ngsTextEditorCommandOrderedList]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(textEditor && textEditor.api.isCommandDisabled('toggleOrderedList')) ? '' : null", "class.active": "textEditor && textEditor.api.isActive('orderedList')" } }, exportAs: ["ngsTextEditorCommandOrderedList"], ngImport: i0 });
910
- }
911
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandOrderedListDirective, decorators: [{
912
- type: Directive,
913
- args: [{
914
- selector: '[ngsTextEditorCommandOrderedList]',
915
- exportAs: 'ngsTextEditorCommandOrderedList',
916
- host: {
917
- '[attr.disabled]': `(textEditor && textEditor.api.isCommandDisabled('toggleOrderedList')) ? '' : null`,
918
- '[class.active]': `textEditor && textEditor.api.isActive('orderedList')`,
919
- '(click)': `onClick()`
920
- }
921
- }]
922
- }] });
923
-
924
- class TextEditorCommandLinkDirective {
925
- _destroyRef = inject(DestroyRef);
926
- _dialog = inject(Dialog);
927
- textEditor = inject(TEXT_EDITOR);
928
- setLinkActive = false;
929
- onClick() {
930
- this.setLinkActive = true;
931
- const dialogRef = this._dialog.open(LinkDialog, {
932
- data: {
933
- linkUrl: this.textEditor.api.editor().getAttributes('link').href
934
- }
935
- });
936
- dialogRef
937
- .afterClosed()
938
- .pipe(takeUntilDestroyed(this._destroyRef))
939
- .subscribe((linkUrl) => {
940
- this.setLinkActive = false;
941
- if (typeof linkUrl === 'undefined') {
942
- return;
943
- }
944
- this._setLink(linkUrl);
945
- });
946
- }
947
- _setLink(url) {
948
- // cancelled
949
- if (url === null) {
950
- return;
951
- }
952
- // empty
953
- if (url === '') {
954
- this.textEditor.api.editor()
955
- .chain()
956
- .focus()
957
- .extendMarkRange('link')
958
- .unsetLink()
959
- .run();
960
- return;
961
- }
962
- // update link
963
- this.textEditor.api.editor()
964
- .chain()
965
- .focus()
966
- .extendMarkRange('link')
967
- .setLink({ href: url })
968
- .run();
969
- }
970
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandLinkDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
971
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandLinkDirective, isStandalone: true, selector: "[ngsTextEditorCommandLink]", host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "(textEditor && textEditor.api.isCommandDisabled('toggleLink')) ? '' : null", "class.active": "textEditor && textEditor.api.isActive('link')" } }, exportAs: ["ngsTextEditorCommandLink"], ngImport: i0 });
972
- }
973
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandLinkDirective, decorators: [{
974
- type: Directive,
975
- args: [{
976
- selector: '[ngsTextEditorCommandLink]',
977
- exportAs: 'ngsTextEditorCommandLink',
978
- host: {
979
- '[attr.disabled]': `(textEditor && textEditor.api.isCommandDisabled('toggleLink')) ? '' : null`,
980
- '[class.active]': `textEditor && textEditor.api.isActive('link')`,
981
- '(click)': `onClick()`
982
- }
983
- }]
984
- }] });
985
-
986
- class TextEditorCommandHeadingDirective {
987
- textEditor = inject(TEXT_EDITOR);
988
- level = input.required({ ...(ngDevMode ? { debugName: "level" } : /* istanbul ignore next */ {}), transform: numberAttribute });
989
- get isActive() {
990
- return !!(this.textEditor && this.textEditor.api.isActive('heading', { level: this.level() }));
991
- }
992
- get isDisabled() {
993
- return !!(this.textEditor && this.textEditor.api.isCommandDisabled('toggleHeading', { level: this.level() }));
994
- }
995
- onClick() {
996
- this.textEditor.api.runCommand('toggleHeading', { level: this.level() });
997
- }
998
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandHeadingDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
999
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.7", type: TextEditorCommandHeadingDirective, isStandalone: true, selector: "[ngsTextEditorCommandHeading]", inputs: { level: { classPropertyName: "level", publicName: "level", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "isDisabled ? '' : null", "class.active": "isActive" } }, exportAs: ["ngsTextEditorCommandHeading"], ngImport: i0 });
1000
- }
1001
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandHeadingDirective, decorators: [{
1002
- type: Directive,
1003
- args: [{
1004
- selector: '[ngsTextEditorCommandHeading]',
1005
- exportAs: 'ngsTextEditorCommandHeading',
1006
- host: {
1007
- '[attr.disabled]': `isDisabled ? '' : null`,
1008
- '[class.active]': `isActive`,
1009
- '(click)': `onClick()`
1010
- }
1011
- }]
1012
- }], propDecorators: { level: [{ type: i0.Input, args: [{ isSignal: true, alias: "level", required: true }] }] } });
1013
-
1014
- class TextEditorCommandHorizontalRuleDirective {
1015
- textEditor = inject(TEXT_EDITOR);
1016
- onClick() {
1017
- this.textEditor.api.editor().chain().focus().setHorizontalRule().run();
1018
- }
1019
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandHorizontalRuleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1020
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextEditorCommandHorizontalRuleDirective, isStandalone: true, selector: "[ngsTextEditorCommandHorizontalRule]", host: { listeners: { "click": "onClick()" }, properties: { "class.button": "true" } }, ngImport: i0 });
1021
- }
1022
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextEditorCommandHorizontalRuleDirective, decorators: [{
1023
- type: Directive,
1024
- args: [{
1025
- selector: '[ngsTextEditorCommandHorizontalRule]',
1026
- host: {
1027
- '[class.button]': 'true',
1028
- '(click)': `onClick()`
1029
- }
1030
- }]
1031
- }] });
1032
-
1033
- /**
1034
- * Generated bundle index. Do not edit.
1035
- */
1036
-
1037
- export { TEXT_EDITOR, TEXT_EDITOR_BUBBLE_MENU, TextEditor, TextEditorBubbleMenu, TextEditorCommandBlockquoteDirective, TextEditorCommandBoldDirective, TextEditorCommandBulletListDirective, TextEditorCommandCodeBlockDirective, TextEditorCommandCodeDirective, TextEditorCommandDirective, TextEditorCommandEditLinkDirective, TextEditorCommandHeadingDirective, TextEditorCommandHorizontalRuleDirective, TextEditorCommandImageDirective, TextEditorCommandItalicDirective, TextEditorCommandLinkDirective, TextEditorCommandOrderedListDirective, TextEditorCommandStrikeDirective, TextEditorCommandUnsetLinkDirective, TextEditorCommandYoutubeDirective, TextEditorDivider, TextEditorFloatingMenu, TextEditorToolbar };
1038
- //# sourceMappingURL=ngstarter-ui-components-text-editor.mjs.map