@firestitch/html-editor 12.7.5 → 13.0.1

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/modules/html-editor/classes/plugin.d.ts +7 -7
  2. package/app/modules/html-editor/components/html-editor/html-editor.component.d.ts +60 -58
  3. package/app/modules/html-editor/consts/paragraph-buttons.const.d.ts +1 -1
  4. package/app/modules/html-editor/consts/rich-buttons.const.d.ts +1 -1
  5. package/app/modules/html-editor/consts/text-buttons.const.d.ts +1 -1
  6. package/app/modules/html-editor/enums/default-plugin.enum.d.ts +16 -16
  7. package/app/modules/html-editor/fs-html-editor.module.d.ts +43 -43
  8. package/app/modules/html-editor/injects/config.inject.d.ts +3 -3
  9. package/app/modules/html-editor/interfaces/html-editor-config.d.ts +40 -40
  10. package/app/modules/html-editor/interfaces/plugin-button.d.ts +12 -12
  11. package/app/modules/html-editor/interfaces/plugin-config.d.ts +5 -5
  12. package/app/modules/html-editor/plugins/checklist.plugin.d.ts +7 -7
  13. package/app/modules/html-editor/plugins/code.plugin.d.ts +9 -9
  14. package/app/modules/html-editor/plugins/configs/mention-plugin.config.d.ts +13 -13
  15. package/app/modules/html-editor/plugins/configs/screen-record-plugin.config.d.ts +7 -7
  16. package/app/modules/html-editor/plugins/mention.plugin.d.ts +15 -15
  17. package/app/modules/html-editor/plugins/realtime.plugin.d.ts +7 -7
  18. package/app/modules/html-editor/plugins/screen-record.plugin.d.ts +11 -11
  19. package/app/modules/html-editor/services/froala-loader.service.d.ts +21 -21
  20. package/app/modules/html-renderer/components/html-renderer/html-renderer.component.d.ts +12 -12
  21. package/app/modules/html-renderer/fs-html-renderer.module.d.ts +8 -8
  22. package/{esm2015/app/modules/html-editor/classes/plugin.js → esm2020/app/modules/html-editor/classes/plugin.mjs} +4 -4
  23. package/esm2020/app/modules/html-editor/components/html-editor/html-editor.component.mjs +480 -0
  24. package/{esm2015/app/modules/html-editor/consts/paragraph-buttons.const.js → esm2020/app/modules/html-editor/consts/paragraph-buttons.const.mjs} +9 -9
  25. package/{esm2015/app/modules/html-editor/consts/rich-buttons.const.js → esm2020/app/modules/html-editor/consts/rich-buttons.const.mjs} +6 -6
  26. package/{esm2015/app/modules/html-editor/consts/text-buttons.const.js → esm2020/app/modules/html-editor/consts/text-buttons.const.mjs} +18 -18
  27. package/{esm2015/app/modules/html-editor/enums/default-plugin.enum.js → esm2020/app/modules/html-editor/enums/default-plugin.enum.mjs} +1 -1
  28. package/{esm2015/app/modules/html-editor/fs-html-editor.module.js → esm2020/app/modules/html-editor/fs-html-editor.module.mjs} +72 -69
  29. package/{esm2015/app/modules/html-editor/injects/config.inject.js → esm2020/app/modules/html-editor/injects/config.inject.mjs} +3 -3
  30. package/{esm2015/app/modules/html-editor/interfaces/html-editor-config.js → esm2020/app/modules/html-editor/interfaces/html-editor-config.mjs} +1 -1
  31. package/{esm2015/app/modules/html-editor/interfaces/plugin-button.js → esm2020/app/modules/html-editor/interfaces/plugin-button.mjs} +1 -1
  32. package/{esm2015/app/modules/html-editor/interfaces/plugin-config.js → esm2020/app/modules/html-editor/interfaces/plugin-config.mjs} +1 -1
  33. package/esm2020/app/modules/html-editor/plugins/checklist.plugin.mjs +39 -0
  34. package/esm2020/app/modules/html-editor/plugins/code.plugin.mjs +67 -0
  35. package/{esm2015/app/modules/html-editor/plugins/configs/mention-plugin.config.js → esm2020/app/modules/html-editor/plugins/configs/mention-plugin.config.mjs} +1 -1
  36. package/{esm2015/app/modules/html-editor/plugins/configs/screen-record-plugin.config.js → esm2020/app/modules/html-editor/plugins/configs/screen-record-plugin.config.mjs} +1 -1
  37. package/esm2020/app/modules/html-editor/plugins/mention.plugin.mjs +90 -0
  38. package/esm2020/app/modules/html-editor/plugins/realtime.plugin.mjs +16 -0
  39. package/esm2020/app/modules/html-editor/plugins/screen-record.plugin.mjs +92 -0
  40. package/{esm2015/app/modules/html-editor/services/froala-loader.service.js → esm2020/app/modules/html-editor/services/froala-loader.service.mjs} +90 -90
  41. package/esm2020/app/modules/html-renderer/components/html-renderer/html-renderer.component.mjs +24 -0
  42. package/{esm2015/app/modules/html-renderer/fs-html-renderer.module.js → esm2020/app/modules/html-renderer/fs-html-renderer.module.mjs} +26 -26
  43. package/{esm2015/firestitch-html-editor.js → esm2020/firestitch-html-editor.mjs} +4 -4
  44. package/{esm2015/public_api.js → esm2020/public_api.mjs} +13 -13
  45. package/fesm2015/{firestitch-html-editor.js → firestitch-html-editor.mjs} +952 -952
  46. package/fesm2015/firestitch-html-editor.mjs.map +1 -0
  47. package/fesm2020/firestitch-html-editor.mjs +1014 -0
  48. package/fesm2020/firestitch-html-editor.mjs.map +1 -0
  49. package/firestitch-html-editor.d.ts +5 -5
  50. package/package.json +21 -8
  51. package/public_api.d.ts +18 -18
  52. package/styles.scss +1 -1
  53. package/bundles/firestitch-html-editor.umd.js +0 -1430
  54. package/bundles/firestitch-html-editor.umd.js.map +0 -1
  55. package/esm2015/app/modules/html-editor/components/html-editor/html-editor.component.js +0 -480
  56. package/esm2015/app/modules/html-editor/plugins/checklist.plugin.js +0 -35
  57. package/esm2015/app/modules/html-editor/plugins/code.plugin.js +0 -63
  58. package/esm2015/app/modules/html-editor/plugins/mention.plugin.js +0 -87
  59. package/esm2015/app/modules/html-editor/plugins/realtime.plugin.js +0 -13
  60. package/esm2015/app/modules/html-editor/plugins/screen-record.plugin.js +0 -91
  61. package/esm2015/app/modules/html-renderer/components/html-renderer/html-renderer.component.js +0 -29
  62. package/fesm2015/firestitch-html-editor.js.map +0 -1
@@ -1,1430 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@firestitch/label'), require('@firestitch/skeleton'), require('@angular/platform-browser'), require('@angular/forms'), require('@firestitch/common'), require('@firestitch/file'), require('rxjs'), require('rxjs/operators'), require('lodash-es'), require('tributejs')) :
3
- typeof define === 'function' && define.amd ? define('@firestitch/html-editor', ['exports', '@angular/common', '@angular/core', '@firestitch/label', '@firestitch/skeleton', '@angular/platform-browser', '@angular/forms', '@firestitch/common', '@firestitch/file', 'rxjs', 'rxjs/operators', 'lodash-es', 'tributejs'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch["html-editor"] = {}), global.ng.common, global.ng.core, global.i2, global.i4, global.ng.platformBrowser, global.ng.forms, global.common, global.file, global.rxjs, global.rxjs.operators, global.lodashEs, global.Tribute));
5
- })(this, (function (exports, i3, i0, i2, i4, i1, forms, common, file, rxjs, operators, lodashEs, Tribute) { 'use strict';
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- function _interopNamespace(e) {
10
- if (e && e.__esModule) return e;
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () { return e[k]; }
19
- });
20
- }
21
- });
22
- }
23
- n["default"] = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
28
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
29
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
30
- var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
31
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
32
- var Tribute__default = /*#__PURE__*/_interopDefaultLegacy(Tribute);
33
-
34
- var FsHtmlRendererComponent = /** @class */ (function () {
35
- function FsHtmlRendererComponent(sanitized, _cdRef) {
36
- this.sanitized = sanitized;
37
- this._cdRef = _cdRef;
38
- }
39
- Object.defineProperty(FsHtmlRendererComponent.prototype, "setHtml", {
40
- set: function (html) {
41
- this.trustedHtml = this.sanitized.bypassSecurityTrustHtml(html || '');
42
- this._cdRef.markForCheck();
43
- },
44
- enumerable: false,
45
- configurable: true
46
- });
47
- return FsHtmlRendererComponent;
48
- }());
49
- FsHtmlRendererComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlRendererComponent, deps: [{ token: i1__namespace.DomSanitizer }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
50
- FsHtmlRendererComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsHtmlRendererComponent, selector: "fs-html-renderer", inputs: { setHtml: ["html", "setHtml"] }, ngImport: i0__namespace, template: "<span class=\"fr-view fs-html-editor-default\" [innerHtml]=\"trustedHtml\"></span>\n", styles: [""], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
51
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlRendererComponent, decorators: [{
52
- type: i0.Component,
53
- args: [{
54
- selector: 'fs-html-renderer',
55
- templateUrl: 'html-renderer.component.html',
56
- styleUrls: ['html-renderer.component.scss'],
57
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
58
- }]
59
- }], ctorParameters: function () { return [{ type: i1__namespace.DomSanitizer }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { setHtml: [{
60
- type: i0.Input,
61
- args: ['html']
62
- }] } });
63
-
64
- var FsHtmlRendererModule = /** @class */ (function () {
65
- function FsHtmlRendererModule() {
66
- }
67
- return FsHtmlRendererModule;
68
- }());
69
- FsHtmlRendererModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlRendererModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
70
- FsHtmlRendererModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlRendererModule, declarations: [FsHtmlRendererComponent], imports: [i3.CommonModule], exports: [FsHtmlRendererComponent] });
71
- FsHtmlRendererModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlRendererModule, imports: [[
72
- i3.CommonModule,
73
- ]] });
74
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlRendererModule, decorators: [{
75
- type: i0.NgModule,
76
- args: [{
77
- imports: [
78
- i3.CommonModule,
79
- ],
80
- exports: [
81
- FsHtmlRendererComponent,
82
- ],
83
- declarations: [
84
- FsHtmlRendererComponent,
85
- ],
86
- }]
87
- }] });
88
-
89
- var ParagraphButtons = [
90
- 'align',
91
- 'formatOL',
92
- 'formatUL',
93
- 'checklist',
94
- 'indent',
95
- 'outdent',
96
- 'lineHeight'
97
- ];
98
-
99
- var RichButtons = [
100
- 'insertTable',
101
- 'insertImage',
102
- 'insertLink',
103
- 'insertVideo',
104
- ];
105
-
106
- var TextButtons = [
107
- 'paragraphFormat',
108
- 'code',
109
- 'bold',
110
- 'italic',
111
- 'underline',
112
- 'strikeThrough',
113
- 'subscript',
114
- 'superscript',
115
- 'fontFamily',
116
- 'fontSize',
117
- 'textColor',
118
- 'backgroundColor',
119
- 'inlineClass',
120
- 'inlineStyle',
121
- 'clearFormatting',
122
- 'quote',
123
- ];
124
-
125
- var FS_HTML_EDITOR_DEFAULT_CONFIG = new i0.InjectionToken('fs-html-editor.default-config');
126
- var FS_HTML_EDITOR_CONFIG = new i0.InjectionToken('fs-html-editor.config');
127
-
128
- /*! *****************************************************************************
129
- Copyright (c) Microsoft Corporation.
130
-
131
- Permission to use, copy, modify, and/or distribute this software for any
132
- purpose with or without fee is hereby granted.
133
-
134
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
135
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
136
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
137
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
138
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
139
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
140
- PERFORMANCE OF THIS SOFTWARE.
141
- ***************************************************************************** */
142
- /* global Reflect, Promise */
143
- var extendStatics = function (d, b) {
144
- extendStatics = Object.setPrototypeOf ||
145
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
146
- function (d, b) { for (var p in b)
147
- if (Object.prototype.hasOwnProperty.call(b, p))
148
- d[p] = b[p]; };
149
- return extendStatics(d, b);
150
- };
151
- function __extends(d, b) {
152
- if (typeof b !== "function" && b !== null)
153
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
154
- extendStatics(d, b);
155
- function __() { this.constructor = d; }
156
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
157
- }
158
- var __assign = function () {
159
- __assign = Object.assign || function __assign(t) {
160
- for (var s, i = 1, n = arguments.length; i < n; i++) {
161
- s = arguments[i];
162
- for (var p in s)
163
- if (Object.prototype.hasOwnProperty.call(s, p))
164
- t[p] = s[p];
165
- }
166
- return t;
167
- };
168
- return __assign.apply(this, arguments);
169
- };
170
- function __rest(s, e) {
171
- var t = {};
172
- for (var p in s)
173
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
174
- t[p] = s[p];
175
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
176
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
177
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
178
- t[p[i]] = s[p[i]];
179
- }
180
- return t;
181
- }
182
- function __decorate(decorators, target, key, desc) {
183
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
184
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
185
- r = Reflect.decorate(decorators, target, key, desc);
186
- else
187
- for (var i = decorators.length - 1; i >= 0; i--)
188
- if (d = decorators[i])
189
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
190
- return c > 3 && r && Object.defineProperty(target, key, r), r;
191
- }
192
- function __param(paramIndex, decorator) {
193
- return function (target, key) { decorator(target, key, paramIndex); };
194
- }
195
- function __metadata(metadataKey, metadataValue) {
196
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
197
- return Reflect.metadata(metadataKey, metadataValue);
198
- }
199
- function __awaiter(thisArg, _arguments, P, generator) {
200
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
201
- return new (P || (P = Promise))(function (resolve, reject) {
202
- function fulfilled(value) { try {
203
- step(generator.next(value));
204
- }
205
- catch (e) {
206
- reject(e);
207
- } }
208
- function rejected(value) { try {
209
- step(generator["throw"](value));
210
- }
211
- catch (e) {
212
- reject(e);
213
- } }
214
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
215
- step((generator = generator.apply(thisArg, _arguments || [])).next());
216
- });
217
- }
218
- function __generator(thisArg, body) {
219
- var _ = { label: 0, sent: function () { if (t[0] & 1)
220
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
221
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
222
- function verb(n) { return function (v) { return step([n, v]); }; }
223
- function step(op) {
224
- if (f)
225
- throw new TypeError("Generator is already executing.");
226
- while (_)
227
- try {
228
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
229
- return t;
230
- if (y = 0, t)
231
- op = [op[0] & 2, t.value];
232
- switch (op[0]) {
233
- case 0:
234
- case 1:
235
- t = op;
236
- break;
237
- case 4:
238
- _.label++;
239
- return { value: op[1], done: false };
240
- case 5:
241
- _.label++;
242
- y = op[1];
243
- op = [0];
244
- continue;
245
- case 7:
246
- op = _.ops.pop();
247
- _.trys.pop();
248
- continue;
249
- default:
250
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
251
- _ = 0;
252
- continue;
253
- }
254
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
255
- _.label = op[1];
256
- break;
257
- }
258
- if (op[0] === 6 && _.label < t[1]) {
259
- _.label = t[1];
260
- t = op;
261
- break;
262
- }
263
- if (t && _.label < t[2]) {
264
- _.label = t[2];
265
- _.ops.push(op);
266
- break;
267
- }
268
- if (t[2])
269
- _.ops.pop();
270
- _.trys.pop();
271
- continue;
272
- }
273
- op = body.call(thisArg, _);
274
- }
275
- catch (e) {
276
- op = [6, e];
277
- y = 0;
278
- }
279
- finally {
280
- f = t = 0;
281
- }
282
- if (op[0] & 5)
283
- throw op[1];
284
- return { value: op[0] ? op[1] : void 0, done: true };
285
- }
286
- }
287
- var __createBinding = Object.create ? (function (o, m, k, k2) {
288
- if (k2 === undefined)
289
- k2 = k;
290
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
291
- }) : (function (o, m, k, k2) {
292
- if (k2 === undefined)
293
- k2 = k;
294
- o[k2] = m[k];
295
- });
296
- function __exportStar(m, o) {
297
- for (var p in m)
298
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
299
- __createBinding(o, m, p);
300
- }
301
- function __values(o) {
302
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
303
- if (m)
304
- return m.call(o);
305
- if (o && typeof o.length === "number")
306
- return {
307
- next: function () {
308
- if (o && i >= o.length)
309
- o = void 0;
310
- return { value: o && o[i++], done: !o };
311
- }
312
- };
313
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
314
- }
315
- function __read(o, n) {
316
- var m = typeof Symbol === "function" && o[Symbol.iterator];
317
- if (!m)
318
- return o;
319
- var i = m.call(o), r, ar = [], e;
320
- try {
321
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
322
- ar.push(r.value);
323
- }
324
- catch (error) {
325
- e = { error: error };
326
- }
327
- finally {
328
- try {
329
- if (r && !r.done && (m = i["return"]))
330
- m.call(i);
331
- }
332
- finally {
333
- if (e)
334
- throw e.error;
335
- }
336
- }
337
- return ar;
338
- }
339
- /** @deprecated */
340
- function __spread() {
341
- for (var ar = [], i = 0; i < arguments.length; i++)
342
- ar = ar.concat(__read(arguments[i]));
343
- return ar;
344
- }
345
- /** @deprecated */
346
- function __spreadArrays() {
347
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
348
- s += arguments[i].length;
349
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
350
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
351
- r[k] = a[j];
352
- return r;
353
- }
354
- function __spreadArray(to, from, pack) {
355
- if (pack || arguments.length === 2)
356
- for (var i = 0, l = from.length, ar; i < l; i++) {
357
- if (ar || !(i in from)) {
358
- if (!ar)
359
- ar = Array.prototype.slice.call(from, 0, i);
360
- ar[i] = from[i];
361
- }
362
- }
363
- return to.concat(ar || Array.prototype.slice.call(from));
364
- }
365
- function __await(v) {
366
- return this instanceof __await ? (this.v = v, this) : new __await(v);
367
- }
368
- function __asyncGenerator(thisArg, _arguments, generator) {
369
- if (!Symbol.asyncIterator)
370
- throw new TypeError("Symbol.asyncIterator is not defined.");
371
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
372
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
373
- function verb(n) { if (g[n])
374
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
375
- function resume(n, v) { try {
376
- step(g[n](v));
377
- }
378
- catch (e) {
379
- settle(q[0][3], e);
380
- } }
381
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
382
- function fulfill(value) { resume("next", value); }
383
- function reject(value) { resume("throw", value); }
384
- function settle(f, v) { if (f(v), q.shift(), q.length)
385
- resume(q[0][0], q[0][1]); }
386
- }
387
- function __asyncDelegator(o) {
388
- var i, p;
389
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
390
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
391
- }
392
- function __asyncValues(o) {
393
- if (!Symbol.asyncIterator)
394
- throw new TypeError("Symbol.asyncIterator is not defined.");
395
- var m = o[Symbol.asyncIterator], i;
396
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
397
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
398
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
399
- }
400
- function __makeTemplateObject(cooked, raw) {
401
- if (Object.defineProperty) {
402
- Object.defineProperty(cooked, "raw", { value: raw });
403
- }
404
- else {
405
- cooked.raw = raw;
406
- }
407
- return cooked;
408
- }
409
- ;
410
- var __setModuleDefault = Object.create ? (function (o, v) {
411
- Object.defineProperty(o, "default", { enumerable: true, value: v });
412
- }) : function (o, v) {
413
- o["default"] = v;
414
- };
415
- function __importStar(mod) {
416
- if (mod && mod.__esModule)
417
- return mod;
418
- var result = {};
419
- if (mod != null)
420
- for (var k in mod)
421
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
422
- __createBinding(result, mod, k);
423
- __setModuleDefault(result, mod);
424
- return result;
425
- }
426
- function __importDefault(mod) {
427
- return (mod && mod.__esModule) ? mod : { default: mod };
428
- }
429
- function __classPrivateFieldGet(receiver, state, kind, f) {
430
- if (kind === "a" && !f)
431
- throw new TypeError("Private accessor was defined without a getter");
432
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
433
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
434
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
435
- }
436
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
437
- if (kind === "m")
438
- throw new TypeError("Private method is not writable");
439
- if (kind === "a" && !f)
440
- throw new TypeError("Private accessor was defined without a setter");
441
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
442
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
443
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
444
- }
445
-
446
- var FsFroalaLoaderService = /** @class */ (function () {
447
- function FsFroalaLoaderService(_defaultConfig, _document) {
448
- this._defaultConfig = _defaultConfig;
449
- this._document = _document;
450
- this._froalaLoaded = new rxjs.BehaviorSubject(false);
451
- this._froalaPluginsLoaded = new rxjs.BehaviorSubject(false);
452
- this._sourceLoader = common.fsSourceLoader;
453
- this._loaded$ = rxjs.combineLatest([this._froalaLoaded, this._froalaPluginsLoaded])
454
- .pipe(operators.map(function (_a) {
455
- var _b = __read(_a, 2), FroalaReady = _b[0], pluginsRead = _b[1];
456
- return pluginsRead && FroalaReady;
457
- }), operators.shareReplay(1));
458
- this._sourceLoader.setDocument(this._document);
459
- this._load();
460
- }
461
- Object.defineProperty(FsFroalaLoaderService.prototype, "loaded$", {
462
- get: function () {
463
- return this._loaded$;
464
- },
465
- enumerable: false,
466
- configurable: true
467
- });
468
- Object.defineProperty(FsFroalaLoaderService.prototype, "FroalaEditor", {
469
- get: function () {
470
- return this._FroalaEditor;
471
- },
472
- enumerable: false,
473
- configurable: true
474
- });
475
- FsFroalaLoaderService.prototype._load = function () {
476
- var _this = this;
477
- var baseDir = '/assets/froala/';
478
- this._sourceLoader.registerResources({
479
- froala: [
480
- baseDir + "js/froala_editor.min.js",
481
- baseDir + "css/froala_editor.pkgd.min.css",
482
- ],
483
- froala_align: baseDir + "js/plugins/align.min.js",
484
- froala_colors: baseDir + "js/plugins/colors.min.js",
485
- froala_image: baseDir + "js/plugins/image.min.js",
486
- froala_link: baseDir + "js/plugins/link.min.js",
487
- froala_lists: baseDir + "js/plugins/lists.min.js",
488
- froala_paragraph_format: baseDir + "js/plugins/paragraph_format.min.js",
489
- froala_table: baseDir + "js/plugins/table.min.js",
490
- froala_url: baseDir + "js/plugins/url.min.js",
491
- froala_video: baseDir + "js/plugins/video.min.js",
492
- froala_quote: baseDir + "js/plugins/quote.min.js",
493
- froala_draggable: baseDir + "js/plugins/draggable.min.js",
494
- froala_font_size: baseDir + "js/plugins/font_size.min.js",
495
- froala_quick_insert: baseDir + "js/plugins/quick_insert.min.js",
496
- froala_line_height: baseDir + "js/plugins/line_height.min.js"
497
- });
498
- this._sourceLoader.loadResource('froala')
499
- .pipe(operators.tap(function () {
500
- _this._FroalaEditor = window.FroalaEditor;
501
- _this._froalaDone();
502
- }), operators.concatMap(function () {
503
- return _this._loadPlugins();
504
- }), operators.tap(function () {
505
- _this._froalaPluginsDone();
506
- }))
507
- .subscribe();
508
- };
509
- FsFroalaLoaderService.prototype._loadPlugins = function () {
510
- var resources = this._defaultConfig
511
- .froalaPlugins
512
- .map(function (pluginName) { return "froala_" + pluginName; });
513
- return this._sourceLoader.loadResources(resources);
514
- };
515
- FsFroalaLoaderService.prototype._froalaDone = function () {
516
- this._froalaLoaded.next(true);
517
- };
518
- FsFroalaLoaderService.prototype._froalaPluginsDone = function () {
519
- this._froalaPluginsLoaded.next(true);
520
- };
521
- return FsFroalaLoaderService;
522
- }());
523
- FsFroalaLoaderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFroalaLoaderService, deps: [{ token: FS_HTML_EDITOR_CONFIG, optional: true }, { token: i3.DOCUMENT }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
524
- FsFroalaLoaderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFroalaLoaderService, providedIn: 'root' });
525
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFroalaLoaderService, decorators: [{
526
- type: i0.Injectable,
527
- args: [{
528
- providedIn: 'root',
529
- }]
530
- }], ctorParameters: function () {
531
- return [{ type: undefined, decorators: [{
532
- type: i0.Optional
533
- }, {
534
- type: i0.Inject,
535
- args: [FS_HTML_EDITOR_CONFIG]
536
- }] }, { type: Document, decorators: [{
537
- type: i0.Inject,
538
- args: [i3.DOCUMENT]
539
- }] }];
540
- } });
541
-
542
- var FsHtmlEditorComponent = /** @class */ (function () {
543
- function FsHtmlEditorComponent(_defaultConfig, _cdRef, _fr) {
544
- this._defaultConfig = _defaultConfig;
545
- this._cdRef = _cdRef;
546
- this._fr = _fr;
547
- this.classFocused = false;
548
- this.config = {};
549
- this.disabled = false;
550
- this.initialized = false;
551
- this.containerID = "fs-html-editor-" + common.guid('xxx');
552
- this._initialize$ = new rxjs.ReplaySubject();
553
- this._froalaReady$ = new rxjs.BehaviorSubject(null);
554
- this._destroy$ = new rxjs.Subject();
555
- this.onChange = function (data) { };
556
- this.onTouched = function () { };
557
- }
558
- Object.defineProperty(FsHtmlEditorComponent.prototype, "el", {
559
- get: function () {
560
- return this.elRef.nativeElement;
561
- },
562
- enumerable: false,
563
- configurable: true
564
- });
565
- Object.defineProperty(FsHtmlEditorComponent.prototype, "html", {
566
- get: function () {
567
- return this._html;
568
- },
569
- enumerable: false,
570
- configurable: true
571
- });
572
- Object.defineProperty(FsHtmlEditorComponent.prototype, "editor", {
573
- get: function () {
574
- return this._editor;
575
- },
576
- enumerable: false,
577
- configurable: true
578
- });
579
- Object.defineProperty(FsHtmlEditorComponent.prototype, "froalaLoaded$", {
580
- get: function () {
581
- return this._fr.loaded$;
582
- },
583
- enumerable: false,
584
- configurable: true
585
- });
586
- FsHtmlEditorComponent.prototype.ngOnInit = function () {
587
- this.config = this.config || {};
588
- this.config.autofocus = this.config.autofocus !== false && (!this.config.disabled || !this.disabled);
589
- this._listenLazyInit();
590
- };
591
- FsHtmlEditorComponent.prototype.ngAfterViewInit = function () {
592
- this._initialize$.next();
593
- };
594
- FsHtmlEditorComponent.prototype.hasContent = function () {
595
- var el = document.createElement('div');
596
- if (el.querySelector('img')) {
597
- return true;
598
- }
599
- el.innerHTML = this._html;
600
- return !!el.innerText.length;
601
- };
602
- FsHtmlEditorComponent.prototype.initialize = function (options) {
603
- var _this = this;
604
- if (options === void 0) { options = {}; }
605
- var config = this._createConfig();
606
- this._initPlugins(config);
607
- this._initButtons(config);
608
- this._editor = new this._fr.FroalaEditor(this.el, this._createOptions(), function () {
609
- _this._froalaReady$.next({ config: config, options: options });
610
- });
611
- };
612
- FsHtmlEditorComponent.prototype._processImageUpload = function (blob) {
613
- var _this = this;
614
- var processor = new file.FileProcessor();
615
- var file$1 = new file.FsFile(blob);
616
- var config = {
617
- orientate: true,
618
- quality: this.config.image.quality,
619
- format: this.config.image.format,
620
- maxWidth: this.config.image.width,
621
- maxHeight: this.config.image.height,
622
- minWidth: this.config.image.minWidth,
623
- minHeight: this.config.image.minHeight,
624
- };
625
- return processor.processFile(file$1, config)
626
- .pipe(operators.switchMap(function (fsFile) {
627
- return _this.config.image.upload(fsFile.file);
628
- }));
629
- };
630
- FsHtmlEditorComponent.prototype.updateSize = function () {
631
- // Hack: To trigger the toolbar button size modes
632
- window.dispatchEvent(new Event('resize'));
633
- };
634
- FsHtmlEditorComponent.prototype.validate = function (control) {
635
- var err = {};
636
- if (this.config.maxLength && this._html) {
637
- var maxLength = this.config.maxLength;
638
- var length = this._html.length;
639
- if (length > maxLength) {
640
- err.maxLengthError = "Must be " + maxLength + " characters or fewer. You entered " + length + " characters.";
641
- }
642
- }
643
- return Object.keys(err).length ? err : null;
644
- };
645
- FsHtmlEditorComponent.prototype.focus = function (options) {
646
- options = options ? options : {};
647
- if (options.cursorPosition === 'end') {
648
- this.editor.selection.setAtEnd(this.editor.$el.get(0));
649
- }
650
- else {
651
- this.editor.selection.setAtStart(this.editor.$el.get(0));
652
- }
653
- this.editor.selection.restore();
654
- var elSelection = this.editor.selection.element();
655
- if (elSelection) {
656
- elSelection.scrollIntoView({ block: 'center' });
657
- }
658
- };
659
- FsHtmlEditorComponent.prototype.clear = function () {
660
- this.writeValue('');
661
- };
662
- FsHtmlEditorComponent.prototype.disable = function () {
663
- this.disabled = true;
664
- };
665
- FsHtmlEditorComponent.prototype.setHtml = function (html) {
666
- this.writeValue(html);
667
- };
668
- FsHtmlEditorComponent.prototype.writeValue = function (html) {
669
- this._html = html || '';
670
- if (Array.isArray(this._html)) {
671
- this._html = this._html.pop();
672
- }
673
- this._html = this._html
674
- .replace(/<(li)>\s?<(div)>/g, '<li>')
675
- .replace(/<\/(div)><\/(li)>/g, '</li>');
676
- if (this.editor && this.editor.html) {
677
- try {
678
- this.editor.html.set(this._html);
679
- }
680
- catch (e) {
681
- }
682
- }
683
- this._cdRef.markForCheck();
684
- };
685
- FsHtmlEditorComponent.prototype.registerOnChange = function (fn) {
686
- this.onChange = fn;
687
- };
688
- FsHtmlEditorComponent.prototype.registerOnTouched = function (fn) {
689
- this.onTouched = fn;
690
- };
691
- FsHtmlEditorComponent.prototype.ngOnDestroy = function () {
692
- this._initialize$.complete();
693
- this._destroy$.next();
694
- this._destroy$.complete();
695
- this.destroy();
696
- };
697
- FsHtmlEditorComponent.prototype.destroy = function () {
698
- if (this.editor) {
699
- this.editor.destroy();
700
- }
701
- this.initialized = false;
702
- this._cdRef.markForCheck();
703
- this.el.innerHTML = '';
704
- };
705
- FsHtmlEditorComponent.prototype._createConfig = function () {
706
- return lodashEs.merge({ froalaConfig: {} }, this._defaultConfig, this.config);
707
- };
708
- FsHtmlEditorComponent.prototype._change = function (html) {
709
- this._html = html;
710
- this.onChange(html);
711
- };
712
- FsHtmlEditorComponent.prototype._initButtons = function (config) {
713
- var _this = this;
714
- (config.buttons || [])
715
- .forEach(function (button) {
716
- /*
717
- Svg Keys:
718
- ["add", "advancedImageEditor", "alignCenter", "alignJustify", "alignLeft", "alignRight",
719
- "anchors", "back", "backgroundColor", "blockquote", "bold", "cellBackground",
720
- "cellBorderColor", "cellOptions", "cellStyle", "clearFormatting", "close", "codeView",
721
- "cogs", "columns", "editLink", "exitFullscreen", "fontAwesome", "fontFamily",
722
- "fontSize", "fullscreen", "help", "horizontalLine", "imageAltText", "imageCaption",
723
- "imageClass", "imageDisplay", "imageManager", "imageSize", "indent", "inlineClass",
724
- "inlineStyle", "insertEmbed", "insertFile", "insertImage", "insertLink", "insertMore",
725
- "insertTable", "insertVideo", "upload", "italic", "search", "lineHeight", "linkStyles",
726
- "mention", "more", "openLink", "orderedList", "outdent", "pageBreaker",
727
- "paragraphFormat", "paragraphMore", "paragraphStyle", "pdfExport", "print",
728
- "redo", "removeTable", "remove", "replaceImage", "row", "selectAll", "smile",
729
- "spellcheck", "star", "strikeThrough", "subscript", "superscript", "symbols", "tags",
730
- "tableHeader", "tableStyle", "textColor", "textMore", "underline", "undo", "unlink",
731
- "unorderedList", "verticalAlignBottom", "verticalAlignMiddle", "verticalAlignTop"]
732
- */
733
- var _a, _b, _c;
734
- if (button.svgKey) {
735
- _this._fr.FroalaEditor.DefineIcon(button.name, { SVG_KEY: button.svgKey });
736
- }
737
- _this._fr.FroalaEditor.RegisterCommand(button.name, {
738
- title: button.title,
739
- focus: (_a = button.focus) !== null && _a !== void 0 ? _a : true,
740
- undo: (_b = button.undo) !== null && _b !== void 0 ? _b : true,
741
- refreshAfterCallback: (_c = button.refreshAfterCallback) !== null && _c !== void 0 ? _c : true,
742
- callback: function () {
743
- button.click(this);
744
- }
745
- });
746
- });
747
- };
748
- FsHtmlEditorComponent.prototype._initPlugins = function (config) {
749
- var _this = this;
750
- (config.plugins || []).forEach(function (plugin) {
751
- _this._fr.FroalaEditor.PLUGINS[plugin.config.name] = function (editor) {
752
- plugin.editor = editor;
753
- plugin.initialize();
754
- return plugin;
755
- };
756
- (plugin.config.buttons || []).forEach(function (button) {
757
- _this._fr.FroalaEditor.DefineIcon(button.name, {
758
- NAME: button.name,
759
- PATH: button.svgPath,
760
- });
761
- _this._fr.FroalaEditor.RegisterCommand(button.name, {
762
- icon: button.name,
763
- title: button.tooltip,
764
- undo: button.undo,
765
- focus: button.focus,
766
- showOnMobile: button.showOnMobile,
767
- refreshAfterCallback: button.refreshAfterCallback,
768
- callback: function () {
769
- if (button.click) {
770
- button.click(this);
771
- }
772
- },
773
- refresh: function (button) {
774
- if (button.refresh) {
775
- button.refresh(this, button);
776
- }
777
- }
778
- });
779
- });
780
- });
781
- };
782
- FsHtmlEditorComponent.prototype._createOptions = function () {
783
- var _a, _b;
784
- var config = this._createConfig();
785
- return lodashEs.merge(
786
- // For some reason editor store somewhere pointer on default config object and dublicate options each time on init
787
- // Extra merge level fixed this problem and allow to init config properly without legacy data
788
- {}, {
789
- shortcutsEnabled: ['show', 'bold', 'italic', 'underline', 'indent', 'outdent', 'undo', 'redo', 'insertImage', 'createLink'],
790
- key: config.activationKey,
791
- placeholderText: config.placeholder,
792
- linkAlwaysBlank: true,
793
- tabSpaces: 2,
794
- typingTimer: 250,
795
- tooltips: false,
796
- wordPasteModal: false,
797
- imageDefaultWidth: 0,
798
- imageDefaultAlign: 'left',
799
- quickInsertEnabled: false,
800
- scrollableContainer: "#" + this.containerID,
801
- paragraphDefaultSelection: 'Format',
802
- videoUpload: false,
803
- imagePaste: !!((_a = config.image) === null || _a === void 0 ? void 0 : _a.upload),
804
- imageUpload: !!((_b = config.image) === null || _b === void 0 ? void 0 : _b.upload),
805
- paragraphFormat: {
806
- N: 'Normal',
807
- H1: 'Heading 1',
808
- H2: 'Heading 2',
809
- H3: 'Heading 3',
810
- H4: 'Heading 4',
811
- BLOCKQUOTE: 'Quote',
812
- },
813
- lineHeights: {
814
- Default: '',
815
- '0.5': '0.5',
816
- 'Single': '1',
817
- '1.15': '1.15',
818
- '1.5': '1.5',
819
- 'Double': '2'
820
- },
821
- paragraphFormatSelection: true,
822
- toolbarButtonsXS: {
823
- moreText: {
824
- buttons: TextButtons,
825
- buttonsVisible: 1,
826
- },
827
- moreParagraph: {
828
- buttons: ParagraphButtons,
829
- buttonsVisible: 2,
830
- },
831
- moreRich: {
832
- buttons: RichButtons,
833
- buttonsVisible: 0,
834
- },
835
- },
836
- toolbarButtons: {
837
- moreText: {
838
- buttons: TextButtons,
839
- buttonsVisible: 3,
840
- },
841
- moreParagraph: {
842
- buttons: ParagraphButtons,
843
- buttonsVisible: 5,
844
- },
845
- moreRich: {
846
- buttons: RichButtons,
847
- buttonsVisible: 3,
848
- },
849
- },
850
- }, config.froalaConfig);
851
- };
852
- FsHtmlEditorComponent.prototype._listenLazyInit = function () {
853
- var _this = this;
854
- this.froalaLoaded$
855
- .pipe(operators.filter(function (ready) { return ready; }), operators.switchMap(function () { return _this._initialize$; }), operators.tap(function () {
856
- var selection = window.getSelection();
857
- var options = {};
858
- if (selection.baseNode) {
859
- options.selection = {
860
- node: selection.baseNode.nodeValue,
861
- offset: selection.baseOffset,
862
- };
863
- }
864
- _this.initialize(options);
865
- }), operators.switchMap(function () { return _this._froalaReady$; }), operators.filter(function (data) { return !!data; }), operators.tap(function (_d) {
866
- var config = _d.config, options = _d.options;
867
- _this._setupFroala(config, options);
868
- }))
869
- .subscribe();
870
- };
871
- FsHtmlEditorComponent.prototype._contentChanged = function () {
872
- var editorHTML = this._editor.html.get();
873
- if (this.html !== editorHTML) {
874
- this._change(editorHTML);
875
- }
876
- };
877
- FsHtmlEditorComponent.prototype._setupFroala = function (config, options) {
878
- var _this = this;
879
- this._cdRef.markForCheck();
880
- this.setHtml(this._html);
881
- if (config.disabled) {
882
- this.disable();
883
- }
884
- if (config.froalaConfig.events) {
885
- if (config.froalaConfig.events.initialized) {
886
- config.froalaConfig.events.initialized();
887
- }
888
- }
889
- this._editor.events.on('focus', function () {
890
- _this.classFocused = true;
891
- _this._cdRef.markForCheck();
892
- });
893
- this._editor.events.on('blur', function () {
894
- _this.classFocused = false;
895
- _this._cdRef.markForCheck();
896
- });
897
- this._editor.events.on('click', function () {
898
- if (_this.config.initOnClick && !_this.initialized) {
899
- _this.initialized = true;
900
- _this._cdRef.markForCheck();
901
- }
902
- });
903
- rxjs.fromEventPattern(function (handler) {
904
- _this._editor.events.on('contentChanged', handler);
905
- }, function () { })
906
- .pipe(operators.startWith(this._html), operators.map(function () { return _this.editor.html.get(); }), operators.distinctUntilChanged(), operators.skip(1))
907
- .subscribe(function () {
908
- _this._contentChanged();
909
- });
910
- this._editor.events.on('paste.afterCleanup', function (html) {
911
- var div = document.createElement('div');
912
- div.innerHTML = html;
913
- div.querySelectorAll('*')
914
- .forEach(function (el) {
915
- for (var i = 0; i < el.attributes.length; i++) {
916
- var name = el.attributes[0].name;
917
- if (name !== 'href') {
918
- el.removeAttribute(name);
919
- }
920
- }
921
- });
922
- return div.innerHTML;
923
- });
924
- this._editor.events.on('keydown', function () {
925
- _this.onTouched();
926
- });
927
- if (this.config.image && this.config.image.upload) {
928
- this._editor.events.on('image.beforePasteUpload', function (image) {
929
- fetch(image.getAttribute('src'))
930
- .then(function (res) {
931
- res.blob()
932
- .then(function (blob) {
933
- _this._processImageUpload(blob)
934
- .pipe(operators.takeUntil(_this._destroy$))
935
- .subscribe(function (url) {
936
- image.setAttribute('src', url);
937
- image.removeAttribute('data-fr-image-pasted');
938
- _this._contentChanged();
939
- });
940
- });
941
- });
942
- return false;
943
- });
944
- this._editor.events.on('image.beforeUpload', function (blobs) {
945
- _this._processImageUpload(blobs[0])
946
- .pipe(operators.takeUntil(_this._destroy$))
947
- .subscribe(function (url) {
948
- _this.editor.image.insert(url, null, null, _this.editor.image.get());
949
- });
950
- return false;
951
- });
952
- }
953
- if (this.el.querySelector('.fr-second-toolbar')) {
954
- this.el.querySelector('.fr-second-toolbar').remove();
955
- }
956
- if (this.config.autofocus && !this.config.initOnClick) {
957
- this.focus();
958
- }
959
- };
960
- return FsHtmlEditorComponent;
961
- }());
962
- FsHtmlEditorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorComponent, deps: [{ token: FS_HTML_EDITOR_CONFIG, optional: true }, { token: i0__namespace.ChangeDetectorRef }, { token: FsFroalaLoaderService }], target: i0__namespace.ɵɵFactoryTarget.Component });
963
- FsHtmlEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsHtmlEditorComponent, selector: "fs-html-editor", inputs: { config: "config", hint: "hint", disabled: "disabled" }, host: { properties: { "class.focused": "this.classFocused", "class.disabled": "this.disabled" } }, providers: [
964
- {
965
- provide: forms.NG_VALUE_ACCESSOR,
966
- useExisting: i0.forwardRef(function () { return FsHtmlEditorComponent; }),
967
- multi: true
968
- },
969
- {
970
- provide: forms.NG_VALIDATORS,
971
- useExisting: i0.forwardRef(function () { return FsHtmlEditorComponent; }),
972
- multi: true
973
- },
974
- ], viewQueries: [{ propertyName: "elRef", first: true, predicate: ["elRef"], descendants: true }], ngImport: i0__namespace, template: "<fs-label-field>\n <fs-label *ngIf=\"config.label\">{{config.label}}</fs-label>\n <div\n class=\"html-editor-container fs-html-editor-default\"\n [id]=\"containerID\"\n [ngClass]=\"{\n initialized: initialized,\n 'init-on-click': config.initOnClick\n }\">\n <ng-container *fsSkeleton=\"(froalaLoaded$ | async) !== false\"></ng-container>\n <div #elRef></div>\n\n <div class=\"bottom-line\"></div>\n <div class=\"disabled-line\"></div>\n </div>\n\n <fs-label-message>\n <div class=\"fs-form-message\">\n <div class=\"fs-form-hint\">{{hint}}</div>\n </div>\n </fs-label-message>\n</fs-label-field>\n", styles: [":host ::ng-deep .fr-box.fr-basic .fr-wrapper{border:0;border-bottom:1px solid #949494;margin-bottom:1px;background-color:transparent}:host ::ng-deep .fr-box.fr-basic .fr-element{padding:0;font-family:inherit;color:inherit;font-size:inherit;line-height:inherit;min-height:auto}:host ::ng-deep .fr-more-toolbar,:host ::ng-deep .fr-toolbar,:host ::ng-deep .fr-dropdown:after,:host ::ng-deep .fr-dropdown-menu .fr-dropdown-wrapper{transition:none!important}:host ::ng-deep .fr-toolbar-open .fr-more-toolbar{display:block}:host ::ng-deep .fr-more-toolbar{display:none}:host ::ng-deep .fr-toolbar.fr-top{position:sticky;z-index:2;border-radius:0;background-color:#fff}:host ::ng-deep .fr-toolbar.fr-top .fr-btn-grp{margin:0 20px 0 0}:host ::ng-deep .fr-toolbar.fr-top .fr-btn-grp:nth-child(1):after,:host ::ng-deep .fr-toolbar.fr-top .fr-btn-grp:nth-child(2):after{content:\"\";position:absolute;top:9px;height:30px;border-left:1px solid #e5e5e5;margin-left:10px}:host ::ng-deep .fr-toolbar.fr-top div:first-of-type:before{border:none}:host ::ng-deep .fr-toolbar.fr-top.fr-toolbar-open .fr-newline{height:auto}:host ::ng-deep .fr-toolbar.fr-top .fr-btn-grp:first-child{margin-left:0}:host ::ng-deep .fr-toolbar.fr-top.fr-top{border:0}:host ::ng-deep .fr-toolbar.fr-top .fr-newline{margin:0}:host ::ng-deep .fr-toolbar.fr-top .fr-more-toolbar{z-index:auto;display:flex;justify-content:center;padding-left:0!important}:host ::ng-deep .fr-toolbar.fr-top .fr-command.fr-btn{z-index:auto}:host ::ng-deep .fr-toolbar.fr-top .fr-command.fr-btn.fr-dropdown:after{right:3px}:host ::ng-deep .fr-toolbar.fr-top .fr-command.fr-btn.fr-dropdown.fr-selection span{margin-right:24px}:host ::ng-deep .fr-toolbar.fr-top .fr-command.fr-btn.fr-open{border-radius:4px;margin:4px 2px}:host ::ng-deep .fr-view ol,:host ::ng-deep .fr-view ul{list-style-position:unset}:host ::ng-deep .html-editor-container.init-on-click:not(.initialized) .fr-toolbar{display:none}:host.disabled ::ng-deep .fr-box.fr-basic{opacity:.5;pointer-events:none}:host.disabled ::ng-deep .fr-box.fr-basic .fr-wrapper{border:none}:host.disabled ::ng-deep .disabled-line{display:block}::ng-deep .fr-popup{z-index:1001!important}::ng-deep .fr-video-by-url-layer .fr-checkbox-line{display:none}.disabled-line{display:none;position:absolute;bottom:-1px;z-index:1;background-image:linear-gradient(90deg,rgba(0,0,0,.42) 0,rgba(0,0,0,.42) 33%,transparent 0);background-size:4px 100%;background-repeat:repeat-x;height:1px;width:100%}.bottom-line{opacity:0;transform-origin:50%;transform:scaleX(.5);transition:background-color .3s cubic-bezier(.55,0,.55,.2);width:100%;border-bottom:2px solid #949494;position:absolute;bottom:-1px;z-index:1}:host{position:relative;display:block}:host.focused .bottom-line{opacity:1;display:block;transform:scaleX(1);transition:transform .3s cubic-bezier(.25,.8,.25,1),opacity .1s cubic-bezier(.25,.8,.25,1),background-color .3s cubic-bezier(.25,.8,.25,1)}::ng-deep .fs-html-editor-mention-container{position:absolute;top:0;left:0;height:auto;max-height:300px;max-width:500px;overflow:auto;display:block;z-index:999999;box-shadow:0 2px 4px -1px #0003,0 4px 5px #00000024,0 1px 10px #0000001f;border-bottom-left-radius:4px;border-bottom-right-radius:4px;background:#fff}::ng-deep .fs-html-editor-mention-container ul{margin:0;padding:0;list-style:none}::ng-deep .fs-html-editor-mention-container li{padding:0 16px;cursor:pointer;line-height:48px}::ng-deep .fs-html-editor-mention-container li.highlight,::ng-deep .fs-html-editor-mention-container li:hover{background:#F5F5F5}::ng-deep .fs-html-editor-mention-container li.no-match{cursor:default}\n"], components: [{ type: i2__namespace.FsLabelFieldComponent, selector: "fs-label-field", inputs: ["bottomMargin", "topMargin", "labelMargin"] }, { type: i2__namespace.FsLabelComponent, selector: "fs-label" }, { type: i2__namespace.FsLabelMessageComponent, selector: "fs-label-message" }], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4__namespace.FsSkeletonContentDirective, selector: "[fsSkeleton]", inputs: ["fsSkeleton", "fsSkeletonPattern"] }], pipes: { "async": i3__namespace.AsyncPipe }, viewProviders: [
975
- {
976
- provide: forms.ControlContainer,
977
- deps: [[i0.Optional, forms.NgForm]],
978
- useFactory: function (ngForm) { return ngForm; },
979
- },
980
- ], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
981
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorComponent, decorators: [{
982
- type: i0.Component,
983
- args: [{
984
- selector: 'fs-html-editor',
985
- templateUrl: 'html-editor.component.html',
986
- styleUrls: ['html-editor.component.scss'],
987
- providers: [
988
- {
989
- provide: forms.NG_VALUE_ACCESSOR,
990
- useExisting: i0.forwardRef(function () { return FsHtmlEditorComponent; }),
991
- multi: true
992
- },
993
- {
994
- provide: forms.NG_VALIDATORS,
995
- useExisting: i0.forwardRef(function () { return FsHtmlEditorComponent; }),
996
- multi: true
997
- },
998
- ],
999
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1000
- viewProviders: [
1001
- {
1002
- provide: forms.ControlContainer,
1003
- deps: [[i0.Optional, forms.NgForm]],
1004
- useFactory: function (ngForm) { return ngForm; },
1005
- },
1006
- ],
1007
- }]
1008
- }], ctorParameters: function () {
1009
- return [{ type: undefined, decorators: [{
1010
- type: i0.Optional
1011
- }, {
1012
- type: i0.Inject,
1013
- args: [FS_HTML_EDITOR_CONFIG]
1014
- }] }, { type: i0__namespace.ChangeDetectorRef }, { type: FsFroalaLoaderService }];
1015
- }, propDecorators: { classFocused: [{
1016
- type: i0.HostBinding,
1017
- args: ['class.focused']
1018
- }], elRef: [{
1019
- type: i0.ViewChild,
1020
- args: ['elRef']
1021
- }], config: [{
1022
- type: i0.Input
1023
- }], hint: [{
1024
- type: i0.Input
1025
- }], disabled: [{
1026
- type: i0.Input
1027
- }, {
1028
- type: i0.HostBinding,
1029
- args: ['class.disabled']
1030
- }] } });
1031
-
1032
- var FsHtmlEditorModule = /** @class */ (function () {
1033
- function FsHtmlEditorModule() {
1034
- }
1035
- FsHtmlEditorModule.forRoot = function (config) {
1036
- if (config === void 0) { config = {}; }
1037
- return {
1038
- ngModule: FsHtmlEditorModule,
1039
- providers: [
1040
- { provide: FS_HTML_EDITOR_DEFAULT_CONFIG, useValue: config },
1041
- {
1042
- provide: FS_HTML_EDITOR_CONFIG,
1043
- useFactory: FsHtmlEditorConfigFactory,
1044
- deps: [FS_HTML_EDITOR_DEFAULT_CONFIG]
1045
- }
1046
- ]
1047
- };
1048
- };
1049
- return FsHtmlEditorModule;
1050
- }());
1051
- FsHtmlEditorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1052
- FsHtmlEditorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorModule, declarations: [FsHtmlEditorComponent], imports: [i3.CommonModule,
1053
- i4.FsSkeletonModule,
1054
- i2.FsLabelModule,
1055
- FsHtmlRendererModule], exports: [FsHtmlEditorComponent] });
1056
- FsHtmlEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorModule, imports: [[
1057
- i3.CommonModule,
1058
- i4.FsSkeletonModule,
1059
- i2.FsLabelModule,
1060
- FsHtmlRendererModule,
1061
- ]] });
1062
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorModule, decorators: [{
1063
- type: i0.NgModule,
1064
- args: [{
1065
- imports: [
1066
- i3.CommonModule,
1067
- i4.FsSkeletonModule,
1068
- i2.FsLabelModule,
1069
- FsHtmlRendererModule,
1070
- ],
1071
- exports: [
1072
- FsHtmlEditorComponent,
1073
- ],
1074
- declarations: [
1075
- FsHtmlEditorComponent,
1076
- ],
1077
- }]
1078
- }] });
1079
- function FsHtmlEditorConfigFactory(config) {
1080
- return Object.assign({ froalaPlugins: [
1081
- "align" /* Align */,
1082
- "colors" /* Colors */,
1083
- "image" /* Image */,
1084
- "link" /* Link */,
1085
- "lists" /* Lists */,
1086
- "paragraph_format" /* ParagraphFormat */,
1087
- "quote" /* Quote */,
1088
- "table" /* Table */,
1089
- "url" /* Url */,
1090
- "video" /* Video */,
1091
- "draggable" /* Draggable */,
1092
- "font_size" /* FontSize */,
1093
- "line_height" /* LineHeight */,
1094
- ] }, config);
1095
- }
1096
-
1097
- var Plugin = /** @class */ (function () {
1098
- function Plugin() {
1099
- }
1100
- Plugin.prototype.initialize = function () { };
1101
- Plugin.prototype.destroy = function () { };
1102
- return Plugin;
1103
- }());
1104
-
1105
- var MentionPlugin = /** @class */ (function (_super) {
1106
- __extends(MentionPlugin, _super);
1107
- function MentionPlugin(config) {
1108
- var _this = _super.call(this) || this;
1109
- _this.config = config;
1110
- _this._guid = common.guid();
1111
- _this.selected = function (event) {
1112
- if (_this.config.selected) {
1113
- if (MentionPlugin._currentGuid === _this._guid) {
1114
- _this.config.selected(event.detail.item.original);
1115
- }
1116
- }
1117
- };
1118
- _this.config = Object.assign(Object.assign({}, config), { buttons: [
1119
- {
1120
- name: config.name,
1121
- tooltip: config.tooltip,
1122
- svgPath: config.iconPath,
1123
- click: function (editor) {
1124
- _this._closeAll();
1125
- _this._tribute.showMenuForCollection(editor.el);
1126
- }
1127
- }
1128
- ] });
1129
- _this._tribute = new Tribute__default["default"]({
1130
- values: lodashEs.debounce(_this._loadValues.bind(_this), 200),
1131
- searchOpts: {
1132
- pre: '',
1133
- post: '',
1134
- skip: true
1135
- },
1136
- containerClass: "fs-html-editor-mention-container " + (_this.config.containerClass || ''),
1137
- itemClass: "fs-html-editor-mention-menu-item " + (_this.config.menuItemClass || ''),
1138
- trigger: _this.config.trigger,
1139
- allowSpaces: true,
1140
- menuItemTemplate: function (item) {
1141
- return _this.config.menuItemTemplate(item.original);
1142
- },
1143
- selectTemplate: function (item) {
1144
- var template = _this.config.selectedTemplate(item.original);
1145
- var p = document.createElement('p');
1146
- p.innerHTML = template;
1147
- var node = p.firstElementChild;
1148
- if (!node) {
1149
- node = document.createElement('span');
1150
- node.innerHTML = template;
1151
- }
1152
- node.setAttribute('contenteditable', 'false');
1153
- node.classList.add('fr-deletable');
1154
- return node.outerHTML;
1155
- },
1156
- });
1157
- MentionPlugin._tributes.push(_this._tribute);
1158
- return _this;
1159
- }
1160
- MentionPlugin.prototype.initialize = function () {
1161
- var _this = this;
1162
- this._tribute.attach(this.editor.el);
1163
- this.editor.events.on('keydown', function (e) {
1164
- if (e.key === 'Enter' && _this._tribute.isActive) {
1165
- return false;
1166
- }
1167
- }, true);
1168
- this.editor.el.addEventListener("tribute-replaced", this.selected);
1169
- };
1170
- MentionPlugin.prototype.destroy = function () {
1171
- this.editor.el.removeEventListener("tribute-replaced", this.selected);
1172
- };
1173
- MentionPlugin.prototype._closeAll = function () {
1174
- MentionPlugin._tributes.forEach(function (tribute) {
1175
- if (tribute.menu) {
1176
- tribute.hideMenu();
1177
- }
1178
- });
1179
- };
1180
- MentionPlugin.prototype._loadValues = function (keyword, cb) {
1181
- MentionPlugin._currentGuid = this._guid;
1182
- return this.config.fetch(keyword)
1183
- .subscribe(function (data) {
1184
- cb(data);
1185
- });
1186
- };
1187
- return MentionPlugin;
1188
- }(Plugin));
1189
- MentionPlugin._currentGuid = null;
1190
- MentionPlugin._tributes = [];
1191
-
1192
- var ChecklistPlugin = /** @class */ (function (_super) {
1193
- __extends(ChecklistPlugin, _super);
1194
- function ChecklistPlugin(config) {
1195
- if (config === void 0) { config = { name: 'checklist' }; }
1196
- var _this = _super.call(this) || this;
1197
- _this.config = config;
1198
- _this.config = Object.assign(Object.assign({}, config), { name: 'checklist', buttons: [
1199
- {
1200
- name: 'checklist',
1201
- 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',
1202
- click: function (editor) {
1203
- editor.html.insert('<ul class="checklist"><li></li></ul>');
1204
- }
1205
- }
1206
- ] });
1207
- return _this;
1208
- }
1209
- ChecklistPlugin.prototype.initialize = function () {
1210
- this.editor.events.on('click', function (e) {
1211
- var li = e.target;
1212
- if (li.nodeName === 'LI' && e.offsetX < 0) {
1213
- var items = __spreadArray([li], __read(li.querySelectorAll('li')));
1214
- if (li.classList.contains('checked')) {
1215
- items.forEach(function (item) {
1216
- item.classList.remove('checked');
1217
- });
1218
- }
1219
- else {
1220
- items.forEach(function (item) {
1221
- item.classList.add('checked');
1222
- });
1223
- }
1224
- }
1225
- }, false);
1226
- };
1227
- return ChecklistPlugin;
1228
- }(Plugin));
1229
-
1230
- var CodePlugin = /** @class */ (function (_super) {
1231
- __extends(CodePlugin, _super);
1232
- function CodePlugin(config) {
1233
- if (config === void 0) { config = { name: 'code' }; }
1234
- var _this = _super.call(this) || this;
1235
- _this.config = config;
1236
- _this.config = Object.assign(Object.assign({}, config), { name: 'code', buttons: [
1237
- {
1238
- name: 'code',
1239
- 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',
1240
- click: function (editor) {
1241
- var node = editor.selection.get();
1242
- var codeEl = _this._getCodeEl(node.baseNode);
1243
- if (codeEl) {
1244
- codeEl.classList.remove('code');
1245
- }
1246
- else {
1247
- editor.html.insert('<p class="code">' + editor.selection.get().toString().replace(/\n{1,}/g, '<br>') + '</p>');
1248
- }
1249
- }
1250
- }
1251
- ] });
1252
- return _this;
1253
- }
1254
- CodePlugin.prototype.initialize = function () {
1255
- var _this = this;
1256
- this.editor.events.on('keydown', function (e) {
1257
- if (e.keyCode === 13) {
1258
- var selection = _this.editor.selection.get();
1259
- if (selection && _this._getCodeEl(selection.baseNode)) {
1260
- e.preventDefault();
1261
- e.stopPropagation();
1262
- e.stopImmediatePropagation();
1263
- var br = '<br>';
1264
- var base = selection.baseNode;
1265
- if (base.nodeName === '#text' && selection.baseOffset === base.length) {
1266
- if (!(base.nextSibling && base.nextSibling.nodeName === 'BR')) {
1267
- br += '<br>';
1268
- }
1269
- }
1270
- else {
1271
- var el = Array.from(base.childNodes).splice(selection.baseOffset - 1, 1).pop();
1272
- if (el && el.nodeName !== 'BR') {
1273
- br += '<br>';
1274
- }
1275
- }
1276
- _this.editor.html.insert(br);
1277
- return false;
1278
- }
1279
- }
1280
- }, true);
1281
- };
1282
- CodePlugin.prototype.destroy = function () { };
1283
- CodePlugin.prototype._getCodeEl = function (el) {
1284
- if (el) {
1285
- if (el.classList && el.classList.contains('code')) {
1286
- return el;
1287
- }
1288
- if (el.parentElement) {
1289
- return this._getCodeEl(el.parentElement);
1290
- }
1291
- }
1292
- return null;
1293
- };
1294
- return CodePlugin;
1295
- }(Plugin));
1296
-
1297
- var ScreenRecordPlugin = /** @class */ (function (_super) {
1298
- __extends(ScreenRecordPlugin, _super);
1299
- function ScreenRecordPlugin(config) {
1300
- if (config === void 0) { config = {}; }
1301
- var _this = _super.call(this) || this;
1302
- _this.config = config;
1303
- _this.config = Object.assign(Object.assign({}, config), { name: config.name || 'screenRecord', buttons: [
1304
- {
1305
- name: 'screenRecord',
1306
- 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",
1307
- tooltip: 'Screen Record',
1308
- click: function (editor) {
1309
- navigator.mediaDevices.getDisplayMedia({ video: true })
1310
- .then(function (stream) {
1311
- var chunks = [];
1312
- var options = { mimeType: 'video/webm; codecs=vp9' };
1313
- var mediaRecorder = new MediaRecorder(stream, options);
1314
- stream.addEventListener('inactive', function (e) {
1315
- mediaRecorder.stop();
1316
- mediaRecorder = null;
1317
- stream.getTracks().forEach(function (track) { return track.stop(); });
1318
- stream = null;
1319
- var blob = new Blob(chunks, { type: 'video/webm' });
1320
- config.upload(blob)
1321
- .subscribe(function (url) {
1322
- 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>");
1323
- });
1324
- });
1325
- mediaRecorder.addEventListener('dataavailable', function (event) {
1326
- if (event.data && event.data.size > 0) {
1327
- chunks.push(event.data);
1328
- }
1329
- });
1330
- mediaRecorder.start(10);
1331
- })
1332
- .catch(function (e) { });
1333
- }
1334
- }
1335
- ] });
1336
- return _this;
1337
- }
1338
- ScreenRecordPlugin.prototype.initialize = function () {
1339
- return __awaiter(this, void 0, void 0, function () {
1340
- var FroalaEditor;
1341
- var _this = this;
1342
- return __generator(this, function (_a) {
1343
- FroalaEditor = window.FroalaEditor;
1344
- this.editor.events.on('mouseup', function (e) {
1345
- var el = _this._getEl(e.target);
1346
- if (el) {
1347
- _this.editor.popups.hideAll();
1348
- _this._activeEl = el;
1349
- _this._showPopup(el);
1350
- }
1351
- });
1352
- FroalaEditor.POPUP_TEMPLATES["screenRecordPlugin.popup"] = '[_BUTTONS_]';
1353
- FroalaEditor.DefineIcon('popupClose', { NAME: 'trash', SVG_KEY: 'remove' });
1354
- FroalaEditor.RegisterCommand('popupClose', {
1355
- title: 'Remove',
1356
- undo: false,
1357
- focus: false,
1358
- callback: function () {
1359
- if (_this._activeEl) {
1360
- _this._activeEl.remove();
1361
- }
1362
- }
1363
- });
1364
- return [2 /*return*/];
1365
- });
1366
- });
1367
- };
1368
- ScreenRecordPlugin.prototype._createPopup = function () {
1369
- var template = {
1370
- buttons: "<div class=\"fr-buttons\">" + this.editor.button.buildList(['popupClose']) + "</div>",
1371
- };
1372
- return this.editor.popups.create('screenRecordPlugin.popup', template);
1373
- };
1374
- ScreenRecordPlugin.prototype._showPopup = function (el) {
1375
- var $popup = this.editor.popups.get('screenRecordPlugin.popup');
1376
- if (!$popup) {
1377
- $popup = this._createPopup();
1378
- }
1379
- this.editor.popups.setContainer('screenRecordPlugin.popup', this.editor.$(el));
1380
- var left = el.offsetLeft + el.offsetWidth / 2;
1381
- this.editor.popups.show('screenRecordPlugin.popup', left, null);
1382
- };
1383
- ScreenRecordPlugin.prototype._getEl = function (el) {
1384
- if (el && el.classList) {
1385
- if (el.classList.contains('fr-screen-record'))
1386
- return el;
1387
- return this._getEl(el.parentNode);
1388
- }
1389
- };
1390
- return ScreenRecordPlugin;
1391
- }(Plugin));
1392
-
1393
- var RealtimePlugin = /** @class */ (function (_super) {
1394
- __extends(RealtimePlugin, _super);
1395
- function RealtimePlugin(config) {
1396
- if (config === void 0) { config = { name: 'realtime' }; }
1397
- var _this = _super.call(this) || this;
1398
- _this.config = config;
1399
- _this.config = Object.assign(Object.assign({}, config), { name: 'realtime' });
1400
- return _this;
1401
- }
1402
- RealtimePlugin.prototype.initialize = function () {
1403
- this.editor.events.on('click', function (e) {
1404
- }, false);
1405
- };
1406
- return RealtimePlugin;
1407
- }(Plugin));
1408
-
1409
- /**
1410
- * Generated bundle index. Do not edit.
1411
- */
1412
-
1413
- exports.ChecklistPlugin = ChecklistPlugin;
1414
- exports.CodePlugin = CodePlugin;
1415
- exports.FS_HTML_EDITOR_CONFIG = FS_HTML_EDITOR_CONFIG;
1416
- exports.FsHtmlEditorComponent = FsHtmlEditorComponent;
1417
- exports.FsHtmlEditorModule = FsHtmlEditorModule;
1418
- exports.FsHtmlRendererComponent = FsHtmlRendererComponent;
1419
- exports.FsHtmlRendererModule = FsHtmlRendererModule;
1420
- exports.MentionPlugin = MentionPlugin;
1421
- exports.ParagraphButtons = ParagraphButtons;
1422
- exports.RealtimePlugin = RealtimePlugin;
1423
- exports.RichButtons = RichButtons;
1424
- exports.ScreenRecordPlugin = ScreenRecordPlugin;
1425
- exports.TextButtons = TextButtons;
1426
-
1427
- Object.defineProperty(exports, '__esModule', { value: true });
1428
-
1429
- }));
1430
- //# sourceMappingURL=firestitch-html-editor.umd.js.map