@firestitch/html-editor 9.4.5 → 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 (68) 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 -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 +1000 -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/enums/default-plugin.enum.js +1 -1
  32. package/esm2015/app/fs-html-editor.module.js +56 -57
  33. package/esm2015/app/injects/config.inject.js +3 -3
  34. package/esm2015/app/interfaces/html-editor-config.js +1 -1
  35. package/esm2015/app/plugins/checklist.plugin.js +34 -34
  36. package/esm2015/app/plugins/code.plugin.js +62 -62
  37. package/esm2015/app/plugins/mention.plugin.js +72 -72
  38. package/esm2015/app/plugins/screen-record.plugin.js +91 -91
  39. package/esm2015/app/services/froala-loader.service.js +80 -80
  40. package/esm2015/app/utils/loader.js +82 -83
  41. package/esm2015/firestitch-html-editor.js +8 -8
  42. package/esm2015/public_api.js +11 -11
  43. package/esm5/app/classes/plugin.js +8 -8
  44. package/esm5/app/components/html-editor/html-editor.component.js +455 -446
  45. package/esm5/app/components/html-renderer/html-renderer.component.js +38 -38
  46. package/esm5/app/consts/paragraph-buttons.const.js +8 -8
  47. package/esm5/app/consts/rich-buttons.const.js +6 -6
  48. package/esm5/app/consts/text-buttons.const.js +18 -18
  49. package/esm5/app/enums/default-plugin.enum.js +1 -1
  50. package/esm5/app/fs-html-editor.module.js +61 -62
  51. package/esm5/app/injects/config.inject.js +3 -3
  52. package/esm5/app/interfaces/html-editor-config.js +1 -1
  53. package/esm5/app/plugins/checklist.plugin.js +40 -40
  54. package/esm5/app/plugins/code.plugin.js +69 -69
  55. package/esm5/app/plugins/mention.plugin.js +78 -78
  56. package/esm5/app/plugins/screen-record.plugin.js +105 -105
  57. package/esm5/app/services/froala-loader.service.js +95 -95
  58. package/esm5/app/utils/loader.js +82 -83
  59. package/esm5/firestitch-html-editor.js +8 -8
  60. package/esm5/public_api.js +11 -11
  61. package/fesm2015/firestitch-html-editor.js +922 -916
  62. package/fesm2015/firestitch-html-editor.js.map +1 -1
  63. package/fesm5/firestitch-html-editor.js +1000 -993
  64. package/fesm5/firestitch-html-editor.js.map +1 -1
  65. package/firestitch-html-editor.d.ts +9 -9
  66. package/firestitch-html-editor.metadata.json +1 -1
  67. package/package.json +1 -1
  68. 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,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
- 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
+ };
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
+ }
354
353
  var ResourceLoader = resourceLoaderFactory();
355
354
 
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;
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;
441
440
  }());
442
441
 
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;
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;
875
882
  }());
876
883
 
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;
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;
910
917
  }());
911
918
 
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);
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);
964
970
  }
965
971
 
966
- var Plugin = /** @class */ (function () {
967
- function Plugin() {
968
- }
969
- Plugin.prototype.initialize = function () { };
970
- Plugin.prototype.destroy = function () { };
971
- return Plugin;
972
+ var Plugin = /** @class */ (function () {
973
+ function Plugin() {
974
+ }
975
+ Plugin.prototype.initialize = function () { };
976
+ Plugin.prototype.destroy = function () { };
977
+ return Plugin;
972
978
  }());
973
979
 
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;
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;
1046
1052
  }(Plugin));
1047
1053
 
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;
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;
1084
1090
  }(Plugin));
1085
1091
 
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;
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;
1151
1157
  }(Plugin));
1152
1158
 
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;
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;
1253
1259
  }(Plugin));
1254
1260
 
1255
1261
  exports.ChecklistPlugin = ChecklistPlugin;