@firestitch/html-editor 9.4.2 → 9.5.0

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 (66) hide show
  1. package/app/classes/plugin.d.ts +7 -7
  2. package/app/components/html-editor/html-editor.component.d.ts +51 -51
  3. package/app/components/html-renderer/html-renderer.component.d.ts +9 -9
  4. package/app/consts/paragraph-buttons.const.d.ts +1 -1
  5. package/app/consts/rich-buttons.const.d.ts +1 -1
  6. package/app/consts/text-buttons.const.d.ts +1 -1
  7. package/app/enums/default-plugin.enum.d.ts +13 -13
  8. package/app/fs-html-editor.module.d.ts +25 -25
  9. package/app/injects/config.inject.d.ts +3 -3
  10. package/app/interfaces/html-editor-config.d.ts +31 -25
  11. package/app/interfaces/plugin-button.d.ts +12 -12
  12. package/app/interfaces/plugin-config.d.ts +5 -5
  13. package/app/plugins/checklist.plugin.d.ts +7 -7
  14. package/app/plugins/code.plugin.d.ts +9 -9
  15. package/app/plugins/configs/mention-plugin.config.d.ts +12 -12
  16. package/app/plugins/configs/screen-record-plugin.config.d.ts +7 -7
  17. package/app/plugins/mention.plugin.d.ts +12 -12
  18. package/app/plugins/screen-record.plugin.d.ts +11 -11
  19. package/app/services/froala-loader.service.d.ts +17 -17
  20. package/app/utils/loader.d.ts +7 -7
  21. package/bundles/firestitch-html-editor.umd.js +1000 -981
  22. package/bundles/firestitch-html-editor.umd.js.map +1 -1
  23. package/bundles/firestitch-html-editor.umd.min.js +2 -2
  24. package/bundles/firestitch-html-editor.umd.min.js.map +1 -1
  25. package/esm2015/app/classes/plugin.js +4 -4
  26. package/esm2015/app/components/html-editor/html-editor.component.js +431 -413
  27. package/esm2015/app/components/html-renderer/html-renderer.component.js +33 -33
  28. package/esm2015/app/consts/paragraph-buttons.const.js +8 -8
  29. package/esm2015/app/consts/rich-buttons.const.js +6 -6
  30. package/esm2015/app/consts/text-buttons.const.js +18 -18
  31. package/esm2015/app/fs-html-editor.module.js +55 -55
  32. package/esm2015/app/injects/config.inject.js +3 -3
  33. package/esm2015/app/interfaces/html-editor-config.js +1 -1
  34. package/esm2015/app/plugins/checklist.plugin.js +34 -34
  35. package/esm2015/app/plugins/code.plugin.js +62 -62
  36. package/esm2015/app/plugins/mention.plugin.js +72 -72
  37. package/esm2015/app/plugins/screen-record.plugin.js +91 -91
  38. package/esm2015/app/services/froala-loader.service.js +80 -80
  39. package/esm2015/app/utils/loader.js +81 -81
  40. package/esm2015/firestitch-html-editor.js +8 -8
  41. package/esm2015/public_api.js +11 -11
  42. package/esm5/app/classes/plugin.js +8 -8
  43. package/esm5/app/components/html-editor/html-editor.component.js +455 -435
  44. package/esm5/app/components/html-renderer/html-renderer.component.js +38 -38
  45. package/esm5/app/consts/paragraph-buttons.const.js +8 -8
  46. package/esm5/app/consts/rich-buttons.const.js +6 -6
  47. package/esm5/app/consts/text-buttons.const.js +18 -18
  48. package/esm5/app/fs-html-editor.module.js +60 -60
  49. package/esm5/app/injects/config.inject.js +3 -3
  50. package/esm5/app/interfaces/html-editor-config.js +1 -1
  51. package/esm5/app/plugins/checklist.plugin.js +40 -40
  52. package/esm5/app/plugins/code.plugin.js +69 -69
  53. package/esm5/app/plugins/mention.plugin.js +78 -78
  54. package/esm5/app/plugins/screen-record.plugin.js +105 -105
  55. package/esm5/app/services/froala-loader.service.js +95 -95
  56. package/esm5/app/utils/loader.js +81 -81
  57. package/esm5/firestitch-html-editor.js +8 -8
  58. package/esm5/public_api.js +11 -11
  59. package/fesm2015/firestitch-html-editor.js +922 -904
  60. package/fesm2015/firestitch-html-editor.js.map +1 -1
  61. package/fesm5/firestitch-html-editor.js +1000 -980
  62. package/fesm5/firestitch-html-editor.js.map +1 -1
  63. package/firestitch-html-editor.d.ts +9 -9
  64. package/firestitch-html-editor.metadata.json +1 -1
  65. package/package.json +1 -1
  66. package/public_api.d.ts +16 -16
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@firestitch/skeleton'), require('@angular/forms'), require('rxjs'), require('rxjs/operators'), require('lodash-es'), require('@angular/platform-browser'), require('tributejs')) :
3
- typeof define === 'function' && define.amd ? define('@firestitch/html-editor', ['exports', '@angular/core', '@angular/common', '@firestitch/skeleton', '@angular/forms', 'rxjs', 'rxjs/operators', 'lodash-es', '@angular/platform-browser', 'tributejs'], factory) :
4
- (global = global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch['html-editor'] = {}), global.ng.core, global.ng.common, global.skeleton, global.ng.forms, global.rxjs, global.rxjs.operators, global.lodashEs, global.ng.platformBrowser, global.Tribute));
5
- }(this, (function (exports, core, common, skeleton, forms, rxjs, operators, lodashEs, platformBrowser, Tribute) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@firestitch/skeleton'), require('@angular/forms'), require('@firestitch/file'), require('rxjs'), require('rxjs/operators'), require('lodash-es'), require('@angular/platform-browser'), require('tributejs')) :
3
+ typeof define === 'function' && define.amd ? define('@firestitch/html-editor', ['exports', '@angular/core', '@angular/common', '@firestitch/skeleton', '@angular/forms', '@firestitch/file', 'rxjs', 'rxjs/operators', 'lodash-es', '@angular/platform-browser', 'tributejs'], factory) :
4
+ (global = global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch['html-editor'] = {}), global.ng.core, global.ng.common, global.skeleton, global.ng.forms, global.file, global.rxjs, global.rxjs.operators, global.lodashEs, global.ng.platformBrowser, global.Tribute));
5
+ }(this, (function (exports, core, common, skeleton, forms, file, rxjs, operators, lodashEs, platformBrowser, Tribute) { 'use strict';
6
6
 
7
7
  Tribute = Tribute && Object.prototype.hasOwnProperty.call(Tribute, 'default') ? Tribute['default'] : Tribute;
8
8
 
@@ -234,1009 +234,1028 @@
234
234
  return value;
235
235
  }
236
236
 
237
- var RichButtons = [
238
- 'insertTable',
239
- 'insertImage',
240
- 'insertLink',
241
- 'insertVideo',
237
+ var RichButtons = [
238
+ 'insertTable',
239
+ 'insertImage',
240
+ 'insertLink',
241
+ 'insertVideo',
242
242
  ];
243
243
 
244
- var TextButtons = [
245
- 'paragraphFormat',
246
- 'code',
247
- 'bold',
248
- 'italic',
249
- 'underline',
250
- 'strikeThrough',
251
- 'subscript',
252
- 'superscript',
253
- 'fontFamily',
254
- 'fontSize',
255
- 'textColor',
256
- 'backgroundColor',
257
- 'inlineClass',
258
- 'inlineStyle',
259
- 'clearFormatting',
260
- 'quote',
244
+ var TextButtons = [
245
+ 'paragraphFormat',
246
+ 'code',
247
+ 'bold',
248
+ 'italic',
249
+ 'underline',
250
+ 'strikeThrough',
251
+ 'subscript',
252
+ 'superscript',
253
+ 'fontFamily',
254
+ 'fontSize',
255
+ 'textColor',
256
+ 'backgroundColor',
257
+ 'inlineClass',
258
+ 'inlineStyle',
259
+ 'clearFormatting',
260
+ 'quote',
261
261
  ];
262
262
 
263
- var ParagraphButtons = [
264
- 'align',
265
- 'formatOL',
266
- 'formatUL',
267
- 'checklist',
268
- 'indent',
269
- 'outdent',
263
+ var ParagraphButtons = [
264
+ 'align',
265
+ 'formatOL',
266
+ 'formatUL',
267
+ 'checklist',
268
+ 'indent',
269
+ 'outdent',
270
270
  ];
271
271
 
272
- var FS_HTML_EDITOR_DEFAULT_CONFIG = new core.InjectionToken('fs-html-editor.default-config');
272
+ var FS_HTML_EDITOR_DEFAULT_CONFIG = new core.InjectionToken('fs-html-editor.default-config');
273
273
  var FS_HTML_EDITOR_CONFIG = new core.InjectionToken('fs-html-editor.config');
274
274
 
275
- function resourceLoaderFactory() {
276
- var resourceBase = '/assets/js/froala/';
277
- var stylesBase = '/assets/css/';
278
- var head = document.getElementsByTagName('head')[0];
279
- var files = new Map();
280
- var resourcePaths = {
281
- froala: 'froala_editor.min.js',
282
- align: 'plugins/align.min.js',
283
- colors: 'plugins/colors.min.js',
284
- image: 'plugins/image.min.js',
285
- link: 'plugins/link.min.js',
286
- lists: 'plugins/lists.min.js',
287
- paragraph_format: 'plugins/paragraph_format.min.js',
288
- table: 'plugins/table.min.js',
289
- url: 'plugins/url.min.js',
290
- video: 'plugins/video.min.js',
291
- quote: 'plugins/quote.min.js',
292
- draggable: 'plugins/draggable.min.js',
293
- };
294
- var stylesPaths = {
295
- froala: 'froala_editor.pkgd.min.css',
296
- };
297
- var loadResource = function (scriptPath) {
298
- if (!files.has(scriptPath)) {
299
- var obs$ = new rxjs.Observable(function (obs) {
300
- var script = document.createElement('script');
301
- script.src = scriptPath;
302
- head.appendChild(script);
303
- script.onload = function () {
304
- obs.next();
305
- obs.complete();
306
- };
307
- script.onerror = function (err) {
308
- obs.error(err);
309
- };
310
- })
311
- .pipe(operators.shareReplay(1));
312
- files.set(scriptPath, obs$);
313
- }
314
- return files.get(scriptPath);
315
- };
316
- var loadStyles = function (stylePath) {
317
- if (!files.has(stylePath)) {
318
- var obs$ = new rxjs.Observable(function (obs) {
319
- var style = document.createElement('link');
320
- style.id = stylePath;
321
- style.rel = 'stylesheet';
322
- style.href = "" + stylePath;
323
- head.appendChild(style);
324
- style.onload = function () {
325
- obs.next();
326
- obs.complete();
327
- };
328
- style.onerror = function (err) {
329
- obs.error(err);
330
- };
331
- });
332
- files.set(stylePath, obs$);
333
- }
334
- return files.get(stylePath);
335
- };
336
- return {
337
- setResourceBase: function (path) {
338
- resourceBase = path;
339
- },
340
- setStylesBase: function (path) {
341
- stylesBase = path;
342
- },
343
- loadResource: function (resourceName) {
344
- var path = resourcePaths[resourceName] || resourceName;
345
- return loadResource(resourceBase + path);
346
- },
347
- loadStyles: function (resourceName) {
348
- var path = stylesPaths[resourceName] || resourceName;
349
- return loadStyles(stylesBase + path);
350
- }
351
- };
352
- }
275
+ function resourceLoaderFactory() {
276
+ var resourceBase = '/assets/js/froala/';
277
+ var stylesBase = '/assets/css/';
278
+ var head = document.getElementsByTagName('head')[0];
279
+ var files = new Map();
280
+ var resourcePaths = {
281
+ froala: 'froala_editor.min.js',
282
+ align: 'plugins/align.min.js',
283
+ colors: 'plugins/colors.min.js',
284
+ image: 'plugins/image.min.js',
285
+ link: 'plugins/link.min.js',
286
+ lists: 'plugins/lists.min.js',
287
+ paragraph_format: 'plugins/paragraph_format.min.js',
288
+ table: 'plugins/table.min.js',
289
+ url: 'plugins/url.min.js',
290
+ video: 'plugins/video.min.js',
291
+ quote: 'plugins/quote.min.js',
292
+ draggable: 'plugins/draggable.min.js',
293
+ };
294
+ var stylesPaths = {
295
+ froala: 'froala_editor.pkgd.min.css',
296
+ };
297
+ var loadResource = function (scriptPath) {
298
+ if (!files.has(scriptPath)) {
299
+ var obs$ = new rxjs.Observable(function (obs) {
300
+ var script = document.createElement('script');
301
+ script.src = scriptPath;
302
+ head.appendChild(script);
303
+ script.onload = function () {
304
+ obs.next();
305
+ obs.complete();
306
+ };
307
+ script.onerror = function (err) {
308
+ obs.error(err);
309
+ };
310
+ })
311
+ .pipe(operators.shareReplay(1));
312
+ files.set(scriptPath, obs$);
313
+ }
314
+ return files.get(scriptPath);
315
+ };
316
+ var loadStyles = function (stylePath) {
317
+ if (!files.has(stylePath)) {
318
+ var obs$ = new rxjs.Observable(function (obs) {
319
+ var style = document.createElement('link');
320
+ style.id = stylePath;
321
+ style.rel = 'stylesheet';
322
+ style.href = "" + stylePath;
323
+ head.appendChild(style);
324
+ style.onload = function () {
325
+ obs.next();
326
+ obs.complete();
327
+ };
328
+ style.onerror = function (err) {
329
+ obs.error(err);
330
+ };
331
+ });
332
+ files.set(stylePath, obs$);
333
+ }
334
+ return files.get(stylePath);
335
+ };
336
+ return {
337
+ setResourceBase: function (path) {
338
+ resourceBase = path;
339
+ },
340
+ setStylesBase: function (path) {
341
+ stylesBase = path;
342
+ },
343
+ loadResource: function (resourceName) {
344
+ var path = resourcePaths[resourceName] || resourceName;
345
+ return loadResource(resourceBase + path);
346
+ },
347
+ loadStyles: function (resourceName) {
348
+ var path = stylesPaths[resourceName] || resourceName;
349
+ return loadStyles(stylesBase + path);
350
+ }
351
+ };
352
+ }
353
353
  var ResourceLoader = resourceLoaderFactory();
354
354
 
355
- var FsFroalaLoaderService = /** @class */ (function () {
356
- function FsFroalaLoaderService(_defaultConfig) {
357
- this._defaultConfig = _defaultConfig;
358
- this._froalaLoaded = new rxjs.BehaviorSubject(false);
359
- this._defaultPluginsLoaded = new rxjs.BehaviorSubject(false);
360
- this._ready$ = rxjs.combineLatest([this._froalaLoaded, this._defaultPluginsLoaded])
361
- .pipe(operators.map(function (_a) {
362
- var _b = __read(_a, 2), FroalaReady = _b[0], pluginsRead = _b[1];
363
- return pluginsRead && FroalaReady;
364
- }), operators.shareReplay(1));
365
- if (this._defaultConfig) {
366
- if (this._defaultConfig.assetsJSPath) {
367
- ResourceLoader.setResourceBase(this._defaultConfig.assetsJSPath);
368
- }
369
- if (this._defaultConfig.assetsCSSPath) {
370
- ResourceLoader.setStylesBase(this._defaultConfig.assetsCSSPath);
371
- }
372
- }
373
- this._load();
374
- }
375
- Object.defineProperty(FsFroalaLoaderService.prototype, "ready$", {
376
- get: function () {
377
- return this._ready$;
378
- },
379
- enumerable: true,
380
- configurable: true
381
- });
382
- Object.defineProperty(FsFroalaLoaderService.prototype, "ready", {
383
- get: function () {
384
- return this._froalaLoaded.getValue() && this._defaultPluginsLoaded.getValue();
385
- },
386
- enumerable: true,
387
- configurable: true
388
- });
389
- Object.defineProperty(FsFroalaLoaderService.prototype, "FroalaEditor", {
390
- get: function () {
391
- return this._FroalaEditor;
392
- },
393
- enumerable: true,
394
- configurable: true
395
- });
396
- FsFroalaLoaderService.prototype._load = function () {
397
- var _this = this;
398
- rxjs.combineLatest([
399
- ResourceLoader.loadResource('froala'),
400
- ResourceLoader.loadStyles('froala')
401
- ])
402
- .pipe(operators.tap(function () {
403
- _this._FroalaEditor = window.FroalaEditor;
404
- _this._froalaDone();
405
- }), operators.concatMap(function () {
406
- return _this._loadPlugins();
407
- }), operators.tap(function () {
408
- _this._defaultPluginsDone();
409
- }))
410
- .subscribe();
411
- };
412
- FsFroalaLoaderService.prototype._loadPlugins = function () {
413
- var imports = this._defaultConfig
414
- .defaultPlugins
415
- .reduce(function (acc, pluginName) {
416
- var import$ = ResourceLoader.loadResource(pluginName);
417
- acc.push(import$);
418
- return acc;
419
- }, []);
420
- return rxjs.combineLatest(imports);
421
- };
422
- FsFroalaLoaderService.prototype._froalaDone = function () {
423
- this._froalaLoaded.next(true);
424
- };
425
- FsFroalaLoaderService.prototype._defaultPluginsDone = function () {
426
- this._defaultPluginsLoaded.next(true);
427
- };
428
- FsFroalaLoaderService.ctorParameters = function () { return [
429
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [FS_HTML_EDITOR_CONFIG,] }] }
430
- ]; };
431
- FsFroalaLoaderService.ɵprov = core.ɵɵdefineInjectable({ factory: function FsFroalaLoaderService_Factory() { return new FsFroalaLoaderService(core.ɵɵinject(FS_HTML_EDITOR_CONFIG, 8)); }, token: FsFroalaLoaderService, providedIn: "root" });
432
- FsFroalaLoaderService = __decorate([
433
- core.Injectable({
434
- providedIn: 'root',
435
- }),
436
- __param(0, core.Optional()), __param(0, core.Inject(FS_HTML_EDITOR_CONFIG)),
437
- __metadata("design:paramtypes", [Object])
438
- ], FsFroalaLoaderService);
439
- return FsFroalaLoaderService;
355
+ var FsFroalaLoaderService = /** @class */ (function () {
356
+ function FsFroalaLoaderService(_defaultConfig) {
357
+ this._defaultConfig = _defaultConfig;
358
+ this._froalaLoaded = new rxjs.BehaviorSubject(false);
359
+ this._defaultPluginsLoaded = new rxjs.BehaviorSubject(false);
360
+ this._ready$ = rxjs.combineLatest([this._froalaLoaded, this._defaultPluginsLoaded])
361
+ .pipe(operators.map(function (_a) {
362
+ var _b = __read(_a, 2), FroalaReady = _b[0], pluginsRead = _b[1];
363
+ return pluginsRead && FroalaReady;
364
+ }), operators.shareReplay(1));
365
+ if (this._defaultConfig) {
366
+ if (this._defaultConfig.assetsJSPath) {
367
+ ResourceLoader.setResourceBase(this._defaultConfig.assetsJSPath);
368
+ }
369
+ if (this._defaultConfig.assetsCSSPath) {
370
+ ResourceLoader.setStylesBase(this._defaultConfig.assetsCSSPath);
371
+ }
372
+ }
373
+ this._load();
374
+ }
375
+ Object.defineProperty(FsFroalaLoaderService.prototype, "ready$", {
376
+ get: function () {
377
+ return this._ready$;
378
+ },
379
+ enumerable: true,
380
+ configurable: true
381
+ });
382
+ Object.defineProperty(FsFroalaLoaderService.prototype, "ready", {
383
+ get: function () {
384
+ return this._froalaLoaded.getValue() && this._defaultPluginsLoaded.getValue();
385
+ },
386
+ enumerable: true,
387
+ configurable: true
388
+ });
389
+ Object.defineProperty(FsFroalaLoaderService.prototype, "FroalaEditor", {
390
+ get: function () {
391
+ return this._FroalaEditor;
392
+ },
393
+ enumerable: true,
394
+ configurable: true
395
+ });
396
+ FsFroalaLoaderService.prototype._load = function () {
397
+ var _this = this;
398
+ rxjs.combineLatest([
399
+ ResourceLoader.loadResource('froala'),
400
+ ResourceLoader.loadStyles('froala')
401
+ ])
402
+ .pipe(operators.tap(function () {
403
+ _this._FroalaEditor = window.FroalaEditor;
404
+ _this._froalaDone();
405
+ }), operators.concatMap(function () {
406
+ return _this._loadPlugins();
407
+ }), operators.tap(function () {
408
+ _this._defaultPluginsDone();
409
+ }))
410
+ .subscribe();
411
+ };
412
+ FsFroalaLoaderService.prototype._loadPlugins = function () {
413
+ var imports = this._defaultConfig
414
+ .defaultPlugins
415
+ .reduce(function (acc, pluginName) {
416
+ var import$ = ResourceLoader.loadResource(pluginName);
417
+ acc.push(import$);
418
+ return acc;
419
+ }, []);
420
+ return rxjs.combineLatest(imports);
421
+ };
422
+ FsFroalaLoaderService.prototype._froalaDone = function () {
423
+ this._froalaLoaded.next(true);
424
+ };
425
+ FsFroalaLoaderService.prototype._defaultPluginsDone = function () {
426
+ this._defaultPluginsLoaded.next(true);
427
+ };
428
+ FsFroalaLoaderService.ctorParameters = function () { return [
429
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [FS_HTML_EDITOR_CONFIG,] }] }
430
+ ]; };
431
+ FsFroalaLoaderService.ɵprov = core.ɵɵdefineInjectable({ factory: function FsFroalaLoaderService_Factory() { return new FsFroalaLoaderService(core.ɵɵinject(FS_HTML_EDITOR_CONFIG, 8)); }, token: FsFroalaLoaderService, providedIn: "root" });
432
+ FsFroalaLoaderService = __decorate([
433
+ core.Injectable({
434
+ providedIn: 'root',
435
+ }),
436
+ __param(0, core.Optional()), __param(0, core.Inject(FS_HTML_EDITOR_CONFIG)),
437
+ __metadata("design:paramtypes", [Object])
438
+ ], FsFroalaLoaderService);
439
+ return FsFroalaLoaderService;
440
440
  }());
441
441
 
442
- var FsHtmlEditorComponent = /** @class */ (function () {
443
- function FsHtmlEditorComponent(_defaultConfig, _cdRef, _fr) {
444
- this._defaultConfig = _defaultConfig;
445
- this._cdRef = _cdRef;
446
- this._fr = _fr;
447
- this.classFocused = false;
448
- this.classDisabled = false;
449
- this.config = {};
450
- this.initialized = false;
451
- this._initialize$ = new rxjs.ReplaySubject();
452
- this._destroy$ = new rxjs.Subject();
453
- this.onChange = function (data) { };
454
- this.onTouched = function () { };
455
- }
456
- FsHtmlEditorComponent_1 = FsHtmlEditorComponent;
457
- Object.defineProperty(FsHtmlEditorComponent.prototype, "el", {
458
- get: function () {
459
- return this.elRef.nativeElement;
460
- },
461
- enumerable: true,
462
- configurable: true
463
- });
464
- Object.defineProperty(FsHtmlEditorComponent.prototype, "html", {
465
- get: function () {
466
- return this._html;
467
- },
468
- enumerable: true,
469
- configurable: true
470
- });
471
- Object.defineProperty(FsHtmlEditorComponent.prototype, "editor", {
472
- get: function () {
473
- return this._editor;
474
- },
475
- enumerable: true,
476
- configurable: true
477
- });
478
- Object.defineProperty(FsHtmlEditorComponent.prototype, "froalaReady$", {
479
- get: function () {
480
- return this._fr.ready$;
481
- },
482
- enumerable: true,
483
- configurable: true
484
- });
485
- FsHtmlEditorComponent.prototype.ngOnInit = function () {
486
- this.config = this.config || {};
487
- this.config.autofocus = this.config.autofocus !== false && !this.config.disabled;
488
- this.initialized = !this.config.initOnClick;
489
- this._listenLazyInit();
490
- };
491
- FsHtmlEditorComponent.prototype.ngAfterViewInit = function () {
492
- if (!this.config.initOnClick || !this.hasContent()) {
493
- this.initialized = true;
494
- this._initialize$.next();
495
- }
496
- };
497
- FsHtmlEditorComponent.prototype.hasContent = function () {
498
- var el = document.createElement('div');
499
- if (el.querySelector('img')) {
500
- return true;
501
- }
502
- el.innerHTML = this._html;
503
- return !!el.innerText.length;
504
- };
505
- FsHtmlEditorComponent.prototype.initialize = function (options) {
506
- var _this = this;
507
- if (options === void 0) { options = {}; }
508
- var config = this._createConfig();
509
- this._initPlugins(config);
510
- this.el.innerHTML = this._html;
511
- this._editor = new this._fr.FroalaEditor(this.el, this._createOptions(), function () {
512
- _this._cdRef.markForCheck();
513
- if (config.disabled) {
514
- _this.disable();
515
- }
516
- if (config.froalaConfig.events) {
517
- if (config.froalaConfig.events.initialized) {
518
- config.froalaConfig.events.initialized();
519
- }
520
- }
521
- _this._editor.events.on('focus', function () {
522
- _this.classFocused = true;
523
- _this._cdRef.markForCheck();
524
- });
525
- _this._editor.events.on('blur', function () {
526
- _this.classFocused = false;
527
- _this._cdRef.markForCheck();
528
- });
529
- _this._editor.events.on('contentChanged', function () {
530
- _this._change(_this._editor.html.get());
531
- });
532
- _this._editor.events.on('paste.afterCleanup', function (html) {
533
- var div = document.createElement('div');
534
- div.innerHTML = html;
535
- div.querySelectorAll('*')
536
- .forEach(function (el) {
537
- for (var i = 0; i < el.attributes.length; i++) {
538
- var name_1 = el.attributes[0].name;
539
- if (name_1 !== 'href') {
540
- el.removeAttribute(name_1);
541
- }
542
- }
543
- });
544
- return div.innerHTML;
545
- });
546
- _this._editor.events.on('keydown', function () {
547
- _this.onTouched();
548
- });
549
- if (_this.config.image && _this.config.image.upload) {
550
- _this._editor.events.on('image.beforePasteUpload', function (image) {
551
- fetch(image.getAttribute('src'))
552
- .then(function (res) {
553
- res.blob()
554
- .then(function (blob) {
555
- _this._processImageUpload(blob)
556
- .subscribe(function (url) {
557
- image.setAttribute('src', url);
558
- image.removeAttribute('data-fr-image-pasted');
559
- });
560
- });
561
- });
562
- return false;
563
- });
564
- _this._editor.events.on('image.beforeUpload', function (blobs) {
565
- _this._processImageUpload(blobs[0]).subscribe(function (url) {
566
- _this.editor.image.insert(url, null, null, _this.editor.image.get());
567
- });
568
- return false;
569
- });
570
- }
571
- if (_this.el.querySelector('.fr-second-toolbar')) {
572
- _this.el.querySelector('.fr-second-toolbar').remove();
573
- }
574
- var selection = options.selection;
575
- if (selection) {
576
- var node = Array.from(_this.el.querySelectorAll('.fr-element *')).find(function (node) {
577
- return selection.node === node.textContent;
578
- });
579
- if (node) {
580
- var range = document.createRange();
581
- var sel = window.getSelection();
582
- range.setStart(_this._getTextNode(node), selection.offset);
583
- range.collapse(true);
584
- sel.removeAllRanges();
585
- sel.addRange(range);
586
- }
587
- else if (_this.config.autofocus) {
588
- _this.focus();
589
- }
590
- }
591
- else if (_this.config.autofocus) {
592
- _this.focus();
593
- }
594
- });
595
- };
596
- FsHtmlEditorComponent.prototype._processImageUpload = function (blob) {
597
- return this.config.image.upload(blob)
598
- .pipe(operators.takeUntil(this._destroy$));
599
- };
600
- FsHtmlEditorComponent.prototype._getTextNode = function (node) {
601
- if (node) {
602
- if (node.nodeType === Node.TEXT_NODE) {
603
- return node;
604
- }
605
- if (node.childNodes) {
606
- return this._getTextNode(node.childNodes[0]);
607
- }
608
- }
609
- };
610
- FsHtmlEditorComponent.prototype.uninitializedClick = function (event) {
611
- if (!event.defaultPrevented) {
612
- var target_1 = event.target;
613
- if (target_1 && target_1.nodeName === 'A' && target_1.getAttribute('href')) {
614
- var targetTarget_1 = target_1.getAttribute('target');
615
- target_1.setAttribute('target', '_blank');
616
- setTimeout(function () {
617
- if (targetTarget_1) {
618
- target_1.setAttribute('target', targetTarget_1);
619
- }
620
- else {
621
- target_1.removeAttribute('target');
622
- }
623
- });
624
- }
625
- else {
626
- if (this.config.initClick) {
627
- this.config.initClick(event);
628
- }
629
- this._initialize$.next();
630
- this.initialized = true;
631
- }
632
- }
633
- };
634
- FsHtmlEditorComponent.prototype.updateSize = function () {
635
- // Hack: To trigger the toolbar button size modes
636
- window.dispatchEvent(new Event('resize'));
637
- };
638
- FsHtmlEditorComponent.prototype.validate = function (control) {
639
- var err = {};
640
- if (this.config.maxLength && this._html) {
641
- var maxLength = this.config.maxLength;
642
- var length_1 = this._html.length;
643
- if (length_1 > maxLength) {
644
- err.maxLengthError = "Must be " + maxLength + " characters or fewer. You entered " + length_1 + " characters.";
645
- }
646
- }
647
- return Object.keys(err).length ? err : null;
648
- };
649
- FsHtmlEditorComponent.prototype.focus = function (options) {
650
- options = options ? options : {};
651
- if (options.cursorPosition === 'end') {
652
- this.editor.selection.setAtEnd(this.editor.$el.get(0));
653
- }
654
- else {
655
- this.editor.selection.setAtStart(this.editor.$el.get(0));
656
- }
657
- this.editor.selection.restore();
658
- var elSelection = this.editor.selection.element();
659
- if (elSelection) {
660
- elSelection.scrollIntoView({ block: 'center' });
661
- }
662
- };
663
- FsHtmlEditorComponent.prototype.clear = function () {
664
- this.writeValue('');
665
- };
666
- FsHtmlEditorComponent.prototype.disable = function () {
667
- this.classDisabled = true;
668
- };
669
- FsHtmlEditorComponent.prototype.setHtml = function (html) {
670
- this.writeValue(html);
671
- };
672
- FsHtmlEditorComponent.prototype.writeValue = function (html) {
673
- this._html = html || '';
674
- this._cdRef.markForCheck();
675
- if (this.editor && this.editor.html) {
676
- try {
677
- this.editor.html.set(this._html);
678
- }
679
- catch (e) {
680
- }
681
- }
682
- };
683
- FsHtmlEditorComponent.prototype.registerOnChange = function (fn) {
684
- this.onChange = fn;
685
- };
686
- FsHtmlEditorComponent.prototype.registerOnTouched = function (fn) {
687
- this.onTouched = fn;
688
- };
689
- FsHtmlEditorComponent.prototype.ngOnDestroy = function () {
690
- this._initialize$.complete();
691
- this._destroy$.next();
692
- this._destroy$.complete();
693
- this.destroy();
694
- };
695
- FsHtmlEditorComponent.prototype.destroy = function () {
696
- if (this.editor) {
697
- this.editor.destroy();
698
- }
699
- this.initialized = false;
700
- this._cdRef.markForCheck();
701
- this.el.innerHTML = '';
702
- };
703
- FsHtmlEditorComponent.prototype._createConfig = function () {
704
- return lodashEs.merge({ froalaConfig: {} }, this._defaultConfig, this.config);
705
- };
706
- FsHtmlEditorComponent.prototype._change = function (html) {
707
- this._html = html;
708
- this.onChange(html);
709
- };
710
- FsHtmlEditorComponent.prototype._initPlugins = function (config) {
711
- var _this = this;
712
- (config.plugins || []).forEach(function (plugin) {
713
- _this._fr.FroalaEditor.PLUGINS[plugin.config.name] = function (editor) {
714
- plugin.editor = editor;
715
- plugin.initialize();
716
- return plugin;
717
- };
718
- (plugin.config.buttons || []).forEach(function (button) {
719
- _this._fr.FroalaEditor.DefineIcon(button.name, {
720
- NAME: button.name,
721
- PATH: button.svgPath,
722
- });
723
- _this._fr.FroalaEditor.RegisterCommand(button.name, {
724
- icon: button.name,
725
- title: button.tooltip,
726
- undo: button.undo,
727
- focus: button.focus,
728
- showOnMobile: button.showOnMobile,
729
- refreshAfterCallback: button.refreshAfterCallback,
730
- callback: function () {
731
- if (button.click) {
732
- button.click(this);
733
- }
734
- },
735
- refresh: function (button) {
736
- if (button.refresh) {
737
- button.refresh(this, button);
738
- }
739
- }
740
- });
741
- });
742
- });
743
- };
744
- FsHtmlEditorComponent.prototype._createOptions = function () {
745
- var config = this._createConfig();
746
- return lodashEs.merge(
747
- // For some reason editor store somewhere pointer on default config object and dublicate options each time on init
748
- // Extra merge level fixed this problem and allow to init config properly without legacy data
749
- {}, {
750
- key: config.activationKey,
751
- placeholderText: config.placeholder,
752
- linkAlwaysBlank: true,
753
- tabSpaces: 2,
754
- typingTimer: 250,
755
- tooltips: false,
756
- wordPasteModal: false,
757
- imageDefaultWidth: 0,
758
- imageDefaultAlign: 'left',
759
- quickInsertEnabled: false,
760
- paragraphDefaultSelection: 'Format',
761
- videoUpload: false,
762
- paragraphFormat: {
763
- N: 'Normal',
764
- H1: 'Heading 1',
765
- H2: 'Heading 2',
766
- H3: 'Heading 3',
767
- H4: 'Heading 4',
768
- BLOCKQUOTE: 'Quote',
769
- },
770
- paragraphFormatSelection: true,
771
- toolbarButtonsXS: {
772
- moreText: {
773
- buttons: TextButtons,
774
- buttonsVisible: 1,
775
- },
776
- moreParagraph: {
777
- buttons: ParagraphButtons,
778
- buttonsVisible: 2,
779
- },
780
- moreRich: {
781
- buttons: RichButtons,
782
- buttonsVisible: 0,
783
- },
784
- },
785
- toolbarButtons: {
786
- moreText: {
787
- buttons: TextButtons,
788
- buttonsVisible: 3,
789
- },
790
- moreParagraph: {
791
- buttons: ParagraphButtons,
792
- buttonsVisible: 5,
793
- },
794
- moreRich: {
795
- buttons: RichButtons,
796
- buttonsVisible: 3,
797
- },
798
- },
799
- }, config.froalaConfig);
800
- };
801
- FsHtmlEditorComponent.prototype._listenLazyInit = function () {
802
- var _this = this;
803
- this.froalaReady$
804
- .pipe(operators.filter(function (ready) { return ready; }), operators.switchMap(function () { return _this._initialize$; }))
805
- .subscribe(function () {
806
- var selection = window.getSelection();
807
- var options = {};
808
- if (selection.baseNode) {
809
- options.selection = {
810
- node: selection.baseNode.nodeValue,
811
- offset: selection.baseOffset,
812
- };
813
- }
814
- _this.initialize(options);
815
- });
816
- };
817
- var FsHtmlEditorComponent_1;
818
- FsHtmlEditorComponent.ctorParameters = function () { return [
819
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [FS_HTML_EDITOR_CONFIG,] }] },
820
- { type: core.ChangeDetectorRef },
821
- { type: FsFroalaLoaderService }
822
- ]; };
823
- __decorate([
824
- core.HostBinding('class.focused'),
825
- __metadata("design:type", Object)
826
- ], FsHtmlEditorComponent.prototype, "classFocused", void 0);
827
- __decorate([
828
- core.HostBinding('class.disabled'),
829
- __metadata("design:type", Object)
830
- ], FsHtmlEditorComponent.prototype, "classDisabled", void 0);
831
- __decorate([
832
- core.ViewChild('elRef'),
833
- __metadata("design:type", core.ElementRef)
834
- ], FsHtmlEditorComponent.prototype, "elRef", void 0);
835
- __decorate([
836
- core.Input(),
837
- __metadata("design:type", Object)
838
- ], FsHtmlEditorComponent.prototype, "config", void 0);
839
- FsHtmlEditorComponent = FsHtmlEditorComponent_1 = __decorate([
840
- core.Component({
841
- selector: 'fs-html-editor',
842
- template: "<div class=\"fs-html-editor-default\">\n <ng-container *ngIf=\"initialized\">\n <ng-container *fsSkeleton=\"(froalaReady$ | 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",
843
- providers: [
844
- {
845
- provide: forms.NG_VALUE_ACCESSOR,
846
- useExisting: core.forwardRef(function () { return FsHtmlEditorComponent_1; }),
847
- multi: true
848
- },
849
- {
850
- provide: forms.NG_VALIDATORS,
851
- useExisting: core.forwardRef(function () { return FsHtmlEditorComponent_1; }),
852
- multi: true
853
- },
854
- ],
855
- changeDetection: core.ChangeDetectionStrategy.OnPush,
856
- 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{position:-webkit-sticky;position:sticky;z-index:2;border-radius:0;background-color:transparent}:host ::ng-deep .fr-toolbar .fr-btn-grp{margin:0 20px 0 0;position:relative}:host ::ng-deep .fr-toolbar .fr-btn-grp:nth-child(1):after,:host ::ng-deep .fr-toolbar .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 div:first-of-type:before{border:none}:host ::ng-deep .fr-toolbar.fr-toolbar-open .fr-newline{height:auto}:host ::ng-deep .fr-toolbar .fr-btn-grp:first-child{margin-left:0}:host ::ng-deep .fr-toolbar.fr-top{border:0}:host ::ng-deep .fr-toolbar .fr-newline{margin:0}:host ::ng-deep .fr-toolbar .fr-more-toolbar{z-index:auto}:host ::ng-deep .fr-toolbar .fr-command.fr-btn{z-index:auto}:host ::ng-deep .fr-toolbar .fr-command.fr-btn.fr-dropdown:after{right:3px}:host ::ng-deep .fr-toolbar .fr-command.fr-btn.fr-dropdown.fr-selection:after{right:10px}:host ::ng-deep .fr-toolbar .fr-command.fr-btn.fr-dropdown.fr-selection span{margin-right:24px}:host ::ng-deep .fr-toolbar .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}"]
857
- }),
858
- __param(0, core.Optional()), __param(0, core.Inject(FS_HTML_EDITOR_CONFIG)),
859
- __metadata("design:paramtypes", [Object, core.ChangeDetectorRef,
860
- FsFroalaLoaderService])
861
- ], FsHtmlEditorComponent);
862
- return FsHtmlEditorComponent;
442
+ var FsHtmlEditorComponent = /** @class */ (function () {
443
+ function FsHtmlEditorComponent(_defaultConfig, _cdRef, _fr) {
444
+ this._defaultConfig = _defaultConfig;
445
+ this._cdRef = _cdRef;
446
+ this._fr = _fr;
447
+ this.classFocused = false;
448
+ this.classDisabled = false;
449
+ this.config = {};
450
+ this.initialized = false;
451
+ this._initialize$ = new rxjs.ReplaySubject();
452
+ this._destroy$ = new rxjs.Subject();
453
+ this.onChange = function (data) { };
454
+ this.onTouched = function () { };
455
+ }
456
+ FsHtmlEditorComponent_1 = FsHtmlEditorComponent;
457
+ Object.defineProperty(FsHtmlEditorComponent.prototype, "el", {
458
+ get: function () {
459
+ return this.elRef.nativeElement;
460
+ },
461
+ enumerable: true,
462
+ configurable: true
463
+ });
464
+ Object.defineProperty(FsHtmlEditorComponent.prototype, "html", {
465
+ get: function () {
466
+ return this._html;
467
+ },
468
+ enumerable: true,
469
+ configurable: true
470
+ });
471
+ Object.defineProperty(FsHtmlEditorComponent.prototype, "editor", {
472
+ get: function () {
473
+ return this._editor;
474
+ },
475
+ enumerable: true,
476
+ configurable: true
477
+ });
478
+ Object.defineProperty(FsHtmlEditorComponent.prototype, "froalaReady$", {
479
+ get: function () {
480
+ return this._fr.ready$;
481
+ },
482
+ enumerable: true,
483
+ configurable: true
484
+ });
485
+ FsHtmlEditorComponent.prototype.ngOnInit = function () {
486
+ this.config = this.config || {};
487
+ this.config.autofocus = this.config.autofocus !== false && !this.config.disabled;
488
+ this.initialized = !this.config.initOnClick;
489
+ this._listenLazyInit();
490
+ };
491
+ FsHtmlEditorComponent.prototype.ngAfterViewInit = function () {
492
+ if (!this.config.initOnClick || !this.hasContent()) {
493
+ this.initialized = true;
494
+ this._initialize$.next();
495
+ }
496
+ };
497
+ FsHtmlEditorComponent.prototype.hasContent = function () {
498
+ var el = document.createElement('div');
499
+ if (el.querySelector('img')) {
500
+ return true;
501
+ }
502
+ el.innerHTML = this._html;
503
+ return !!el.innerText.length;
504
+ };
505
+ FsHtmlEditorComponent.prototype.initialize = function (options) {
506
+ var _this = this;
507
+ if (options === void 0) { options = {}; }
508
+ var config = this._createConfig();
509
+ this._initPlugins(config);
510
+ this.el.innerHTML = this._html;
511
+ this._editor = new this._fr.FroalaEditor(this.el, this._createOptions(), function () {
512
+ _this._cdRef.markForCheck();
513
+ if (config.disabled) {
514
+ _this.disable();
515
+ }
516
+ if (config.froalaConfig.events) {
517
+ if (config.froalaConfig.events.initialized) {
518
+ config.froalaConfig.events.initialized();
519
+ }
520
+ }
521
+ _this._editor.events.on('focus', function () {
522
+ _this.classFocused = true;
523
+ _this._cdRef.markForCheck();
524
+ });
525
+ _this._editor.events.on('blur', function () {
526
+ _this.classFocused = false;
527
+ _this._cdRef.markForCheck();
528
+ });
529
+ _this._editor.events.on('contentChanged', function () {
530
+ var editorHTML = _this._editor.html.get();
531
+ if (_this.html !== editorHTML) {
532
+ _this._change(editorHTML);
533
+ }
534
+ });
535
+ _this._editor.events.on('paste.afterCleanup', function (html) {
536
+ var div = document.createElement('div');
537
+ div.innerHTML = html;
538
+ div.querySelectorAll('*')
539
+ .forEach(function (el) {
540
+ for (var i = 0; i < el.attributes.length; i++) {
541
+ var name_1 = el.attributes[0].name;
542
+ if (name_1 !== 'href') {
543
+ el.removeAttribute(name_1);
544
+ }
545
+ }
546
+ });
547
+ return div.innerHTML;
548
+ });
549
+ _this._editor.events.on('keydown', function () {
550
+ _this.onTouched();
551
+ });
552
+ if (_this.config.image && _this.config.image.upload) {
553
+ _this._editor.events.on('image.beforePasteUpload', function (image) {
554
+ fetch(image.getAttribute('src'))
555
+ .then(function (res) {
556
+ res.blob()
557
+ .then(function (blob) {
558
+ _this._processImageUpload(blob)
559
+ .pipe(operators.takeUntil(_this._destroy$))
560
+ .subscribe(function (url) {
561
+ image.setAttribute('src', url);
562
+ image.removeAttribute('data-fr-image-pasted');
563
+ });
564
+ });
565
+ });
566
+ return false;
567
+ });
568
+ _this._editor.events.on('image.beforeUpload', function (blobs) {
569
+ _this._processImageUpload(blobs[0])
570
+ .pipe(operators.takeUntil(_this._destroy$))
571
+ .subscribe(function (url) {
572
+ _this.editor.image.insert(url, null, null, _this.editor.image.get());
573
+ });
574
+ return false;
575
+ });
576
+ }
577
+ if (_this.el.querySelector('.fr-second-toolbar')) {
578
+ _this.el.querySelector('.fr-second-toolbar').remove();
579
+ }
580
+ var selection = options.selection;
581
+ if (selection) {
582
+ var node = Array.from(_this.el.querySelectorAll('.fr-element *')).find(function (node) {
583
+ return selection.node === node.textContent;
584
+ });
585
+ if (node) {
586
+ var range = document.createRange();
587
+ var sel = window.getSelection();
588
+ range.setStart(_this._getTextNode(node), selection.offset);
589
+ range.collapse(true);
590
+ sel.removeAllRanges();
591
+ sel.addRange(range);
592
+ }
593
+ else if (_this.config.autofocus) {
594
+ _this.focus();
595
+ }
596
+ }
597
+ else if (_this.config.autofocus) {
598
+ _this.focus();
599
+ }
600
+ });
601
+ };
602
+ FsHtmlEditorComponent.prototype._processImageUpload = function (blob) {
603
+ var _this = this;
604
+ var processor = new file.FileProcessor();
605
+ var file$1 = new file.FsFile(blob);
606
+ return processor.process([file$1], this.config.image)
607
+ .pipe(operators.switchMap(function (img) {
608
+ return _this.config.image.upload(img.file);
609
+ }));
610
+ };
611
+ FsHtmlEditorComponent.prototype._getTextNode = function (node) {
612
+ if (node) {
613
+ if (node.nodeType === Node.TEXT_NODE) {
614
+ return node;
615
+ }
616
+ if (node.childNodes) {
617
+ return this._getTextNode(node.childNodes[0]);
618
+ }
619
+ }
620
+ };
621
+ FsHtmlEditorComponent.prototype.uninitializedClick = function (event) {
622
+ if (!event.defaultPrevented) {
623
+ var target_1 = event.target;
624
+ if (target_1 && target_1.nodeName === 'A' && target_1.getAttribute('href')) {
625
+ var targetTarget_1 = target_1.getAttribute('target');
626
+ target_1.setAttribute('target', '_blank');
627
+ setTimeout(function () {
628
+ if (targetTarget_1) {
629
+ target_1.setAttribute('target', targetTarget_1);
630
+ }
631
+ else {
632
+ target_1.removeAttribute('target');
633
+ }
634
+ });
635
+ }
636
+ else {
637
+ if (this.config.initClick) {
638
+ this.config.initClick(event);
639
+ }
640
+ this._initialize$.next();
641
+ this.initialized = true;
642
+ }
643
+ }
644
+ };
645
+ FsHtmlEditorComponent.prototype.updateSize = function () {
646
+ // Hack: To trigger the toolbar button size modes
647
+ window.dispatchEvent(new Event('resize'));
648
+ };
649
+ FsHtmlEditorComponent.prototype.validate = function (control) {
650
+ var err = {};
651
+ if (this.config.maxLength && this._html) {
652
+ var maxLength = this.config.maxLength;
653
+ var length_1 = this._html.length;
654
+ if (length_1 > maxLength) {
655
+ err.maxLengthError = "Must be " + maxLength + " characters or fewer. You entered " + length_1 + " characters.";
656
+ }
657
+ }
658
+ return Object.keys(err).length ? err : null;
659
+ };
660
+ FsHtmlEditorComponent.prototype.focus = function (options) {
661
+ options = options ? options : {};
662
+ if (options.cursorPosition === 'end') {
663
+ this.editor.selection.setAtEnd(this.editor.$el.get(0));
664
+ }
665
+ else {
666
+ this.editor.selection.setAtStart(this.editor.$el.get(0));
667
+ }
668
+ this.editor.selection.restore();
669
+ var elSelection = this.editor.selection.element();
670
+ if (elSelection) {
671
+ elSelection.scrollIntoView({ block: 'center' });
672
+ }
673
+ };
674
+ FsHtmlEditorComponent.prototype.clear = function () {
675
+ this.writeValue('');
676
+ };
677
+ FsHtmlEditorComponent.prototype.disable = function () {
678
+ this.classDisabled = true;
679
+ };
680
+ FsHtmlEditorComponent.prototype.setHtml = function (html) {
681
+ this.writeValue(html);
682
+ };
683
+ FsHtmlEditorComponent.prototype.writeValue = function (html) {
684
+ var _this = this;
685
+ this._html = html || '';
686
+ this._cdRef.markForCheck();
687
+ // SP-T2298 timeout needed for the case, when froala was already initated and
688
+ // second instance opened in dialog/drawer. In this case init step pass much faster, writeValue trigger
689
+ // after init and froala ignore new html. At the same time froala was initied but editor not yet, and next
690
+ // code doesn't work without timeout. We've got time range when too late for initiate value, and to early
691
+ // for change event.
692
+ setTimeout(function () {
693
+ if (_this.editor && _this.editor.html) {
694
+ try {
695
+ _this.editor.html.set(_this._html);
696
+ }
697
+ catch (e) {
698
+ }
699
+ }
700
+ });
701
+ };
702
+ FsHtmlEditorComponent.prototype.registerOnChange = function (fn) {
703
+ this.onChange = fn;
704
+ };
705
+ FsHtmlEditorComponent.prototype.registerOnTouched = function (fn) {
706
+ this.onTouched = fn;
707
+ };
708
+ FsHtmlEditorComponent.prototype.ngOnDestroy = function () {
709
+ this._initialize$.complete();
710
+ this._destroy$.next();
711
+ this._destroy$.complete();
712
+ this.destroy();
713
+ };
714
+ FsHtmlEditorComponent.prototype.destroy = function () {
715
+ if (this.editor) {
716
+ this.editor.destroy();
717
+ }
718
+ this.initialized = false;
719
+ this._cdRef.markForCheck();
720
+ this.el.innerHTML = '';
721
+ };
722
+ FsHtmlEditorComponent.prototype._createConfig = function () {
723
+ return lodashEs.merge({ froalaConfig: {} }, this._defaultConfig, this.config);
724
+ };
725
+ FsHtmlEditorComponent.prototype._change = function (html) {
726
+ this._html = html;
727
+ this.onChange(html);
728
+ };
729
+ FsHtmlEditorComponent.prototype._initPlugins = function (config) {
730
+ var _this = this;
731
+ (config.plugins || []).forEach(function (plugin) {
732
+ _this._fr.FroalaEditor.PLUGINS[plugin.config.name] = function (editor) {
733
+ plugin.editor = editor;
734
+ plugin.initialize();
735
+ return plugin;
736
+ };
737
+ (plugin.config.buttons || []).forEach(function (button) {
738
+ _this._fr.FroalaEditor.DefineIcon(button.name, {
739
+ NAME: button.name,
740
+ PATH: button.svgPath,
741
+ });
742
+ _this._fr.FroalaEditor.RegisterCommand(button.name, {
743
+ icon: button.name,
744
+ title: button.tooltip,
745
+ undo: button.undo,
746
+ focus: button.focus,
747
+ showOnMobile: button.showOnMobile,
748
+ refreshAfterCallback: button.refreshAfterCallback,
749
+ callback: function () {
750
+ if (button.click) {
751
+ button.click(this);
752
+ }
753
+ },
754
+ refresh: function (button) {
755
+ if (button.refresh) {
756
+ button.refresh(this, button);
757
+ }
758
+ }
759
+ });
760
+ });
761
+ });
762
+ };
763
+ FsHtmlEditorComponent.prototype._createOptions = function () {
764
+ var config = this._createConfig();
765
+ return lodashEs.merge(
766
+ // For some reason editor store somewhere pointer on default config object and dublicate options each time on init
767
+ // Extra merge level fixed this problem and allow to init config properly without legacy data
768
+ {}, {
769
+ key: config.activationKey,
770
+ placeholderText: config.placeholder,
771
+ linkAlwaysBlank: true,
772
+ tabSpaces: 2,
773
+ typingTimer: 250,
774
+ tooltips: false,
775
+ wordPasteModal: false,
776
+ imageDefaultWidth: 0,
777
+ imageDefaultAlign: 'left',
778
+ quickInsertEnabled: false,
779
+ paragraphDefaultSelection: 'Format',
780
+ videoUpload: false,
781
+ paragraphFormat: {
782
+ N: 'Normal',
783
+ H1: 'Heading 1',
784
+ H2: 'Heading 2',
785
+ H3: 'Heading 3',
786
+ H4: 'Heading 4',
787
+ BLOCKQUOTE: 'Quote',
788
+ },
789
+ paragraphFormatSelection: true,
790
+ toolbarButtonsXS: {
791
+ moreText: {
792
+ buttons: TextButtons,
793
+ buttonsVisible: 1,
794
+ },
795
+ moreParagraph: {
796
+ buttons: ParagraphButtons,
797
+ buttonsVisible: 2,
798
+ },
799
+ moreRich: {
800
+ buttons: RichButtons,
801
+ buttonsVisible: 0,
802
+ },
803
+ },
804
+ toolbarButtons: {
805
+ moreText: {
806
+ buttons: TextButtons,
807
+ buttonsVisible: 3,
808
+ },
809
+ moreParagraph: {
810
+ buttons: ParagraphButtons,
811
+ buttonsVisible: 5,
812
+ },
813
+ moreRich: {
814
+ buttons: RichButtons,
815
+ buttonsVisible: 3,
816
+ },
817
+ },
818
+ }, config.froalaConfig);
819
+ };
820
+ FsHtmlEditorComponent.prototype._listenLazyInit = function () {
821
+ var _this = this;
822
+ this.froalaReady$
823
+ .pipe(operators.filter(function (ready) { return ready; }), operators.switchMap(function () { return _this._initialize$; }))
824
+ .subscribe(function () {
825
+ var selection = window.getSelection();
826
+ var options = {};
827
+ if (selection.baseNode) {
828
+ options.selection = {
829
+ node: selection.baseNode.nodeValue,
830
+ offset: selection.baseOffset,
831
+ };
832
+ }
833
+ _this.initialize(options);
834
+ });
835
+ };
836
+ var FsHtmlEditorComponent_1;
837
+ FsHtmlEditorComponent.ctorParameters = function () { return [
838
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [FS_HTML_EDITOR_CONFIG,] }] },
839
+ { type: core.ChangeDetectorRef },
840
+ { type: FsFroalaLoaderService }
841
+ ]; };
842
+ __decorate([
843
+ core.HostBinding('class.focused'),
844
+ __metadata("design:type", Object)
845
+ ], FsHtmlEditorComponent.prototype, "classFocused", void 0);
846
+ __decorate([
847
+ core.HostBinding('class.disabled'),
848
+ __metadata("design:type", Object)
849
+ ], FsHtmlEditorComponent.prototype, "classDisabled", void 0);
850
+ __decorate([
851
+ core.ViewChild('elRef'),
852
+ __metadata("design:type", core.ElementRef)
853
+ ], FsHtmlEditorComponent.prototype, "elRef", void 0);
854
+ __decorate([
855
+ core.Input(),
856
+ __metadata("design:type", Object)
857
+ ], FsHtmlEditorComponent.prototype, "config", void 0);
858
+ FsHtmlEditorComponent = FsHtmlEditorComponent_1 = __decorate([
859
+ core.Component({
860
+ selector: 'fs-html-editor',
861
+ template: "<div class=\"fs-html-editor-default\">\n <ng-container *ngIf=\"initialized\">\n <ng-container *fsSkeleton=\"(froalaReady$ | 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",
862
+ providers: [
863
+ {
864
+ provide: forms.NG_VALUE_ACCESSOR,
865
+ useExisting: core.forwardRef(function () { return FsHtmlEditorComponent_1; }),
866
+ multi: true
867
+ },
868
+ {
869
+ provide: forms.NG_VALIDATORS,
870
+ useExisting: core.forwardRef(function () { return FsHtmlEditorComponent_1; }),
871
+ multi: true
872
+ },
873
+ ],
874
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
875
+ 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{position:-webkit-sticky;position:sticky;z-index:2;border-radius:0;background-color:transparent}:host ::ng-deep .fr-toolbar .fr-btn-grp{margin:0 20px 0 0;position:relative}:host ::ng-deep .fr-toolbar .fr-btn-grp:nth-child(1):after,:host ::ng-deep .fr-toolbar .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 div:first-of-type:before{border:none}:host ::ng-deep .fr-toolbar.fr-toolbar-open .fr-newline{height:auto}:host ::ng-deep .fr-toolbar .fr-btn-grp:first-child{margin-left:0}:host ::ng-deep .fr-toolbar.fr-top{border:0}:host ::ng-deep .fr-toolbar .fr-newline{margin:0}:host ::ng-deep .fr-toolbar .fr-more-toolbar{z-index:auto}:host ::ng-deep .fr-toolbar .fr-command.fr-btn{z-index:auto}:host ::ng-deep .fr-toolbar .fr-command.fr-btn.fr-dropdown:after{right:3px}:host ::ng-deep .fr-toolbar .fr-command.fr-btn.fr-dropdown.fr-selection:after{right:10px}:host ::ng-deep .fr-toolbar .fr-command.fr-btn.fr-dropdown.fr-selection span{margin-right:24px}:host ::ng-deep .fr-toolbar .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}"]
876
+ }),
877
+ __param(0, core.Optional()), __param(0, core.Inject(FS_HTML_EDITOR_CONFIG)),
878
+ __metadata("design:paramtypes", [Object, core.ChangeDetectorRef,
879
+ FsFroalaLoaderService])
880
+ ], FsHtmlEditorComponent);
881
+ return FsHtmlEditorComponent;
863
882
  }());
864
883
 
865
- var FsHtmlRendererComponent = /** @class */ (function () {
866
- function FsHtmlRendererComponent(sanitized, _cdRef) {
867
- this.sanitized = sanitized;
868
- this._cdRef = _cdRef;
869
- }
870
- Object.defineProperty(FsHtmlRendererComponent.prototype, "setHtml", {
871
- set: function (html) {
872
- this.trustedHtml = this.sanitized.bypassSecurityTrustHtml(html);
873
- this._cdRef.markForCheck();
874
- },
875
- enumerable: true,
876
- configurable: true
877
- });
878
- FsHtmlRendererComponent.ctorParameters = function () { return [
879
- { type: platformBrowser.DomSanitizer },
880
- { type: core.ChangeDetectorRef }
881
- ]; };
882
- __decorate([
883
- core.Input('html'),
884
- __metadata("design:type", Object),
885
- __metadata("design:paramtypes", [Object])
886
- ], FsHtmlRendererComponent.prototype, "setHtml", null);
887
- FsHtmlRendererComponent = __decorate([
888
- core.Component({
889
- selector: 'fs-html-renderer',
890
- template: "<div class=\"fr-view fs-html-editor-default\" [innerHtml]=\"trustedHtml\"></div>\n",
891
- changeDetection: core.ChangeDetectionStrategy.OnPush,
892
- styles: [""]
893
- }),
894
- __metadata("design:paramtypes", [platformBrowser.DomSanitizer,
895
- core.ChangeDetectorRef])
896
- ], FsHtmlRendererComponent);
897
- return FsHtmlRendererComponent;
884
+ var FsHtmlRendererComponent = /** @class */ (function () {
885
+ function FsHtmlRendererComponent(sanitized, _cdRef) {
886
+ this.sanitized = sanitized;
887
+ this._cdRef = _cdRef;
888
+ }
889
+ Object.defineProperty(FsHtmlRendererComponent.prototype, "setHtml", {
890
+ set: function (html) {
891
+ this.trustedHtml = this.sanitized.bypassSecurityTrustHtml(html);
892
+ this._cdRef.markForCheck();
893
+ },
894
+ enumerable: true,
895
+ configurable: true
896
+ });
897
+ FsHtmlRendererComponent.ctorParameters = function () { return [
898
+ { type: platformBrowser.DomSanitizer },
899
+ { type: core.ChangeDetectorRef }
900
+ ]; };
901
+ __decorate([
902
+ core.Input('html'),
903
+ __metadata("design:type", Object),
904
+ __metadata("design:paramtypes", [Object])
905
+ ], FsHtmlRendererComponent.prototype, "setHtml", null);
906
+ FsHtmlRendererComponent = __decorate([
907
+ core.Component({
908
+ selector: 'fs-html-renderer',
909
+ template: "<div class=\"fr-view fs-html-editor-default\" [innerHtml]=\"trustedHtml\"></div>\n",
910
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
911
+ styles: [""]
912
+ }),
913
+ __metadata("design:paramtypes", [platformBrowser.DomSanitizer,
914
+ core.ChangeDetectorRef])
915
+ ], FsHtmlRendererComponent);
916
+ return FsHtmlRendererComponent;
898
917
  }());
899
918
 
900
- var FsHtmlEditorModule = /** @class */ (function () {
901
- function FsHtmlEditorModule() {
902
- }
903
- FsHtmlEditorModule_1 = FsHtmlEditorModule;
904
- FsHtmlEditorModule.forRoot = function (config) {
905
- if (config === void 0) { config = {}; }
906
- return {
907
- ngModule: FsHtmlEditorModule_1,
908
- providers: [
909
- { provide: FS_HTML_EDITOR_DEFAULT_CONFIG, useValue: config },
910
- {
911
- provide: FS_HTML_EDITOR_CONFIG,
912
- useFactory: FsHtmlEditorConfigFactory,
913
- deps: [FS_HTML_EDITOR_DEFAULT_CONFIG]
914
- }
915
- ]
916
- };
917
- };
918
- var FsHtmlEditorModule_1;
919
- FsHtmlEditorModule = FsHtmlEditorModule_1 = __decorate([
920
- core.NgModule({
921
- imports: [
922
- common.CommonModule,
923
- skeleton.FsSkeletonModule,
924
- ],
925
- exports: [
926
- FsHtmlEditorComponent,
927
- FsHtmlRendererComponent,
928
- ],
929
- declarations: [
930
- FsHtmlEditorComponent,
931
- FsHtmlRendererComponent,
932
- ],
933
- })
934
- ], FsHtmlEditorModule);
935
- return FsHtmlEditorModule;
936
- }());
937
- function FsHtmlEditorConfigFactory(config) {
938
- return __assign({ defaultPlugins: [
939
- "align" /* Align */,
940
- "colors" /* Colors */,
941
- "image" /* Image */,
942
- "link" /* Link */,
943
- "lists" /* Lists */,
944
- "paragraph_format" /* ParagraphFormat */,
945
- "quote" /* Quote */,
946
- "table" /* Table */,
947
- "url" /* Url */,
948
- "video" /* Video */,
949
- "draggable" /* Draggable */,
950
- ] }, config);
919
+ var FsHtmlEditorModule = /** @class */ (function () {
920
+ function FsHtmlEditorModule() {
921
+ }
922
+ FsHtmlEditorModule_1 = FsHtmlEditorModule;
923
+ FsHtmlEditorModule.forRoot = function (config) {
924
+ if (config === void 0) { config = {}; }
925
+ return {
926
+ ngModule: FsHtmlEditorModule_1,
927
+ providers: [
928
+ { provide: FS_HTML_EDITOR_DEFAULT_CONFIG, useValue: config },
929
+ {
930
+ provide: FS_HTML_EDITOR_CONFIG,
931
+ useFactory: FsHtmlEditorConfigFactory,
932
+ deps: [FS_HTML_EDITOR_DEFAULT_CONFIG]
933
+ }
934
+ ]
935
+ };
936
+ };
937
+ var FsHtmlEditorModule_1;
938
+ FsHtmlEditorModule = FsHtmlEditorModule_1 = __decorate([
939
+ core.NgModule({
940
+ imports: [
941
+ common.CommonModule,
942
+ skeleton.FsSkeletonModule,
943
+ ],
944
+ exports: [
945
+ FsHtmlEditorComponent,
946
+ FsHtmlRendererComponent,
947
+ ],
948
+ declarations: [
949
+ FsHtmlEditorComponent,
950
+ FsHtmlRendererComponent,
951
+ ],
952
+ })
953
+ ], FsHtmlEditorModule);
954
+ return FsHtmlEditorModule;
955
+ }());
956
+ function FsHtmlEditorConfigFactory(config) {
957
+ return __assign({ defaultPlugins: [
958
+ "align" /* Align */,
959
+ "colors" /* Colors */,
960
+ "image" /* Image */,
961
+ "link" /* Link */,
962
+ "lists" /* Lists */,
963
+ "paragraph_format" /* ParagraphFormat */,
964
+ "quote" /* Quote */,
965
+ "table" /* Table */,
966
+ "url" /* Url */,
967
+ "video" /* Video */,
968
+ "draggable" /* Draggable */,
969
+ ] }, config);
951
970
  }
952
971
 
953
- var Plugin = /** @class */ (function () {
954
- function Plugin() {
955
- }
956
- Plugin.prototype.initialize = function () { };
957
- Plugin.prototype.destroy = function () { };
958
- return Plugin;
972
+ var Plugin = /** @class */ (function () {
973
+ function Plugin() {
974
+ }
975
+ Plugin.prototype.initialize = function () { };
976
+ Plugin.prototype.destroy = function () { };
977
+ return Plugin;
959
978
  }());
960
979
 
961
- var MentionPlugin = /** @class */ (function (_super) {
962
- __extends(MentionPlugin, _super);
963
- function MentionPlugin(config) {
964
- var _this = _super.call(this) || this;
965
- _this.config = config;
966
- _this.config = __assign(__assign({}, config), { buttons: [
967
- {
968
- name: config.name,
969
- tooltip: config.tooltip,
970
- svgPath: config.iconPath,
971
- click: function (editor) {
972
- _this._closeAll();
973
- _this._tribute.showMenuForCollection(editor.el);
974
- }
975
- }
976
- ] });
977
- _this._tribute = new Tribute({
978
- values: lodashEs.debounce(_this._loadValues.bind(_this), 200),
979
- searchOpts: {
980
- pre: '',
981
- post: '',
982
- skip: true
983
- },
984
- containerClass: "fs-html-editor-mention-container " + (_this.config.containerClass || ''),
985
- itemClass: "fs-html-editor-mention-menu-item " + (_this.config.menuItemClass || ''),
986
- trigger: _this.config.trigger,
987
- allowSpaces: true,
988
- menuItemTemplate: function (item) {
989
- return _this.config.menuItemTemplate(item.original);
990
- },
991
- selectTemplate: function (item) {
992
- var template = _this.config.selectedTemplate(item.original);
993
- var p = document.createElement('p');
994
- p.innerHTML = template;
995
- var node = p.firstElementChild;
996
- if (!node) {
997
- node = document.createElement('span');
998
- node.innerHTML = template;
999
- }
1000
- node.setAttribute('contenteditable', 'false');
1001
- node.classList.add('fr-deletable');
1002
- return node.outerHTML;
1003
- },
1004
- });
1005
- MentionPlugin._tributes.push(_this._tribute);
1006
- return _this;
1007
- }
1008
- MentionPlugin.prototype.initialize = function () {
1009
- var _this = this;
1010
- this._tribute.attach(this.editor.el);
1011
- this.editor.events.on('keydown', function (e) {
1012
- if (e.key === 'Enter' && _this._tribute.isActive) {
1013
- return false;
1014
- }
1015
- }, true);
1016
- };
1017
- MentionPlugin.prototype.destroy = function () { };
1018
- MentionPlugin.prototype._closeAll = function () {
1019
- MentionPlugin._tributes.forEach(function (tribute) {
1020
- if (tribute.menu) {
1021
- tribute.hideMenu();
1022
- }
1023
- });
1024
- };
1025
- MentionPlugin.prototype._loadValues = function (keyword, cb) {
1026
- return this.config.fetch(keyword)
1027
- .subscribe(function (data) {
1028
- cb(data);
1029
- });
1030
- };
1031
- MentionPlugin._tributes = [];
1032
- return MentionPlugin;
980
+ var MentionPlugin = /** @class */ (function (_super) {
981
+ __extends(MentionPlugin, _super);
982
+ function MentionPlugin(config) {
983
+ var _this = _super.call(this) || this;
984
+ _this.config = config;
985
+ _this.config = __assign(__assign({}, config), { buttons: [
986
+ {
987
+ name: config.name,
988
+ tooltip: config.tooltip,
989
+ svgPath: config.iconPath,
990
+ click: function (editor) {
991
+ _this._closeAll();
992
+ _this._tribute.showMenuForCollection(editor.el);
993
+ }
994
+ }
995
+ ] });
996
+ _this._tribute = new Tribute({
997
+ values: lodashEs.debounce(_this._loadValues.bind(_this), 200),
998
+ searchOpts: {
999
+ pre: '',
1000
+ post: '',
1001
+ skip: true
1002
+ },
1003
+ containerClass: "fs-html-editor-mention-container " + (_this.config.containerClass || ''),
1004
+ itemClass: "fs-html-editor-mention-menu-item " + (_this.config.menuItemClass || ''),
1005
+ trigger: _this.config.trigger,
1006
+ allowSpaces: true,
1007
+ menuItemTemplate: function (item) {
1008
+ return _this.config.menuItemTemplate(item.original);
1009
+ },
1010
+ selectTemplate: function (item) {
1011
+ var template = _this.config.selectedTemplate(item.original);
1012
+ var p = document.createElement('p');
1013
+ p.innerHTML = template;
1014
+ var node = p.firstElementChild;
1015
+ if (!node) {
1016
+ node = document.createElement('span');
1017
+ node.innerHTML = template;
1018
+ }
1019
+ node.setAttribute('contenteditable', 'false');
1020
+ node.classList.add('fr-deletable');
1021
+ return node.outerHTML;
1022
+ },
1023
+ });
1024
+ MentionPlugin._tributes.push(_this._tribute);
1025
+ return _this;
1026
+ }
1027
+ MentionPlugin.prototype.initialize = function () {
1028
+ var _this = this;
1029
+ this._tribute.attach(this.editor.el);
1030
+ this.editor.events.on('keydown', function (e) {
1031
+ if (e.key === 'Enter' && _this._tribute.isActive) {
1032
+ return false;
1033
+ }
1034
+ }, true);
1035
+ };
1036
+ MentionPlugin.prototype.destroy = function () { };
1037
+ MentionPlugin.prototype._closeAll = function () {
1038
+ MentionPlugin._tributes.forEach(function (tribute) {
1039
+ if (tribute.menu) {
1040
+ tribute.hideMenu();
1041
+ }
1042
+ });
1043
+ };
1044
+ MentionPlugin.prototype._loadValues = function (keyword, cb) {
1045
+ return this.config.fetch(keyword)
1046
+ .subscribe(function (data) {
1047
+ cb(data);
1048
+ });
1049
+ };
1050
+ MentionPlugin._tributes = [];
1051
+ return MentionPlugin;
1033
1052
  }(Plugin));
1034
1053
 
1035
- var ChecklistPlugin = /** @class */ (function (_super) {
1036
- __extends(ChecklistPlugin, _super);
1037
- function ChecklistPlugin(config) {
1038
- if (config === void 0) { config = { name: 'checklist' }; }
1039
- var _this = _super.call(this) || this;
1040
- _this.config = config;
1041
- _this.config = __assign(__assign({}, config), { name: 'checklist', buttons: [
1042
- {
1043
- name: 'checklist',
1044
- svgPath: 'M8.4,10.3l-1.2,1.2l4,4L20,6.7l-1.2-1.2l-7.6,7.6L8.4,10.3z M18.2,18.2H5.8V5.8h8.9V4H5.8C4.8,4,4,4.8,4,5.8v12.4c0,1,0.8,1.8,1.8,1.8h12.4c1,0,1.8-0.8,1.8-1.8v-7.1h-1.8V18.2z',
1045
- click: function (editor) {
1046
- editor.html.insert('<ul class="checklist"><li></li></ul>');
1047
- }
1048
- }
1049
- ] });
1050
- return _this;
1051
- }
1052
- ChecklistPlugin.prototype.initialize = function () {
1053
- this.editor.events.on('click', function (e) {
1054
- var li = e.target;
1055
- if (li.nodeName === 'LI' && e.offsetX < 0) {
1056
- var items = __spread([li], li.querySelectorAll('li'));
1057
- if (li.classList.contains('checked')) {
1058
- items.forEach(function (item) {
1059
- item.classList.remove('checked');
1060
- });
1061
- }
1062
- else {
1063
- items.forEach(function (item) {
1064
- item.classList.add('checked');
1065
- });
1066
- }
1067
- }
1068
- }, false);
1069
- };
1070
- return ChecklistPlugin;
1054
+ var ChecklistPlugin = /** @class */ (function (_super) {
1055
+ __extends(ChecklistPlugin, _super);
1056
+ function ChecklistPlugin(config) {
1057
+ if (config === void 0) { config = { name: 'checklist' }; }
1058
+ var _this = _super.call(this) || this;
1059
+ _this.config = config;
1060
+ _this.config = __assign(__assign({}, config), { name: 'checklist', buttons: [
1061
+ {
1062
+ name: 'checklist',
1063
+ svgPath: 'M8.4,10.3l-1.2,1.2l4,4L20,6.7l-1.2-1.2l-7.6,7.6L8.4,10.3z M18.2,18.2H5.8V5.8h8.9V4H5.8C4.8,4,4,4.8,4,5.8v12.4c0,1,0.8,1.8,1.8,1.8h12.4c1,0,1.8-0.8,1.8-1.8v-7.1h-1.8V18.2z',
1064
+ click: function (editor) {
1065
+ editor.html.insert('<ul class="checklist"><li></li></ul>');
1066
+ }
1067
+ }
1068
+ ] });
1069
+ return _this;
1070
+ }
1071
+ ChecklistPlugin.prototype.initialize = function () {
1072
+ this.editor.events.on('click', function (e) {
1073
+ var li = e.target;
1074
+ if (li.nodeName === 'LI' && e.offsetX < 0) {
1075
+ var items = __spread([li], li.querySelectorAll('li'));
1076
+ if (li.classList.contains('checked')) {
1077
+ items.forEach(function (item) {
1078
+ item.classList.remove('checked');
1079
+ });
1080
+ }
1081
+ else {
1082
+ items.forEach(function (item) {
1083
+ item.classList.add('checked');
1084
+ });
1085
+ }
1086
+ }
1087
+ }, false);
1088
+ };
1089
+ return ChecklistPlugin;
1071
1090
  }(Plugin));
1072
1091
 
1073
- var CodePlugin = /** @class */ (function (_super) {
1074
- __extends(CodePlugin, _super);
1075
- function CodePlugin(config) {
1076
- if (config === void 0) { config = { name: 'code' }; }
1077
- var _this = _super.call(this) || this;
1078
- _this.config = config;
1079
- _this.config = __assign(__assign({}, config), { name: 'code', buttons: [
1080
- {
1081
- name: 'code',
1082
- svgPath: 'M8.9,7.3L4.2,12l4.7,4.7l1.1-1.1L6.4,12L10,8.4L8.9,7.3z M15.1,7.3L14,8.4l3.6,3.6L14,15.6l1.1,1.1l4.7-4.7L15.1,7.3z',
1083
- click: function (editor) {
1084
- var node = editor.selection.get();
1085
- var codeEl = _this._getCodeEl(node.baseNode);
1086
- if (codeEl) {
1087
- codeEl.classList.remove('code');
1088
- }
1089
- else {
1090
- editor.html.insert('<p class="code">' + editor.selection.get().toString().replace(/\n{1,}/g, '<br>') + '</p>');
1091
- }
1092
- }
1093
- }
1094
- ] });
1095
- return _this;
1096
- }
1097
- CodePlugin.prototype.initialize = function () {
1098
- var _this = this;
1099
- this.editor.events.on('keydown', function (e) {
1100
- if (e.keyCode === 13) {
1101
- var selection = _this.editor.selection.get();
1102
- if (selection && _this._getCodeEl(selection.baseNode)) {
1103
- e.preventDefault();
1104
- e.stopPropagation();
1105
- e.stopImmediatePropagation();
1106
- var br = '<br>';
1107
- var base = selection.baseNode;
1108
- if (base.nodeName === '#text' && selection.baseOffset === base.length) {
1109
- if (!(base.nextSibling && base.nextSibling.nodeName === 'BR')) {
1110
- br += '<br>';
1111
- }
1112
- }
1113
- else {
1114
- var el = Array.from(base.childNodes).splice(selection.baseOffset - 1, 1).pop();
1115
- if (el && el.nodeName !== 'BR') {
1116
- br += '<br>';
1117
- }
1118
- }
1119
- _this.editor.html.insert(br);
1120
- return false;
1121
- }
1122
- }
1123
- }, true);
1124
- };
1125
- CodePlugin.prototype.destroy = function () { };
1126
- CodePlugin.prototype._getCodeEl = function (el) {
1127
- if (el) {
1128
- if (el.classList && el.classList.contains('code')) {
1129
- return el;
1130
- }
1131
- if (el.parentElement) {
1132
- return this._getCodeEl(el.parentElement);
1133
- }
1134
- }
1135
- return null;
1136
- };
1137
- return CodePlugin;
1092
+ var CodePlugin = /** @class */ (function (_super) {
1093
+ __extends(CodePlugin, _super);
1094
+ function CodePlugin(config) {
1095
+ if (config === void 0) { config = { name: 'code' }; }
1096
+ var _this = _super.call(this) || this;
1097
+ _this.config = config;
1098
+ _this.config = __assign(__assign({}, config), { name: 'code', buttons: [
1099
+ {
1100
+ name: 'code',
1101
+ svgPath: 'M8.9,7.3L4.2,12l4.7,4.7l1.1-1.1L6.4,12L10,8.4L8.9,7.3z M15.1,7.3L14,8.4l3.6,3.6L14,15.6l1.1,1.1l4.7-4.7L15.1,7.3z',
1102
+ click: function (editor) {
1103
+ var node = editor.selection.get();
1104
+ var codeEl = _this._getCodeEl(node.baseNode);
1105
+ if (codeEl) {
1106
+ codeEl.classList.remove('code');
1107
+ }
1108
+ else {
1109
+ editor.html.insert('<p class="code">' + editor.selection.get().toString().replace(/\n{1,}/g, '<br>') + '</p>');
1110
+ }
1111
+ }
1112
+ }
1113
+ ] });
1114
+ return _this;
1115
+ }
1116
+ CodePlugin.prototype.initialize = function () {
1117
+ var _this = this;
1118
+ this.editor.events.on('keydown', function (e) {
1119
+ if (e.keyCode === 13) {
1120
+ var selection = _this.editor.selection.get();
1121
+ if (selection && _this._getCodeEl(selection.baseNode)) {
1122
+ e.preventDefault();
1123
+ e.stopPropagation();
1124
+ e.stopImmediatePropagation();
1125
+ var br = '<br>';
1126
+ var base = selection.baseNode;
1127
+ if (base.nodeName === '#text' && selection.baseOffset === base.length) {
1128
+ if (!(base.nextSibling && base.nextSibling.nodeName === 'BR')) {
1129
+ br += '<br>';
1130
+ }
1131
+ }
1132
+ else {
1133
+ var el = Array.from(base.childNodes).splice(selection.baseOffset - 1, 1).pop();
1134
+ if (el && el.nodeName !== 'BR') {
1135
+ br += '<br>';
1136
+ }
1137
+ }
1138
+ _this.editor.html.insert(br);
1139
+ return false;
1140
+ }
1141
+ }
1142
+ }, true);
1143
+ };
1144
+ CodePlugin.prototype.destroy = function () { };
1145
+ CodePlugin.prototype._getCodeEl = function (el) {
1146
+ if (el) {
1147
+ if (el.classList && el.classList.contains('code')) {
1148
+ return el;
1149
+ }
1150
+ if (el.parentElement) {
1151
+ return this._getCodeEl(el.parentElement);
1152
+ }
1153
+ }
1154
+ return null;
1155
+ };
1156
+ return CodePlugin;
1138
1157
  }(Plugin));
1139
1158
 
1140
- var ScreenRecordPlugin = /** @class */ (function (_super) {
1141
- __extends(ScreenRecordPlugin, _super);
1142
- function ScreenRecordPlugin(config) {
1143
- if (config === void 0) { config = {}; }
1144
- var _this = _super.call(this) || this;
1145
- _this.config = config;
1146
- _this.config = __assign(__assign({}, config), { name: config.name || 'screenRecord', buttons: [
1147
- {
1148
- name: 'screenRecord',
1149
- svgPath: "M14.7,7.7v6.1H7.1V7.7H14.7 M16.3,9.6V6.9c0-0.4-0.3-0.8-0.8-0.8H6.4c-0.4,0-0.8,0.3-0.8,0.8v7.6c0,0.4,0.3,0.8,0.8,0.8h9.1c0.4,0,0.8-0.3,0.8-0.8v-2.7l1.7,1.7c0.3,0.3,0.8,0.3,1.1,0c0.1-0.1,0.2-0.3,0.2-0.5V8.4c0-0.4-0.3-0.8-0.8-0.8\n\tc-0.2,0-0.4,0.1-0.5,0.2L16.3,9.6z M21.5,1.6H2.9c-0.7,0-1.3,0.7-1.3,1.6v14.6c0,0.9,0.6,1.6,1.3,1.6h7.6v1.1l-5,1c-0.2,0-0.4,0.3-0.4,0.6c0,0.3,0.2,0.4,0.4,0.4c0,0,0,0,0.1,0l5.3-1h2.6l5.3,1c0,0,0,0,0.1,0c0.2,0,0.4-0.2,0.4-0.4\n c0-0.3-0.1-0.6-0.4-0.6l-5-1v-1.1h7.6c0.7,0,1.3-0.7,1.3-1.6V3.2C22.9,2.3,22.3,1.6,21.5,1.6z M21.1,17.3H3.3V3.7h17.8L21.1,17.3L21.1,17.3z",
1150
- tooltip: 'Screen Record',
1151
- click: function (editor) {
1152
- navigator.mediaDevices.getDisplayMedia({ video: true })
1153
- .then(function (stream) {
1154
- var chunks = [];
1155
- var options = { mimeType: 'video/webm; codecs=vp9' };
1156
- var mediaRecorder = new MediaRecorder(stream, options);
1157
- stream.addEventListener('inactive', function (e) {
1158
- mediaRecorder.stop();
1159
- mediaRecorder = null;
1160
- stream.getTracks().forEach(function (track) { return track.stop(); });
1161
- stream = null;
1162
- var blob = new Blob(chunks, { type: 'video/webm' });
1163
- config.upload(blob)
1164
- .subscribe(function (url) {
1165
- editor.html.insert("<span class=\"fr-screen-record fr-deletable fr-draggable\"><video controls style=\"max-width:" + config.maxWidth + "\"><source src=\"" + url + "\" type=\"video/webm\"></video></span>");
1166
- });
1167
- });
1168
- mediaRecorder.addEventListener('dataavailable', function (event) {
1169
- if (event.data && event.data.size > 0) {
1170
- chunks.push(event.data);
1171
- }
1172
- });
1173
- mediaRecorder.start(10);
1174
- })
1175
- .catch(function (e) { });
1176
- }
1177
- }
1178
- ] });
1179
- return _this;
1180
- }
1181
- ScreenRecordPlugin.prototype.initialize = function () {
1182
- return __awaiter(this, void 0, void 0, function () {
1183
- var FroalaEditor;
1184
- var _this = this;
1185
- return __generator(this, function (_a) {
1186
- switch (_a.label) {
1187
- case 0: return [4 /*yield*/, ResourceLoader.loadStyles('froala')
1188
- .toPromise()];
1189
- case 1:
1190
- _a.sent();
1191
- FroalaEditor = window.FroalaEditor;
1192
- this.editor.events.on('mouseup', function (e) {
1193
- var el = _this._getEl(e.target);
1194
- if (el) {
1195
- _this.editor.popups.hideAll();
1196
- _this._activeEl = el;
1197
- _this._showPopup(el);
1198
- }
1199
- });
1200
- FroalaEditor.POPUP_TEMPLATES["screenRecordPlugin.popup"] = '[_BUTTONS_]';
1201
- FroalaEditor.DefineIcon('popupClose', { NAME: 'trash', SVG_KEY: 'remove' });
1202
- FroalaEditor.RegisterCommand('popupClose', {
1203
- title: 'Remove',
1204
- undo: false,
1205
- focus: false,
1206
- callback: function () {
1207
- if (_this._activeEl) {
1208
- _this._activeEl.remove();
1209
- }
1210
- }
1211
- });
1212
- return [2 /*return*/];
1213
- }
1214
- });
1215
- });
1216
- };
1217
- ScreenRecordPlugin.prototype._createPopup = function () {
1218
- var template = {
1219
- buttons: "<div class=\"fr-buttons\">" + this.editor.button.buildList(['popupClose']) + "</div>",
1220
- };
1221
- return this.editor.popups.create('screenRecordPlugin.popup', template);
1222
- };
1223
- ScreenRecordPlugin.prototype._showPopup = function (el) {
1224
- var $popup = this.editor.popups.get('screenRecordPlugin.popup');
1225
- if (!$popup) {
1226
- $popup = this._createPopup();
1227
- }
1228
- this.editor.popups.setContainer('screenRecordPlugin.popup', this.editor.$(el));
1229
- var left = el.offsetLeft + el.offsetWidth / 2;
1230
- this.editor.popups.show('screenRecordPlugin.popup', left, null);
1231
- };
1232
- ScreenRecordPlugin.prototype._getEl = function (el) {
1233
- if (el && el.classList) {
1234
- if (el.classList.contains('fr-screen-record'))
1235
- return el;
1236
- return this._getEl(el.parentNode);
1237
- }
1238
- };
1239
- return ScreenRecordPlugin;
1159
+ var ScreenRecordPlugin = /** @class */ (function (_super) {
1160
+ __extends(ScreenRecordPlugin, _super);
1161
+ function ScreenRecordPlugin(config) {
1162
+ if (config === void 0) { config = {}; }
1163
+ var _this = _super.call(this) || this;
1164
+ _this.config = config;
1165
+ _this.config = __assign(__assign({}, config), { name: config.name || 'screenRecord', buttons: [
1166
+ {
1167
+ name: 'screenRecord',
1168
+ svgPath: "M14.7,7.7v6.1H7.1V7.7H14.7 M16.3,9.6V6.9c0-0.4-0.3-0.8-0.8-0.8H6.4c-0.4,0-0.8,0.3-0.8,0.8v7.6c0,0.4,0.3,0.8,0.8,0.8h9.1c0.4,0,0.8-0.3,0.8-0.8v-2.7l1.7,1.7c0.3,0.3,0.8,0.3,1.1,0c0.1-0.1,0.2-0.3,0.2-0.5V8.4c0-0.4-0.3-0.8-0.8-0.8\n\tc-0.2,0-0.4,0.1-0.5,0.2L16.3,9.6z M21.5,1.6H2.9c-0.7,0-1.3,0.7-1.3,1.6v14.6c0,0.9,0.6,1.6,1.3,1.6h7.6v1.1l-5,1c-0.2,0-0.4,0.3-0.4,0.6c0,0.3,0.2,0.4,0.4,0.4c0,0,0,0,0.1,0l5.3-1h2.6l5.3,1c0,0,0,0,0.1,0c0.2,0,0.4-0.2,0.4-0.4\n c0-0.3-0.1-0.6-0.4-0.6l-5-1v-1.1h7.6c0.7,0,1.3-0.7,1.3-1.6V3.2C22.9,2.3,22.3,1.6,21.5,1.6z M21.1,17.3H3.3V3.7h17.8L21.1,17.3L21.1,17.3z",
1169
+ tooltip: 'Screen Record',
1170
+ click: function (editor) {
1171
+ navigator.mediaDevices.getDisplayMedia({ video: true })
1172
+ .then(function (stream) {
1173
+ var chunks = [];
1174
+ var options = { mimeType: 'video/webm; codecs=vp9' };
1175
+ var mediaRecorder = new MediaRecorder(stream, options);
1176
+ stream.addEventListener('inactive', function (e) {
1177
+ mediaRecorder.stop();
1178
+ mediaRecorder = null;
1179
+ stream.getTracks().forEach(function (track) { return track.stop(); });
1180
+ stream = null;
1181
+ var blob = new Blob(chunks, { type: 'video/webm' });
1182
+ config.upload(blob)
1183
+ .subscribe(function (url) {
1184
+ editor.html.insert("<span class=\"fr-screen-record fr-deletable fr-draggable\"><video controls style=\"max-width:" + config.maxWidth + "\"><source src=\"" + url + "\" type=\"video/webm\"></video></span>");
1185
+ });
1186
+ });
1187
+ mediaRecorder.addEventListener('dataavailable', function (event) {
1188
+ if (event.data && event.data.size > 0) {
1189
+ chunks.push(event.data);
1190
+ }
1191
+ });
1192
+ mediaRecorder.start(10);
1193
+ })
1194
+ .catch(function (e) { });
1195
+ }
1196
+ }
1197
+ ] });
1198
+ return _this;
1199
+ }
1200
+ ScreenRecordPlugin.prototype.initialize = function () {
1201
+ return __awaiter(this, void 0, void 0, function () {
1202
+ var FroalaEditor;
1203
+ var _this = this;
1204
+ return __generator(this, function (_a) {
1205
+ switch (_a.label) {
1206
+ case 0: return [4 /*yield*/, ResourceLoader.loadStyles('froala')
1207
+ .toPromise()];
1208
+ case 1:
1209
+ _a.sent();
1210
+ FroalaEditor = window.FroalaEditor;
1211
+ this.editor.events.on('mouseup', function (e) {
1212
+ var el = _this._getEl(e.target);
1213
+ if (el) {
1214
+ _this.editor.popups.hideAll();
1215
+ _this._activeEl = el;
1216
+ _this._showPopup(el);
1217
+ }
1218
+ });
1219
+ FroalaEditor.POPUP_TEMPLATES["screenRecordPlugin.popup"] = '[_BUTTONS_]';
1220
+ FroalaEditor.DefineIcon('popupClose', { NAME: 'trash', SVG_KEY: 'remove' });
1221
+ FroalaEditor.RegisterCommand('popupClose', {
1222
+ title: 'Remove',
1223
+ undo: false,
1224
+ focus: false,
1225
+ callback: function () {
1226
+ if (_this._activeEl) {
1227
+ _this._activeEl.remove();
1228
+ }
1229
+ }
1230
+ });
1231
+ return [2 /*return*/];
1232
+ }
1233
+ });
1234
+ });
1235
+ };
1236
+ ScreenRecordPlugin.prototype._createPopup = function () {
1237
+ var template = {
1238
+ buttons: "<div class=\"fr-buttons\">" + this.editor.button.buildList(['popupClose']) + "</div>",
1239
+ };
1240
+ return this.editor.popups.create('screenRecordPlugin.popup', template);
1241
+ };
1242
+ ScreenRecordPlugin.prototype._showPopup = function (el) {
1243
+ var $popup = this.editor.popups.get('screenRecordPlugin.popup');
1244
+ if (!$popup) {
1245
+ $popup = this._createPopup();
1246
+ }
1247
+ this.editor.popups.setContainer('screenRecordPlugin.popup', this.editor.$(el));
1248
+ var left = el.offsetLeft + el.offsetWidth / 2;
1249
+ this.editor.popups.show('screenRecordPlugin.popup', left, null);
1250
+ };
1251
+ ScreenRecordPlugin.prototype._getEl = function (el) {
1252
+ if (el && el.classList) {
1253
+ if (el.classList.contains('fr-screen-record'))
1254
+ return el;
1255
+ return this._getEl(el.parentNode);
1256
+ }
1257
+ };
1258
+ return ScreenRecordPlugin;
1240
1259
  }(Plugin));
1241
1260
 
1242
1261
  exports.ChecklistPlugin = ChecklistPlugin;