@firestitch/html-editor 9.5.2 → 9.5.6
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.
- package/app/components/html-editor/html-editor.component.d.ts +4 -1
- package/app/services/froala-loader.service.d.ts +2 -2
- package/bundles/firestitch-html-editor.umd.js +160 -132
- package/bundles/firestitch-html-editor.umd.js.map +1 -1
- package/bundles/firestitch-html-editor.umd.min.js +1 -1
- package/bundles/firestitch-html-editor.umd.min.js.map +1 -1
- package/esm2015/app/components/html-editor/html-editor.component.js +129 -115
- package/esm2015/app/services/froala-loader.service.js +4 -4
- package/esm5/app/components/html-editor/html-editor.component.js +133 -117
- package/esm5/app/services/froala-loader.service.js +4 -4
- package/fesm2015/firestitch-html-editor.js +131 -117
- package/fesm2015/firestitch-html-editor.js.map +1 -1
- package/fesm5/firestitch-html-editor.js +134 -118
- package/fesm5/firestitch-html-editor.js.map +1 -1
- package/firestitch-html-editor.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ export declare class FsHtmlEditorComponent implements OnInit, AfterViewInit, Con
|
|
|
15
15
|
private _editor;
|
|
16
16
|
private _html;
|
|
17
17
|
private _initialize$;
|
|
18
|
+
private _froalaReady$;
|
|
18
19
|
private _destroy$;
|
|
19
20
|
constructor(_defaultConfig: any, _cdRef: ChangeDetectorRef, _fr: FsFroalaLoaderService);
|
|
20
21
|
onChange: (data: any) => void;
|
|
@@ -22,7 +23,7 @@ export declare class FsHtmlEditorComponent implements OnInit, AfterViewInit, Con
|
|
|
22
23
|
readonly el: any;
|
|
23
24
|
readonly html: string;
|
|
24
25
|
readonly editor: any;
|
|
25
|
-
readonly
|
|
26
|
+
readonly froalaLoaded$: Observable<boolean>;
|
|
26
27
|
ngOnInit(): void;
|
|
27
28
|
ngAfterViewInit(): void;
|
|
28
29
|
hasContent(): boolean;
|
|
@@ -48,4 +49,6 @@ export declare class FsHtmlEditorComponent implements OnInit, AfterViewInit, Con
|
|
|
48
49
|
private _initPlugins;
|
|
49
50
|
private _createOptions;
|
|
50
51
|
private _listenLazyInit;
|
|
52
|
+
private _contentChanged;
|
|
53
|
+
private _setupFroala;
|
|
51
54
|
}
|
|
@@ -5,9 +5,9 @@ export declare class FsFroalaLoaderService {
|
|
|
5
5
|
private _FroalaEditor;
|
|
6
6
|
private _froalaLoaded;
|
|
7
7
|
private _defaultPluginsLoaded;
|
|
8
|
-
private
|
|
8
|
+
private _loaded$;
|
|
9
9
|
constructor(_defaultConfig: FsHtmlEditorConfig);
|
|
10
|
-
readonly
|
|
10
|
+
readonly loaded$: Observable<boolean>;
|
|
11
11
|
readonly ready: boolean;
|
|
12
12
|
readonly FroalaEditor: any;
|
|
13
13
|
private _load;
|
|
@@ -25,11 +25,13 @@
|
|
|
25
25
|
var extendStatics = function(d, b) {
|
|
26
26
|
extendStatics = Object.setPrototypeOf ||
|
|
27
27
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
28
|
-
function (d, b) { for (var p in b) if (
|
|
28
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
29
29
|
return extendStatics(d, b);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
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");
|
|
33
35
|
extendStatics(d, b);
|
|
34
36
|
function __() { this.constructor = d; }
|
|
35
37
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -119,8 +121,8 @@
|
|
|
119
121
|
o[k2] = m[k];
|
|
120
122
|
});
|
|
121
123
|
|
|
122
|
-
function __exportStar(m,
|
|
123
|
-
for (var p in m) if (p !== "default" && !
|
|
124
|
+
function __exportStar(m, o) {
|
|
125
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
function __values(o) {
|
|
@@ -152,19 +154,31 @@
|
|
|
152
154
|
return ar;
|
|
153
155
|
}
|
|
154
156
|
|
|
157
|
+
/** @deprecated */
|
|
155
158
|
function __spread() {
|
|
156
159
|
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
157
160
|
ar = ar.concat(__read(arguments[i]));
|
|
158
161
|
return ar;
|
|
159
162
|
}
|
|
160
163
|
|
|
164
|
+
/** @deprecated */
|
|
161
165
|
function __spreadArrays() {
|
|
162
166
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
163
167
|
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
164
168
|
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
165
169
|
r[k] = a[j];
|
|
166
170
|
return r;
|
|
167
|
-
}
|
|
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
|
+
}
|
|
168
182
|
|
|
169
183
|
function __await(v) {
|
|
170
184
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
@@ -210,7 +224,7 @@
|
|
|
210
224
|
function __importStar(mod) {
|
|
211
225
|
if (mod && mod.__esModule) return mod;
|
|
212
226
|
var result = {};
|
|
213
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
227
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
214
228
|
__setModuleDefault(result, mod);
|
|
215
229
|
return result;
|
|
216
230
|
}
|
|
@@ -219,19 +233,17 @@
|
|
|
219
233
|
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
220
234
|
}
|
|
221
235
|
|
|
222
|
-
function __classPrivateFieldGet(receiver,
|
|
223
|
-
if (!
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return privateMap.get(receiver);
|
|
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);
|
|
227
240
|
}
|
|
228
241
|
|
|
229
|
-
function __classPrivateFieldSet(receiver,
|
|
230
|
-
if (
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return value;
|
|
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;
|
|
235
247
|
}
|
|
236
248
|
|
|
237
249
|
var RichButtons = [
|
|
@@ -358,7 +370,7 @@
|
|
|
358
370
|
this._defaultConfig = _defaultConfig;
|
|
359
371
|
this._froalaLoaded = new rxjs.BehaviorSubject(false);
|
|
360
372
|
this._defaultPluginsLoaded = new rxjs.BehaviorSubject(false);
|
|
361
|
-
this.
|
|
373
|
+
this._loaded$ = rxjs.combineLatest([this._froalaLoaded, this._defaultPluginsLoaded])
|
|
362
374
|
.pipe(operators.map(function (_a) {
|
|
363
375
|
var _b = __read(_a, 2), FroalaReady = _b[0], pluginsRead = _b[1];
|
|
364
376
|
return pluginsRead && FroalaReady;
|
|
@@ -373,9 +385,9 @@
|
|
|
373
385
|
}
|
|
374
386
|
this._load();
|
|
375
387
|
}
|
|
376
|
-
Object.defineProperty(FsFroalaLoaderService.prototype, "
|
|
388
|
+
Object.defineProperty(FsFroalaLoaderService.prototype, "loaded$", {
|
|
377
389
|
get: function () {
|
|
378
|
-
return this.
|
|
390
|
+
return this._loaded$;
|
|
379
391
|
},
|
|
380
392
|
enumerable: true,
|
|
381
393
|
configurable: true
|
|
@@ -450,6 +462,7 @@
|
|
|
450
462
|
this.config = {};
|
|
451
463
|
this.initialized = false;
|
|
452
464
|
this._initialize$ = new rxjs.ReplaySubject();
|
|
465
|
+
this._froalaReady$ = new rxjs.BehaviorSubject(null);
|
|
453
466
|
this._destroy$ = new rxjs.Subject();
|
|
454
467
|
this.onChange = function (data) { };
|
|
455
468
|
this.onTouched = function () { };
|
|
@@ -476,9 +489,9 @@
|
|
|
476
489
|
enumerable: true,
|
|
477
490
|
configurable: true
|
|
478
491
|
});
|
|
479
|
-
Object.defineProperty(FsHtmlEditorComponent.prototype, "
|
|
492
|
+
Object.defineProperty(FsHtmlEditorComponent.prototype, "froalaLoaded$", {
|
|
480
493
|
get: function () {
|
|
481
|
-
return this._fr.
|
|
494
|
+
return this._fr.loaded$;
|
|
482
495
|
},
|
|
483
496
|
enumerable: true,
|
|
484
497
|
configurable: true
|
|
@@ -508,96 +521,9 @@
|
|
|
508
521
|
if (options === void 0) { options = {}; }
|
|
509
522
|
var config = this._createConfig();
|
|
510
523
|
this._initPlugins(config);
|
|
511
|
-
this.el.innerHTML = this._html;
|
|
524
|
+
// this.el.innerHTML = this._html || '';
|
|
512
525
|
this._editor = new this._fr.FroalaEditor(this.el, this._createOptions(), function () {
|
|
513
|
-
_this.
|
|
514
|
-
if (config.disabled) {
|
|
515
|
-
_this.disable();
|
|
516
|
-
}
|
|
517
|
-
if (config.froalaConfig.events) {
|
|
518
|
-
if (config.froalaConfig.events.initialized) {
|
|
519
|
-
config.froalaConfig.events.initialized();
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
_this._editor.events.on('focus', function () {
|
|
523
|
-
_this.classFocused = true;
|
|
524
|
-
_this._cdRef.markForCheck();
|
|
525
|
-
});
|
|
526
|
-
_this._editor.events.on('blur', function () {
|
|
527
|
-
_this.classFocused = false;
|
|
528
|
-
_this._cdRef.markForCheck();
|
|
529
|
-
});
|
|
530
|
-
_this._editor.events.on('contentChanged', function () {
|
|
531
|
-
var editorHTML = _this._editor.html.get();
|
|
532
|
-
if (_this.html !== editorHTML) {
|
|
533
|
-
_this._change(editorHTML);
|
|
534
|
-
}
|
|
535
|
-
});
|
|
536
|
-
_this._editor.events.on('paste.afterCleanup', function (html) {
|
|
537
|
-
var div = document.createElement('div');
|
|
538
|
-
div.innerHTML = html;
|
|
539
|
-
div.querySelectorAll('*')
|
|
540
|
-
.forEach(function (el) {
|
|
541
|
-
for (var i = 0; i < el.attributes.length; i++) {
|
|
542
|
-
var name_1 = el.attributes[0].name;
|
|
543
|
-
if (name_1 !== 'href') {
|
|
544
|
-
el.removeAttribute(name_1);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
});
|
|
548
|
-
return div.innerHTML;
|
|
549
|
-
});
|
|
550
|
-
_this._editor.events.on('keydown', function () {
|
|
551
|
-
_this.onTouched();
|
|
552
|
-
});
|
|
553
|
-
if (_this.config.image && _this.config.image.upload) {
|
|
554
|
-
_this._editor.events.on('image.beforePasteUpload', function (image) {
|
|
555
|
-
fetch(image.getAttribute('src'))
|
|
556
|
-
.then(function (res) {
|
|
557
|
-
res.blob()
|
|
558
|
-
.then(function (blob) {
|
|
559
|
-
_this._processImageUpload(blob)
|
|
560
|
-
.pipe(operators.takeUntil(_this._destroy$))
|
|
561
|
-
.subscribe(function (url) {
|
|
562
|
-
image.setAttribute('src', url);
|
|
563
|
-
image.removeAttribute('data-fr-image-pasted');
|
|
564
|
-
});
|
|
565
|
-
});
|
|
566
|
-
});
|
|
567
|
-
return false;
|
|
568
|
-
});
|
|
569
|
-
_this._editor.events.on('image.beforeUpload', function (blobs) {
|
|
570
|
-
_this._processImageUpload(blobs[0])
|
|
571
|
-
.pipe(operators.takeUntil(_this._destroy$))
|
|
572
|
-
.subscribe(function (url) {
|
|
573
|
-
_this.editor.image.insert(url, null, null, _this.editor.image.get());
|
|
574
|
-
});
|
|
575
|
-
return false;
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
if (_this.el.querySelector('.fr-second-toolbar')) {
|
|
579
|
-
_this.el.querySelector('.fr-second-toolbar').remove();
|
|
580
|
-
}
|
|
581
|
-
var selection = options.selection;
|
|
582
|
-
if (selection) {
|
|
583
|
-
var node = Array.from(_this.el.querySelectorAll('.fr-element *')).find(function (node) {
|
|
584
|
-
return selection.node === node.textContent;
|
|
585
|
-
});
|
|
586
|
-
if (node) {
|
|
587
|
-
var range = document.createRange();
|
|
588
|
-
var sel = window.getSelection();
|
|
589
|
-
range.setStart(_this._getTextNode(node), selection.offset);
|
|
590
|
-
range.collapse(true);
|
|
591
|
-
sel.removeAllRanges();
|
|
592
|
-
sel.addRange(range);
|
|
593
|
-
}
|
|
594
|
-
else if (_this.config.autofocus) {
|
|
595
|
-
_this.focus();
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
else if (_this.config.autofocus) {
|
|
599
|
-
_this.focus();
|
|
600
|
-
}
|
|
526
|
+
_this._froalaReady$.next({ config: config, options: options });
|
|
601
527
|
});
|
|
602
528
|
};
|
|
603
529
|
FsHtmlEditorComponent.prototype._processImageUpload = function (blob) {
|
|
@@ -605,8 +531,9 @@
|
|
|
605
531
|
var processor = new file.FileProcessor();
|
|
606
532
|
var file$1 = new file.FsFile(blob);
|
|
607
533
|
return processor.process([file$1], this.config.image)
|
|
608
|
-
.pipe(operators.switchMap(function (
|
|
609
|
-
|
|
534
|
+
.pipe(operators.switchMap(function (_a) {
|
|
535
|
+
var _b = __read(_a, 1), f = _b[0];
|
|
536
|
+
return _this.config.image.upload(f.file);
|
|
610
537
|
}));
|
|
611
538
|
};
|
|
612
539
|
FsHtmlEditorComponent.prototype._getTextNode = function (node) {
|
|
@@ -682,23 +609,15 @@
|
|
|
682
609
|
this.writeValue(html);
|
|
683
610
|
};
|
|
684
611
|
FsHtmlEditorComponent.prototype.writeValue = function (html) {
|
|
685
|
-
var _this = this;
|
|
686
612
|
this._html = html || '';
|
|
687
|
-
this.
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
// after init and froala ignore new html. At the same time froala was initied but editor not yet, and next
|
|
691
|
-
// code doesn't work without timeout. We've got time range when too late for initiate value, and to early
|
|
692
|
-
// for change event.
|
|
693
|
-
setTimeout(function () {
|
|
694
|
-
if (_this.editor && _this.editor.html) {
|
|
695
|
-
try {
|
|
696
|
-
_this.editor.html.set(_this._html);
|
|
697
|
-
}
|
|
698
|
-
catch (e) {
|
|
699
|
-
}
|
|
613
|
+
if (this.editor && this.editor.html) {
|
|
614
|
+
try {
|
|
615
|
+
this.editor.html.set(this._html);
|
|
700
616
|
}
|
|
701
|
-
|
|
617
|
+
catch (e) {
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
this._cdRef.markForCheck();
|
|
702
621
|
};
|
|
703
622
|
FsHtmlEditorComponent.prototype.registerOnChange = function (fn) {
|
|
704
623
|
this.onChange = fn;
|
|
@@ -724,7 +643,7 @@
|
|
|
724
643
|
return lodashEs.merge({ froalaConfig: {} }, this._defaultConfig, this.config);
|
|
725
644
|
};
|
|
726
645
|
FsHtmlEditorComponent.prototype._change = function (html) {
|
|
727
|
-
this._html = html;
|
|
646
|
+
// this._html = html;
|
|
728
647
|
this.onChange(html);
|
|
729
648
|
};
|
|
730
649
|
FsHtmlEditorComponent.prototype._initPlugins = function (config) {
|
|
@@ -820,9 +739,8 @@
|
|
|
820
739
|
};
|
|
821
740
|
FsHtmlEditorComponent.prototype._listenLazyInit = function () {
|
|
822
741
|
var _this = this;
|
|
823
|
-
this.
|
|
824
|
-
.pipe(operators.filter(function (ready) { return ready; }), operators.switchMap(function () { return _this._initialize$; }))
|
|
825
|
-
.subscribe(function () {
|
|
742
|
+
this.froalaLoaded$
|
|
743
|
+
.pipe(operators.filter(function (ready) { return ready; }), operators.switchMap(function () { return _this._initialize$; }), operators.tap(function () {
|
|
826
744
|
var selection = window.getSelection();
|
|
827
745
|
var options = {};
|
|
828
746
|
if (selection.baseNode) {
|
|
@@ -832,7 +750,117 @@
|
|
|
832
750
|
};
|
|
833
751
|
}
|
|
834
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();
|
|
835
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
|
+
}
|
|
836
864
|
};
|
|
837
865
|
var FsHtmlEditorComponent_1;
|
|
838
866
|
FsHtmlEditorComponent.ctorParameters = function () { return [
|
|
@@ -859,7 +887,7 @@
|
|
|
859
887
|
FsHtmlEditorComponent = FsHtmlEditorComponent_1 = __decorate([
|
|
860
888
|
core.Component({
|
|
861
889
|
selector: 'fs-html-editor',
|
|
862
|
-
template: "<div class=\"fs-html-editor-default\">\n <ng-container *ngIf=\"initialized\">\n <ng-container *fsSkeleton=\"(
|
|
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",
|
|
863
891
|
providers: [
|
|
864
892
|
{
|
|
865
893
|
provide: forms.NG_VALUE_ACCESSOR,
|