@firestitch/html-editor 18.0.30 → 18.0.32
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/modules/html-editor/components/html-editor/html-editor.component.d.ts +2 -0
- package/app/modules/html-editor/consts/index.d.ts +5 -0
- package/app/modules/html-editor/consts/toolbar-buttons.const.d.ts +14 -0
- package/app/modules/html-editor/consts/toolbar-xs-buttons.const.d.ts +14 -0
- package/app/modules/html-editor/fs-html-editor.module.d.ts +11 -1
- package/app/modules/html-editor/interfaces/html-editor-config.d.ts +11 -1
- package/app/modules/html-editor/services/froala-loader.service.d.ts +2 -2
- package/esm2022/app/modules/html-editor/components/html-editor/html-editor.component.mjs +55 -42
- package/esm2022/app/modules/html-editor/consts/index.mjs +6 -0
- package/esm2022/app/modules/html-editor/consts/paragraph-buttons.const.mjs +2 -2
- package/esm2022/app/modules/html-editor/consts/toolbar-buttons.const.mjs +18 -0
- package/esm2022/app/modules/html-editor/consts/toolbar-xs-buttons.const.mjs +18 -0
- package/esm2022/app/modules/html-editor/interfaces/html-editor-config.mjs +1 -1
- package/esm2022/app/modules/html-editor/services/froala-loader.service.mjs +5 -5
- package/esm2022/public_api.mjs +2 -4
- package/fesm2022/firestitch-html-editor.mjs +101 -57
- package/fesm2022/firestitch-html-editor.mjs.map +1 -1
- package/package.json +1 -2
- package/public_api.d.ts +1 -3
package/esm2022/public_api.mjs
CHANGED
|
@@ -3,9 +3,7 @@ export { FsHtmlRendererModule } from './app/modules/html-renderer/fs-html-render
|
|
|
3
3
|
export { FsHtmlEditorComponent } from './app/modules/html-editor/components/html-editor/html-editor.component';
|
|
4
4
|
export { FsHtmlRendererComponent } from './app/modules/html-renderer/components/html-renderer/html-renderer.component';
|
|
5
5
|
export { FS_HTML_EDITOR_CONFIG } from './app/modules/html-editor/injects/config.inject';
|
|
6
|
-
export
|
|
7
|
-
export { RichButtons } from './app/modules/html-editor/consts/rich-buttons.const';
|
|
8
|
-
export { TextButtons } from './app/modules/html-editor/consts/text-buttons.const';
|
|
6
|
+
export * from './app/modules/html-editor/consts';
|
|
9
7
|
export { ChecklistPlugin } from './app/modules/html-editor/plugins/checklist.plugin';
|
|
10
8
|
export { CodePlugin } from './app/modules/html-editor/plugins/code.plugin';
|
|
11
9
|
export { MentionPlugin } from './app/modules/html-editor/plugins/mention.plugin';
|
|
@@ -13,4 +11,4 @@ export { RealtimePlugin } from './app/modules/html-editor/plugins/realtime.plugi
|
|
|
13
11
|
export { ScreenRecordPlugin } from './app/modules/html-editor/plugins/screen-record.plugin';
|
|
14
12
|
export { Plugin } from './app/modules/html-editor/classes/plugin';
|
|
15
13
|
export { FsHtmlEditorContainerDirective } from './app/modules/html-editor/directives';
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWNfYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLGlEQUFpRCxDQUFDO0FBQ3JGLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHFEQUFxRCxDQUFDO0FBRTNGLE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHdFQUF3RSxDQUFDO0FBQy9HLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLDhFQUE4RSxDQUFDO0FBRXZILE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLGlEQUFpRCxDQUFDO0FBRXhGLGNBQWMsa0NBQWtDLENBQUM7QUFNakQsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLG9EQUFvRCxDQUFDO0FBQ3JGLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwrQ0FBK0MsQ0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naW5zL3JlYWx0aW1lLnBsdWdpbic7XG5leHBvcnQgeyBTY3JlZW5SZWNvcmRQbHVnaW4gfSBmcm9tICcuL2FwcC9tb2R1bGVzL2h0bWwtZWRpdG9yL3BsdWdpbnMvc2NyZWVuLXJlY29yZC5wbHVnaW4nO1xuXG5leHBvcnQgeyBQbHVnaW4gfSBmcm9tICcuL2FwcC9tb2R1bGVzL2h0bWwtZWRpdG9yL2NsYXNzZXMvcGx1Z2luJztcbmV4cG9ydCB7IEZzSHRtbEVkaXRvckNvbnRhaW5lckRpcmVjdGl2ZSB9IGZyb20gJy4vYXBwL21vZHVsZXMvaHRtbC1lZGl0b3IvZGlyZWN0aXZlcyc7XG5cbiJdfQ==
|
|
@@ -21,10 +21,13 @@ const FS_HTML_EDITOR_CONFIG = new InjectionToken('fs-html-editor.config');
|
|
|
21
21
|
class FsFroalaLoaderService {
|
|
22
22
|
_defaultConfig;
|
|
23
23
|
_document;
|
|
24
|
-
_froalaEditor;
|
|
25
24
|
_froalaLoaded = new BehaviorSubject(false);
|
|
26
25
|
_froalaPluginsLoaded = new BehaviorSubject(false);
|
|
27
26
|
_sourceLoader = fsSourceLoader;
|
|
27
|
+
_froalaEditor;
|
|
28
|
+
get FroalaEditor() {
|
|
29
|
+
return this._froalaEditor;
|
|
30
|
+
}
|
|
28
31
|
_loaded$ = combineLatest([this._froalaLoaded, this._froalaPluginsLoaded])
|
|
29
32
|
.pipe(map(([FroalaReady, pluginsRead]) => {
|
|
30
33
|
return pluginsRead && FroalaReady;
|
|
@@ -38,9 +41,6 @@ class FsFroalaLoaderService {
|
|
|
38
41
|
get loaded$() {
|
|
39
42
|
return this._loaded$;
|
|
40
43
|
}
|
|
41
|
-
get FroalaEditor() {
|
|
42
|
-
return this._froalaEditor;
|
|
43
|
-
}
|
|
44
44
|
_load() {
|
|
45
45
|
const baseDir = '/assets/froala/';
|
|
46
46
|
this._sourceLoader.registerResources({
|
|
@@ -151,18 +151,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
151
151
|
}]
|
|
152
152
|
}] });
|
|
153
153
|
|
|
154
|
-
class FsHtmlEditorContainerDirective {
|
|
155
|
-
static ngTemplateContextGuard(dir, ctx) {
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
158
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsHtmlEditorContainerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
159
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsHtmlEditorContainerDirective, selector: "[fsHtmlEditorContainer]", ngImport: i0 });
|
|
160
|
-
}
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsHtmlEditorContainerDirective, decorators: [{
|
|
162
|
-
type: Directive,
|
|
163
|
-
args: [{ selector: '[fsHtmlEditorContainer]' }]
|
|
164
|
-
}] });
|
|
165
|
-
|
|
166
154
|
const ParagraphButtons = [
|
|
167
155
|
'align',
|
|
168
156
|
'formatOL',
|
|
@@ -170,7 +158,7 @@ const ParagraphButtons = [
|
|
|
170
158
|
'checklist',
|
|
171
159
|
'indent',
|
|
172
160
|
'outdent',
|
|
173
|
-
'lineHeight'
|
|
161
|
+
'lineHeight',
|
|
174
162
|
];
|
|
175
163
|
|
|
176
164
|
const RichButtons = [
|
|
@@ -199,6 +187,48 @@ const TextButtons = [
|
|
|
199
187
|
'code',
|
|
200
188
|
];
|
|
201
189
|
|
|
190
|
+
const ToolbarButtons = {
|
|
191
|
+
moreText: {
|
|
192
|
+
buttons: TextButtons,
|
|
193
|
+
buttonsVisible: 3,
|
|
194
|
+
},
|
|
195
|
+
moreParagraph: {
|
|
196
|
+
buttons: ParagraphButtons,
|
|
197
|
+
buttonsVisible: 5,
|
|
198
|
+
},
|
|
199
|
+
moreRich: {
|
|
200
|
+
buttons: RichButtons,
|
|
201
|
+
buttonsVisible: 3,
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const ToolbarXsButtons = {
|
|
206
|
+
moreText: {
|
|
207
|
+
buttons: TextButtons,
|
|
208
|
+
buttonsVisible: 2,
|
|
209
|
+
},
|
|
210
|
+
moreParagraph: {
|
|
211
|
+
buttons: ParagraphButtons,
|
|
212
|
+
buttonsVisible: 2,
|
|
213
|
+
},
|
|
214
|
+
moreRich: {
|
|
215
|
+
buttons: RichButtons,
|
|
216
|
+
buttonsVisible: 1,
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
class FsHtmlEditorContainerDirective {
|
|
221
|
+
static ngTemplateContextGuard(dir, ctx) {
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsHtmlEditorContainerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
225
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsHtmlEditorContainerDirective, selector: "[fsHtmlEditorContainer]", ngImport: i0 });
|
|
226
|
+
}
|
|
227
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsHtmlEditorContainerDirective, decorators: [{
|
|
228
|
+
type: Directive,
|
|
229
|
+
args: [{ selector: '[fsHtmlEditorContainer]' }]
|
|
230
|
+
}] });
|
|
231
|
+
|
|
202
232
|
class FsHtmlEditorComponent {
|
|
203
233
|
_defaultConfig;
|
|
204
234
|
_cdRef;
|
|
@@ -259,7 +289,8 @@ class FsHtmlEditorComponent {
|
|
|
259
289
|
const config = this._createConfig();
|
|
260
290
|
this._initPlugins(config);
|
|
261
291
|
this._initButtons(config);
|
|
262
|
-
|
|
292
|
+
const froalaOptions = this._createOptions();
|
|
293
|
+
this._editor = new this._fr.FroalaEditor(this.el, froalaOptions, () => {
|
|
263
294
|
this._froalaReady$.next({ config, options });
|
|
264
295
|
});
|
|
265
296
|
}
|
|
@@ -400,11 +431,17 @@ class FsHtmlEditorComponent {
|
|
|
400
431
|
});
|
|
401
432
|
});
|
|
402
433
|
}
|
|
403
|
-
|
|
404
|
-
(
|
|
434
|
+
_initToolbarButtons(buttons) {
|
|
435
|
+
(buttons || [])
|
|
436
|
+
.filter((button) => typeof button !== 'string')
|
|
405
437
|
.forEach((button) => {
|
|
406
438
|
this._defineButton(button);
|
|
407
439
|
});
|
|
440
|
+
}
|
|
441
|
+
_initPlugins(config) {
|
|
442
|
+
this._initToolbarButtons(config.toolbars?.text?.prepend);
|
|
443
|
+
this._initToolbarButtons(config.toolbars?.paragraph?.prepend);
|
|
444
|
+
this._initToolbarButtons(config.toolbars?.rich?.prepend);
|
|
408
445
|
(config.plugins || []).forEach((plugin) => {
|
|
409
446
|
this._fr.FroalaEditor.PLUGINS[plugin.config.name] = function (editor) {
|
|
410
447
|
plugin.editor = editor;
|
|
@@ -452,17 +489,32 @@ class FsHtmlEditorComponent {
|
|
|
452
489
|
},
|
|
453
490
|
});
|
|
454
491
|
}
|
|
492
|
+
_buttonsToNames(buttons) {
|
|
493
|
+
return (buttons || [])
|
|
494
|
+
.map((item) => {
|
|
495
|
+
return typeof item === 'string' ? item : item.name;
|
|
496
|
+
});
|
|
497
|
+
}
|
|
455
498
|
_createOptions() {
|
|
456
499
|
const config = this._createConfig();
|
|
457
|
-
const
|
|
458
|
-
...(config.
|
|
459
|
-
.map((item) => item.name),
|
|
500
|
+
const moreText = [
|
|
501
|
+
...this._buttonsToNames(config.toolbars?.text?.prepend),
|
|
460
502
|
...TextButtons,
|
|
461
503
|
];
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
504
|
+
const moreParagraph = [
|
|
505
|
+
...this._buttonsToNames(config.toolbars?.paragraph?.prepend),
|
|
506
|
+
...ParagraphButtons,
|
|
507
|
+
];
|
|
508
|
+
const moreRich = [
|
|
509
|
+
...this._buttonsToNames(config.toolbars?.rich?.prepend),
|
|
510
|
+
...RichButtons,
|
|
511
|
+
];
|
|
512
|
+
const toolbarButtons = merge(ToolbarButtons, {
|
|
513
|
+
moreText: { buttons: moreText },
|
|
514
|
+
moreParagraph: { buttons: moreParagraph },
|
|
515
|
+
moreRich: { buttons: moreRich },
|
|
516
|
+
});
|
|
517
|
+
const froalaOptions = {
|
|
466
518
|
shortcutsEnabled: ['show', 'bold', 'italic', 'underline', 'indent', 'outdent', 'undo', 'redo', 'insertImage', 'createLink'],
|
|
467
519
|
key: config.activationKey,
|
|
468
520
|
placeholderText: config.placeholder,
|
|
@@ -503,35 +555,27 @@ class FsHtmlEditorComponent {
|
|
|
503
555
|
Double: '2',
|
|
504
556
|
},
|
|
505
557
|
paragraphFormatSelection: true,
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
buttonsVisible: 5,
|
|
528
|
-
},
|
|
529
|
-
moreRich: {
|
|
530
|
-
buttons: RichButtons,
|
|
531
|
-
buttonsVisible: 3,
|
|
532
|
-
},
|
|
533
|
-
},
|
|
534
|
-
}, config.froalaConfig);
|
|
558
|
+
toolbarButtons,
|
|
559
|
+
toolbarButtonsXS: ToolbarXsButtons,
|
|
560
|
+
};
|
|
561
|
+
const options = merge(
|
|
562
|
+
// For some reason editor store somewhere pointer on default config object and dublicate options each time on init
|
|
563
|
+
// Extra merge level fixed this problem and allow to init config properly without legacy data
|
|
564
|
+
{}, froalaOptions, config.froalaConfig, {
|
|
565
|
+
pluginsEnabled: [
|
|
566
|
+
"align" /* FroalaPlugin.Align */,
|
|
567
|
+
"colors" /* FroalaPlugin.Colors */,
|
|
568
|
+
"image" /* FroalaPlugin.Image */,
|
|
569
|
+
"link" /* FroalaPlugin.Link */,
|
|
570
|
+
"lists" /* FroalaPlugin.Lists */,
|
|
571
|
+
"paragraph_format" /* FroalaPlugin.ParagraphFormat */,
|
|
572
|
+
"quote" /* FroalaPlugin.Quote */,
|
|
573
|
+
"table" /* FroalaPlugin.Table */,
|
|
574
|
+
"url" /* FroalaPlugin.Url */,
|
|
575
|
+
"video" /* FroalaPlugin.Video */,
|
|
576
|
+
],
|
|
577
|
+
});
|
|
578
|
+
return options;
|
|
535
579
|
}
|
|
536
580
|
_listenLazyInit() {
|
|
537
581
|
this.froalaLoaded$
|
|
@@ -1084,5 +1128,5 @@ class ScreenRecordPlugin extends Plugin {
|
|
|
1084
1128
|
* Generated bundle index. Do not edit.
|
|
1085
1129
|
*/
|
|
1086
1130
|
|
|
1087
|
-
export { ChecklistPlugin, CodePlugin, FS_HTML_EDITOR_CONFIG, FsHtmlEditorComponent, FsHtmlEditorContainerDirective, FsHtmlEditorModule, FsHtmlRendererComponent, FsHtmlRendererModule, MentionPlugin, ParagraphButtons, Plugin, RealtimePlugin, RichButtons, ScreenRecordPlugin, TextButtons };
|
|
1131
|
+
export { ChecklistPlugin, CodePlugin, FS_HTML_EDITOR_CONFIG, FsHtmlEditorComponent, FsHtmlEditorContainerDirective, FsHtmlEditorModule, FsHtmlRendererComponent, FsHtmlRendererModule, MentionPlugin, ParagraphButtons, Plugin, RealtimePlugin, RichButtons, ScreenRecordPlugin, TextButtons, ToolbarButtons, ToolbarXsButtons };
|
|
1088
1132
|
//# sourceMappingURL=firestitch-html-editor.mjs.map
|