@firestitch/html-editor 12.7.0 → 12.7.1

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