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