@firestitch/html-editor 9.5.7 → 12.0.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 (62) hide show
  1. package/app/components/html-editor/html-editor.component.d.ts +7 -4
  2. package/app/components/html-renderer/html-renderer.component.d.ts +4 -1
  3. package/app/fs-html-editor.module.d.ts +8 -0
  4. package/app/plugins/configs/mention-plugin.config.d.ts +1 -0
  5. package/app/plugins/mention.plugin.d.ts +3 -0
  6. package/app/services/froala-loader.service.d.ts +6 -3
  7. package/bundles/firestitch-html-editor.umd.js +510 -382
  8. package/bundles/firestitch-html-editor.umd.js.map +1 -1
  9. package/esm2015/app/classes/plugin.js +1 -1
  10. package/esm2015/app/components/html-editor/html-editor.component.js +59 -51
  11. package/esm2015/app/components/html-renderer/html-renderer.component.js +21 -26
  12. package/esm2015/app/consts/paragraph-buttons.const.js +1 -1
  13. package/esm2015/app/consts/rich-buttons.const.js +1 -1
  14. package/esm2015/app/consts/text-buttons.const.js +1 -1
  15. package/esm2015/app/enums/default-plugin.enum.js +2 -1
  16. package/esm2015/app/fs-html-editor.module.js +29 -21
  17. package/esm2015/app/injects/config.inject.js +1 -1
  18. package/esm2015/app/interfaces/html-editor-config.js +2 -1
  19. package/esm2015/app/interfaces/plugin-button.js +2 -1
  20. package/esm2015/app/interfaces/plugin-config.js +2 -1
  21. package/esm2015/app/plugins/checklist.plugin.js +1 -1
  22. package/esm2015/app/plugins/code.plugin.js +1 -1
  23. package/esm2015/app/plugins/configs/mention-plugin.config.js +2 -1
  24. package/esm2015/app/plugins/configs/screen-record-plugin.config.js +2 -1
  25. package/esm2015/app/plugins/mention.plugin.js +16 -2
  26. package/esm2015/app/plugins/screen-record.plugin.js +1 -1
  27. package/esm2015/app/services/froala-loader.service.js +16 -17
  28. package/esm2015/app/utils/loader.js +1 -1
  29. package/esm2015/firestitch-html-editor.js +1 -5
  30. package/esm2015/public_api.js +1 -1
  31. package/fesm2015/firestitch-html-editor.js +141 -113
  32. package/fesm2015/firestitch-html-editor.js.map +1 -1
  33. package/firestitch-html-editor.d.ts +1 -5
  34. package/package.json +4 -7
  35. package/styles.scss +3 -2
  36. package/bundles/firestitch-html-editor.umd.min.js +0 -17
  37. package/bundles/firestitch-html-editor.umd.min.js.map +0 -1
  38. package/esm5/app/classes/plugin.js +0 -9
  39. package/esm5/app/components/html-editor/html-editor.component.js +0 -471
  40. package/esm5/app/components/html-renderer/html-renderer.component.js +0 -39
  41. package/esm5/app/consts/paragraph-buttons.const.js +0 -9
  42. package/esm5/app/consts/rich-buttons.const.js +0 -7
  43. package/esm5/app/consts/text-buttons.const.js +0 -19
  44. package/esm5/app/enums/default-plugin.enum.js +0 -1
  45. package/esm5/app/fs-html-editor.module.js +0 -62
  46. package/esm5/app/injects/config.inject.js +0 -4
  47. package/esm5/app/interfaces/html-editor-config.js +0 -1
  48. package/esm5/app/interfaces/plugin-button.js +0 -1
  49. package/esm5/app/interfaces/plugin-config.js +0 -1
  50. package/esm5/app/plugins/checklist.plugin.js +0 -41
  51. package/esm5/app/plugins/code.plugin.js +0 -70
  52. package/esm5/app/plugins/configs/mention-plugin.config.js +0 -1
  53. package/esm5/app/plugins/configs/screen-record-plugin.config.js +0 -1
  54. package/esm5/app/plugins/mention.plugin.js +0 -79
  55. package/esm5/app/plugins/screen-record.plugin.js +0 -106
  56. package/esm5/app/services/froala-loader.service.js +0 -96
  57. package/esm5/app/utils/loader.js +0 -83
  58. package/esm5/firestitch-html-editor.js +0 -9
  59. package/esm5/public_api.js +0 -12
  60. package/fesm5/firestitch-html-editor.js +0 -1060
  61. package/fesm5/firestitch-html-editor.js.map +0 -1
  62. package/firestitch-html-editor.metadata.json +0 -1
@@ -1,1060 +0,0 @@
1
- import { __read, __decorate, __param, __metadata, __assign, __extends, __spread, __awaiter, __generator } from 'tslib';
2
- import { InjectionToken, Optional, Inject, ɵɵdefineInjectable, ɵɵinject, Injectable, ChangeDetectorRef, HostBinding, ViewChild, ElementRef, Input, Component, forwardRef, ChangeDetectionStrategy, NgModule } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
4
- import { FsSkeletonModule } from '@firestitch/skeleton';
5
- import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
6
- import { FileProcessor, FsFile } from '@firestitch/file';
7
- import { Observable, BehaviorSubject, combineLatest, ReplaySubject, Subject, fromEventPattern } from 'rxjs';
8
- import { shareReplay, map, tap, concatMap, switchMap, filter, startWith, distinctUntilChanged, skip, takeUntil } from 'rxjs/operators';
9
- import { merge, debounce } from 'lodash-es';
10
- import { DomSanitizer } from '@angular/platform-browser';
11
- import Tribute from 'tributejs';
12
-
13
- var RichButtons = [
14
- 'insertTable',
15
- 'insertImage',
16
- 'insertLink',
17
- 'insertVideo',
18
- ];
19
-
20
- var TextButtons = [
21
- 'paragraphFormat',
22
- 'code',
23
- 'bold',
24
- 'italic',
25
- 'underline',
26
- 'strikeThrough',
27
- 'subscript',
28
- 'superscript',
29
- 'fontFamily',
30
- 'fontSize',
31
- 'textColor',
32
- 'backgroundColor',
33
- 'inlineClass',
34
- 'inlineStyle',
35
- 'clearFormatting',
36
- 'quote',
37
- ];
38
-
39
- var ParagraphButtons = [
40
- 'align',
41
- 'formatOL',
42
- 'formatUL',
43
- 'checklist',
44
- 'indent',
45
- 'outdent',
46
- ];
47
-
48
- var FS_HTML_EDITOR_DEFAULT_CONFIG = new InjectionToken('fs-html-editor.default-config');
49
- var FS_HTML_EDITOR_CONFIG = new InjectionToken('fs-html-editor.config');
50
-
51
- function resourceLoaderFactory() {
52
- var resourceBase = '/assets/js/froala/';
53
- var stylesBase = '/assets/css/';
54
- var head = document.getElementsByTagName('head')[0];
55
- var files = new Map();
56
- var resourcePaths = {
57
- froala: 'froala_editor.min.js',
58
- align: 'plugins/align.min.js',
59
- colors: 'plugins/colors.min.js',
60
- image: 'plugins/image.min.js',
61
- link: 'plugins/link.min.js',
62
- lists: 'plugins/lists.min.js',
63
- paragraph_format: 'plugins/paragraph_format.min.js',
64
- table: 'plugins/table.min.js',
65
- url: 'plugins/url.min.js',
66
- video: 'plugins/video.min.js',
67
- quote: 'plugins/quote.min.js',
68
- draggable: 'plugins/draggable.min.js',
69
- font_size: 'plugins/font_size.min.js',
70
- };
71
- var stylesPaths = {
72
- froala: 'froala_editor.pkgd.min.css',
73
- };
74
- var loadResource = function (scriptPath) {
75
- if (!files.has(scriptPath)) {
76
- var obs$ = new Observable(function (obs) {
77
- var script = document.createElement('script');
78
- script.src = scriptPath;
79
- head.appendChild(script);
80
- script.onload = function () {
81
- obs.next();
82
- obs.complete();
83
- };
84
- script.onerror = function (err) {
85
- obs.error(err);
86
- };
87
- })
88
- .pipe(shareReplay(1));
89
- files.set(scriptPath, obs$);
90
- }
91
- return files.get(scriptPath);
92
- };
93
- var loadStyles = function (stylePath) {
94
- if (!files.has(stylePath)) {
95
- var obs$ = new Observable(function (obs) {
96
- var style = document.createElement('link');
97
- style.id = stylePath;
98
- style.rel = 'stylesheet';
99
- style.href = "" + stylePath;
100
- head.appendChild(style);
101
- style.onload = function () {
102
- obs.next();
103
- obs.complete();
104
- };
105
- style.onerror = function (err) {
106
- obs.error(err);
107
- };
108
- });
109
- files.set(stylePath, obs$);
110
- }
111
- return files.get(stylePath);
112
- };
113
- return {
114
- setResourceBase: function (path) {
115
- resourceBase = path;
116
- },
117
- setStylesBase: function (path) {
118
- stylesBase = path;
119
- },
120
- loadResource: function (resourceName) {
121
- var path = resourcePaths[resourceName] || resourceName;
122
- return loadResource(resourceBase + path);
123
- },
124
- loadStyles: function (resourceName) {
125
- var path = stylesPaths[resourceName] || resourceName;
126
- return loadStyles(stylesBase + path);
127
- }
128
- };
129
- }
130
- var ResourceLoader = resourceLoaderFactory();
131
-
132
- var FsFroalaLoaderService = /** @class */ (function () {
133
- function FsFroalaLoaderService(_defaultConfig) {
134
- this._defaultConfig = _defaultConfig;
135
- this._froalaLoaded = new BehaviorSubject(false);
136
- this._defaultPluginsLoaded = new BehaviorSubject(false);
137
- this._loaded$ = combineLatest([this._froalaLoaded, this._defaultPluginsLoaded])
138
- .pipe(map(function (_a) {
139
- var _b = __read(_a, 2), FroalaReady = _b[0], pluginsRead = _b[1];
140
- return pluginsRead && FroalaReady;
141
- }), shareReplay(1));
142
- if (this._defaultConfig) {
143
- if (this._defaultConfig.assetsJSPath) {
144
- ResourceLoader.setResourceBase(this._defaultConfig.assetsJSPath);
145
- }
146
- if (this._defaultConfig.assetsCSSPath) {
147
- ResourceLoader.setStylesBase(this._defaultConfig.assetsCSSPath);
148
- }
149
- }
150
- this._load();
151
- }
152
- Object.defineProperty(FsFroalaLoaderService.prototype, "loaded$", {
153
- get: function () {
154
- return this._loaded$;
155
- },
156
- enumerable: true,
157
- configurable: true
158
- });
159
- Object.defineProperty(FsFroalaLoaderService.prototype, "ready", {
160
- get: function () {
161
- return this._froalaLoaded.getValue() && this._defaultPluginsLoaded.getValue();
162
- },
163
- enumerable: true,
164
- configurable: true
165
- });
166
- Object.defineProperty(FsFroalaLoaderService.prototype, "FroalaEditor", {
167
- get: function () {
168
- return this._FroalaEditor;
169
- },
170
- enumerable: true,
171
- configurable: true
172
- });
173
- FsFroalaLoaderService.prototype._load = function () {
174
- var _this = this;
175
- combineLatest([
176
- ResourceLoader.loadResource('froala'),
177
- ResourceLoader.loadStyles('froala')
178
- ])
179
- .pipe(tap(function () {
180
- _this._FroalaEditor = window.FroalaEditor;
181
- _this._froalaDone();
182
- }), concatMap(function () {
183
- return _this._loadPlugins();
184
- }), tap(function () {
185
- _this._defaultPluginsDone();
186
- }))
187
- .subscribe();
188
- };
189
- FsFroalaLoaderService.prototype._loadPlugins = function () {
190
- var imports = this._defaultConfig
191
- .defaultPlugins
192
- .reduce(function (acc, pluginName) {
193
- var import$ = ResourceLoader.loadResource(pluginName);
194
- acc.push(import$);
195
- return acc;
196
- }, []);
197
- return combineLatest(imports);
198
- };
199
- FsFroalaLoaderService.prototype._froalaDone = function () {
200
- this._froalaLoaded.next(true);
201
- };
202
- FsFroalaLoaderService.prototype._defaultPluginsDone = function () {
203
- this._defaultPluginsLoaded.next(true);
204
- };
205
- FsFroalaLoaderService.ctorParameters = function () { return [
206
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [FS_HTML_EDITOR_CONFIG,] }] }
207
- ]; };
208
- FsFroalaLoaderService.ɵprov = ɵɵdefineInjectable({ factory: function FsFroalaLoaderService_Factory() { return new FsFroalaLoaderService(ɵɵinject(FS_HTML_EDITOR_CONFIG, 8)); }, token: FsFroalaLoaderService, providedIn: "root" });
209
- FsFroalaLoaderService = __decorate([
210
- Injectable({
211
- providedIn: 'root',
212
- }),
213
- __param(0, Optional()), __param(0, Inject(FS_HTML_EDITOR_CONFIG)),
214
- __metadata("design:paramtypes", [Object])
215
- ], FsFroalaLoaderService);
216
- return FsFroalaLoaderService;
217
- }());
218
-
219
- var FsHtmlEditorComponent = /** @class */ (function () {
220
- function FsHtmlEditorComponent(_defaultConfig, _cdRef, _fr) {
221
- this._defaultConfig = _defaultConfig;
222
- this._cdRef = _cdRef;
223
- this._fr = _fr;
224
- this.classFocused = false;
225
- this.classDisabled = false;
226
- this.config = {};
227
- this.initialized = false;
228
- this._initialize$ = new ReplaySubject();
229
- this._froalaReady$ = new BehaviorSubject(null);
230
- this._destroy$ = new Subject();
231
- this.onChange = function (data) { };
232
- this.onTouched = function () { };
233
- }
234
- FsHtmlEditorComponent_1 = FsHtmlEditorComponent;
235
- Object.defineProperty(FsHtmlEditorComponent.prototype, "el", {
236
- get: function () {
237
- return this.elRef.nativeElement;
238
- },
239
- enumerable: true,
240
- configurable: true
241
- });
242
- Object.defineProperty(FsHtmlEditorComponent.prototype, "html", {
243
- get: function () {
244
- return this._html;
245
- },
246
- enumerable: true,
247
- configurable: true
248
- });
249
- Object.defineProperty(FsHtmlEditorComponent.prototype, "editor", {
250
- get: function () {
251
- return this._editor;
252
- },
253
- enumerable: true,
254
- configurable: true
255
- });
256
- Object.defineProperty(FsHtmlEditorComponent.prototype, "froalaLoaded$", {
257
- get: function () {
258
- return this._fr.loaded$;
259
- },
260
- enumerable: true,
261
- configurable: true
262
- });
263
- FsHtmlEditorComponent.prototype.ngOnInit = function () {
264
- this.config = this.config || {};
265
- this.config.autofocus = this.config.autofocus !== false && !this.config.disabled;
266
- this.initialized = !this.config.initOnClick;
267
- this._listenLazyInit();
268
- };
269
- FsHtmlEditorComponent.prototype.ngAfterViewInit = function () {
270
- if (!this.config.initOnClick || !this.hasContent()) {
271
- this.initialized = true;
272
- this._initialize$.next();
273
- }
274
- };
275
- FsHtmlEditorComponent.prototype.hasContent = function () {
276
- var el = document.createElement('div');
277
- if (el.querySelector('img')) {
278
- return true;
279
- }
280
- el.innerHTML = this._html;
281
- return !!el.innerText.length;
282
- };
283
- FsHtmlEditorComponent.prototype.initialize = function (options) {
284
- var _this = this;
285
- if (options === void 0) { options = {}; }
286
- var config = this._createConfig();
287
- this._initPlugins(config);
288
- // this.el.innerHTML = this._html || '';
289
- this._editor = new this._fr.FroalaEditor(this.el, this._createOptions(), function () {
290
- _this._froalaReady$.next({ config: config, options: options });
291
- });
292
- };
293
- FsHtmlEditorComponent.prototype._processImageUpload = function (blob) {
294
- var _this = this;
295
- var processor = new FileProcessor();
296
- var file = new FsFile(blob);
297
- return processor.process([file], this.config.image)
298
- .pipe(switchMap(function (_a) {
299
- var _b = __read(_a, 1), f = _b[0];
300
- return _this.config.image.upload(f.file);
301
- }));
302
- };
303
- FsHtmlEditorComponent.prototype._getTextNode = function (node) {
304
- if (node) {
305
- if (node.nodeType === Node.TEXT_NODE) {
306
- return node;
307
- }
308
- if (node.childNodes) {
309
- return this._getTextNode(node.childNodes[0]);
310
- }
311
- }
312
- };
313
- FsHtmlEditorComponent.prototype.uninitializedClick = function (event) {
314
- if (!event.defaultPrevented) {
315
- var target_1 = event.target;
316
- if (target_1 && target_1.nodeName === 'A' && target_1.getAttribute('href')) {
317
- var targetTarget_1 = target_1.getAttribute('target');
318
- target_1.setAttribute('target', '_blank');
319
- setTimeout(function () {
320
- if (targetTarget_1) {
321
- target_1.setAttribute('target', targetTarget_1);
322
- }
323
- else {
324
- target_1.removeAttribute('target');
325
- }
326
- });
327
- }
328
- else {
329
- if (this.config.initClick) {
330
- this.config.initClick(event);
331
- }
332
- this._initialize$.next();
333
- this.initialized = true;
334
- }
335
- }
336
- };
337
- FsHtmlEditorComponent.prototype.updateSize = function () {
338
- // Hack: To trigger the toolbar button size modes
339
- window.dispatchEvent(new Event('resize'));
340
- };
341
- FsHtmlEditorComponent.prototype.validate = function (control) {
342
- var err = {};
343
- if (this.config.maxLength && this._html) {
344
- var maxLength = this.config.maxLength;
345
- var length_1 = this._html.length;
346
- if (length_1 > maxLength) {
347
- err.maxLengthError = "Must be " + maxLength + " characters or fewer. You entered " + length_1 + " characters.";
348
- }
349
- }
350
- return Object.keys(err).length ? err : null;
351
- };
352
- FsHtmlEditorComponent.prototype.focus = function (options) {
353
- options = options ? options : {};
354
- if (options.cursorPosition === 'end') {
355
- this.editor.selection.setAtEnd(this.editor.$el.get(0));
356
- }
357
- else {
358
- this.editor.selection.setAtStart(this.editor.$el.get(0));
359
- }
360
- this.editor.selection.restore();
361
- var elSelection = this.editor.selection.element();
362
- if (elSelection) {
363
- elSelection.scrollIntoView({ block: 'center' });
364
- }
365
- };
366
- FsHtmlEditorComponent.prototype.clear = function () {
367
- this.writeValue('');
368
- };
369
- FsHtmlEditorComponent.prototype.disable = function () {
370
- this.classDisabled = true;
371
- };
372
- FsHtmlEditorComponent.prototype.setHtml = function (html) {
373
- this.writeValue(html);
374
- };
375
- FsHtmlEditorComponent.prototype.writeValue = function (html) {
376
- this._html = html || '';
377
- if (this.editor && this.editor.html) {
378
- try {
379
- this.editor.html.set(this._html);
380
- }
381
- catch (e) {
382
- }
383
- }
384
- this._cdRef.markForCheck();
385
- };
386
- FsHtmlEditorComponent.prototype.registerOnChange = function (fn) {
387
- this.onChange = fn;
388
- };
389
- FsHtmlEditorComponent.prototype.registerOnTouched = function (fn) {
390
- this.onTouched = fn;
391
- };
392
- FsHtmlEditorComponent.prototype.ngOnDestroy = function () {
393
- this._initialize$.complete();
394
- this._destroy$.next();
395
- this._destroy$.complete();
396
- this.destroy();
397
- };
398
- FsHtmlEditorComponent.prototype.destroy = function () {
399
- if (this.editor) {
400
- this.editor.destroy();
401
- }
402
- this.initialized = false;
403
- this._cdRef.markForCheck();
404
- this.el.innerHTML = '';
405
- };
406
- FsHtmlEditorComponent.prototype._createConfig = function () {
407
- return merge({ froalaConfig: {} }, this._defaultConfig, this.config);
408
- };
409
- FsHtmlEditorComponent.prototype._change = function (html) {
410
- // this._html = html;
411
- this.onChange(html);
412
- };
413
- FsHtmlEditorComponent.prototype._initPlugins = function (config) {
414
- var _this = this;
415
- (config.plugins || []).forEach(function (plugin) {
416
- _this._fr.FroalaEditor.PLUGINS[plugin.config.name] = function (editor) {
417
- plugin.editor = editor;
418
- plugin.initialize();
419
- return plugin;
420
- };
421
- (plugin.config.buttons || []).forEach(function (button) {
422
- _this._fr.FroalaEditor.DefineIcon(button.name, {
423
- NAME: button.name,
424
- PATH: button.svgPath,
425
- });
426
- _this._fr.FroalaEditor.RegisterCommand(button.name, {
427
- icon: button.name,
428
- title: button.tooltip,
429
- undo: button.undo,
430
- focus: button.focus,
431
- showOnMobile: button.showOnMobile,
432
- refreshAfterCallback: button.refreshAfterCallback,
433
- callback: function () {
434
- if (button.click) {
435
- button.click(this);
436
- }
437
- },
438
- refresh: function (button) {
439
- if (button.refresh) {
440
- button.refresh(this, button);
441
- }
442
- }
443
- });
444
- });
445
- });
446
- };
447
- FsHtmlEditorComponent.prototype._createOptions = function () {
448
- var config = this._createConfig();
449
- return merge(
450
- // For some reason editor store somewhere pointer on default config object and dublicate options each time on init
451
- // Extra merge level fixed this problem and allow to init config properly without legacy data
452
- {}, {
453
- key: config.activationKey,
454
- placeholderText: config.placeholder,
455
- linkAlwaysBlank: true,
456
- tabSpaces: 2,
457
- typingTimer: 250,
458
- tooltips: false,
459
- wordPasteModal: false,
460
- imageDefaultWidth: 0,
461
- imageDefaultAlign: 'left',
462
- quickInsertEnabled: false,
463
- paragraphDefaultSelection: 'Format',
464
- videoUpload: false,
465
- paragraphFormat: {
466
- N: 'Normal',
467
- H1: 'Heading 1',
468
- H2: 'Heading 2',
469
- H3: 'Heading 3',
470
- H4: 'Heading 4',
471
- BLOCKQUOTE: 'Quote',
472
- },
473
- paragraphFormatSelection: true,
474
- toolbarButtonsXS: {
475
- moreText: {
476
- buttons: TextButtons,
477
- buttonsVisible: 1,
478
- },
479
- moreParagraph: {
480
- buttons: ParagraphButtons,
481
- buttonsVisible: 2,
482
- },
483
- moreRich: {
484
- buttons: RichButtons,
485
- buttonsVisible: 0,
486
- },
487
- },
488
- toolbarButtons: {
489
- moreText: {
490
- buttons: TextButtons,
491
- buttonsVisible: 3,
492
- },
493
- moreParagraph: {
494
- buttons: ParagraphButtons,
495
- buttonsVisible: 5,
496
- },
497
- moreRich: {
498
- buttons: RichButtons,
499
- buttonsVisible: 3,
500
- },
501
- },
502
- }, config.froalaConfig);
503
- };
504
- FsHtmlEditorComponent.prototype._listenLazyInit = function () {
505
- var _this = this;
506
- this.froalaLoaded$
507
- .pipe(filter(function (ready) { return ready; }), switchMap(function () { return _this._initialize$; }), tap(function () {
508
- var selection = window.getSelection();
509
- var options = {};
510
- if (selection.baseNode) {
511
- options.selection = {
512
- node: selection.baseNode.nodeValue,
513
- offset: selection.baseOffset,
514
- };
515
- }
516
- _this.initialize(options);
517
- }), switchMap(function () { return _this._froalaReady$; }), filter(function (data) { return !!data; }), tap(function (_a) {
518
- var config = _a.config, options = _a.options;
519
- _this._setupFroala(config, options);
520
- }))
521
- .subscribe();
522
- };
523
- FsHtmlEditorComponent.prototype._contentChanged = function () {
524
- var editorHTML = this._editor.html.get();
525
- if (this.html !== editorHTML) {
526
- this._change(editorHTML);
527
- }
528
- };
529
- FsHtmlEditorComponent.prototype._setupFroala = function (config, options) {
530
- var _this = this;
531
- this._cdRef.markForCheck();
532
- this.setHtml(this._html);
533
- if (config.disabled) {
534
- this.disable();
535
- }
536
- if (config.froalaConfig.events) {
537
- if (config.froalaConfig.events.initialized) {
538
- config.froalaConfig.events.initialized();
539
- }
540
- }
541
- this._editor.events.on('focus', function () {
542
- _this.classFocused = true;
543
- _this._cdRef.markForCheck();
544
- });
545
- this._editor.events.on('blur', function () {
546
- _this.classFocused = false;
547
- _this._cdRef.markForCheck();
548
- });
549
- fromEventPattern(function (handler) {
550
- _this._editor.events.on('contentChanged', handler);
551
- }, function () { })
552
- .pipe(startWith(this._html), map(function () { return _this.editor.html.get(); }), distinctUntilChanged(), skip(1))
553
- .subscribe(function () {
554
- _this._contentChanged();
555
- });
556
- // this._editor.events.on('contentChanged', () => {
557
- // console.log('test');
558
- // if (!this._firstChange) {
559
- // this._contentChanged();
560
- // }
561
- // });
562
- this._editor.events.on('paste.afterCleanup', function (html) {
563
- var div = document.createElement('div');
564
- div.innerHTML = html;
565
- div.querySelectorAll('*')
566
- .forEach(function (el) {
567
- for (var i = 0; i < el.attributes.length; i++) {
568
- var name_1 = el.attributes[0].name;
569
- if (name_1 !== 'href') {
570
- el.removeAttribute(name_1);
571
- }
572
- }
573
- });
574
- return div.innerHTML;
575
- });
576
- this._editor.events.on('keydown', function () {
577
- _this.onTouched();
578
- });
579
- if (this.config.image && this.config.image.upload) {
580
- this._editor.events.on('image.beforePasteUpload', function (image) {
581
- fetch(image.getAttribute('src'))
582
- .then(function (res) {
583
- res.blob()
584
- .then(function (blob) {
585
- _this._processImageUpload(blob)
586
- .pipe(takeUntil(_this._destroy$))
587
- .subscribe(function (url) {
588
- image.setAttribute('src', url);
589
- image.removeAttribute('data-fr-image-pasted');
590
- _this._contentChanged();
591
- });
592
- });
593
- });
594
- return false;
595
- });
596
- this._editor.events.on('image.beforeUpload', function (blobs) {
597
- _this._processImageUpload(blobs[0])
598
- .pipe(takeUntil(_this._destroy$))
599
- .subscribe(function (url) {
600
- _this.editor.image.insert(url, null, null, _this.editor.image.get());
601
- });
602
- return false;
603
- });
604
- }
605
- if (this.el.querySelector('.fr-second-toolbar')) {
606
- this.el.querySelector('.fr-second-toolbar').remove();
607
- }
608
- var selection = options.selection;
609
- if (selection) {
610
- var node = Array.from(this.el.querySelectorAll('.fr-element *')).find(function (node) {
611
- return selection.node === node.textContent;
612
- });
613
- if (node) {
614
- var range = document.createRange();
615
- var sel = window.getSelection();
616
- range.setStart(this._getTextNode(node), selection.offset);
617
- range.collapse(true);
618
- sel.removeAllRanges();
619
- sel.addRange(range);
620
- }
621
- else if (this.config.autofocus) {
622
- this.focus();
623
- }
624
- }
625
- else if (this.config.autofocus) {
626
- this.focus();
627
- }
628
- };
629
- var FsHtmlEditorComponent_1;
630
- FsHtmlEditorComponent.ctorParameters = function () { return [
631
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [FS_HTML_EDITOR_CONFIG,] }] },
632
- { type: ChangeDetectorRef },
633
- { type: FsFroalaLoaderService }
634
- ]; };
635
- __decorate([
636
- HostBinding('class.focused'),
637
- __metadata("design:type", Object)
638
- ], FsHtmlEditorComponent.prototype, "classFocused", void 0);
639
- __decorate([
640
- HostBinding('class.disabled'),
641
- __metadata("design:type", Object)
642
- ], FsHtmlEditorComponent.prototype, "classDisabled", void 0);
643
- __decorate([
644
- ViewChild('elRef'),
645
- __metadata("design:type", ElementRef)
646
- ], FsHtmlEditorComponent.prototype, "elRef", void 0);
647
- __decorate([
648
- Input(),
649
- __metadata("design:type", Object)
650
- ], FsHtmlEditorComponent.prototype, "config", void 0);
651
- FsHtmlEditorComponent = FsHtmlEditorComponent_1 = __decorate([
652
- Component({
653
- selector: 'fs-html-editor',
654
- template: "<div class=\"fs-html-editor-default\">\n <ng-container *ngIf=\"initialized\">\n <ng-container *fsSkeleton=\"(froalaLoaded$ | async) !== false\">\n </ng-container>\n </ng-container>\n\n <div #elRef></div>\n\n <div class=\"bottom-line\"></div>\n <div class=\"disabled-line\"></div>\n <fs-html-renderer\n *ngIf=\"!initialized\"\n [html]=\"html\"\n (click)=\"uninitializedClick($event)\">\n </fs-html-renderer>\n</div>\n",
655
- providers: [
656
- {
657
- provide: NG_VALUE_ACCESSOR,
658
- useExisting: forwardRef(function () { return FsHtmlEditorComponent_1; }),
659
- multi: true
660
- },
661
- {
662
- provide: NG_VALIDATORS,
663
- useExisting: forwardRef(function () { return FsHtmlEditorComponent_1; }),
664
- multi: true
665
- },
666
- ],
667
- changeDetection: ChangeDetectionStrategy.OnPush,
668
- 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:#fff}: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}"]
669
- }),
670
- __param(0, Optional()), __param(0, Inject(FS_HTML_EDITOR_CONFIG)),
671
- __metadata("design:paramtypes", [Object, ChangeDetectorRef,
672
- FsFroalaLoaderService])
673
- ], FsHtmlEditorComponent);
674
- return FsHtmlEditorComponent;
675
- }());
676
-
677
- var FsHtmlRendererComponent = /** @class */ (function () {
678
- function FsHtmlRendererComponent(sanitized, _cdRef) {
679
- this.sanitized = sanitized;
680
- this._cdRef = _cdRef;
681
- }
682
- Object.defineProperty(FsHtmlRendererComponent.prototype, "setHtml", {
683
- set: function (html) {
684
- this.trustedHtml = this.sanitized.bypassSecurityTrustHtml(html);
685
- this._cdRef.markForCheck();
686
- },
687
- enumerable: true,
688
- configurable: true
689
- });
690
- FsHtmlRendererComponent.ctorParameters = function () { return [
691
- { type: DomSanitizer },
692
- { type: ChangeDetectorRef }
693
- ]; };
694
- __decorate([
695
- Input('html'),
696
- __metadata("design:type", Object),
697
- __metadata("design:paramtypes", [Object])
698
- ], FsHtmlRendererComponent.prototype, "setHtml", null);
699
- FsHtmlRendererComponent = __decorate([
700
- Component({
701
- selector: 'fs-html-renderer',
702
- template: "<div class=\"fr-view fs-html-editor-default\" [innerHtml]=\"trustedHtml\"></div>\n",
703
- changeDetection: ChangeDetectionStrategy.OnPush,
704
- styles: [""]
705
- }),
706
- __metadata("design:paramtypes", [DomSanitizer,
707
- ChangeDetectorRef])
708
- ], FsHtmlRendererComponent);
709
- return FsHtmlRendererComponent;
710
- }());
711
-
712
- var FsHtmlEditorModule = /** @class */ (function () {
713
- function FsHtmlEditorModule() {
714
- }
715
- FsHtmlEditorModule_1 = FsHtmlEditorModule;
716
- FsHtmlEditorModule.forRoot = function (config) {
717
- if (config === void 0) { config = {}; }
718
- return {
719
- ngModule: FsHtmlEditorModule_1,
720
- providers: [
721
- { provide: FS_HTML_EDITOR_DEFAULT_CONFIG, useValue: config },
722
- {
723
- provide: FS_HTML_EDITOR_CONFIG,
724
- useFactory: FsHtmlEditorConfigFactory,
725
- deps: [FS_HTML_EDITOR_DEFAULT_CONFIG]
726
- }
727
- ]
728
- };
729
- };
730
- var FsHtmlEditorModule_1;
731
- FsHtmlEditorModule = FsHtmlEditorModule_1 = __decorate([
732
- NgModule({
733
- imports: [
734
- CommonModule,
735
- FsSkeletonModule,
736
- ],
737
- exports: [
738
- FsHtmlEditorComponent,
739
- FsHtmlRendererComponent,
740
- ],
741
- declarations: [
742
- FsHtmlEditorComponent,
743
- FsHtmlRendererComponent,
744
- ],
745
- })
746
- ], FsHtmlEditorModule);
747
- return FsHtmlEditorModule;
748
- }());
749
- function FsHtmlEditorConfigFactory(config) {
750
- return __assign({ defaultPlugins: [
751
- "align" /* Align */,
752
- "colors" /* Colors */,
753
- "image" /* Image */,
754
- "link" /* Link */,
755
- "lists" /* Lists */,
756
- "paragraph_format" /* ParagraphFormat */,
757
- "quote" /* Quote */,
758
- "table" /* Table */,
759
- "url" /* Url */,
760
- "video" /* Video */,
761
- "draggable" /* Draggable */,
762
- "font_size" /* FontSize */,
763
- ] }, config);
764
- }
765
-
766
- var Plugin = /** @class */ (function () {
767
- function Plugin() {
768
- }
769
- Plugin.prototype.initialize = function () { };
770
- Plugin.prototype.destroy = function () { };
771
- return Plugin;
772
- }());
773
-
774
- var MentionPlugin = /** @class */ (function (_super) {
775
- __extends(MentionPlugin, _super);
776
- function MentionPlugin(config) {
777
- var _this = _super.call(this) || this;
778
- _this.config = config;
779
- _this.config = __assign(__assign({}, config), { buttons: [
780
- {
781
- name: config.name,
782
- tooltip: config.tooltip,
783
- svgPath: config.iconPath,
784
- click: function (editor) {
785
- _this._closeAll();
786
- _this._tribute.showMenuForCollection(editor.el);
787
- }
788
- }
789
- ] });
790
- _this._tribute = new Tribute({
791
- values: debounce(_this._loadValues.bind(_this), 200),
792
- searchOpts: {
793
- pre: '',
794
- post: '',
795
- skip: true
796
- },
797
- containerClass: "fs-html-editor-mention-container " + (_this.config.containerClass || ''),
798
- itemClass: "fs-html-editor-mention-menu-item " + (_this.config.menuItemClass || ''),
799
- trigger: _this.config.trigger,
800
- allowSpaces: true,
801
- menuItemTemplate: function (item) {
802
- return _this.config.menuItemTemplate(item.original);
803
- },
804
- selectTemplate: function (item) {
805
- var template = _this.config.selectedTemplate(item.original);
806
- var p = document.createElement('p');
807
- p.innerHTML = template;
808
- var node = p.firstElementChild;
809
- if (!node) {
810
- node = document.createElement('span');
811
- node.innerHTML = template;
812
- }
813
- node.setAttribute('contenteditable', 'false');
814
- node.classList.add('fr-deletable');
815
- return node.outerHTML;
816
- },
817
- });
818
- MentionPlugin._tributes.push(_this._tribute);
819
- return _this;
820
- }
821
- MentionPlugin.prototype.initialize = function () {
822
- var _this = this;
823
- this._tribute.attach(this.editor.el);
824
- this.editor.events.on('keydown', function (e) {
825
- if (e.key === 'Enter' && _this._tribute.isActive) {
826
- return false;
827
- }
828
- }, true);
829
- };
830
- MentionPlugin.prototype.destroy = function () { };
831
- MentionPlugin.prototype._closeAll = function () {
832
- MentionPlugin._tributes.forEach(function (tribute) {
833
- if (tribute.menu) {
834
- tribute.hideMenu();
835
- }
836
- });
837
- };
838
- MentionPlugin.prototype._loadValues = function (keyword, cb) {
839
- return this.config.fetch(keyword)
840
- .subscribe(function (data) {
841
- cb(data);
842
- });
843
- };
844
- MentionPlugin._tributes = [];
845
- return MentionPlugin;
846
- }(Plugin));
847
-
848
- var ChecklistPlugin = /** @class */ (function (_super) {
849
- __extends(ChecklistPlugin, _super);
850
- function ChecklistPlugin(config) {
851
- if (config === void 0) { config = { name: 'checklist' }; }
852
- var _this = _super.call(this) || this;
853
- _this.config = config;
854
- _this.config = __assign(__assign({}, config), { name: 'checklist', buttons: [
855
- {
856
- name: 'checklist',
857
- 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',
858
- click: function (editor) {
859
- editor.html.insert('<ul class="checklist"><li></li></ul>');
860
- }
861
- }
862
- ] });
863
- return _this;
864
- }
865
- ChecklistPlugin.prototype.initialize = function () {
866
- this.editor.events.on('click', function (e) {
867
- var li = e.target;
868
- if (li.nodeName === 'LI' && e.offsetX < 0) {
869
- var items = __spread([li], li.querySelectorAll('li'));
870
- if (li.classList.contains('checked')) {
871
- items.forEach(function (item) {
872
- item.classList.remove('checked');
873
- });
874
- }
875
- else {
876
- items.forEach(function (item) {
877
- item.classList.add('checked');
878
- });
879
- }
880
- }
881
- }, false);
882
- };
883
- return ChecklistPlugin;
884
- }(Plugin));
885
-
886
- var CodePlugin = /** @class */ (function (_super) {
887
- __extends(CodePlugin, _super);
888
- function CodePlugin(config) {
889
- if (config === void 0) { config = { name: 'code' }; }
890
- var _this = _super.call(this) || this;
891
- _this.config = config;
892
- _this.config = __assign(__assign({}, config), { name: 'code', buttons: [
893
- {
894
- name: 'code',
895
- 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',
896
- click: function (editor) {
897
- var node = editor.selection.get();
898
- var codeEl = _this._getCodeEl(node.baseNode);
899
- if (codeEl) {
900
- codeEl.classList.remove('code');
901
- }
902
- else {
903
- editor.html.insert('<p class="code">' + editor.selection.get().toString().replace(/\n{1,}/g, '<br>') + '</p>');
904
- }
905
- }
906
- }
907
- ] });
908
- return _this;
909
- }
910
- CodePlugin.prototype.initialize = function () {
911
- var _this = this;
912
- this.editor.events.on('keydown', function (e) {
913
- if (e.keyCode === 13) {
914
- var selection = _this.editor.selection.get();
915
- if (selection && _this._getCodeEl(selection.baseNode)) {
916
- e.preventDefault();
917
- e.stopPropagation();
918
- e.stopImmediatePropagation();
919
- var br = '<br>';
920
- var base = selection.baseNode;
921
- if (base.nodeName === '#text' && selection.baseOffset === base.length) {
922
- if (!(base.nextSibling && base.nextSibling.nodeName === 'BR')) {
923
- br += '<br>';
924
- }
925
- }
926
- else {
927
- var el = Array.from(base.childNodes).splice(selection.baseOffset - 1, 1).pop();
928
- if (el && el.nodeName !== 'BR') {
929
- br += '<br>';
930
- }
931
- }
932
- _this.editor.html.insert(br);
933
- return false;
934
- }
935
- }
936
- }, true);
937
- };
938
- CodePlugin.prototype.destroy = function () { };
939
- CodePlugin.prototype._getCodeEl = function (el) {
940
- if (el) {
941
- if (el.classList && el.classList.contains('code')) {
942
- return el;
943
- }
944
- if (el.parentElement) {
945
- return this._getCodeEl(el.parentElement);
946
- }
947
- }
948
- return null;
949
- };
950
- return CodePlugin;
951
- }(Plugin));
952
-
953
- var ScreenRecordPlugin = /** @class */ (function (_super) {
954
- __extends(ScreenRecordPlugin, _super);
955
- function ScreenRecordPlugin(config) {
956
- if (config === void 0) { config = {}; }
957
- var _this = _super.call(this) || this;
958
- _this.config = config;
959
- _this.config = __assign(__assign({}, config), { name: config.name || 'screenRecord', buttons: [
960
- {
961
- name: 'screenRecord',
962
- 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",
963
- tooltip: 'Screen Record',
964
- click: function (editor) {
965
- navigator.mediaDevices.getDisplayMedia({ video: true })
966
- .then(function (stream) {
967
- var chunks = [];
968
- var options = { mimeType: 'video/webm; codecs=vp9' };
969
- var mediaRecorder = new MediaRecorder(stream, options);
970
- stream.addEventListener('inactive', function (e) {
971
- mediaRecorder.stop();
972
- mediaRecorder = null;
973
- stream.getTracks().forEach(function (track) { return track.stop(); });
974
- stream = null;
975
- var blob = new Blob(chunks, { type: 'video/webm' });
976
- config.upload(blob)
977
- .subscribe(function (url) {
978
- 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>");
979
- });
980
- });
981
- mediaRecorder.addEventListener('dataavailable', function (event) {
982
- if (event.data && event.data.size > 0) {
983
- chunks.push(event.data);
984
- }
985
- });
986
- mediaRecorder.start(10);
987
- })
988
- .catch(function (e) { });
989
- }
990
- }
991
- ] });
992
- return _this;
993
- }
994
- ScreenRecordPlugin.prototype.initialize = function () {
995
- return __awaiter(this, void 0, void 0, function () {
996
- var FroalaEditor;
997
- var _this = this;
998
- return __generator(this, function (_a) {
999
- switch (_a.label) {
1000
- case 0: return [4 /*yield*/, ResourceLoader.loadStyles('froala')
1001
- .toPromise()];
1002
- case 1:
1003
- _a.sent();
1004
- FroalaEditor = window.FroalaEditor;
1005
- this.editor.events.on('mouseup', function (e) {
1006
- var el = _this._getEl(e.target);
1007
- if (el) {
1008
- _this.editor.popups.hideAll();
1009
- _this._activeEl = el;
1010
- _this._showPopup(el);
1011
- }
1012
- });
1013
- FroalaEditor.POPUP_TEMPLATES["screenRecordPlugin.popup"] = '[_BUTTONS_]';
1014
- FroalaEditor.DefineIcon('popupClose', { NAME: 'trash', SVG_KEY: 'remove' });
1015
- FroalaEditor.RegisterCommand('popupClose', {
1016
- title: 'Remove',
1017
- undo: false,
1018
- focus: false,
1019
- callback: function () {
1020
- if (_this._activeEl) {
1021
- _this._activeEl.remove();
1022
- }
1023
- }
1024
- });
1025
- return [2 /*return*/];
1026
- }
1027
- });
1028
- });
1029
- };
1030
- ScreenRecordPlugin.prototype._createPopup = function () {
1031
- var template = {
1032
- buttons: "<div class=\"fr-buttons\">" + this.editor.button.buildList(['popupClose']) + "</div>",
1033
- };
1034
- return this.editor.popups.create('screenRecordPlugin.popup', template);
1035
- };
1036
- ScreenRecordPlugin.prototype._showPopup = function (el) {
1037
- var $popup = this.editor.popups.get('screenRecordPlugin.popup');
1038
- if (!$popup) {
1039
- $popup = this._createPopup();
1040
- }
1041
- this.editor.popups.setContainer('screenRecordPlugin.popup', this.editor.$(el));
1042
- var left = el.offsetLeft + el.offsetWidth / 2;
1043
- this.editor.popups.show('screenRecordPlugin.popup', left, null);
1044
- };
1045
- ScreenRecordPlugin.prototype._getEl = function (el) {
1046
- if (el && el.classList) {
1047
- if (el.classList.contains('fr-screen-record'))
1048
- return el;
1049
- return this._getEl(el.parentNode);
1050
- }
1051
- };
1052
- return ScreenRecordPlugin;
1053
- }(Plugin));
1054
-
1055
- /**
1056
- * Generated bundle index. Do not edit.
1057
- */
1058
-
1059
- export { ChecklistPlugin, CodePlugin, FS_HTML_EDITOR_CONFIG, FsHtmlEditorComponent, FsHtmlEditorModule, FsHtmlRendererComponent, MentionPlugin, ParagraphButtons, RichButtons, ScreenRecordPlugin, TextButtons, FsHtmlEditorConfigFactory as ɵa, FS_HTML_EDITOR_DEFAULT_CONFIG as ɵb, FsFroalaLoaderService as ɵc, Plugin as ɵe };
1060
- //# sourceMappingURL=firestitch-html-editor.js.map