@firestitch/html-editor 9.4.5 → 9.5.3

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