@firestitch/html-editor 12.0.3 → 12.0.4

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