@firestitch/html-editor 12.0.0 → 12.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/app/classes/plugin.d.ts +7 -7
  2. package/app/components/html-editor/html-editor.component.d.ts +57 -57
  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 +14 -14
  8. package/app/fs-html-editor.module.d.ts +33 -33
  9. package/app/injects/config.inject.d.ts +3 -3
  10. package/app/interfaces/html-editor-config.d.ts +31 -31
  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 +1359 -1358
  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 +454 -453
  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 +64 -64
  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 +80 -80
  42. package/esm2015/app/utils/loader.js +82 -82
  43. package/esm2015/firestitch-html-editor.js +4 -4
  44. package/esm2015/public_api.js +11 -11
  45. package/fesm2015/firestitch-html-editor.js +961 -960
  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
@@ -30,1394 +30,1395 @@
30
30
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
31
31
  var Tribute__default = /*#__PURE__*/_interopDefaultLegacy(Tribute);
32
32
 
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;
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;
349
349
  }
350
350
 
351
- var RichButtons = [
352
- 'insertTable',
353
- 'insertImage',
354
- 'insertLink',
355
- 'insertVideo',
351
+ var RichButtons = [
352
+ 'insertTable',
353
+ 'insertImage',
354
+ 'insertLink',
355
+ 'insertVideo',
356
356
  ];
357
357
 
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',
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',
375
375
  ];
376
376
 
377
- var ParagraphButtons = [
378
- 'align',
379
- 'formatOL',
380
- 'formatUL',
381
- 'checklist',
382
- 'indent',
383
- 'outdent',
377
+ var ParagraphButtons = [
378
+ 'align',
379
+ 'formatOL',
380
+ 'formatUL',
381
+ 'checklist',
382
+ 'indent',
383
+ 'outdent',
384
384
  ];
385
385
 
386
- var FS_HTML_EDITOR_DEFAULT_CONFIG = new i0.InjectionToken('fs-html-editor.default-config');
386
+ var FS_HTML_EDITOR_DEFAULT_CONFIG = new i0.InjectionToken('fs-html-editor.default-config');
387
387
  var FS_HTML_EDITOR_CONFIG = new i0.InjectionToken('fs-html-editor.config');
388
388
 
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
- };
409
- var stylesPaths = {
410
- froala: 'froala_editor.pkgd.min.css',
411
- };
412
- var loadResource = function (scriptPath) {
413
- if (!files.has(scriptPath)) {
414
- var obs$ = new rxjs.Observable(function (obs) {
415
- var script = document.createElement('script');
416
- script.src = scriptPath;
417
- head.appendChild(script);
418
- script.onload = function () {
419
- obs.next();
420
- obs.complete();
421
- };
422
- script.onerror = function (err) {
423
- obs.error(err);
424
- };
425
- })
426
- .pipe(operators.shareReplay(1));
427
- files.set(scriptPath, obs$);
428
- }
429
- return files.get(scriptPath);
430
- };
431
- var loadStyles = function (stylePath) {
432
- if (!files.has(stylePath)) {
433
- var obs$ = new rxjs.Observable(function (obs) {
434
- var style = document.createElement('link');
435
- style.id = stylePath;
436
- style.rel = 'stylesheet';
437
- style.href = "" + stylePath;
438
- head.appendChild(style);
439
- style.onload = function () {
440
- obs.next();
441
- obs.complete();
442
- };
443
- style.onerror = function (err) {
444
- obs.error(err);
445
- };
446
- });
447
- files.set(stylePath, obs$);
448
- }
449
- return files.get(stylePath);
450
- };
451
- return {
452
- setResourceBase: function (path) {
453
- resourceBase = path;
454
- },
455
- setStylesBase: function (path) {
456
- stylesBase = path;
457
- },
458
- loadResource: function (resourceName) {
459
- var path = resourcePaths[resourceName] || resourceName;
460
- return loadResource(resourceBase + path);
461
- },
462
- loadStyles: function (resourceName) {
463
- var path = stylesPaths[resourceName] || resourceName;
464
- return loadStyles(stylesBase + path);
465
- }
466
- };
467
- }
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
+ };
409
+ var stylesPaths = {
410
+ froala: 'froala_editor.pkgd.min.css',
411
+ };
412
+ var loadResource = function (scriptPath) {
413
+ if (!files.has(scriptPath)) {
414
+ var obs$ = new rxjs.Observable(function (obs) {
415
+ var script = document.createElement('script');
416
+ script.src = scriptPath;
417
+ head.appendChild(script);
418
+ script.onload = function () {
419
+ obs.next();
420
+ obs.complete();
421
+ };
422
+ script.onerror = function (err) {
423
+ obs.error(err);
424
+ };
425
+ })
426
+ .pipe(operators.shareReplay(1));
427
+ files.set(scriptPath, obs$);
428
+ }
429
+ return files.get(scriptPath);
430
+ };
431
+ var loadStyles = function (stylePath) {
432
+ if (!files.has(stylePath)) {
433
+ var obs$ = new rxjs.Observable(function (obs) {
434
+ var style = document.createElement('link');
435
+ style.id = stylePath;
436
+ style.rel = 'stylesheet';
437
+ style.href = "" + stylePath;
438
+ head.appendChild(style);
439
+ style.onload = function () {
440
+ obs.next();
441
+ obs.complete();
442
+ };
443
+ style.onerror = function (err) {
444
+ obs.error(err);
445
+ };
446
+ });
447
+ files.set(stylePath, obs$);
448
+ }
449
+ return files.get(stylePath);
450
+ };
451
+ return {
452
+ setResourceBase: function (path) {
453
+ resourceBase = path;
454
+ },
455
+ setStylesBase: function (path) {
456
+ stylesBase = path;
457
+ },
458
+ loadResource: function (resourceName) {
459
+ var path = resourcePaths[resourceName] || resourceName;
460
+ return loadResource(resourceBase + path);
461
+ },
462
+ loadStyles: function (resourceName) {
463
+ var path = stylesPaths[resourceName] || resourceName;
464
+ return loadStyles(stylesBase + path);
465
+ }
466
+ };
467
+ }
468
468
  var ResourceLoader = resourceLoaderFactory();
469
469
 
470
- var FsFroalaLoaderService = /** @class */ (function () {
471
- function FsFroalaLoaderService(_defaultConfig) {
472
- this._defaultConfig = _defaultConfig;
473
- this._froalaLoaded = new rxjs.BehaviorSubject(false);
474
- this._defaultPluginsLoaded = new rxjs.BehaviorSubject(false);
475
- this._loaded$ = rxjs.combineLatest([this._froalaLoaded, this._defaultPluginsLoaded])
476
- .pipe(operators.map(function (_a) {
477
- var _b = __read(_a, 2), FroalaReady = _b[0], pluginsRead = _b[1];
478
- return pluginsRead && FroalaReady;
479
- }), operators.shareReplay(1));
480
- if (this._defaultConfig) {
481
- if (this._defaultConfig.assetsJSPath) {
482
- ResourceLoader.setResourceBase(this._defaultConfig.assetsJSPath);
483
- }
484
- if (this._defaultConfig.assetsCSSPath) {
485
- ResourceLoader.setStylesBase(this._defaultConfig.assetsCSSPath);
486
- }
487
- }
488
- this._load();
489
- }
490
- Object.defineProperty(FsFroalaLoaderService.prototype, "loaded$", {
491
- get: function () {
492
- return this._loaded$;
493
- },
494
- enumerable: false,
495
- configurable: true
496
- });
497
- Object.defineProperty(FsFroalaLoaderService.prototype, "ready", {
498
- get: function () {
499
- return this._froalaLoaded.getValue() && this._defaultPluginsLoaded.getValue();
500
- },
501
- enumerable: false,
502
- configurable: true
503
- });
504
- Object.defineProperty(FsFroalaLoaderService.prototype, "FroalaEditor", {
505
- get: function () {
506
- return this._FroalaEditor;
507
- },
508
- enumerable: false,
509
- configurable: true
510
- });
511
- FsFroalaLoaderService.prototype._load = function () {
512
- var _this = this;
513
- rxjs.combineLatest([
514
- ResourceLoader.loadResource('froala'),
515
- ResourceLoader.loadStyles('froala')
516
- ])
517
- .pipe(operators.tap(function () {
518
- _this._FroalaEditor = window.FroalaEditor;
519
- _this._froalaDone();
520
- }), operators.concatMap(function () {
521
- return _this._loadPlugins();
522
- }), operators.tap(function () {
523
- _this._defaultPluginsDone();
524
- }))
525
- .subscribe();
526
- };
527
- FsFroalaLoaderService.prototype._loadPlugins = function () {
528
- var imports = this._defaultConfig
529
- .defaultPlugins
530
- .reduce(function (acc, pluginName) {
531
- var import$ = ResourceLoader.loadResource(pluginName);
532
- acc.push(import$);
533
- return acc;
534
- }, []);
535
- return rxjs.combineLatest(imports);
536
- };
537
- FsFroalaLoaderService.prototype._froalaDone = function () {
538
- this._froalaLoaded.next(true);
539
- };
540
- FsFroalaLoaderService.prototype._defaultPluginsDone = function () {
541
- this._defaultPluginsLoaded.next(true);
542
- };
543
- return FsFroalaLoaderService;
544
- }());
545
- 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 });
546
- FsFroalaLoaderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFroalaLoaderService, providedIn: 'root' });
547
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFroalaLoaderService, decorators: [{
548
- type: i0.Injectable,
549
- args: [{
550
- providedIn: 'root',
551
- }]
552
- }], ctorParameters: function () {
553
- return [{ type: undefined, decorators: [{
554
- type: i0.Optional
555
- }, {
556
- type: i0.Inject,
557
- args: [FS_HTML_EDITOR_CONFIG]
558
- }] }];
470
+ var FsFroalaLoaderService = /** @class */ (function () {
471
+ function FsFroalaLoaderService(_defaultConfig) {
472
+ this._defaultConfig = _defaultConfig;
473
+ this._froalaLoaded = new rxjs.BehaviorSubject(false);
474
+ this._defaultPluginsLoaded = new rxjs.BehaviorSubject(false);
475
+ this._loaded$ = rxjs.combineLatest([this._froalaLoaded, this._defaultPluginsLoaded])
476
+ .pipe(operators.map(function (_a) {
477
+ var _b = __read(_a, 2), FroalaReady = _b[0], pluginsRead = _b[1];
478
+ return pluginsRead && FroalaReady;
479
+ }), operators.shareReplay(1));
480
+ if (this._defaultConfig) {
481
+ if (this._defaultConfig.assetsJSPath) {
482
+ ResourceLoader.setResourceBase(this._defaultConfig.assetsJSPath);
483
+ }
484
+ if (this._defaultConfig.assetsCSSPath) {
485
+ ResourceLoader.setStylesBase(this._defaultConfig.assetsCSSPath);
486
+ }
487
+ }
488
+ this._load();
489
+ }
490
+ Object.defineProperty(FsFroalaLoaderService.prototype, "loaded$", {
491
+ get: function () {
492
+ return this._loaded$;
493
+ },
494
+ enumerable: false,
495
+ configurable: true
496
+ });
497
+ Object.defineProperty(FsFroalaLoaderService.prototype, "ready", {
498
+ get: function () {
499
+ return this._froalaLoaded.getValue() && this._defaultPluginsLoaded.getValue();
500
+ },
501
+ enumerable: false,
502
+ configurable: true
503
+ });
504
+ Object.defineProperty(FsFroalaLoaderService.prototype, "FroalaEditor", {
505
+ get: function () {
506
+ return this._FroalaEditor;
507
+ },
508
+ enumerable: false,
509
+ configurable: true
510
+ });
511
+ FsFroalaLoaderService.prototype._load = function () {
512
+ var _this = this;
513
+ rxjs.combineLatest([
514
+ ResourceLoader.loadResource('froala'),
515
+ ResourceLoader.loadStyles('froala')
516
+ ])
517
+ .pipe(operators.tap(function () {
518
+ _this._FroalaEditor = window.FroalaEditor;
519
+ _this._froalaDone();
520
+ }), operators.concatMap(function () {
521
+ return _this._loadPlugins();
522
+ }), operators.tap(function () {
523
+ _this._defaultPluginsDone();
524
+ }))
525
+ .subscribe();
526
+ };
527
+ FsFroalaLoaderService.prototype._loadPlugins = function () {
528
+ var imports = this._defaultConfig
529
+ .defaultPlugins
530
+ .reduce(function (acc, pluginName) {
531
+ var import$ = ResourceLoader.loadResource(pluginName);
532
+ acc.push(import$);
533
+ return acc;
534
+ }, []);
535
+ return rxjs.combineLatest(imports);
536
+ };
537
+ FsFroalaLoaderService.prototype._froalaDone = function () {
538
+ this._froalaLoaded.next(true);
539
+ };
540
+ FsFroalaLoaderService.prototype._defaultPluginsDone = function () {
541
+ this._defaultPluginsLoaded.next(true);
542
+ };
543
+ return FsFroalaLoaderService;
544
+ }());
545
+ 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 });
546
+ FsFroalaLoaderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFroalaLoaderService, providedIn: 'root' });
547
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFroalaLoaderService, decorators: [{
548
+ type: i0.Injectable,
549
+ args: [{
550
+ providedIn: 'root',
551
+ }]
552
+ }], ctorParameters: function () {
553
+ return [{ type: undefined, decorators: [{
554
+ type: i0.Optional
555
+ }, {
556
+ type: i0.Inject,
557
+ args: [FS_HTML_EDITOR_CONFIG]
558
+ }] }];
559
559
  } });
560
560
 
561
- var FsHtmlRendererComponent = /** @class */ (function () {
562
- function FsHtmlRendererComponent(sanitized, _cdRef) {
563
- this.sanitized = sanitized;
564
- this._cdRef = _cdRef;
565
- }
566
- Object.defineProperty(FsHtmlRendererComponent.prototype, "setHtml", {
567
- set: function (html) {
568
- this.trustedHtml = this.sanitized.bypassSecurityTrustHtml(html || '');
569
- this._cdRef.markForCheck();
570
- },
571
- enumerable: false,
572
- configurable: true
573
- });
574
- return FsHtmlRendererComponent;
575
- }());
576
- 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 });
577
- 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 });
578
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlRendererComponent, decorators: [{
579
- type: i0.Component,
580
- args: [{
581
- selector: 'fs-html-renderer',
582
- templateUrl: 'html-renderer.component.html',
583
- styleUrls: ['html-renderer.component.scss'],
584
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
585
- }]
586
- }], ctorParameters: function () { return [{ type: i1__namespace.DomSanitizer }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { setHtml: [{
587
- type: i0.Input,
588
- args: ['html']
561
+ var FsHtmlRendererComponent = /** @class */ (function () {
562
+ function FsHtmlRendererComponent(sanitized, _cdRef) {
563
+ this.sanitized = sanitized;
564
+ this._cdRef = _cdRef;
565
+ }
566
+ Object.defineProperty(FsHtmlRendererComponent.prototype, "setHtml", {
567
+ set: function (html) {
568
+ this.trustedHtml = this.sanitized.bypassSecurityTrustHtml(html || '');
569
+ this._cdRef.markForCheck();
570
+ },
571
+ enumerable: false,
572
+ configurable: true
573
+ });
574
+ return FsHtmlRendererComponent;
575
+ }());
576
+ 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 });
577
+ 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 });
578
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlRendererComponent, decorators: [{
579
+ type: i0.Component,
580
+ args: [{
581
+ selector: 'fs-html-renderer',
582
+ templateUrl: 'html-renderer.component.html',
583
+ styleUrls: ['html-renderer.component.scss'],
584
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
585
+ }]
586
+ }], ctorParameters: function () { return [{ type: i1__namespace.DomSanitizer }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { setHtml: [{
587
+ type: i0.Input,
588
+ args: ['html']
589
589
  }] } });
590
590
 
591
- var FsHtmlEditorComponent = /** @class */ (function () {
592
- function FsHtmlEditorComponent(_defaultConfig, _cdRef, _fr) {
593
- this._defaultConfig = _defaultConfig;
594
- this._cdRef = _cdRef;
595
- this._fr = _fr;
596
- this.classFocused = false;
597
- this.classDisabled = false;
598
- this.config = {};
599
- this.initialized = false;
600
- this._initialize$ = new rxjs.ReplaySubject();
601
- this._froalaReady$ = new rxjs.BehaviorSubject(null);
602
- this._destroy$ = new rxjs.Subject();
603
- this.onChange = function (data) { };
604
- this.onTouched = function () { };
605
- }
606
- Object.defineProperty(FsHtmlEditorComponent.prototype, "el", {
607
- get: function () {
608
- return this.elRef.nativeElement;
609
- },
610
- enumerable: false,
611
- configurable: true
612
- });
613
- Object.defineProperty(FsHtmlEditorComponent.prototype, "html", {
614
- get: function () {
615
- return this._html;
616
- },
617
- enumerable: false,
618
- configurable: true
619
- });
620
- Object.defineProperty(FsHtmlEditorComponent.prototype, "editor", {
621
- get: function () {
622
- return this._editor;
623
- },
624
- enumerable: false,
625
- configurable: true
626
- });
627
- Object.defineProperty(FsHtmlEditorComponent.prototype, "froalaLoaded$", {
628
- get: function () {
629
- return this._fr.loaded$;
630
- },
631
- enumerable: false,
632
- configurable: true
633
- });
634
- FsHtmlEditorComponent.prototype.ngOnInit = function () {
635
- this.config = this.config || {};
636
- this.config.autofocus = this.config.autofocus !== false && !this.config.disabled;
637
- this.initialized = !this.config.initOnClick;
638
- this._listenLazyInit();
639
- };
640
- FsHtmlEditorComponent.prototype.ngAfterViewInit = function () {
641
- if (!this.config.initOnClick || !this.hasContent()) {
642
- this.initialized = true;
643
- this._initialize$.next();
644
- }
645
- };
646
- FsHtmlEditorComponent.prototype.hasContent = function () {
647
- var el = document.createElement('div');
648
- if (el.querySelector('img')) {
649
- return true;
650
- }
651
- el.innerHTML = this._html;
652
- return !!el.innerText.length;
653
- };
654
- FsHtmlEditorComponent.prototype.initialize = function (options) {
655
- var _this = this;
656
- if (options === void 0) { options = {}; }
657
- var config = this._createConfig();
658
- this._initPlugins(config);
659
- // this.el.innerHTML = this._html || '';
660
- this._editor = new this._fr.FroalaEditor(this.el, this._createOptions(), function () {
661
- _this._froalaReady$.next({ config: config, options: options });
662
- });
663
- };
664
- FsHtmlEditorComponent.prototype._processImageUpload = function (blob) {
665
- var _this = this;
666
- var processor = new file.FileProcessor();
667
- var file$1 = new file.FsFile(blob);
668
- return processor.process([file$1], this.config.image)
669
- .pipe(operators.switchMap(function (_a) {
670
- var _b = __read(_a, 1), f = _b[0];
671
- return _this.config.image.upload(f.file);
672
- }));
673
- };
674
- FsHtmlEditorComponent.prototype._getTextNode = function (node) {
675
- if (node) {
676
- if (node.nodeType === Node.TEXT_NODE) {
677
- return node;
678
- }
679
- if (node.childNodes) {
680
- return this._getTextNode(node.childNodes[0]);
681
- }
682
- }
683
- };
684
- FsHtmlEditorComponent.prototype.uninitializedClick = function (event) {
685
- if (!event.defaultPrevented) {
686
- var target_1 = event.target;
687
- if (target_1 && target_1.nodeName === 'A' && target_1.getAttribute('href')) {
688
- var targetTarget_1 = target_1.getAttribute('target');
689
- target_1.setAttribute('target', '_blank');
690
- setTimeout(function () {
691
- if (targetTarget_1) {
692
- target_1.setAttribute('target', targetTarget_1);
693
- }
694
- else {
695
- target_1.removeAttribute('target');
696
- }
697
- });
698
- }
699
- else {
700
- if (this.config.initClick) {
701
- this.config.initClick(event);
702
- }
703
- this._initialize$.next();
704
- this.initialized = true;
705
- }
706
- }
707
- };
708
- FsHtmlEditorComponent.prototype.updateSize = function () {
709
- // Hack: To trigger the toolbar button size modes
710
- window.dispatchEvent(new Event('resize'));
711
- };
712
- FsHtmlEditorComponent.prototype.validate = function (control) {
713
- var err = {};
714
- if (this.config.maxLength && this._html) {
715
- var maxLength = this.config.maxLength;
716
- var length = this._html.length;
717
- if (length > maxLength) {
718
- err.maxLengthError = "Must be " + maxLength + " characters or fewer. You entered " + length + " characters.";
719
- }
720
- }
721
- return Object.keys(err).length ? err : null;
722
- };
723
- FsHtmlEditorComponent.prototype.focus = function (options) {
724
- options = options ? options : {};
725
- if (options.cursorPosition === 'end') {
726
- this.editor.selection.setAtEnd(this.editor.$el.get(0));
727
- }
728
- else {
729
- this.editor.selection.setAtStart(this.editor.$el.get(0));
730
- }
731
- this.editor.selection.restore();
732
- var elSelection = this.editor.selection.element();
733
- if (elSelection) {
734
- elSelection.scrollIntoView({ block: 'center' });
735
- }
736
- };
737
- FsHtmlEditorComponent.prototype.clear = function () {
738
- this.writeValue('');
739
- };
740
- FsHtmlEditorComponent.prototype.disable = function () {
741
- this.classDisabled = true;
742
- };
743
- FsHtmlEditorComponent.prototype.setHtml = function (html) {
744
- this.writeValue(html);
745
- };
746
- FsHtmlEditorComponent.prototype.writeValue = function (html) {
747
- this._html = html || '';
748
- if (this.editor && this.editor.html) {
749
- try {
750
- this.editor.html.set(this._html);
751
- }
752
- catch (e) {
753
- }
754
- }
755
- this._cdRef.markForCheck();
756
- };
757
- FsHtmlEditorComponent.prototype.registerOnChange = function (fn) {
758
- this.onChange = fn;
759
- };
760
- FsHtmlEditorComponent.prototype.registerOnTouched = function (fn) {
761
- this.onTouched = fn;
762
- };
763
- FsHtmlEditorComponent.prototype.ngOnDestroy = function () {
764
- this._initialize$.complete();
765
- this._destroy$.next();
766
- this._destroy$.complete();
767
- this.destroy();
768
- };
769
- FsHtmlEditorComponent.prototype.destroy = function () {
770
- if (this.editor) {
771
- this.editor.destroy();
772
- }
773
- this.initialized = false;
774
- this._cdRef.markForCheck();
775
- this.el.innerHTML = '';
776
- };
777
- FsHtmlEditorComponent.prototype._createConfig = function () {
778
- return lodashEs.merge({ froalaConfig: {} }, this._defaultConfig, this.config);
779
- };
780
- FsHtmlEditorComponent.prototype._change = function (html) {
781
- // this._html = html;
782
- this.onChange(html);
783
- };
784
- FsHtmlEditorComponent.prototype._initPlugins = function (config) {
785
- var _this = this;
786
- (config.plugins || []).forEach(function (plugin) {
787
- _this._fr.FroalaEditor.PLUGINS[plugin.config.name] = function (editor) {
788
- plugin.editor = editor;
789
- plugin.initialize();
790
- return plugin;
791
- };
792
- (plugin.config.buttons || []).forEach(function (button) {
793
- _this._fr.FroalaEditor.DefineIcon(button.name, {
794
- NAME: button.name,
795
- PATH: button.svgPath,
796
- });
797
- _this._fr.FroalaEditor.RegisterCommand(button.name, {
798
- icon: button.name,
799
- title: button.tooltip,
800
- undo: button.undo,
801
- focus: button.focus,
802
- showOnMobile: button.showOnMobile,
803
- refreshAfterCallback: button.refreshAfterCallback,
804
- callback: function () {
805
- if (button.click) {
806
- button.click(this);
807
- }
808
- },
809
- refresh: function (button) {
810
- if (button.refresh) {
811
- button.refresh(this, button);
812
- }
813
- }
814
- });
815
- });
816
- });
817
- };
818
- FsHtmlEditorComponent.prototype._createOptions = function () {
819
- var config = this._createConfig();
820
- return lodashEs.merge(
821
- // For some reason editor store somewhere pointer on default config object and dublicate options each time on init
822
- // Extra merge level fixed this problem and allow to init config properly without legacy data
823
- {}, {
824
- key: config.activationKey,
825
- placeholderText: config.placeholder,
826
- linkAlwaysBlank: true,
827
- tabSpaces: 2,
828
- typingTimer: 250,
829
- tooltips: false,
830
- wordPasteModal: false,
831
- imageDefaultWidth: 0,
832
- imageDefaultAlign: 'left',
833
- quickInsertEnabled: false,
834
- paragraphDefaultSelection: 'Format',
835
- videoUpload: false,
836
- paragraphFormat: {
837
- N: 'Normal',
838
- H1: 'Heading 1',
839
- H2: 'Heading 2',
840
- H3: 'Heading 3',
841
- H4: 'Heading 4',
842
- BLOCKQUOTE: 'Quote',
843
- },
844
- paragraphFormatSelection: true,
845
- toolbarButtonsXS: {
846
- moreText: {
847
- buttons: TextButtons,
848
- buttonsVisible: 1,
849
- },
850
- moreParagraph: {
851
- buttons: ParagraphButtons,
852
- buttonsVisible: 2,
853
- },
854
- moreRich: {
855
- buttons: RichButtons,
856
- buttonsVisible: 0,
857
- },
858
- },
859
- toolbarButtons: {
860
- moreText: {
861
- buttons: TextButtons,
862
- buttonsVisible: 3,
863
- },
864
- moreParagraph: {
865
- buttons: ParagraphButtons,
866
- buttonsVisible: 5,
867
- },
868
- moreRich: {
869
- buttons: RichButtons,
870
- buttonsVisible: 3,
871
- },
872
- },
873
- }, config.froalaConfig);
874
- };
875
- FsHtmlEditorComponent.prototype._listenLazyInit = function () {
876
- var _this = this;
877
- this.froalaLoaded$
878
- .pipe(operators.filter(function (ready) { return ready; }), operators.switchMap(function () { return _this._initialize$; }), operators.tap(function () {
879
- var selection = window.getSelection();
880
- var options = {};
881
- if (selection.baseNode) {
882
- options.selection = {
883
- node: selection.baseNode.nodeValue,
884
- offset: selection.baseOffset,
885
- };
886
- }
887
- _this.initialize(options);
888
- }), operators.switchMap(function () { return _this._froalaReady$; }), operators.filter(function (data) { return !!data; }), operators.tap(function (_a) {
889
- var config = _a.config, options = _a.options;
890
- _this._setupFroala(config, options);
891
- }))
892
- .subscribe();
893
- };
894
- FsHtmlEditorComponent.prototype._contentChanged = function () {
895
- var editorHTML = this._editor.html.get();
896
- if (this.html !== editorHTML) {
897
- this._change(editorHTML);
898
- }
899
- };
900
- FsHtmlEditorComponent.prototype._setupFroala = function (config, options) {
901
- var _this = this;
902
- this._cdRef.markForCheck();
903
- this.setHtml(this._html);
904
- if (config.disabled) {
905
- this.disable();
906
- }
907
- if (config.froalaConfig.events) {
908
- if (config.froalaConfig.events.initialized) {
909
- config.froalaConfig.events.initialized();
910
- }
911
- }
912
- this._editor.events.on('focus', function () {
913
- _this.classFocused = true;
914
- _this._cdRef.markForCheck();
915
- });
916
- this._editor.events.on('blur', function () {
917
- _this.classFocused = false;
918
- _this._cdRef.markForCheck();
919
- });
920
- rxjs.fromEventPattern(function (handler) {
921
- _this._editor.events.on('contentChanged', handler);
922
- }, function () { })
923
- .pipe(operators.startWith(this._html), operators.map(function () { return _this.editor.html.get(); }), operators.distinctUntilChanged(), operators.skip(1))
924
- .subscribe(function () {
925
- _this._contentChanged();
926
- });
927
- // this._editor.events.on('contentChanged', () => {
928
- // console.log('test');
929
- // if (!this._firstChange) {
930
- // this._contentChanged();
931
- // }
932
- // });
933
- this._editor.events.on('paste.afterCleanup', function (html) {
934
- var div = document.createElement('div');
935
- div.innerHTML = html;
936
- div.querySelectorAll('*')
937
- .forEach(function (el) {
938
- for (var i = 0; i < el.attributes.length; i++) {
939
- var name = el.attributes[0].name;
940
- if (name !== 'href') {
941
- el.removeAttribute(name);
942
- }
943
- }
944
- });
945
- return div.innerHTML;
946
- });
947
- this._editor.events.on('keydown', function () {
948
- _this.onTouched();
949
- });
950
- if (this.config.image && this.config.image.upload) {
951
- this._editor.events.on('image.beforePasteUpload', function (image) {
952
- fetch(image.getAttribute('src'))
953
- .then(function (res) {
954
- res.blob()
955
- .then(function (blob) {
956
- _this._processImageUpload(blob)
957
- .pipe(operators.takeUntil(_this._destroy$))
958
- .subscribe(function (url) {
959
- image.setAttribute('src', url);
960
- image.removeAttribute('data-fr-image-pasted');
961
- _this._contentChanged();
962
- });
963
- });
964
- });
965
- return false;
966
- });
967
- this._editor.events.on('image.beforeUpload', function (blobs) {
968
- _this._processImageUpload(blobs[0])
969
- .pipe(operators.takeUntil(_this._destroy$))
970
- .subscribe(function (url) {
971
- _this.editor.image.insert(url, null, null, _this.editor.image.get());
972
- });
973
- return false;
974
- });
975
- }
976
- if (this.el.querySelector('.fr-second-toolbar')) {
977
- this.el.querySelector('.fr-second-toolbar').remove();
978
- }
979
- var selection = options.selection;
980
- if (selection) {
981
- var node = Array.from(this.el.querySelectorAll('.fr-element *')).find(function (node) {
982
- return selection.node === node.textContent;
983
- });
984
- if (node) {
985
- var range = document.createRange();
986
- var sel = window.getSelection();
987
- range.setStart(this._getTextNode(node), selection.offset);
988
- range.collapse(true);
989
- sel.removeAllRanges();
990
- sel.addRange(range);
991
- }
992
- else if (this.config.autofocus) {
993
- this.focus();
994
- }
995
- }
996
- else if (this.config.autofocus) {
997
- this.focus();
998
- }
999
- };
1000
- return FsHtmlEditorComponent;
1001
- }());
1002
- 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 });
1003
- 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: [
1004
- {
1005
- provide: forms.NG_VALUE_ACCESSOR,
1006
- useExisting: i0.forwardRef(function () { return FsHtmlEditorComponent; }),
1007
- multi: true
1008
- },
1009
- {
1010
- provide: forms.NG_VALIDATORS,
1011
- useExisting: i0.forwardRef(function () { return FsHtmlEditorComponent; }),
1012
- multi: true
1013
- },
1014
- ], 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 });
1015
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorComponent, decorators: [{
1016
- type: i0.Component,
1017
- args: [{
1018
- selector: 'fs-html-editor',
1019
- templateUrl: 'html-editor.component.html',
1020
- styleUrls: ['html-editor.component.scss'],
1021
- providers: [
1022
- {
1023
- provide: forms.NG_VALUE_ACCESSOR,
1024
- useExisting: i0.forwardRef(function () { return FsHtmlEditorComponent; }),
1025
- multi: true
1026
- },
1027
- {
1028
- provide: forms.NG_VALIDATORS,
1029
- useExisting: i0.forwardRef(function () { return FsHtmlEditorComponent; }),
1030
- multi: true
1031
- },
1032
- ],
1033
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1034
- }]
1035
- }], ctorParameters: function () {
1036
- return [{ type: undefined, decorators: [{
1037
- type: i0.Optional
1038
- }, {
1039
- type: i0.Inject,
1040
- args: [FS_HTML_EDITOR_CONFIG]
1041
- }] }, { type: i0__namespace.ChangeDetectorRef }, { type: FsFroalaLoaderService }];
1042
- }, propDecorators: { classFocused: [{
1043
- type: i0.HostBinding,
1044
- args: ['class.focused']
1045
- }], classDisabled: [{
1046
- type: i0.HostBinding,
1047
- args: ['class.disabled']
1048
- }], elRef: [{
1049
- type: i0.ViewChild,
1050
- args: ['elRef']
1051
- }], config: [{
1052
- type: i0.Input
591
+ var FsHtmlEditorComponent = /** @class */ (function () {
592
+ function FsHtmlEditorComponent(_defaultConfig, _cdRef, _fr) {
593
+ this._defaultConfig = _defaultConfig;
594
+ this._cdRef = _cdRef;
595
+ this._fr = _fr;
596
+ this.classFocused = false;
597
+ this.classDisabled = false;
598
+ this.config = {};
599
+ this.initialized = false;
600
+ this._initialize$ = new rxjs.ReplaySubject();
601
+ this._froalaReady$ = new rxjs.BehaviorSubject(null);
602
+ this._destroy$ = new rxjs.Subject();
603
+ this.onChange = function (data) { };
604
+ this.onTouched = function () { };
605
+ }
606
+ Object.defineProperty(FsHtmlEditorComponent.prototype, "el", {
607
+ get: function () {
608
+ return this.elRef.nativeElement;
609
+ },
610
+ enumerable: false,
611
+ configurable: true
612
+ });
613
+ Object.defineProperty(FsHtmlEditorComponent.prototype, "html", {
614
+ get: function () {
615
+ return this._html;
616
+ },
617
+ enumerable: false,
618
+ configurable: true
619
+ });
620
+ Object.defineProperty(FsHtmlEditorComponent.prototype, "editor", {
621
+ get: function () {
622
+ return this._editor;
623
+ },
624
+ enumerable: false,
625
+ configurable: true
626
+ });
627
+ Object.defineProperty(FsHtmlEditorComponent.prototype, "froalaLoaded$", {
628
+ get: function () {
629
+ return this._fr.loaded$;
630
+ },
631
+ enumerable: false,
632
+ configurable: true
633
+ });
634
+ FsHtmlEditorComponent.prototype.ngOnInit = function () {
635
+ this.config = this.config || {};
636
+ this.config.autofocus = this.config.autofocus !== false && !this.config.disabled;
637
+ this.initialized = !this.config.initOnClick;
638
+ this._listenLazyInit();
639
+ };
640
+ FsHtmlEditorComponent.prototype.ngAfterViewInit = function () {
641
+ if (!this.config.initOnClick || !this.hasContent()) {
642
+ this.initialized = true;
643
+ this._initialize$.next();
644
+ }
645
+ };
646
+ FsHtmlEditorComponent.prototype.hasContent = function () {
647
+ var el = document.createElement('div');
648
+ if (el.querySelector('img')) {
649
+ return true;
650
+ }
651
+ el.innerHTML = this._html;
652
+ return !!el.innerText.length;
653
+ };
654
+ FsHtmlEditorComponent.prototype.initialize = function (options) {
655
+ var _this = this;
656
+ if (options === void 0) { options = {}; }
657
+ var config = this._createConfig();
658
+ this._initPlugins(config);
659
+ // this.el.innerHTML = this._html || '';
660
+ this._editor = new this._fr.FroalaEditor(this.el, this._createOptions(), function () {
661
+ _this._froalaReady$.next({ config: config, options: options });
662
+ });
663
+ };
664
+ FsHtmlEditorComponent.prototype._processImageUpload = function (blob) {
665
+ var _this = this;
666
+ var processor = new file.FileProcessor();
667
+ var file$1 = new file.FsFile(blob);
668
+ return processor.process([file$1], this.config.image)
669
+ .pipe(operators.switchMap(function (_a) {
670
+ var _b = __read(_a, 1), f = _b[0];
671
+ return _this.config.image.upload(f.file);
672
+ }));
673
+ };
674
+ FsHtmlEditorComponent.prototype._getTextNode = function (node) {
675
+ if (node) {
676
+ if (node.nodeType === Node.TEXT_NODE) {
677
+ return node;
678
+ }
679
+ if (node.childNodes) {
680
+ return this._getTextNode(node.childNodes[0]);
681
+ }
682
+ }
683
+ };
684
+ FsHtmlEditorComponent.prototype.uninitializedClick = function (event) {
685
+ if (!event.defaultPrevented) {
686
+ var target_1 = event.target;
687
+ if (target_1 && target_1.nodeName === 'A' && target_1.getAttribute('href')) {
688
+ var targetTarget_1 = target_1.getAttribute('target');
689
+ target_1.setAttribute('target', '_blank');
690
+ setTimeout(function () {
691
+ if (targetTarget_1) {
692
+ target_1.setAttribute('target', targetTarget_1);
693
+ }
694
+ else {
695
+ target_1.removeAttribute('target');
696
+ }
697
+ });
698
+ }
699
+ else {
700
+ if (this.config.initClick) {
701
+ this.config.initClick(event);
702
+ }
703
+ this._initialize$.next();
704
+ this.initialized = true;
705
+ }
706
+ }
707
+ };
708
+ FsHtmlEditorComponent.prototype.updateSize = function () {
709
+ // Hack: To trigger the toolbar button size modes
710
+ window.dispatchEvent(new Event('resize'));
711
+ };
712
+ FsHtmlEditorComponent.prototype.validate = function (control) {
713
+ var err = {};
714
+ if (this.config.maxLength && this._html) {
715
+ var maxLength = this.config.maxLength;
716
+ var length = this._html.length;
717
+ if (length > maxLength) {
718
+ err.maxLengthError = "Must be " + maxLength + " characters or fewer. You entered " + length + " characters.";
719
+ }
720
+ }
721
+ return Object.keys(err).length ? err : null;
722
+ };
723
+ FsHtmlEditorComponent.prototype.focus = function (options) {
724
+ options = options ? options : {};
725
+ if (options.cursorPosition === 'end') {
726
+ this.editor.selection.setAtEnd(this.editor.$el.get(0));
727
+ }
728
+ else {
729
+ this.editor.selection.setAtStart(this.editor.$el.get(0));
730
+ }
731
+ this.editor.selection.restore();
732
+ var elSelection = this.editor.selection.element();
733
+ if (elSelection) {
734
+ elSelection.scrollIntoView({ block: 'center' });
735
+ }
736
+ };
737
+ FsHtmlEditorComponent.prototype.clear = function () {
738
+ this.writeValue('');
739
+ };
740
+ FsHtmlEditorComponent.prototype.disable = function () {
741
+ this.classDisabled = true;
742
+ };
743
+ FsHtmlEditorComponent.prototype.setHtml = function (html) {
744
+ this.writeValue(html);
745
+ };
746
+ FsHtmlEditorComponent.prototype.writeValue = function (html) {
747
+ this._html = html || '';
748
+ if (this.editor && this.editor.html) {
749
+ try {
750
+ this.editor.html.set(this._html);
751
+ }
752
+ catch (e) {
753
+ }
754
+ }
755
+ this._cdRef.markForCheck();
756
+ };
757
+ FsHtmlEditorComponent.prototype.registerOnChange = function (fn) {
758
+ this.onChange = fn;
759
+ };
760
+ FsHtmlEditorComponent.prototype.registerOnTouched = function (fn) {
761
+ this.onTouched = fn;
762
+ };
763
+ FsHtmlEditorComponent.prototype.ngOnDestroy = function () {
764
+ this._initialize$.complete();
765
+ this._destroy$.next();
766
+ this._destroy$.complete();
767
+ this.destroy();
768
+ };
769
+ FsHtmlEditorComponent.prototype.destroy = function () {
770
+ if (this.editor) {
771
+ this.editor.destroy();
772
+ }
773
+ this.initialized = false;
774
+ this._cdRef.markForCheck();
775
+ this.el.innerHTML = '';
776
+ };
777
+ FsHtmlEditorComponent.prototype._createConfig = function () {
778
+ return lodashEs.merge({ froalaConfig: {} }, this._defaultConfig, this.config);
779
+ };
780
+ FsHtmlEditorComponent.prototype._change = function (html) {
781
+ // this._html = html;
782
+ this.onChange(html);
783
+ };
784
+ FsHtmlEditorComponent.prototype._initPlugins = function (config) {
785
+ var _this = this;
786
+ (config.plugins || []).forEach(function (plugin) {
787
+ _this._fr.FroalaEditor.PLUGINS[plugin.config.name] = function (editor) {
788
+ plugin.editor = editor;
789
+ plugin.initialize();
790
+ return plugin;
791
+ };
792
+ (plugin.config.buttons || []).forEach(function (button) {
793
+ _this._fr.FroalaEditor.DefineIcon(button.name, {
794
+ NAME: button.name,
795
+ PATH: button.svgPath,
796
+ });
797
+ _this._fr.FroalaEditor.RegisterCommand(button.name, {
798
+ icon: button.name,
799
+ title: button.tooltip,
800
+ undo: button.undo,
801
+ focus: button.focus,
802
+ showOnMobile: button.showOnMobile,
803
+ refreshAfterCallback: button.refreshAfterCallback,
804
+ callback: function () {
805
+ if (button.click) {
806
+ button.click(this);
807
+ }
808
+ },
809
+ refresh: function (button) {
810
+ if (button.refresh) {
811
+ button.refresh(this, button);
812
+ }
813
+ }
814
+ });
815
+ });
816
+ });
817
+ };
818
+ FsHtmlEditorComponent.prototype._createOptions = function () {
819
+ var config = this._createConfig();
820
+ return lodashEs.merge(
821
+ // For some reason editor store somewhere pointer on default config object and dublicate options each time on init
822
+ // Extra merge level fixed this problem and allow to init config properly without legacy data
823
+ {}, {
824
+ shortcutsEnabled: ['show', 'bold', 'italic', 'underline', 'indent', 'outdent', 'undo', 'redo', 'insertImage', 'createLink'],
825
+ key: config.activationKey,
826
+ placeholderText: config.placeholder,
827
+ linkAlwaysBlank: true,
828
+ tabSpaces: 2,
829
+ typingTimer: 250,
830
+ tooltips: false,
831
+ wordPasteModal: false,
832
+ imageDefaultWidth: 0,
833
+ imageDefaultAlign: 'left',
834
+ quickInsertEnabled: false,
835
+ paragraphDefaultSelection: 'Format',
836
+ videoUpload: false,
837
+ paragraphFormat: {
838
+ N: 'Normal',
839
+ H1: 'Heading 1',
840
+ H2: 'Heading 2',
841
+ H3: 'Heading 3',
842
+ H4: 'Heading 4',
843
+ BLOCKQUOTE: 'Quote',
844
+ },
845
+ paragraphFormatSelection: true,
846
+ toolbarButtonsXS: {
847
+ moreText: {
848
+ buttons: TextButtons,
849
+ buttonsVisible: 1,
850
+ },
851
+ moreParagraph: {
852
+ buttons: ParagraphButtons,
853
+ buttonsVisible: 2,
854
+ },
855
+ moreRich: {
856
+ buttons: RichButtons,
857
+ buttonsVisible: 0,
858
+ },
859
+ },
860
+ toolbarButtons: {
861
+ moreText: {
862
+ buttons: TextButtons,
863
+ buttonsVisible: 3,
864
+ },
865
+ moreParagraph: {
866
+ buttons: ParagraphButtons,
867
+ buttonsVisible: 5,
868
+ },
869
+ moreRich: {
870
+ buttons: RichButtons,
871
+ buttonsVisible: 3,
872
+ },
873
+ },
874
+ }, config.froalaConfig);
875
+ };
876
+ FsHtmlEditorComponent.prototype._listenLazyInit = function () {
877
+ var _this = this;
878
+ this.froalaLoaded$
879
+ .pipe(operators.filter(function (ready) { return ready; }), operators.switchMap(function () { return _this._initialize$; }), operators.tap(function () {
880
+ var selection = window.getSelection();
881
+ var options = {};
882
+ if (selection.baseNode) {
883
+ options.selection = {
884
+ node: selection.baseNode.nodeValue,
885
+ offset: selection.baseOffset,
886
+ };
887
+ }
888
+ _this.initialize(options);
889
+ }), operators.switchMap(function () { return _this._froalaReady$; }), operators.filter(function (data) { return !!data; }), operators.tap(function (_a) {
890
+ var config = _a.config, options = _a.options;
891
+ _this._setupFroala(config, options);
892
+ }))
893
+ .subscribe();
894
+ };
895
+ FsHtmlEditorComponent.prototype._contentChanged = function () {
896
+ var editorHTML = this._editor.html.get();
897
+ if (this.html !== editorHTML) {
898
+ this._change(editorHTML);
899
+ }
900
+ };
901
+ FsHtmlEditorComponent.prototype._setupFroala = function (config, options) {
902
+ var _this = this;
903
+ this._cdRef.markForCheck();
904
+ this.setHtml(this._html);
905
+ if (config.disabled) {
906
+ this.disable();
907
+ }
908
+ if (config.froalaConfig.events) {
909
+ if (config.froalaConfig.events.initialized) {
910
+ config.froalaConfig.events.initialized();
911
+ }
912
+ }
913
+ this._editor.events.on('focus', function () {
914
+ _this.classFocused = true;
915
+ _this._cdRef.markForCheck();
916
+ });
917
+ this._editor.events.on('blur', function () {
918
+ _this.classFocused = false;
919
+ _this._cdRef.markForCheck();
920
+ });
921
+ rxjs.fromEventPattern(function (handler) {
922
+ _this._editor.events.on('contentChanged', handler);
923
+ }, function () { })
924
+ .pipe(operators.startWith(this._html), operators.map(function () { return _this.editor.html.get(); }), operators.distinctUntilChanged(), operators.skip(1))
925
+ .subscribe(function () {
926
+ _this._contentChanged();
927
+ });
928
+ // this._editor.events.on('contentChanged', () => {
929
+ // console.log('test');
930
+ // if (!this._firstChange) {
931
+ // this._contentChanged();
932
+ // }
933
+ // });
934
+ this._editor.events.on('paste.afterCleanup', function (html) {
935
+ var div = document.createElement('div');
936
+ div.innerHTML = html;
937
+ div.querySelectorAll('*')
938
+ .forEach(function (el) {
939
+ for (var i = 0; i < el.attributes.length; i++) {
940
+ var name = el.attributes[0].name;
941
+ if (name !== 'href') {
942
+ el.removeAttribute(name);
943
+ }
944
+ }
945
+ });
946
+ return div.innerHTML;
947
+ });
948
+ this._editor.events.on('keydown', function () {
949
+ _this.onTouched();
950
+ });
951
+ if (this.config.image && this.config.image.upload) {
952
+ this._editor.events.on('image.beforePasteUpload', function (image) {
953
+ fetch(image.getAttribute('src'))
954
+ .then(function (res) {
955
+ res.blob()
956
+ .then(function (blob) {
957
+ _this._processImageUpload(blob)
958
+ .pipe(operators.takeUntil(_this._destroy$))
959
+ .subscribe(function (url) {
960
+ image.setAttribute('src', url);
961
+ image.removeAttribute('data-fr-image-pasted');
962
+ _this._contentChanged();
963
+ });
964
+ });
965
+ });
966
+ return false;
967
+ });
968
+ this._editor.events.on('image.beforeUpload', function (blobs) {
969
+ _this._processImageUpload(blobs[0])
970
+ .pipe(operators.takeUntil(_this._destroy$))
971
+ .subscribe(function (url) {
972
+ _this.editor.image.insert(url, null, null, _this.editor.image.get());
973
+ });
974
+ return false;
975
+ });
976
+ }
977
+ if (this.el.querySelector('.fr-second-toolbar')) {
978
+ this.el.querySelector('.fr-second-toolbar').remove();
979
+ }
980
+ var selection = options.selection;
981
+ if (selection) {
982
+ var node = Array.from(this.el.querySelectorAll('.fr-element *')).find(function (node) {
983
+ return selection.node === node.textContent;
984
+ });
985
+ if (node) {
986
+ var range = document.createRange();
987
+ var sel = window.getSelection();
988
+ range.setStart(this._getTextNode(node), selection.offset);
989
+ range.collapse(true);
990
+ sel.removeAllRanges();
991
+ sel.addRange(range);
992
+ }
993
+ else if (this.config.autofocus) {
994
+ this.focus();
995
+ }
996
+ }
997
+ else if (this.config.autofocus) {
998
+ this.focus();
999
+ }
1000
+ };
1001
+ return FsHtmlEditorComponent;
1002
+ }());
1003
+ 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 });
1004
+ 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: [
1005
+ {
1006
+ provide: forms.NG_VALUE_ACCESSOR,
1007
+ useExisting: i0.forwardRef(function () { return FsHtmlEditorComponent; }),
1008
+ multi: true
1009
+ },
1010
+ {
1011
+ provide: forms.NG_VALIDATORS,
1012
+ useExisting: i0.forwardRef(function () { return FsHtmlEditorComponent; }),
1013
+ multi: true
1014
+ },
1015
+ ], 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 });
1016
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorComponent, decorators: [{
1017
+ type: i0.Component,
1018
+ args: [{
1019
+ selector: 'fs-html-editor',
1020
+ templateUrl: 'html-editor.component.html',
1021
+ styleUrls: ['html-editor.component.scss'],
1022
+ providers: [
1023
+ {
1024
+ provide: forms.NG_VALUE_ACCESSOR,
1025
+ useExisting: i0.forwardRef(function () { return FsHtmlEditorComponent; }),
1026
+ multi: true
1027
+ },
1028
+ {
1029
+ provide: forms.NG_VALIDATORS,
1030
+ useExisting: i0.forwardRef(function () { return FsHtmlEditorComponent; }),
1031
+ multi: true
1032
+ },
1033
+ ],
1034
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1035
+ }]
1036
+ }], ctorParameters: function () {
1037
+ return [{ type: undefined, decorators: [{
1038
+ type: i0.Optional
1039
+ }, {
1040
+ type: i0.Inject,
1041
+ args: [FS_HTML_EDITOR_CONFIG]
1042
+ }] }, { type: i0__namespace.ChangeDetectorRef }, { type: FsFroalaLoaderService }];
1043
+ }, propDecorators: { classFocused: [{
1044
+ type: i0.HostBinding,
1045
+ args: ['class.focused']
1046
+ }], classDisabled: [{
1047
+ type: i0.HostBinding,
1048
+ args: ['class.disabled']
1049
+ }], elRef: [{
1050
+ type: i0.ViewChild,
1051
+ args: ['elRef']
1052
+ }], config: [{
1053
+ type: i0.Input
1053
1054
  }] } });
1054
1055
 
1055
- var FsHtmlEditorModule = /** @class */ (function () {
1056
- function FsHtmlEditorModule() {
1057
- }
1058
- FsHtmlEditorModule.forRoot = function (config) {
1059
- if (config === void 0) { config = {}; }
1060
- return {
1061
- ngModule: FsHtmlEditorModule,
1062
- providers: [
1063
- { provide: FS_HTML_EDITOR_DEFAULT_CONFIG, useValue: config },
1064
- {
1065
- provide: FS_HTML_EDITOR_CONFIG,
1066
- useFactory: FsHtmlEditorConfigFactory,
1067
- deps: [FS_HTML_EDITOR_DEFAULT_CONFIG]
1068
- }
1069
- ]
1070
- };
1071
- };
1072
- return FsHtmlEditorModule;
1073
- }());
1074
- FsHtmlEditorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1075
- FsHtmlEditorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorModule, declarations: [FsHtmlEditorComponent,
1076
- FsHtmlRendererComponent], imports: [i3.CommonModule,
1077
- i4.FsSkeletonModule], exports: [FsHtmlEditorComponent,
1078
- FsHtmlRendererComponent] });
1079
- FsHtmlEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorModule, imports: [[
1080
- i3.CommonModule,
1081
- i4.FsSkeletonModule,
1082
- ]] });
1083
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorModule, decorators: [{
1084
- type: i0.NgModule,
1085
- args: [{
1086
- imports: [
1087
- i3.CommonModule,
1088
- i4.FsSkeletonModule,
1089
- ],
1090
- exports: [
1091
- FsHtmlEditorComponent,
1092
- FsHtmlRendererComponent,
1093
- ],
1094
- declarations: [
1095
- FsHtmlEditorComponent,
1096
- FsHtmlRendererComponent,
1097
- ],
1098
- }]
1099
- }] });
1100
- function FsHtmlEditorConfigFactory(config) {
1101
- return Object.assign({ defaultPlugins: [
1102
- "align" /* Align */,
1103
- "colors" /* Colors */,
1104
- "image" /* Image */,
1105
- "link" /* Link */,
1106
- "lists" /* Lists */,
1107
- "paragraph_format" /* ParagraphFormat */,
1108
- "quote" /* Quote */,
1109
- "table" /* Table */,
1110
- "url" /* Url */,
1111
- "video" /* Video */,
1112
- "draggable" /* Draggable */,
1113
- "font_size" /* FontSize */,
1114
- ] }, config);
1056
+ var FsHtmlEditorModule = /** @class */ (function () {
1057
+ function FsHtmlEditorModule() {
1058
+ }
1059
+ FsHtmlEditorModule.forRoot = function (config) {
1060
+ if (config === void 0) { config = {}; }
1061
+ return {
1062
+ ngModule: FsHtmlEditorModule,
1063
+ providers: [
1064
+ { provide: FS_HTML_EDITOR_DEFAULT_CONFIG, useValue: config },
1065
+ {
1066
+ provide: FS_HTML_EDITOR_CONFIG,
1067
+ useFactory: FsHtmlEditorConfigFactory,
1068
+ deps: [FS_HTML_EDITOR_DEFAULT_CONFIG]
1069
+ }
1070
+ ]
1071
+ };
1072
+ };
1073
+ return FsHtmlEditorModule;
1074
+ }());
1075
+ FsHtmlEditorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1076
+ FsHtmlEditorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorModule, declarations: [FsHtmlEditorComponent,
1077
+ FsHtmlRendererComponent], imports: [i3.CommonModule,
1078
+ i4.FsSkeletonModule], exports: [FsHtmlEditorComponent,
1079
+ FsHtmlRendererComponent] });
1080
+ FsHtmlEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorModule, imports: [[
1081
+ i3.CommonModule,
1082
+ i4.FsSkeletonModule,
1083
+ ]] });
1084
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsHtmlEditorModule, decorators: [{
1085
+ type: i0.NgModule,
1086
+ args: [{
1087
+ imports: [
1088
+ i3.CommonModule,
1089
+ i4.FsSkeletonModule,
1090
+ ],
1091
+ exports: [
1092
+ FsHtmlEditorComponent,
1093
+ FsHtmlRendererComponent,
1094
+ ],
1095
+ declarations: [
1096
+ FsHtmlEditorComponent,
1097
+ FsHtmlRendererComponent,
1098
+ ],
1099
+ }]
1100
+ }] });
1101
+ function FsHtmlEditorConfigFactory(config) {
1102
+ return Object.assign({ defaultPlugins: [
1103
+ "align" /* Align */,
1104
+ "colors" /* Colors */,
1105
+ "image" /* Image */,
1106
+ "link" /* Link */,
1107
+ "lists" /* Lists */,
1108
+ "paragraph_format" /* ParagraphFormat */,
1109
+ "quote" /* Quote */,
1110
+ "table" /* Table */,
1111
+ "url" /* Url */,
1112
+ "video" /* Video */,
1113
+ "draggable" /* Draggable */,
1114
+ "font_size" /* FontSize */,
1115
+ ] }, config);
1115
1116
  }
1116
1117
 
1117
- var Plugin = /** @class */ (function () {
1118
- function Plugin() {
1119
- }
1120
- Plugin.prototype.initialize = function () { };
1121
- Plugin.prototype.destroy = function () { };
1122
- return Plugin;
1118
+ var Plugin = /** @class */ (function () {
1119
+ function Plugin() {
1120
+ }
1121
+ Plugin.prototype.initialize = function () { };
1122
+ Plugin.prototype.destroy = function () { };
1123
+ return Plugin;
1123
1124
  }());
1124
1125
 
1125
- var MentionPlugin = /** @class */ (function (_super) {
1126
- __extends(MentionPlugin, _super);
1127
- function MentionPlugin(config) {
1128
- var _this = _super.call(this) || this;
1129
- _this.config = config;
1130
- _this._guid = common.guid();
1131
- _this.selected = function (event) {
1132
- if (_this.config.selected) {
1133
- if (MentionPlugin._currentGuid === _this._guid) {
1134
- _this.config.selected(event.detail.item.original);
1135
- }
1136
- }
1137
- };
1138
- _this.config = Object.assign(Object.assign({}, config), { buttons: [
1139
- {
1140
- name: config.name,
1141
- tooltip: config.tooltip,
1142
- svgPath: config.iconPath,
1143
- click: function (editor) {
1144
- _this._closeAll();
1145
- _this._tribute.showMenuForCollection(editor.el);
1146
- }
1147
- }
1148
- ] });
1149
- _this._tribute = new Tribute__default["default"]({
1150
- values: lodashEs.debounce(_this._loadValues.bind(_this), 200),
1151
- searchOpts: {
1152
- pre: '',
1153
- post: '',
1154
- skip: true
1155
- },
1156
- containerClass: "fs-html-editor-mention-container " + (_this.config.containerClass || ''),
1157
- itemClass: "fs-html-editor-mention-menu-item " + (_this.config.menuItemClass || ''),
1158
- trigger: _this.config.trigger,
1159
- allowSpaces: true,
1160
- menuItemTemplate: function (item) {
1161
- return _this.config.menuItemTemplate(item.original);
1162
- },
1163
- selectTemplate: function (item) {
1164
- var template = _this.config.selectedTemplate(item.original);
1165
- var p = document.createElement('p');
1166
- p.innerHTML = template;
1167
- var node = p.firstElementChild;
1168
- if (!node) {
1169
- node = document.createElement('span');
1170
- node.innerHTML = template;
1171
- }
1172
- node.setAttribute('contenteditable', 'false');
1173
- node.classList.add('fr-deletable');
1174
- return node.outerHTML;
1175
- },
1176
- });
1177
- MentionPlugin._tributes.push(_this._tribute);
1178
- return _this;
1179
- }
1180
- MentionPlugin.prototype.initialize = function () {
1181
- var _this = this;
1182
- this._tribute.attach(this.editor.el);
1183
- this.editor.events.on('keydown', function (e) {
1184
- if (e.key === 'Enter' && _this._tribute.isActive) {
1185
- return false;
1186
- }
1187
- }, true);
1188
- this.editor.el.addEventListener("tribute-replaced", this.selected);
1189
- };
1190
- MentionPlugin.prototype.destroy = function () {
1191
- this.editor.el.removeEventListener("tribute-replaced", this.selected);
1192
- };
1193
- MentionPlugin.prototype._closeAll = function () {
1194
- MentionPlugin._tributes.forEach(function (tribute) {
1195
- if (tribute.menu) {
1196
- tribute.hideMenu();
1197
- }
1198
- });
1199
- };
1200
- MentionPlugin.prototype._loadValues = function (keyword, cb) {
1201
- MentionPlugin._currentGuid = this._guid;
1202
- return this.config.fetch(keyword)
1203
- .subscribe(function (data) {
1204
- cb(data);
1205
- });
1206
- };
1207
- return MentionPlugin;
1208
- }(Plugin));
1209
- MentionPlugin._currentGuid = null;
1126
+ var MentionPlugin = /** @class */ (function (_super) {
1127
+ __extends(MentionPlugin, _super);
1128
+ function MentionPlugin(config) {
1129
+ var _this = _super.call(this) || this;
1130
+ _this.config = config;
1131
+ _this._guid = common.guid();
1132
+ _this.selected = function (event) {
1133
+ if (_this.config.selected) {
1134
+ if (MentionPlugin._currentGuid === _this._guid) {
1135
+ _this.config.selected(event.detail.item.original);
1136
+ }
1137
+ }
1138
+ };
1139
+ _this.config = Object.assign(Object.assign({}, config), { buttons: [
1140
+ {
1141
+ name: config.name,
1142
+ tooltip: config.tooltip,
1143
+ svgPath: config.iconPath,
1144
+ click: function (editor) {
1145
+ _this._closeAll();
1146
+ _this._tribute.showMenuForCollection(editor.el);
1147
+ }
1148
+ }
1149
+ ] });
1150
+ _this._tribute = new Tribute__default["default"]({
1151
+ values: lodashEs.debounce(_this._loadValues.bind(_this), 200),
1152
+ searchOpts: {
1153
+ pre: '',
1154
+ post: '',
1155
+ skip: true
1156
+ },
1157
+ containerClass: "fs-html-editor-mention-container " + (_this.config.containerClass || ''),
1158
+ itemClass: "fs-html-editor-mention-menu-item " + (_this.config.menuItemClass || ''),
1159
+ trigger: _this.config.trigger,
1160
+ allowSpaces: true,
1161
+ menuItemTemplate: function (item) {
1162
+ return _this.config.menuItemTemplate(item.original);
1163
+ },
1164
+ selectTemplate: function (item) {
1165
+ var template = _this.config.selectedTemplate(item.original);
1166
+ var p = document.createElement('p');
1167
+ p.innerHTML = template;
1168
+ var node = p.firstElementChild;
1169
+ if (!node) {
1170
+ node = document.createElement('span');
1171
+ node.innerHTML = template;
1172
+ }
1173
+ node.setAttribute('contenteditable', 'false');
1174
+ node.classList.add('fr-deletable');
1175
+ return node.outerHTML;
1176
+ },
1177
+ });
1178
+ MentionPlugin._tributes.push(_this._tribute);
1179
+ return _this;
1180
+ }
1181
+ MentionPlugin.prototype.initialize = function () {
1182
+ var _this = this;
1183
+ this._tribute.attach(this.editor.el);
1184
+ this.editor.events.on('keydown', function (e) {
1185
+ if (e.key === 'Enter' && _this._tribute.isActive) {
1186
+ return false;
1187
+ }
1188
+ }, true);
1189
+ this.editor.el.addEventListener("tribute-replaced", this.selected);
1190
+ };
1191
+ MentionPlugin.prototype.destroy = function () {
1192
+ this.editor.el.removeEventListener("tribute-replaced", this.selected);
1193
+ };
1194
+ MentionPlugin.prototype._closeAll = function () {
1195
+ MentionPlugin._tributes.forEach(function (tribute) {
1196
+ if (tribute.menu) {
1197
+ tribute.hideMenu();
1198
+ }
1199
+ });
1200
+ };
1201
+ MentionPlugin.prototype._loadValues = function (keyword, cb) {
1202
+ MentionPlugin._currentGuid = this._guid;
1203
+ return this.config.fetch(keyword)
1204
+ .subscribe(function (data) {
1205
+ cb(data);
1206
+ });
1207
+ };
1208
+ return MentionPlugin;
1209
+ }(Plugin));
1210
+ MentionPlugin._currentGuid = null;
1210
1211
  MentionPlugin._tributes = [];
1211
1212
 
1212
- var ChecklistPlugin = /** @class */ (function (_super) {
1213
- __extends(ChecklistPlugin, _super);
1214
- function ChecklistPlugin(config) {
1215
- if (config === void 0) { config = { name: 'checklist' }; }
1216
- var _this = _super.call(this) || this;
1217
- _this.config = config;
1218
- _this.config = Object.assign(Object.assign({}, config), { name: 'checklist', buttons: [
1219
- {
1220
- name: 'checklist',
1221
- 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',
1222
- click: function (editor) {
1223
- editor.html.insert('<ul class="checklist"><li></li></ul>');
1224
- }
1225
- }
1226
- ] });
1227
- return _this;
1228
- }
1229
- ChecklistPlugin.prototype.initialize = function () {
1230
- this.editor.events.on('click', function (e) {
1231
- var li = e.target;
1232
- if (li.nodeName === 'LI' && e.offsetX < 0) {
1233
- var items = __spreadArray([li], __read(li.querySelectorAll('li')));
1234
- if (li.classList.contains('checked')) {
1235
- items.forEach(function (item) {
1236
- item.classList.remove('checked');
1237
- });
1238
- }
1239
- else {
1240
- items.forEach(function (item) {
1241
- item.classList.add('checked');
1242
- });
1243
- }
1244
- }
1245
- }, false);
1246
- };
1247
- return ChecklistPlugin;
1213
+ var ChecklistPlugin = /** @class */ (function (_super) {
1214
+ __extends(ChecklistPlugin, _super);
1215
+ function ChecklistPlugin(config) {
1216
+ if (config === void 0) { config = { name: 'checklist' }; }
1217
+ var _this = _super.call(this) || this;
1218
+ _this.config = config;
1219
+ _this.config = Object.assign(Object.assign({}, config), { name: 'checklist', buttons: [
1220
+ {
1221
+ name: 'checklist',
1222
+ 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',
1223
+ click: function (editor) {
1224
+ editor.html.insert('<ul class="checklist"><li></li></ul>');
1225
+ }
1226
+ }
1227
+ ] });
1228
+ return _this;
1229
+ }
1230
+ ChecklistPlugin.prototype.initialize = function () {
1231
+ this.editor.events.on('click', function (e) {
1232
+ var li = e.target;
1233
+ if (li.nodeName === 'LI' && e.offsetX < 0) {
1234
+ var items = __spreadArray([li], __read(li.querySelectorAll('li')));
1235
+ if (li.classList.contains('checked')) {
1236
+ items.forEach(function (item) {
1237
+ item.classList.remove('checked');
1238
+ });
1239
+ }
1240
+ else {
1241
+ items.forEach(function (item) {
1242
+ item.classList.add('checked');
1243
+ });
1244
+ }
1245
+ }
1246
+ }, false);
1247
+ };
1248
+ return ChecklistPlugin;
1248
1249
  }(Plugin));
1249
1250
 
1250
- var CodePlugin = /** @class */ (function (_super) {
1251
- __extends(CodePlugin, _super);
1252
- function CodePlugin(config) {
1253
- if (config === void 0) { config = { name: 'code' }; }
1254
- var _this = _super.call(this) || this;
1255
- _this.config = config;
1256
- _this.config = Object.assign(Object.assign({}, config), { name: 'code', buttons: [
1257
- {
1258
- name: 'code',
1259
- 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',
1260
- click: function (editor) {
1261
- var node = editor.selection.get();
1262
- var codeEl = _this._getCodeEl(node.baseNode);
1263
- if (codeEl) {
1264
- codeEl.classList.remove('code');
1265
- }
1266
- else {
1267
- editor.html.insert('<p class="code">' + editor.selection.get().toString().replace(/\n{1,}/g, '<br>') + '</p>');
1268
- }
1269
- }
1270
- }
1271
- ] });
1272
- return _this;
1273
- }
1274
- CodePlugin.prototype.initialize = function () {
1275
- var _this = this;
1276
- this.editor.events.on('keydown', function (e) {
1277
- if (e.keyCode === 13) {
1278
- var selection = _this.editor.selection.get();
1279
- if (selection && _this._getCodeEl(selection.baseNode)) {
1280
- e.preventDefault();
1281
- e.stopPropagation();
1282
- e.stopImmediatePropagation();
1283
- var br = '<br>';
1284
- var base = selection.baseNode;
1285
- if (base.nodeName === '#text' && selection.baseOffset === base.length) {
1286
- if (!(base.nextSibling && base.nextSibling.nodeName === 'BR')) {
1287
- br += '<br>';
1288
- }
1289
- }
1290
- else {
1291
- var el = Array.from(base.childNodes).splice(selection.baseOffset - 1, 1).pop();
1292
- if (el && el.nodeName !== 'BR') {
1293
- br += '<br>';
1294
- }
1295
- }
1296
- _this.editor.html.insert(br);
1297
- return false;
1298
- }
1299
- }
1300
- }, true);
1301
- };
1302
- CodePlugin.prototype.destroy = function () { };
1303
- CodePlugin.prototype._getCodeEl = function (el) {
1304
- if (el) {
1305
- if (el.classList && el.classList.contains('code')) {
1306
- return el;
1307
- }
1308
- if (el.parentElement) {
1309
- return this._getCodeEl(el.parentElement);
1310
- }
1311
- }
1312
- return null;
1313
- };
1314
- return CodePlugin;
1251
+ var CodePlugin = /** @class */ (function (_super) {
1252
+ __extends(CodePlugin, _super);
1253
+ function CodePlugin(config) {
1254
+ if (config === void 0) { config = { name: 'code' }; }
1255
+ var _this = _super.call(this) || this;
1256
+ _this.config = config;
1257
+ _this.config = Object.assign(Object.assign({}, config), { name: 'code', buttons: [
1258
+ {
1259
+ name: 'code',
1260
+ 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',
1261
+ click: function (editor) {
1262
+ var node = editor.selection.get();
1263
+ var codeEl = _this._getCodeEl(node.baseNode);
1264
+ if (codeEl) {
1265
+ codeEl.classList.remove('code');
1266
+ }
1267
+ else {
1268
+ editor.html.insert('<p class="code">' + editor.selection.get().toString().replace(/\n{1,}/g, '<br>') + '</p>');
1269
+ }
1270
+ }
1271
+ }
1272
+ ] });
1273
+ return _this;
1274
+ }
1275
+ CodePlugin.prototype.initialize = function () {
1276
+ var _this = this;
1277
+ this.editor.events.on('keydown', function (e) {
1278
+ if (e.keyCode === 13) {
1279
+ var selection = _this.editor.selection.get();
1280
+ if (selection && _this._getCodeEl(selection.baseNode)) {
1281
+ e.preventDefault();
1282
+ e.stopPropagation();
1283
+ e.stopImmediatePropagation();
1284
+ var br = '<br>';
1285
+ var base = selection.baseNode;
1286
+ if (base.nodeName === '#text' && selection.baseOffset === base.length) {
1287
+ if (!(base.nextSibling && base.nextSibling.nodeName === 'BR')) {
1288
+ br += '<br>';
1289
+ }
1290
+ }
1291
+ else {
1292
+ var el = Array.from(base.childNodes).splice(selection.baseOffset - 1, 1).pop();
1293
+ if (el && el.nodeName !== 'BR') {
1294
+ br += '<br>';
1295
+ }
1296
+ }
1297
+ _this.editor.html.insert(br);
1298
+ return false;
1299
+ }
1300
+ }
1301
+ }, true);
1302
+ };
1303
+ CodePlugin.prototype.destroy = function () { };
1304
+ CodePlugin.prototype._getCodeEl = function (el) {
1305
+ if (el) {
1306
+ if (el.classList && el.classList.contains('code')) {
1307
+ return el;
1308
+ }
1309
+ if (el.parentElement) {
1310
+ return this._getCodeEl(el.parentElement);
1311
+ }
1312
+ }
1313
+ return null;
1314
+ };
1315
+ return CodePlugin;
1315
1316
  }(Plugin));
1316
1317
 
1317
- var ScreenRecordPlugin = /** @class */ (function (_super) {
1318
- __extends(ScreenRecordPlugin, _super);
1319
- function ScreenRecordPlugin(config) {
1320
- if (config === void 0) { config = {}; }
1321
- var _this = _super.call(this) || this;
1322
- _this.config = config;
1323
- _this.config = Object.assign(Object.assign({}, config), { name: config.name || 'screenRecord', buttons: [
1324
- {
1325
- name: 'screenRecord',
1326
- 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",
1327
- tooltip: 'Screen Record',
1328
- click: function (editor) {
1329
- navigator.mediaDevices.getDisplayMedia({ video: true })
1330
- .then(function (stream) {
1331
- var chunks = [];
1332
- var options = { mimeType: 'video/webm; codecs=vp9' };
1333
- var mediaRecorder = new MediaRecorder(stream, options);
1334
- stream.addEventListener('inactive', function (e) {
1335
- mediaRecorder.stop();
1336
- mediaRecorder = null;
1337
- stream.getTracks().forEach(function (track) { return track.stop(); });
1338
- stream = null;
1339
- var blob = new Blob(chunks, { type: 'video/webm' });
1340
- config.upload(blob)
1341
- .subscribe(function (url) {
1342
- 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>");
1343
- });
1344
- });
1345
- mediaRecorder.addEventListener('dataavailable', function (event) {
1346
- if (event.data && event.data.size > 0) {
1347
- chunks.push(event.data);
1348
- }
1349
- });
1350
- mediaRecorder.start(10);
1351
- })
1352
- .catch(function (e) { });
1353
- }
1354
- }
1355
- ] });
1356
- return _this;
1357
- }
1358
- ScreenRecordPlugin.prototype.initialize = function () {
1359
- return __awaiter(this, void 0, void 0, function () {
1360
- var FroalaEditor;
1361
- var _this = this;
1362
- return __generator(this, function (_a) {
1363
- switch (_a.label) {
1364
- case 0: return [4 /*yield*/, ResourceLoader.loadStyles('froala')
1365
- .toPromise()];
1366
- case 1:
1367
- _a.sent();
1368
- FroalaEditor = window.FroalaEditor;
1369
- this.editor.events.on('mouseup', function (e) {
1370
- var el = _this._getEl(e.target);
1371
- if (el) {
1372
- _this.editor.popups.hideAll();
1373
- _this._activeEl = el;
1374
- _this._showPopup(el);
1375
- }
1376
- });
1377
- FroalaEditor.POPUP_TEMPLATES["screenRecordPlugin.popup"] = '[_BUTTONS_]';
1378
- FroalaEditor.DefineIcon('popupClose', { NAME: 'trash', SVG_KEY: 'remove' });
1379
- FroalaEditor.RegisterCommand('popupClose', {
1380
- title: 'Remove',
1381
- undo: false,
1382
- focus: false,
1383
- callback: function () {
1384
- if (_this._activeEl) {
1385
- _this._activeEl.remove();
1386
- }
1387
- }
1388
- });
1389
- return [2 /*return*/];
1390
- }
1391
- });
1392
- });
1393
- };
1394
- ScreenRecordPlugin.prototype._createPopup = function () {
1395
- var template = {
1396
- buttons: "<div class=\"fr-buttons\">" + this.editor.button.buildList(['popupClose']) + "</div>",
1397
- };
1398
- return this.editor.popups.create('screenRecordPlugin.popup', template);
1399
- };
1400
- ScreenRecordPlugin.prototype._showPopup = function (el) {
1401
- var $popup = this.editor.popups.get('screenRecordPlugin.popup');
1402
- if (!$popup) {
1403
- $popup = this._createPopup();
1404
- }
1405
- this.editor.popups.setContainer('screenRecordPlugin.popup', this.editor.$(el));
1406
- var left = el.offsetLeft + el.offsetWidth / 2;
1407
- this.editor.popups.show('screenRecordPlugin.popup', left, null);
1408
- };
1409
- ScreenRecordPlugin.prototype._getEl = function (el) {
1410
- if (el && el.classList) {
1411
- if (el.classList.contains('fr-screen-record'))
1412
- return el;
1413
- return this._getEl(el.parentNode);
1414
- }
1415
- };
1416
- return ScreenRecordPlugin;
1318
+ var ScreenRecordPlugin = /** @class */ (function (_super) {
1319
+ __extends(ScreenRecordPlugin, _super);
1320
+ function ScreenRecordPlugin(config) {
1321
+ if (config === void 0) { config = {}; }
1322
+ var _this = _super.call(this) || this;
1323
+ _this.config = config;
1324
+ _this.config = Object.assign(Object.assign({}, config), { name: config.name || 'screenRecord', buttons: [
1325
+ {
1326
+ name: 'screenRecord',
1327
+ 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",
1328
+ tooltip: 'Screen Record',
1329
+ click: function (editor) {
1330
+ navigator.mediaDevices.getDisplayMedia({ video: true })
1331
+ .then(function (stream) {
1332
+ var chunks = [];
1333
+ var options = { mimeType: 'video/webm; codecs=vp9' };
1334
+ var mediaRecorder = new MediaRecorder(stream, options);
1335
+ stream.addEventListener('inactive', function (e) {
1336
+ mediaRecorder.stop();
1337
+ mediaRecorder = null;
1338
+ stream.getTracks().forEach(function (track) { return track.stop(); });
1339
+ stream = null;
1340
+ var blob = new Blob(chunks, { type: 'video/webm' });
1341
+ config.upload(blob)
1342
+ .subscribe(function (url) {
1343
+ 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>");
1344
+ });
1345
+ });
1346
+ mediaRecorder.addEventListener('dataavailable', function (event) {
1347
+ if (event.data && event.data.size > 0) {
1348
+ chunks.push(event.data);
1349
+ }
1350
+ });
1351
+ mediaRecorder.start(10);
1352
+ })
1353
+ .catch(function (e) { });
1354
+ }
1355
+ }
1356
+ ] });
1357
+ return _this;
1358
+ }
1359
+ ScreenRecordPlugin.prototype.initialize = function () {
1360
+ return __awaiter(this, void 0, void 0, function () {
1361
+ var FroalaEditor;
1362
+ var _this = this;
1363
+ return __generator(this, function (_a) {
1364
+ switch (_a.label) {
1365
+ case 0: return [4 /*yield*/, ResourceLoader.loadStyles('froala')
1366
+ .toPromise()];
1367
+ case 1:
1368
+ _a.sent();
1369
+ FroalaEditor = window.FroalaEditor;
1370
+ this.editor.events.on('mouseup', function (e) {
1371
+ var el = _this._getEl(e.target);
1372
+ if (el) {
1373
+ _this.editor.popups.hideAll();
1374
+ _this._activeEl = el;
1375
+ _this._showPopup(el);
1376
+ }
1377
+ });
1378
+ FroalaEditor.POPUP_TEMPLATES["screenRecordPlugin.popup"] = '[_BUTTONS_]';
1379
+ FroalaEditor.DefineIcon('popupClose', { NAME: 'trash', SVG_KEY: 'remove' });
1380
+ FroalaEditor.RegisterCommand('popupClose', {
1381
+ title: 'Remove',
1382
+ undo: false,
1383
+ focus: false,
1384
+ callback: function () {
1385
+ if (_this._activeEl) {
1386
+ _this._activeEl.remove();
1387
+ }
1388
+ }
1389
+ });
1390
+ return [2 /*return*/];
1391
+ }
1392
+ });
1393
+ });
1394
+ };
1395
+ ScreenRecordPlugin.prototype._createPopup = function () {
1396
+ var template = {
1397
+ buttons: "<div class=\"fr-buttons\">" + this.editor.button.buildList(['popupClose']) + "</div>",
1398
+ };
1399
+ return this.editor.popups.create('screenRecordPlugin.popup', template);
1400
+ };
1401
+ ScreenRecordPlugin.prototype._showPopup = function (el) {
1402
+ var $popup = this.editor.popups.get('screenRecordPlugin.popup');
1403
+ if (!$popup) {
1404
+ $popup = this._createPopup();
1405
+ }
1406
+ this.editor.popups.setContainer('screenRecordPlugin.popup', this.editor.$(el));
1407
+ var left = el.offsetLeft + el.offsetWidth / 2;
1408
+ this.editor.popups.show('screenRecordPlugin.popup', left, null);
1409
+ };
1410
+ ScreenRecordPlugin.prototype._getEl = function (el) {
1411
+ if (el && el.classList) {
1412
+ if (el.classList.contains('fr-screen-record'))
1413
+ return el;
1414
+ return this._getEl(el.parentNode);
1415
+ }
1416
+ };
1417
+ return ScreenRecordPlugin;
1417
1418
  }(Plugin));
1418
1419
 
1419
- /**
1420
- * Generated bundle index. Do not edit.
1420
+ /**
1421
+ * Generated bundle index. Do not edit.
1421
1422
  */
1422
1423
 
1423
1424
  exports.ChecklistPlugin = ChecklistPlugin;