@firestitch/html-editor 9.5.9 → 12.0.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.
Files changed (62) hide show
  1. package/app/components/html-editor/html-editor.component.d.ts +9 -5
  2. package/app/components/html-renderer/html-renderer.component.d.ts +4 -1
  3. package/app/enums/default-plugin.enum.d.ts +3 -2
  4. package/app/fs-html-editor.module.d.ts +20 -3
  5. package/app/interfaces/html-editor-config.d.ts +12 -3
  6. package/app/services/froala-loader.service.d.ts +8 -5
  7. package/bundles/firestitch-html-editor.umd.js +421 -268
  8. package/bundles/firestitch-html-editor.umd.js.map +1 -1
  9. package/esm2015/app/classes/plugin.js +1 -1
  10. package/esm2015/app/components/html-editor/html-editor.component.js +106 -62
  11. package/esm2015/app/components/html-renderer/html-renderer.component.js +20 -25
  12. package/esm2015/app/consts/paragraph-buttons.const.js +1 -1
  13. package/esm2015/app/consts/rich-buttons.const.js +1 -1
  14. package/esm2015/app/consts/text-buttons.const.js +1 -1
  15. package/esm2015/app/enums/default-plugin.enum.js +2 -1
  16. package/esm2015/app/fs-html-editor.module.js +30 -22
  17. package/esm2015/app/injects/config.inject.js +1 -1
  18. package/esm2015/app/interfaces/html-editor-config.js +2 -1
  19. package/esm2015/app/interfaces/plugin-button.js +2 -1
  20. package/esm2015/app/interfaces/plugin-config.js +2 -1
  21. package/esm2015/app/plugins/checklist.plugin.js +1 -1
  22. package/esm2015/app/plugins/code.plugin.js +1 -1
  23. package/esm2015/app/plugins/configs/mention-plugin.config.js +2 -1
  24. package/esm2015/app/plugins/configs/screen-record-plugin.config.js +2 -1
  25. package/esm2015/app/plugins/mention.plugin.js +1 -1
  26. package/esm2015/app/plugins/screen-record.plugin.js +1 -1
  27. package/esm2015/app/services/froala-loader.service.js +23 -24
  28. package/esm2015/app/utils/loader.js +2 -1
  29. package/esm2015/firestitch-html-editor.js +1 -5
  30. package/esm2015/public_api.js +1 -1
  31. package/fesm2015/firestitch-html-editor.js +182 -131
  32. package/fesm2015/firestitch-html-editor.js.map +1 -1
  33. package/firestitch-html-editor.d.ts +1 -5
  34. package/package.json +4 -7
  35. package/styles.scss +3 -2
  36. package/bundles/firestitch-html-editor.umd.min.js +0 -17
  37. package/bundles/firestitch-html-editor.umd.min.js.map +0 -1
  38. package/esm5/app/classes/plugin.js +0 -9
  39. package/esm5/app/components/html-editor/html-editor.component.js +0 -471
  40. package/esm5/app/components/html-renderer/html-renderer.component.js +0 -39
  41. package/esm5/app/consts/paragraph-buttons.const.js +0 -9
  42. package/esm5/app/consts/rich-buttons.const.js +0 -7
  43. package/esm5/app/consts/text-buttons.const.js +0 -19
  44. package/esm5/app/enums/default-plugin.enum.js +0 -1
  45. package/esm5/app/fs-html-editor.module.js +0 -62
  46. package/esm5/app/injects/config.inject.js +0 -4
  47. package/esm5/app/interfaces/html-editor-config.js +0 -1
  48. package/esm5/app/interfaces/plugin-button.js +0 -1
  49. package/esm5/app/interfaces/plugin-config.js +0 -1
  50. package/esm5/app/plugins/checklist.plugin.js +0 -41
  51. package/esm5/app/plugins/code.plugin.js +0 -70
  52. package/esm5/app/plugins/configs/mention-plugin.config.js +0 -1
  53. package/esm5/app/plugins/configs/screen-record-plugin.config.js +0 -1
  54. package/esm5/app/plugins/mention.plugin.js +0 -93
  55. package/esm5/app/plugins/screen-record.plugin.js +0 -106
  56. package/esm5/app/services/froala-loader.service.js +0 -96
  57. package/esm5/app/utils/loader.js +0 -83
  58. package/esm5/firestitch-html-editor.js +0 -9
  59. package/esm5/public_api.js +0 -12
  60. package/fesm5/firestitch-html-editor.js +0 -1074
  61. package/fesm5/firestitch-html-editor.js.map +0 -1
  62. package/firestitch-html-editor.metadata.json +0 -1
@@ -1,15 +1,18 @@
1
- import { __decorate, __param, __metadata, __awaiter } from 'tslib';
2
- import { InjectionToken, Optional, Inject, ɵɵdefineInjectable, ɵɵinject, Injectable, ChangeDetectorRef, HostBinding, ViewChild, ElementRef, Input, Component, forwardRef, ChangeDetectionStrategy, NgModule } from '@angular/core';
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, Injectable, Optional, Inject, Component, ChangeDetectionStrategy, Input, forwardRef, HostBinding, ViewChild, NgModule } from '@angular/core';
3
+ import * as i3 from '@angular/common';
3
4
  import { CommonModule } from '@angular/common';
5
+ import * as i4 from '@firestitch/skeleton';
4
6
  import { FsSkeletonModule } from '@firestitch/skeleton';
5
7
  import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
6
8
  import { FileProcessor, FsFile } from '@firestitch/file';
7
9
  import { Observable, BehaviorSubject, combineLatest, ReplaySubject, Subject, fromEventPattern } from 'rxjs';
8
10
  import { shareReplay, map, tap, concatMap, switchMap, filter, startWith, distinctUntilChanged, skip, takeUntil } from 'rxjs/operators';
9
11
  import { merge, debounce } from 'lodash-es';
10
- import { DomSanitizer } from '@angular/platform-browser';
12
+ import * as i1 from '@angular/platform-browser';
11
13
  import Tribute from 'tributejs';
12
14
  import { guid } from '@firestitch/common';
15
+ import { __awaiter } from 'tslib';
13
16
 
14
17
  const RichButtons = [
15
18
  'insertTable',
@@ -68,6 +71,7 @@ function resourceLoaderFactory() {
68
71
  quote: 'plugins/quote.min.js',
69
72
  draggable: 'plugins/draggable.min.js',
70
73
  font_size: 'plugins/font_size.min.js',
74
+ quick_insert: 'plugins/quick_insert.min.js',
71
75
  };
72
76
  const stylesPaths = {
73
77
  froala: 'froala_editor.pkgd.min.css',
@@ -130,12 +134,12 @@ function resourceLoaderFactory() {
130
134
  }
131
135
  const ResourceLoader = resourceLoaderFactory();
132
136
 
133
- let FsFroalaLoaderService = class FsFroalaLoaderService {
137
+ class FsFroalaLoaderService {
134
138
  constructor(_defaultConfig) {
135
139
  this._defaultConfig = _defaultConfig;
136
140
  this._froalaLoaded = new BehaviorSubject(false);
137
- this._defaultPluginsLoaded = new BehaviorSubject(false);
138
- this._loaded$ = combineLatest([this._froalaLoaded, this._defaultPluginsLoaded])
141
+ this._froalaPluginsLoaded = new BehaviorSubject(false);
142
+ this._loaded$ = combineLatest([this._froalaLoaded, this._froalaPluginsLoaded])
139
143
  .pipe(map(([FroalaReady, pluginsRead]) => {
140
144
  return pluginsRead && FroalaReady;
141
145
  }), shareReplay(1));
@@ -153,7 +157,7 @@ let FsFroalaLoaderService = class FsFroalaLoaderService {
153
157
  return this._loaded$;
154
158
  }
155
159
  get ready() {
156
- return this._froalaLoaded.getValue() && this._defaultPluginsLoaded.getValue();
160
+ return this._froalaLoaded.getValue() && this._froalaPluginsLoaded.getValue();
157
161
  }
158
162
  get FroalaEditor() {
159
163
  return this._FroalaEditor;
@@ -169,13 +173,13 @@ let FsFroalaLoaderService = class FsFroalaLoaderService {
169
173
  }), concatMap(() => {
170
174
  return this._loadPlugins();
171
175
  }), tap(() => {
172
- this._defaultPluginsDone();
176
+ this._froalaPluginsDone();
173
177
  }))
174
178
  .subscribe();
175
179
  }
176
180
  _loadPlugins() {
177
181
  const imports = this._defaultConfig
178
- .defaultPlugins
182
+ .froalaPlugins
179
183
  .reduce((acc, pluginName) => {
180
184
  const import$ = ResourceLoader.loadResource(pluginName);
181
185
  acc.push(import$);
@@ -186,24 +190,50 @@ let FsFroalaLoaderService = class FsFroalaLoaderService {
186
190
  _froalaDone() {
187
191
  this._froalaLoaded.next(true);
188
192
  }
189
- _defaultPluginsDone() {
190
- this._defaultPluginsLoaded.next(true);
191
- }
192
- };
193
- FsFroalaLoaderService.ctorParameters = () => [
194
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [FS_HTML_EDITOR_CONFIG,] }] }
195
- ];
196
- FsFroalaLoaderService.ɵprov = ɵɵdefineInjectable({ factory: function FsFroalaLoaderService_Factory() { return new FsFroalaLoaderService(ɵɵinject(FS_HTML_EDITOR_CONFIG, 8)); }, token: FsFroalaLoaderService, providedIn: "root" });
197
- FsFroalaLoaderService = __decorate([
198
- Injectable({
199
- providedIn: 'root',
200
- }),
201
- __param(0, Optional()), __param(0, Inject(FS_HTML_EDITOR_CONFIG)),
202
- __metadata("design:paramtypes", [Object])
203
- ], FsFroalaLoaderService);
193
+ _froalaPluginsDone() {
194
+ this._froalaPluginsLoaded.next(true);
195
+ }
196
+ }
197
+ FsFroalaLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFroalaLoaderService, deps: [{ token: FS_HTML_EDITOR_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
198
+ FsFroalaLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFroalaLoaderService, providedIn: 'root' });
199
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsFroalaLoaderService, decorators: [{
200
+ type: Injectable,
201
+ args: [{
202
+ providedIn: 'root',
203
+ }]
204
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
205
+ type: Optional
206
+ }, {
207
+ type: Inject,
208
+ args: [FS_HTML_EDITOR_CONFIG]
209
+ }] }]; } });
204
210
 
205
- var FsHtmlEditorComponent_1;
206
- let FsHtmlEditorComponent = FsHtmlEditorComponent_1 = class FsHtmlEditorComponent {
211
+ class FsHtmlRendererComponent {
212
+ constructor(sanitized, _cdRef) {
213
+ this.sanitized = sanitized;
214
+ this._cdRef = _cdRef;
215
+ }
216
+ set setHtml(html) {
217
+ this.trustedHtml = this.sanitized.bypassSecurityTrustHtml(html || '');
218
+ this._cdRef.markForCheck();
219
+ }
220
+ }
221
+ FsHtmlRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsHtmlRendererComponent, deps: [{ token: i1.DomSanitizer }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
222
+ FsHtmlRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsHtmlRendererComponent, selector: "fs-html-renderer", inputs: { setHtml: ["html", "setHtml"] }, ngImport: i0, template: "<div class=\"fr-view fs-html-editor-default\" [innerHtml]=\"trustedHtml\"></div>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
223
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsHtmlRendererComponent, decorators: [{
224
+ type: Component,
225
+ args: [{
226
+ selector: 'fs-html-renderer',
227
+ templateUrl: 'html-renderer.component.html',
228
+ styleUrls: ['html-renderer.component.scss'],
229
+ changeDetection: ChangeDetectionStrategy.OnPush,
230
+ }]
231
+ }], ctorParameters: function () { return [{ type: i1.DomSanitizer }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { setHtml: [{
232
+ type: Input,
233
+ args: ['html']
234
+ }] } });
235
+
236
+ class FsHtmlEditorComponent {
207
237
  constructor(_defaultConfig, _cdRef, _fr) {
208
238
  this._defaultConfig = _defaultConfig;
209
239
  this._cdRef = _cdRef;
@@ -253,7 +283,7 @@ let FsHtmlEditorComponent = FsHtmlEditorComponent_1 = class FsHtmlEditorComponen
253
283
  initialize(options = {}) {
254
284
  const config = this._createConfig();
255
285
  this._initPlugins(config);
256
- // this.el.innerHTML = this._html || '';
286
+ this._initButtons(config);
257
287
  this._editor = new this._fr.FroalaEditor(this.el, this._createOptions(), () => {
258
288
  this._froalaReady$.next({ config, options });
259
289
  });
@@ -266,16 +296,6 @@ let FsHtmlEditorComponent = FsHtmlEditorComponent_1 = class FsHtmlEditorComponen
266
296
  return this.config.image.upload(f.file);
267
297
  }));
268
298
  }
269
- _getTextNode(node) {
270
- if (node) {
271
- if (node.nodeType === Node.TEXT_NODE) {
272
- return node;
273
- }
274
- if (node.childNodes) {
275
- return this._getTextNode(node.childNodes[0]);
276
- }
277
- }
278
- }
279
299
  uninitializedClick(event) {
280
300
  if (!event.defaultPrevented) {
281
301
  const target = event.target;
@@ -376,6 +396,41 @@ let FsHtmlEditorComponent = FsHtmlEditorComponent_1 = class FsHtmlEditorComponen
376
396
  // this._html = html;
377
397
  this.onChange(html);
378
398
  }
399
+ _initButtons(config) {
400
+ (config.buttons || [])
401
+ .forEach((button) => {
402
+ /*
403
+ Svg Keys:
404
+ ["add", "advancedImageEditor", "alignCenter", "alignJustify", "alignLeft", "alignRight",
405
+ "anchors", "back", "backgroundColor", "blockquote", "bold", "cellBackground",
406
+ "cellBorderColor", "cellOptions", "cellStyle", "clearFormatting", "close", "codeView",
407
+ "cogs", "columns", "editLink", "exitFullscreen", "fontAwesome", "fontFamily",
408
+ "fontSize", "fullscreen", "help", "horizontalLine", "imageAltText", "imageCaption",
409
+ "imageClass", "imageDisplay", "imageManager", "imageSize", "indent", "inlineClass",
410
+ "inlineStyle", "insertEmbed", "insertFile", "insertImage", "insertLink", "insertMore",
411
+ "insertTable", "insertVideo", "upload", "italic", "search", "lineHeight", "linkStyles",
412
+ "mention", "more", "openLink", "orderedList", "outdent", "pageBreaker",
413
+ "paragraphFormat", "paragraphMore", "paragraphStyle", "pdfExport", "print",
414
+ "redo", "removeTable", "remove", "replaceImage", "row", "selectAll", "smile",
415
+ "spellcheck", "star", "strikeThrough", "subscript", "superscript", "symbols", "tags",
416
+ "tableHeader", "tableStyle", "textColor", "textMore", "underline", "undo", "unlink",
417
+ "unorderedList", "verticalAlignBottom", "verticalAlignMiddle", "verticalAlignTop"]
418
+ */
419
+ var _a, _b, _c;
420
+ if (button.svgKey) {
421
+ this._fr.FroalaEditor.DefineIcon(button.name, { SVG_KEY: button.svgKey });
422
+ }
423
+ this._fr.FroalaEditor.RegisterCommand(button.name, {
424
+ title: button.title,
425
+ focus: (_a = button.focus) !== null && _a !== void 0 ? _a : true,
426
+ undo: (_b = button.undo) !== null && _b !== void 0 ? _b : true,
427
+ refreshAfterCallback: (_c = button.refreshAfterCallback) !== null && _c !== void 0 ? _c : true,
428
+ callback: function () {
429
+ button.click(this);
430
+ }
431
+ });
432
+ });
433
+ }
379
434
  _initPlugins(config) {
380
435
  (config.plugins || []).forEach((plugin) => {
381
436
  this._fr.FroalaEditor.PLUGINS[plugin.config.name] = function (editor) {
@@ -415,6 +470,7 @@ let FsHtmlEditorComponent = FsHtmlEditorComponent_1 = class FsHtmlEditorComponen
415
470
  // For some reason editor store somewhere pointer on default config object and dublicate options each time on init
416
471
  // Extra merge level fixed this problem and allow to init config properly without legacy data
417
472
  {}, {
473
+ shortcutsEnabled: ['show', 'bold', 'italic', 'underline', 'indent', 'outdent', 'undo', 'redo', 'insertImage', 'createLink'],
418
474
  key: config.activationKey,
419
475
  placeholderText: config.placeholder,
420
476
  linkAlwaysBlank: true,
@@ -588,87 +644,72 @@ let FsHtmlEditorComponent = FsHtmlEditorComponent_1 = class FsHtmlEditorComponen
588
644
  this.focus();
589
645
  }
590
646
  }
591
- };
592
- FsHtmlEditorComponent.ctorParameters = () => [
593
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [FS_HTML_EDITOR_CONFIG,] }] },
594
- { type: ChangeDetectorRef },
595
- { type: FsFroalaLoaderService }
596
- ];
597
- __decorate([
598
- HostBinding('class.focused'),
599
- __metadata("design:type", Object)
600
- ], FsHtmlEditorComponent.prototype, "classFocused", void 0);
601
- __decorate([
602
- HostBinding('class.disabled'),
603
- __metadata("design:type", Object)
604
- ], FsHtmlEditorComponent.prototype, "classDisabled", void 0);
605
- __decorate([
606
- ViewChild('elRef'),
607
- __metadata("design:type", ElementRef)
608
- ], FsHtmlEditorComponent.prototype, "elRef", void 0);
609
- __decorate([
610
- Input(),
611
- __metadata("design:type", Object)
612
- ], FsHtmlEditorComponent.prototype, "config", void 0);
613
- FsHtmlEditorComponent = FsHtmlEditorComponent_1 = __decorate([
614
- Component({
615
- selector: 'fs-html-editor',
616
- template: "<div class=\"fs-html-editor-default\">\n <ng-container *ngIf=\"initialized\">\n <ng-container *fsSkeleton=\"(froalaLoaded$ | async) !== false\">\n </ng-container>\n </ng-container>\n\n <div #elRef></div>\n\n <div class=\"bottom-line\"></div>\n <div class=\"disabled-line\"></div>\n <fs-html-renderer\n *ngIf=\"!initialized\"\n [html]=\"html\"\n (click)=\"uninitializedClick($event)\">\n </fs-html-renderer>\n</div>\n",
617
- providers: [
618
- {
619
- provide: NG_VALUE_ACCESSOR,
620
- useExisting: forwardRef(() => FsHtmlEditorComponent_1),
621
- multi: true
622
- },
623
- {
624
- provide: NG_VALIDATORS,
625
- useExisting: forwardRef(() => FsHtmlEditorComponent_1),
626
- multi: true
627
- },
628
- ],
629
- changeDetection: ChangeDetectionStrategy.OnPush,
630
- styles: [":host ::ng-deep .fr-box.fr-basic .fr-wrapper{border:0;border-bottom:1px solid #949494;margin-bottom:1px;background-color:transparent}:host ::ng-deep .fr-box.fr-basic .fr-element{padding:0;font-family:inherit;color:inherit;font-size:inherit;line-height:inherit;min-height:auto}:host ::ng-deep .fr-dropdown-menu .fr-dropdown-wrapper,:host ::ng-deep .fr-dropdown:after,:host ::ng-deep .fr-more-toolbar,:host ::ng-deep .fr-toolbar{transition:none!important}:host ::ng-deep .fr-toolbar.fr-top{position:-webkit-sticky;position:sticky;z-index:2;border-radius:0;background-color:#fff}:host ::ng-deep .fr-toolbar.fr-top .fr-btn-grp{margin:0 20px 0 0}:host ::ng-deep .fr-toolbar.fr-top .fr-btn-grp:nth-child(1):after,:host ::ng-deep .fr-toolbar.fr-top .fr-btn-grp:nth-child(2):after{content:\"\";position:absolute;top:9px;height:30px;border-left:1px solid #e5e5e5;margin-left:10px}:host ::ng-deep .fr-toolbar.fr-top div:first-of-type:before{border:none}:host ::ng-deep .fr-toolbar.fr-top.fr-toolbar-open .fr-newline{height:auto}:host ::ng-deep .fr-toolbar.fr-top .fr-btn-grp:first-child{margin-left:0}:host ::ng-deep .fr-toolbar.fr-top.fr-top{border:0}:host ::ng-deep .fr-toolbar.fr-top .fr-newline{margin:0}:host ::ng-deep .fr-toolbar.fr-top .fr-more-toolbar{z-index:auto}:host ::ng-deep .fr-toolbar.fr-top .fr-command.fr-btn{z-index:auto}:host ::ng-deep .fr-toolbar.fr-top .fr-command.fr-btn.fr-dropdown:after{right:3px}:host ::ng-deep .fr-toolbar.fr-top .fr-command.fr-btn.fr-dropdown.fr-selection span{margin-right:24px}:host ::ng-deep .fr-toolbar.fr-top .fr-command.fr-btn.fr-open{border-radius:4px;margin:4px 2px}:host ::ng-deep .fr-view ol,:host ::ng-deep .fr-view ul{list-style-position:unset}:host.disabled ::ng-deep .fr-box.fr-basic{opacity:.5;pointer-events:none}:host.disabled ::ng-deep .fr-box.fr-basic .fr-wrapper{border:none}:host.disabled ::ng-deep .disabled-line{display:block}::ng-deep .fr-popup{z-index:1001!important}::ng-deep .fr-video-by-url-layer .fr-checkbox-line{display:none}.disabled-line{display:none;position:absolute;bottom:-1px;z-index:1;background-image:linear-gradient(90deg,rgba(0,0,0,.42) 0,rgba(0,0,0,.42) 33%,transparent 0);background-size:4px 100%;background-repeat:repeat-x;height:1px;width:100%}.bottom-line{opacity:0;transform-origin:50%;transform:scaleX(.5);transition:background-color .3s cubic-bezier(.55,0,.55,.2);width:100%;border-bottom:2px solid #949494;position:absolute;bottom:-1px;z-index:1}:host{position:relative;display:block}:host.focused .bottom-line{opacity:1;display:block;transform:scaleX(1);transition:transform .3s cubic-bezier(.25,.8,.25,1),opacity .1s cubic-bezier(.25,.8,.25,1),background-color .3s cubic-bezier(.25,.8,.25,1)}::ng-deep .fs-html-editor-mention-container{position:absolute;top:0;left:0;height:auto;max-height:300px;max-width:500px;overflow:auto;display:block;z-index:999999;box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12);border-bottom-left-radius:4px;border-bottom-right-radius:4px;background:#fff}::ng-deep .fs-html-editor-mention-container ul{margin:0;padding:0;list-style:none}::ng-deep .fs-html-editor-mention-container li{padding:0 16px;cursor:pointer;line-height:48px}::ng-deep .fs-html-editor-mention-container li.highlight,::ng-deep .fs-html-editor-mention-container li:hover{background:#f5f5f5}::ng-deep .fs-html-editor-mention-container li.no-match{cursor:default}"]
631
- }),
632
- __param(0, Optional()), __param(0, Inject(FS_HTML_EDITOR_CONFIG)),
633
- __metadata("design:paramtypes", [Object, ChangeDetectorRef,
634
- FsFroalaLoaderService])
635
- ], FsHtmlEditorComponent);
636
-
637
- let FsHtmlRendererComponent = class FsHtmlRendererComponent {
638
- constructor(sanitized, _cdRef) {
639
- this.sanitized = sanitized;
640
- this._cdRef = _cdRef;
641
- }
642
- set setHtml(html) {
643
- this.trustedHtml = this.sanitized.bypassSecurityTrustHtml(html || '');
644
- this._cdRef.markForCheck();
647
+ _getTextNode(node) {
648
+ if (node) {
649
+ if (node.nodeType === Node.TEXT_NODE) {
650
+ return node;
651
+ }
652
+ if (node.childNodes) {
653
+ return this._getTextNode(node.childNodes[0]);
654
+ }
655
+ }
645
656
  }
646
- };
647
- FsHtmlRendererComponent.ctorParameters = () => [
648
- { type: DomSanitizer },
649
- { type: ChangeDetectorRef }
650
- ];
651
- __decorate([
652
- Input('html'),
653
- __metadata("design:type", Object),
654
- __metadata("design:paramtypes", [Object])
655
- ], FsHtmlRendererComponent.prototype, "setHtml", null);
656
- FsHtmlRendererComponent = __decorate([
657
- Component({
658
- selector: 'fs-html-renderer',
659
- template: "<div class=\"fr-view fs-html-editor-default\" [innerHtml]=\"trustedHtml\"></div>\n",
660
- changeDetection: ChangeDetectionStrategy.OnPush,
661
- styles: [""]
662
- }),
663
- __metadata("design:paramtypes", [DomSanitizer,
664
- ChangeDetectorRef])
665
- ], FsHtmlRendererComponent);
657
+ }
658
+ FsHtmlEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsHtmlEditorComponent, deps: [{ token: FS_HTML_EDITOR_CONFIG, optional: true }, { token: i0.ChangeDetectorRef }, { token: FsFroalaLoaderService }], target: i0.ɵɵFactoryTarget.Component });
659
+ FsHtmlEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsHtmlEditorComponent, selector: "fs-html-editor", inputs: { config: "config" }, host: { properties: { "class.focused": "this.classFocused", "class.disabled": "this.classDisabled" } }, providers: [
660
+ {
661
+ provide: NG_VALUE_ACCESSOR,
662
+ useExisting: forwardRef(() => FsHtmlEditorComponent),
663
+ multi: true
664
+ },
665
+ {
666
+ provide: NG_VALIDATORS,
667
+ useExisting: forwardRef(() => FsHtmlEditorComponent),
668
+ multi: true
669
+ },
670
+ ], viewQueries: [{ propertyName: "elRef", first: true, predicate: ["elRef"], descendants: true }], ngImport: i0, template: "<div class=\"fs-html-editor-default\">\n <ng-container *ngIf=\"initialized\">\n <ng-container *fsSkeleton=\"(froalaLoaded$ | async) !== false\">\n </ng-container>\n </ng-container>\n\n <div #elRef></div>\n\n <div class=\"bottom-line\"></div>\n <div class=\"disabled-line\"></div>\n <fs-html-renderer\n *ngIf=\"!initialized\"\n [html]=\"html\"\n (click)=\"uninitializedClick($event)\">\n </fs-html-renderer>\n</div>\n", styles: [":host ::ng-deep .fr-box.fr-basic .fr-wrapper{border:0;border-bottom:1px solid #949494;margin-bottom:1px;background-color:transparent}:host ::ng-deep .fr-box.fr-basic .fr-element{padding:0;font-family:inherit;color:inherit;font-size:inherit;line-height:inherit;min-height:auto}:host ::ng-deep .fr-more-toolbar,:host ::ng-deep .fr-toolbar,:host ::ng-deep .fr-dropdown:after,:host ::ng-deep .fr-dropdown-menu .fr-dropdown-wrapper{transition:none!important}:host ::ng-deep .fr-toolbar.fr-top{position:sticky;z-index:2;border-radius:0;background-color:#fff}:host ::ng-deep .fr-toolbar.fr-top .fr-btn-grp{margin:0 20px 0 0}:host ::ng-deep .fr-toolbar.fr-top .fr-btn-grp:nth-child(1):after,:host ::ng-deep .fr-toolbar.fr-top .fr-btn-grp:nth-child(2):after{content:\"\";position:absolute;top:9px;height:30px;border-left:1px solid #e5e5e5;margin-left:10px}:host ::ng-deep .fr-toolbar.fr-top div:first-of-type:before{border:none}:host ::ng-deep .fr-toolbar.fr-top.fr-toolbar-open .fr-newline{height:auto}:host ::ng-deep .fr-toolbar.fr-top .fr-btn-grp:first-child{margin-left:0}:host ::ng-deep .fr-toolbar.fr-top.fr-top{border:0}:host ::ng-deep .fr-toolbar.fr-top .fr-newline{margin:0}:host ::ng-deep .fr-toolbar.fr-top .fr-more-toolbar{z-index:auto}:host ::ng-deep .fr-toolbar.fr-top .fr-command.fr-btn{z-index:auto}:host ::ng-deep .fr-toolbar.fr-top .fr-command.fr-btn.fr-dropdown:after{right:3px}:host ::ng-deep .fr-toolbar.fr-top .fr-command.fr-btn.fr-dropdown.fr-selection span{margin-right:24px}:host ::ng-deep .fr-toolbar.fr-top .fr-command.fr-btn.fr-open{border-radius:4px;margin:4px 2px}:host ::ng-deep .fr-view ol,:host ::ng-deep .fr-view ul{list-style-position:unset}:host.disabled ::ng-deep .fr-box.fr-basic{opacity:.5;pointer-events:none}:host.disabled ::ng-deep .fr-box.fr-basic .fr-wrapper{border:none}:host.disabled ::ng-deep .disabled-line{display:block}::ng-deep .fr-popup{z-index:1001!important}::ng-deep .fr-video-by-url-layer .fr-checkbox-line{display:none}.disabled-line{display:none;position:absolute;bottom:-1px;z-index:1;background-image:linear-gradient(90deg,rgba(0,0,0,.42) 0,rgba(0,0,0,.42) 33%,transparent 0);background-size:4px 100%;background-repeat:repeat-x;height:1px;width:100%}.bottom-line{opacity:0;transform-origin:50%;transform:scaleX(.5);transition:background-color .3s cubic-bezier(.55,0,.55,.2);width:100%;border-bottom:2px solid #949494;position:absolute;bottom:-1px;z-index:1}:host{position:relative;display:block}:host.focused .bottom-line{opacity:1;display:block;transform:scaleX(1);transition:transform .3s cubic-bezier(.25,.8,.25,1),opacity .1s cubic-bezier(.25,.8,.25,1),background-color .3s cubic-bezier(.25,.8,.25,1)}::ng-deep .fs-html-editor-mention-container{position:absolute;top:0;left:0;height:auto;max-height:300px;max-width:500px;overflow:auto;display:block;z-index:999999;box-shadow:0 2px 4px -1px #0003,0 4px 5px #00000024,0 1px 10px #0000001f;border-bottom-left-radius:4px;border-bottom-right-radius:4px;background:#fff}::ng-deep .fs-html-editor-mention-container ul{margin:0;padding:0;list-style:none}::ng-deep .fs-html-editor-mention-container li{padding:0 16px;cursor:pointer;line-height:48px}::ng-deep .fs-html-editor-mention-container li.highlight,::ng-deep .fs-html-editor-mention-container li:hover{background:#F5F5F5}::ng-deep .fs-html-editor-mention-container li.no-match{cursor:default}\n"], components: [{ type: FsHtmlRendererComponent, selector: "fs-html-renderer", inputs: ["html"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.FsSkeletonContentDirective, selector: "[fsSkeleton]", inputs: ["fsSkeleton", "fsSkeletonPattern"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
671
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsHtmlEditorComponent, decorators: [{
672
+ type: Component,
673
+ args: [{
674
+ selector: 'fs-html-editor',
675
+ templateUrl: 'html-editor.component.html',
676
+ styleUrls: ['html-editor.component.scss'],
677
+ providers: [
678
+ {
679
+ provide: NG_VALUE_ACCESSOR,
680
+ useExisting: forwardRef(() => FsHtmlEditorComponent),
681
+ multi: true
682
+ },
683
+ {
684
+ provide: NG_VALIDATORS,
685
+ useExisting: forwardRef(() => FsHtmlEditorComponent),
686
+ multi: true
687
+ },
688
+ ],
689
+ changeDetection: ChangeDetectionStrategy.OnPush,
690
+ }]
691
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
692
+ type: Optional
693
+ }, {
694
+ type: Inject,
695
+ args: [FS_HTML_EDITOR_CONFIG]
696
+ }] }, { type: i0.ChangeDetectorRef }, { type: FsFroalaLoaderService }]; }, propDecorators: { classFocused: [{
697
+ type: HostBinding,
698
+ args: ['class.focused']
699
+ }], classDisabled: [{
700
+ type: HostBinding,
701
+ args: ['class.disabled']
702
+ }], elRef: [{
703
+ type: ViewChild,
704
+ args: ['elRef']
705
+ }], config: [{
706
+ type: Input
707
+ }] } });
666
708
 
667
- var FsHtmlEditorModule_1;
668
- let FsHtmlEditorModule = FsHtmlEditorModule_1 = class FsHtmlEditorModule {
709
+ class FsHtmlEditorModule {
669
710
  static forRoot(config = {}) {
670
711
  return {
671
- ngModule: FsHtmlEditorModule_1,
712
+ ngModule: FsHtmlEditorModule,
672
713
  providers: [
673
714
  { provide: FS_HTML_EDITOR_DEFAULT_CONFIG, useValue: config },
674
715
  {
@@ -679,25 +720,35 @@ let FsHtmlEditorModule = FsHtmlEditorModule_1 = class FsHtmlEditorModule {
679
720
  ]
680
721
  };
681
722
  }
682
- };
683
- FsHtmlEditorModule = FsHtmlEditorModule_1 = __decorate([
684
- NgModule({
685
- imports: [
723
+ }
724
+ FsHtmlEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsHtmlEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
725
+ FsHtmlEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsHtmlEditorModule, declarations: [FsHtmlEditorComponent,
726
+ FsHtmlRendererComponent], imports: [CommonModule,
727
+ FsSkeletonModule], exports: [FsHtmlEditorComponent,
728
+ FsHtmlRendererComponent] });
729
+ FsHtmlEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsHtmlEditorModule, imports: [[
686
730
  CommonModule,
687
731
  FsSkeletonModule,
688
- ],
689
- exports: [
690
- FsHtmlEditorComponent,
691
- FsHtmlRendererComponent,
692
- ],
693
- declarations: [
694
- FsHtmlEditorComponent,
695
- FsHtmlRendererComponent,
696
- ],
697
- })
698
- ], FsHtmlEditorModule);
732
+ ]] });
733
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsHtmlEditorModule, decorators: [{
734
+ type: NgModule,
735
+ args: [{
736
+ imports: [
737
+ CommonModule,
738
+ FsSkeletonModule,
739
+ ],
740
+ exports: [
741
+ FsHtmlEditorComponent,
742
+ FsHtmlRendererComponent,
743
+ ],
744
+ declarations: [
745
+ FsHtmlEditorComponent,
746
+ FsHtmlRendererComponent,
747
+ ],
748
+ }]
749
+ }] });
699
750
  function FsHtmlEditorConfigFactory(config) {
700
- return Object.assign({ defaultPlugins: [
751
+ return Object.assign({ froalaPlugins: [
701
752
  "align" /* Align */,
702
753
  "colors" /* Colors */,
703
754
  "image" /* Image */,
@@ -992,5 +1043,5 @@ class ScreenRecordPlugin extends Plugin {
992
1043
  * Generated bundle index. Do not edit.
993
1044
  */
994
1045
 
995
- export { ChecklistPlugin, CodePlugin, FS_HTML_EDITOR_CONFIG, FsHtmlEditorComponent, FsHtmlEditorModule, FsHtmlRendererComponent, MentionPlugin, ParagraphButtons, RichButtons, ScreenRecordPlugin, TextButtons, FsHtmlEditorConfigFactory as ɵa, FS_HTML_EDITOR_DEFAULT_CONFIG as ɵb, FsFroalaLoaderService as ɵc, Plugin as ɵe };
1046
+ export { ChecklistPlugin, CodePlugin, FS_HTML_EDITOR_CONFIG, FsHtmlEditorComponent, FsHtmlEditorModule, FsHtmlRendererComponent, MentionPlugin, ParagraphButtons, RichButtons, ScreenRecordPlugin, TextButtons };
996
1047
  //# sourceMappingURL=firestitch-html-editor.js.map