@firestitch/html-editor 9.5.9 → 12.0.0

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