sk-front-lib 0.18.2 → 0.18.3
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/article/sk-article-editor-server.component.d.ts +1 -1
- package/article/sk-article-editor.component.d.ts +1 -1
- package/article/sk-froala-editor.directive.d.ts +1 -1
- package/crud/sk-auth-admin.guard.d.ts +2 -2
- package/crud/sk-auth.guard.d.ts +2 -2
- package/{esm2020 → esm2022}/api/sk-api.module.mjs +9 -9
- package/{esm2020 → esm2022}/api/sk-api.service.mjs +4 -4
- package/{esm2020 → esm2022}/article/sk-article-editor-server.component.mjs +4 -4
- package/{esm2020 → esm2022}/article/sk-article-editor.component.mjs +4 -4
- package/{esm2020 → esm2022}/article/sk-article-server.module.mjs +5 -5
- package/{esm2020 → esm2022}/article/sk-article.module.mjs +7 -7
- package/{esm2020 → esm2022}/article/sk-article.service.mjs +4 -4
- package/{esm2020 → esm2022}/article/sk-froala-editor.directive.mjs +7 -7
- package/{esm2020 → esm2022}/crud/sk-account.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-affiliate.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-auth-admin.guard.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-auth.guard.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-auth.service.mjs +7 -7
- package/{esm2020 → esm2022}/crud/sk-board.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-brand.service.mjs +4 -4
- package/esm2022/crud/sk-cart.service.mjs +256 -0
- package/{esm2020 → esm2022}/crud/sk-category.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-comment.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-config.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-contact.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-coupon.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-document.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-etc.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-file.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-keyword.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-order.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-point.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-product.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-promotion.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-search.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-store.service.mjs +4 -4
- package/{esm2020 → esm2022}/crud/sk-user.service.mjs +4 -4
- package/{esm2020 → esm2022}/google-analytics/google-analytics-router.module.mjs +9 -9
- package/{esm2020 → esm2022}/google-analytics/google-analytics.module.mjs +5 -5
- package/{esm2020 → esm2022}/google-analytics/services/google-analytics.service.mjs +4 -4
- package/{esm2020 → esm2022}/image/sk-image.component.mjs +6 -6
- package/esm2022/image/sk-image.module.mjs +40 -0
- package/{esm2020 → esm2022}/lib/sk-byte.pipe.mjs +4 -4
- package/{esm2020 → esm2022}/lib/sk-date-time.pipe.mjs +4 -4
- package/{esm2020 → esm2022}/lib/sk-date.pipe.mjs +4 -4
- package/{esm2020 → esm2022}/lib/sk-front-lib.module.mjs +13 -13
- package/{esm2020 → esm2022}/lib/sk-keys.pipe.mjs +4 -4
- package/{esm2020 → esm2022}/lib/sk-time.pipe.mjs +4 -4
- package/esm2022/model/lib/filetype.mjs +179 -0
- package/esm2022/search-address/dialog/dialog.component.mjs +27 -0
- package/{esm2020 → esm2022}/search-address/sk-search-address.directive.mjs +6 -6
- package/esm2022/search-address/sk-search-address.module.mjs +47 -0
- package/{esm2020 → esm2022}/search-address/sk-search-address.service.mjs +4 -4
- package/esm2022/uploader/sk-uploader.component.mjs +119 -0
- package/esm2022/uploader/sk-uploader.directive.mjs +44 -0
- package/esm2022/uploader/sk-uploader.module.mjs +57 -0
- package/{fesm2020 → fesm2022}/sk-front-lib-api.mjs +11 -11
- package/{fesm2020 → fesm2022}/sk-front-lib-api.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/sk-front-lib-article.mjs +25 -25
- package/{fesm2020 → fesm2022}/sk-front-lib-article.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/sk-front-lib-crud.mjs +93 -93
- package/fesm2022/sk-front-lib-crud.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/sk-front-lib-google-analytics.mjs +15 -15
- package/{fesm2020 → fesm2022}/sk-front-lib-google-analytics.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/sk-front-lib-image.mjs +21 -21
- package/fesm2022/sk-front-lib-image.mjs.map +1 -0
- package/{fesm2015 → fesm2022}/sk-front-lib-model.mjs +56 -56
- package/{fesm2020 → fesm2022}/sk-front-lib-model.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/sk-front-lib-search-address.mjs +32 -32
- package/fesm2022/sk-front-lib-search-address.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/sk-front-lib-uploader.mjs +48 -49
- package/fesm2022/sk-front-lib-uploader.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/sk-front-lib.mjs +27 -27
- package/{fesm2015 → fesm2022}/sk-front-lib.mjs.map +1 -1
- package/google-analytics/types/ga-action.type.d.ts +1 -1
- package/google-analytics/types/ga-bind.type.d.ts +1 -1
- package/image/sk-image.component.d.ts +2 -2
- package/image/sk-image.module.d.ts +3 -3
- package/model/lib/payment.d.ts +1 -1
- package/package.json +44 -66
- package/search-address/dialog/dialog.component.d.ts +1 -1
- package/search-address/sk-search-address.directive.d.ts +2 -2
- package/search-address/sk-search-address.module.d.ts +3 -3
- package/uploader/sk-uploader.component.d.ts +1 -1
- package/uploader/sk-uploader.directive.d.ts +2 -2
- package/uploader/sk-uploader.module.d.ts +5 -5
- package/esm2020/crud/sk-cart.service.mjs +0 -256
- package/esm2020/image/sk-image.module.mjs +0 -40
- package/esm2020/model/lib/filetype.mjs +0 -179
- package/esm2020/search-address/dialog/dialog.component.mjs +0 -27
- package/esm2020/search-address/sk-search-address.module.mjs +0 -47
- package/esm2020/uploader/sk-uploader.component.mjs +0 -120
- package/esm2020/uploader/sk-uploader.directive.mjs +0 -44
- package/esm2020/uploader/sk-uploader.module.mjs +0 -57
- package/fesm2015/sk-front-lib-api.mjs +0 -216
- package/fesm2015/sk-front-lib-api.mjs.map +0 -1
- package/fesm2015/sk-front-lib-article.mjs +0 -758
- package/fesm2015/sk-front-lib-article.mjs.map +0 -1
- package/fesm2015/sk-front-lib-crud.mjs +0 -1529
- package/fesm2015/sk-front-lib-crud.mjs.map +0 -1
- package/fesm2015/sk-front-lib-google-analytics.mjs +0 -334
- package/fesm2015/sk-front-lib-google-analytics.mjs.map +0 -1
- package/fesm2015/sk-front-lib-image.mjs +0 -303
- package/fesm2015/sk-front-lib-image.mjs.map +0 -1
- package/fesm2015/sk-front-lib-model.mjs.map +0 -1
- package/fesm2015/sk-front-lib-search-address.mjs +0 -183
- package/fesm2015/sk-front-lib-search-address.mjs.map +0 -1
- package/fesm2015/sk-front-lib-uploader.mjs +0 -546
- package/fesm2015/sk-front-lib-uploader.mjs.map +0 -1
- package/fesm2015/sk-front-lib.mjs +0 -538
- package/fesm2020/sk-front-lib-crud.mjs.map +0 -1
- package/fesm2020/sk-front-lib-image.mjs.map +0 -1
- package/fesm2020/sk-front-lib-model.mjs +0 -1105
- package/fesm2020/sk-front-lib-search-address.mjs.map +0 -1
- package/fesm2020/sk-front-lib-uploader.mjs.map +0 -1
- package/fesm2020/sk-front-lib.mjs.map +0 -1
- /package/{esm2020 → esm2022}/api/model/api-config.mjs +0 -0
- /package/{esm2020 → esm2022}/api/model/api-pageable-param.mjs +0 -0
- /package/{esm2020 → esm2022}/api/model/api-pageable.mjs +0 -0
- /package/{esm2020 → esm2022}/api/model/api-response.mjs +0 -0
- /package/{esm2020 → esm2022}/api/model/index.mjs +0 -0
- /package/{esm2020 → esm2022}/api/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/api/sk-front-lib-api.mjs +0 -0
- /package/{esm2020 → esm2022}/article/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/article/sk-front-lib-article.mjs +0 -0
- /package/{esm2020 → esm2022}/crud/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/crud/sk-front-lib-crud.mjs +0 -0
- /package/{esm2020 → esm2022}/google-analytics/initializers/google-analytics-router.initializer.mjs +0 -0
- /package/{esm2020 → esm2022}/google-analytics/initializers/google-analytics.initializer.mjs +0 -0
- /package/{esm2020 → esm2022}/google-analytics/interfaces/google-analytics-command.mjs +0 -0
- /package/{esm2020 → esm2022}/google-analytics/interfaces/google-analytics-settings.mjs +0 -0
- /package/{esm2020 → esm2022}/google-analytics/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/google-analytics/sk-front-lib-google-analytics.mjs +0 -0
- /package/{esm2020 → esm2022}/google-analytics/tokens/google-analytics-settings-token.mjs +0 -0
- /package/{esm2020 → esm2022}/google-analytics/types/ga-action.type.mjs +0 -0
- /package/{esm2020 → esm2022}/google-analytics/types/ga-bind.type.mjs +0 -0
- /package/{esm2020 → esm2022}/image/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/image/sk-front-lib-image.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/sk-animations.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/sk-utils.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/article.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/audit.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/auth.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/board.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/cart.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/comment.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/contact.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/coupon.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/document.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/etc.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/file.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/grid.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/nicepay.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/order.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/payment.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/point.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/product-series.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/product.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/promotion.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/shipping.mjs +0 -0
- /package/{esm2020 → esm2022}/model/lib/user.mjs +0 -0
- /package/{esm2020 → esm2022}/model/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/model/sk-front-lib-model.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/search-address/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/search-address/sk-front-lib-search-address.mjs +0 -0
- /package/{esm2020 → esm2022}/search-address/sk-search-address.model.mjs +0 -0
- /package/{esm2020 → esm2022}/sk-front-lib.mjs +0 -0
- /package/{esm2020 → esm2022}/uploader/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/uploader/sk-front-lib-uploader.mjs +0 -0
- /package/{esm2020 → esm2022}/uploader/sk-uploader-file-item.model.mjs +0 -0
- /package/{esm2020 → esm2022}/uploader/sk-uploader.animation.mjs +0 -0
- /package/{esm2020 → esm2022}/uploader/sk-uploader.class.mjs +0 -0
|
@@ -1,758 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Inject, EventEmitter, forwardRef, Directive, Input, Output, Component, NgModule } from '@angular/core';
|
|
3
|
-
import { SkFile } from 'sk-front-lib/model';
|
|
4
|
-
import * as i1 from 'sk-front-lib/api';
|
|
5
|
-
import FroalaEditor from 'froala-editor';
|
|
6
|
-
import 'froala-editor/js/plugins.pkgd.min.js';
|
|
7
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
8
|
-
import { CommonModule } from '@angular/common';
|
|
9
|
-
|
|
10
|
-
class SkArticleService {
|
|
11
|
-
constructor(environment) {
|
|
12
|
-
this.environment = environment;
|
|
13
|
-
this.initializeFroala();
|
|
14
|
-
}
|
|
15
|
-
initializeFroala() {
|
|
16
|
-
FroalaEditor.DefineIconTemplate('material_design', '<i class="material-icons">[NAME]</i>');
|
|
17
|
-
this.loadFontWeight();
|
|
18
|
-
this.registerShortcuts();
|
|
19
|
-
}
|
|
20
|
-
loadFontWeight() {
|
|
21
|
-
// Define an icon.
|
|
22
|
-
FroalaEditor.DefineIcon('font-weight', { NAME: 'format_size', template: 'material_design' });
|
|
23
|
-
// Define a dropdown button.
|
|
24
|
-
FroalaEditor.RegisterCommand('font-weight-drop', {
|
|
25
|
-
// Button title.
|
|
26
|
-
title: 'Font Weight',
|
|
27
|
-
// Mark the button as a dropdown.
|
|
28
|
-
type: 'dropdown',
|
|
29
|
-
// Specify the icon for the button.
|
|
30
|
-
// If this option is not specified, the button name will be used.
|
|
31
|
-
icon: 'font-weight',
|
|
32
|
-
// Options for the dropdown.
|
|
33
|
-
options: {
|
|
34
|
-
100: 'Thin',
|
|
35
|
-
300: 'Light',
|
|
36
|
-
400: 'Regular',
|
|
37
|
-
500: 'Medium',
|
|
38
|
-
700: 'Bold',
|
|
39
|
-
900: 'Black'
|
|
40
|
-
},
|
|
41
|
-
// If present, the options property will be ignored.
|
|
42
|
-
// It can be used to define a custom HTML for the dropdown.
|
|
43
|
-
// html: function () {
|
|
44
|
-
// // The current context is the editor instance.
|
|
45
|
-
// return '';
|
|
46
|
-
// },
|
|
47
|
-
// Save the dropdown action into undo stack.
|
|
48
|
-
undo: true,
|
|
49
|
-
// Focus inside the editor before callback.
|
|
50
|
-
focus: true,
|
|
51
|
-
// Refresh the button state after the callback.
|
|
52
|
-
refreshAfterCallback: true,
|
|
53
|
-
// Callback.
|
|
54
|
-
callback(cmd, val, params) {
|
|
55
|
-
this.format.removeStyle('font-weight');
|
|
56
|
-
this.format.applyStyle('font-weight', val);
|
|
57
|
-
},
|
|
58
|
-
// Called when the dropdown button state might have changed.
|
|
59
|
-
// refresh: function ($btn) {
|
|
60
|
-
// // The current context is the editor instance.
|
|
61
|
-
// console.log (this.selection.element());
|
|
62
|
-
// console.log(this);
|
|
63
|
-
// },
|
|
64
|
-
// Called when the dropdown is shown.
|
|
65
|
-
// refreshOnShow: function ($btn, $dropdown) {
|
|
66
|
-
// // The current context is the editor instance.
|
|
67
|
-
// console.log (this.selection.element());
|
|
68
|
-
// }
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
registerShortcuts() {
|
|
72
|
-
FroalaEditor.RegisterShortcut(49, 'paragraphFormat', 'H1', '1', false);
|
|
73
|
-
FroalaEditor.RegisterShortcut(50, 'paragraphFormat', 'H2', '2', false);
|
|
74
|
-
FroalaEditor.RegisterShortcut(51, 'paragraphFormat', 'H3', '3', false);
|
|
75
|
-
FroalaEditor.RegisterShortcut(52, 'paragraphFormat', 'N', '4', false);
|
|
76
|
-
FroalaEditor.RegisterShortcut(66, 'font-weight-drop', '700');
|
|
77
|
-
}
|
|
78
|
-
getBaseConfig() {
|
|
79
|
-
return {
|
|
80
|
-
key: 'Ig1A7vB2D2E2E1F1B4muvugzxmwA-7I-7A5B-21qrC-11A2B2C2A1C9B3B3C6E2C1==',
|
|
81
|
-
editorClass: 'sk-custom',
|
|
82
|
-
fontFamily: {
|
|
83
|
-
'Noto Sans KR, Noto Sans, Arial,Helvetica,sans-serif': 'Noto Sans',
|
|
84
|
-
'Roboto, Arial,Helvetica,sans-serif': 'Roboto',
|
|
85
|
-
'Georgia,serif': 'Georgia',
|
|
86
|
-
'Impact,Charcoal,sans-serif': 'Impact',
|
|
87
|
-
'Tahoma,Geneva,sans-serif': 'Tahoma',
|
|
88
|
-
'\'Times New Roman\',Times,serif': 'Times New Roman',
|
|
89
|
-
'Verdana,Geneva,sans-serif': 'Verdana'
|
|
90
|
-
},
|
|
91
|
-
imageDefaultWidth: 0,
|
|
92
|
-
// remove image manager
|
|
93
|
-
// imageInsertButtons: ['imageBack', '|', 'imageUpload', 'imageByURL', 'imageManager'],
|
|
94
|
-
imageInsertButtons: ['imageBack', '|', 'imageUpload', 'imageByURL'],
|
|
95
|
-
imageEditButtons: ['imageAlign', 'imageCaption', 'imageRemove', '|', 'imageLink', 'linkOpen', 'linkEdit', 'linkRemove', '-', 'imageDisplay', 'imageStyle', 'imageAlt', 'imageSize'],
|
|
96
|
-
imageAllowedTypes: ['jpeg', 'jpg', 'png', 'gif'],
|
|
97
|
-
// remove video upload
|
|
98
|
-
// ['videoBack', '|', 'videoByURL', 'videoEmbed', 'videoUpload']
|
|
99
|
-
videoInsertButtons: ['videoBack', '|', 'videoByURL', 'videoEmbed'],
|
|
100
|
-
videoUpload: false,
|
|
101
|
-
videoResponsive: true,
|
|
102
|
-
pastePlain: true,
|
|
103
|
-
pasteDeniedAttrs: ['class', 'id', 'style'],
|
|
104
|
-
pasteDeniedTags: ['div'],
|
|
105
|
-
wordPasteKeepFormatting: false,
|
|
106
|
-
imagePaste: false,
|
|
107
|
-
quickInsertEnabled: false,
|
|
108
|
-
paragraphFormat: {
|
|
109
|
-
H1: '대제목',
|
|
110
|
-
H2: '소제목',
|
|
111
|
-
H3: '문단 제목',
|
|
112
|
-
N: '본문'
|
|
113
|
-
},
|
|
114
|
-
// toolbarContainer: '.sk-custom-editor-toolbar',
|
|
115
|
-
toolbarSticky: false,
|
|
116
|
-
toolbarBottom: false,
|
|
117
|
-
attribution: false,
|
|
118
|
-
helpSets: [
|
|
119
|
-
{
|
|
120
|
-
title: 'Gearlounge Custom',
|
|
121
|
-
commands: [
|
|
122
|
-
{ val: 'OSkey1', desc: '대제목' },
|
|
123
|
-
{ val: 'OSkey2', desc: '소제목' },
|
|
124
|
-
{ val: 'OSkey3', desc: '문단 제목' },
|
|
125
|
-
{ val: 'OSkey4', desc: '본문' }
|
|
126
|
-
]
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
title: 'Inline Editor',
|
|
130
|
-
commands: [
|
|
131
|
-
{ val: 'OSkeyE', desc: 'Show the editor' }
|
|
132
|
-
]
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
title: 'Common actions',
|
|
136
|
-
commands: [
|
|
137
|
-
{ val: 'OSkeyC', desc: 'Copy' },
|
|
138
|
-
{ val: 'OSkeyX', desc: 'Cut' },
|
|
139
|
-
{ val: 'OSkeyV', desc: 'Paste' },
|
|
140
|
-
{ val: 'OSkeyZ', desc: 'Undo' },
|
|
141
|
-
{ val: 'OSkeyShift+Z', desc: 'Redo' },
|
|
142
|
-
{ val: 'OSkeyK', desc: 'Insert Link' },
|
|
143
|
-
{ val: 'OSkeyP', desc: 'Insert Image' }
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
title: 'Basic Formatting',
|
|
148
|
-
commands: [
|
|
149
|
-
{ val: 'OSkeyA', desc: 'Select All' },
|
|
150
|
-
{ val: 'OSkeyB', desc: 'Bold' },
|
|
151
|
-
{ val: 'OSkeyI', desc: 'Italic' },
|
|
152
|
-
{ val: 'OSkeyU', desc: 'Underline' },
|
|
153
|
-
{ val: 'OSkeyS', desc: 'Strikethrough' },
|
|
154
|
-
{ val: 'OSkey]', desc: 'Increase Indent' },
|
|
155
|
-
{ val: 'OSkey[', desc: 'Decrease Indent' }
|
|
156
|
-
]
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
title: 'Quote',
|
|
160
|
-
commands: [
|
|
161
|
-
{ val: 'OSkey\'', desc: 'Increase quote level' },
|
|
162
|
-
{ val: 'OSkeyShift+\'', desc: 'Decrease quote level' }
|
|
163
|
-
]
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
title: 'Image / Video',
|
|
167
|
-
commands: [
|
|
168
|
-
{ val: 'OSkey+', desc: 'Resize larger' },
|
|
169
|
-
{ val: 'OSkey-', desc: 'Resize smaller' }
|
|
170
|
-
]
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
title: 'Table',
|
|
174
|
-
commands: [
|
|
175
|
-
{ val: 'Alt+Space', desc: 'Select table cell' },
|
|
176
|
-
{ val: 'Shift+Left/Right arrow', desc: 'Extend selection one cell' },
|
|
177
|
-
{ val: 'Shift+Up/Down arrow', desc: 'Extend selection one row' }
|
|
178
|
-
]
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
title: 'Navigation',
|
|
182
|
-
commands: [
|
|
183
|
-
{ val: 'OSkey/', desc: 'Shortcuts' },
|
|
184
|
-
{ val: 'Alt+F10', desc: 'Focus popup / toolbar' },
|
|
185
|
-
{ val: 'Esc', desc: 'Return focus to previous position' }
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
],
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
getToolbar(type = 'default') {
|
|
192
|
-
if (type === 'default') {
|
|
193
|
-
return {
|
|
194
|
-
toolbarButtons: {
|
|
195
|
-
moreText: {
|
|
196
|
-
buttons: ['font-weight-drop', 'fontFamily', 'fontSize', 'textColor', 'clearFormatting', 'italic', 'strikeThrough', 'subscript', 'superscript', 'backgroundColor', 'inlineClass', 'inlineStyle'],
|
|
197
|
-
buttonsVisible: 5
|
|
198
|
-
},
|
|
199
|
-
moreParagraph: {
|
|
200
|
-
buttons: ['paragraphFormat', 'alignLeft', 'alignCenter', 'formatUL', 'quote', 'alignRight', 'alignJustify', 'formatOLSimple', 'formatOL', 'paragraphStyle', 'lineHeight', 'outdent', 'indent'],
|
|
201
|
-
buttonsVisible: 5
|
|
202
|
-
},
|
|
203
|
-
moreRich: {
|
|
204
|
-
buttons: ['insertLink', 'insertImage', 'insertVideo', 'insertHR', 'insertTable', 'emoticons', 'fontAwesome', 'specialCharacters', 'embedly', 'insertFile'],
|
|
205
|
-
buttonsVisible: 4
|
|
206
|
-
},
|
|
207
|
-
moreMisc: {
|
|
208
|
-
buttons: ['undo', 'redo', 'fullscreen', 'print', 'getPDF', 'spellChecker', 'selectAll', 'html', 'help'],
|
|
209
|
-
align: 'right',
|
|
210
|
-
buttonsVisible: 3
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
toolbarButtonsSm: {
|
|
214
|
-
moreText: {
|
|
215
|
-
buttons: ['font-weight-drop', 'underline', 'strikeThrough', 'subscript', 'superscript', 'fontFamily', 'fontSize', 'textColor', 'backgroundColor', 'inlineClass', 'inlineStyle', 'clearFormatting'],
|
|
216
|
-
buttonsVisible: 2
|
|
217
|
-
},
|
|
218
|
-
moreParagraph: {
|
|
219
|
-
buttons: ['alignLeft', 'alignCenter', 'formatOLSimple', 'alignRight', 'alignJustify', 'formatOL', 'formatUL', 'paragraphFormat', 'paragraphStyle', 'lineHeight', 'outdent', 'indent', 'quote'],
|
|
220
|
-
buttonsVisible: 2
|
|
221
|
-
},
|
|
222
|
-
moreRich: {
|
|
223
|
-
buttons: ['insertLink', 'insertImage', 'insertVideo', 'insertTable', 'emoticons', 'fontAwesome', 'specialCharacters', 'embedly', 'insertFile', 'insertHR'],
|
|
224
|
-
buttonsVisible: 2
|
|
225
|
-
},
|
|
226
|
-
moreMisc: {
|
|
227
|
-
buttons: ['undo', 'redo', 'fullscreen', 'print', 'getPDF', 'spellChecker', 'selectAll', 'html', 'help'],
|
|
228
|
-
align: 'right',
|
|
229
|
-
buttonsVisible: 2
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
else if (type === 'simple') {
|
|
235
|
-
return {
|
|
236
|
-
toolbarButtons: [['font-weight-drop', 'fontFamily', 'fontSize', 'textColor', 'clearFormatting'], ['paragraphFormat', 'alignLeft', 'alignCenter', 'formatUL', 'quote'], ['insertLink']],
|
|
237
|
-
toolbarButtonsSm: [['font-weight-drop', 'fontFamily', 'fontSize', 'textColor', 'clearFormatting'], ['paragraphFormat', 'alignLeft', 'alignCenter', 'formatUL', 'quote'], ['insertLink']],
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
SkArticleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
243
|
-
SkArticleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleService, providedIn: 'root' });
|
|
244
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleService, decorators: [{
|
|
245
|
-
type: Injectable,
|
|
246
|
-
args: [{
|
|
247
|
-
providedIn: 'root'
|
|
248
|
-
}]
|
|
249
|
-
}], ctorParameters: function () {
|
|
250
|
-
return [{ type: undefined, decorators: [{
|
|
251
|
-
type: Inject,
|
|
252
|
-
args: ['environment']
|
|
253
|
-
}] }];
|
|
254
|
-
} });
|
|
255
|
-
|
|
256
|
-
class SkFroalaEditorDirective {
|
|
257
|
-
constructor(el, zone) {
|
|
258
|
-
this.zone = zone;
|
|
259
|
-
// editor options
|
|
260
|
-
this._opts = {
|
|
261
|
-
immediateAngularModelUpdate: false,
|
|
262
|
-
angularIgnoreAttrs: null
|
|
263
|
-
};
|
|
264
|
-
this.SPECIAL_TAGS = ['img', 'button', 'input', 'a'];
|
|
265
|
-
this.INNER_HTML_ATTR = 'innerHTML';
|
|
266
|
-
this._hasSpecialTag = false;
|
|
267
|
-
this._editorInitialized = false;
|
|
268
|
-
this._oldModel = null;
|
|
269
|
-
// froalaModel directive as output: update model if editor contentChanged
|
|
270
|
-
this.froalaModelChange = new EventEmitter();
|
|
271
|
-
// froalaInit directive as output: send manual editor initialization
|
|
272
|
-
this.froalaInit = new EventEmitter();
|
|
273
|
-
// Begin ControlValueAccesor methods.
|
|
274
|
-
this.onChange = (_) => {
|
|
275
|
-
};
|
|
276
|
-
this.onTouched = () => {
|
|
277
|
-
};
|
|
278
|
-
const element = el.nativeElement;
|
|
279
|
-
// check if the element is a special tag
|
|
280
|
-
if (this.SPECIAL_TAGS.indexOf(element.tagName.toLowerCase()) != -1) {
|
|
281
|
-
this._hasSpecialTag = true;
|
|
282
|
-
}
|
|
283
|
-
this._element = element;
|
|
284
|
-
this.zone = zone;
|
|
285
|
-
}
|
|
286
|
-
// End ControlValueAccesor methods.
|
|
287
|
-
// froalaEditor directive as input: store the editor options
|
|
288
|
-
set froalaEditor(opts) {
|
|
289
|
-
this._opts = this.clone(opts || this._opts);
|
|
290
|
-
this._opts = Object.assign({}, this._opts);
|
|
291
|
-
}
|
|
292
|
-
// froalaModel directive as input: store initial editor content
|
|
293
|
-
set froalaModel(content) {
|
|
294
|
-
this.updateEditor(content);
|
|
295
|
-
}
|
|
296
|
-
// Form model content changed.
|
|
297
|
-
writeValue(content) {
|
|
298
|
-
this.updateEditor(content);
|
|
299
|
-
}
|
|
300
|
-
registerOnChange(fn) {
|
|
301
|
-
this.onChange = fn;
|
|
302
|
-
}
|
|
303
|
-
registerOnTouched(fn) {
|
|
304
|
-
this.onTouched = fn;
|
|
305
|
-
}
|
|
306
|
-
// TODO: replace clone method with better possible alternate
|
|
307
|
-
clone(item) {
|
|
308
|
-
const me = this;
|
|
309
|
-
if (!item) {
|
|
310
|
-
return item;
|
|
311
|
-
} // null, undefined values check
|
|
312
|
-
let types = [Number, String, Boolean], result;
|
|
313
|
-
// normalizing primitives if someone did new String('aaa'), or new Number('444');
|
|
314
|
-
types.forEach(function (type) {
|
|
315
|
-
if (item instanceof type) {
|
|
316
|
-
result = type(item);
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
if (typeof result == 'undefined') {
|
|
320
|
-
if (Object.prototype.toString.call(item) === '[object Array]') {
|
|
321
|
-
result = [];
|
|
322
|
-
item.forEach(function (child, index, array) {
|
|
323
|
-
result[index] = me.clone(child);
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
else if (typeof item == 'object') {
|
|
327
|
-
// testing that this is DOM
|
|
328
|
-
if (item.nodeType && typeof item.cloneNode == 'function') {
|
|
329
|
-
result = item.cloneNode(true);
|
|
330
|
-
}
|
|
331
|
-
else if (!item.prototype) { // check that this is a literal
|
|
332
|
-
if (item instanceof Date) {
|
|
333
|
-
result = new Date(item);
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
// it is an object literal
|
|
337
|
-
result = {};
|
|
338
|
-
for (const i in item) {
|
|
339
|
-
result[i] = me.clone(item[i]);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
else {
|
|
344
|
-
if (false && item.constructor) {
|
|
345
|
-
result = new item.constructor();
|
|
346
|
-
}
|
|
347
|
-
else {
|
|
348
|
-
result = item;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
else {
|
|
353
|
-
result = item;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
return result;
|
|
357
|
-
}
|
|
358
|
-
// Update editor with model contents.
|
|
359
|
-
updateEditor(content) {
|
|
360
|
-
if (JSON.stringify(this._oldModel) == JSON.stringify(content)) {
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
if (!this._hasSpecialTag) {
|
|
364
|
-
this._oldModel = content;
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
this._model = content;
|
|
368
|
-
}
|
|
369
|
-
if (this._editorInitialized) {
|
|
370
|
-
if (!this._hasSpecialTag) {
|
|
371
|
-
this._editor.html.set(content);
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
this.setContent();
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
else {
|
|
378
|
-
if (!this._hasSpecialTag) {
|
|
379
|
-
this._element.innerHTML = content || '';
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
this.setContent();
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
// update model if editor contentChanged
|
|
387
|
-
updateModel() {
|
|
388
|
-
this.zone.run(() => {
|
|
389
|
-
let modelContent = null;
|
|
390
|
-
if (this._hasSpecialTag) {
|
|
391
|
-
const attributeNodes = this._element.attributes;
|
|
392
|
-
const attrs = {};
|
|
393
|
-
for (let i = 0; i < attributeNodes.length; i++) {
|
|
394
|
-
const attrName = attributeNodes[i].name;
|
|
395
|
-
if (this._opts.angularIgnoreAttrs && this._opts.angularIgnoreAttrs.indexOf(attrName) != -1) {
|
|
396
|
-
continue;
|
|
397
|
-
}
|
|
398
|
-
attrs[attrName] = attributeNodes[i].value;
|
|
399
|
-
}
|
|
400
|
-
if (this._element.innerHTML) {
|
|
401
|
-
attrs[this.INNER_HTML_ATTR] = this._element.innerHTML;
|
|
402
|
-
}
|
|
403
|
-
modelContent = attrs;
|
|
404
|
-
}
|
|
405
|
-
else {
|
|
406
|
-
const returnedHtml = this._editor.html.get();
|
|
407
|
-
if (typeof returnedHtml === 'string') {
|
|
408
|
-
modelContent = returnedHtml;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
if (this._oldModel !== modelContent) {
|
|
412
|
-
this._oldModel = modelContent;
|
|
413
|
-
// Update froalaModel.
|
|
414
|
-
this.froalaModelChange.emit(modelContent);
|
|
415
|
-
// Update form model.
|
|
416
|
-
this.onChange(modelContent);
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
registerEvent(eventName, callback) {
|
|
421
|
-
if (!eventName || !callback) {
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
if (!this._opts.events) {
|
|
425
|
-
this._opts.events = {};
|
|
426
|
-
}
|
|
427
|
-
this._opts.events[eventName] = callback;
|
|
428
|
-
}
|
|
429
|
-
initListeners() {
|
|
430
|
-
const self = this;
|
|
431
|
-
// Check if we have events on the editor.
|
|
432
|
-
if (this._editor.events) {
|
|
433
|
-
// bind contentChange and keyup event to froalaModel
|
|
434
|
-
this._editor.events.on('contentChanged', function () {
|
|
435
|
-
setTimeout(function () {
|
|
436
|
-
self.updateModel();
|
|
437
|
-
}, 0);
|
|
438
|
-
});
|
|
439
|
-
this._editor.events.on('mousedown', function () {
|
|
440
|
-
setTimeout(function () {
|
|
441
|
-
self.onTouched();
|
|
442
|
-
}, 0);
|
|
443
|
-
});
|
|
444
|
-
if (this._opts.immediateAngularModelUpdate) {
|
|
445
|
-
this._editor.events.on('keyup', function () {
|
|
446
|
-
setTimeout(function () {
|
|
447
|
-
self.updateModel();
|
|
448
|
-
}, 0);
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
this._editorInitialized = true;
|
|
453
|
-
}
|
|
454
|
-
createEditor() {
|
|
455
|
-
if (this._editorInitialized) {
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
this.setContent(true);
|
|
459
|
-
// init editor
|
|
460
|
-
this.zone.runOutsideAngular(() => {
|
|
461
|
-
// Add listeners on initialized event.
|
|
462
|
-
if (!this._opts.events) {
|
|
463
|
-
this._opts.events = {};
|
|
464
|
-
}
|
|
465
|
-
// Register initialized event.
|
|
466
|
-
this.registerEvent('initialized', this._opts.events && this._opts.events.initialized);
|
|
467
|
-
const existingInitCallback = this._opts.events.initialized;
|
|
468
|
-
// Default initialized event.
|
|
469
|
-
if (!this._opts.events.initialized || !this._opts.events.initialized.overridden) {
|
|
470
|
-
this._opts.events.initialized = () => {
|
|
471
|
-
this.initListeners();
|
|
472
|
-
existingInitCallback && existingInitCallback.call(this._editor, this);
|
|
473
|
-
};
|
|
474
|
-
this._opts.events.initialized.overridden = true;
|
|
475
|
-
}
|
|
476
|
-
// Initialize the Froala Editor.
|
|
477
|
-
this._editor = new FroalaEditor(this._element, this._opts);
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
setHtml() {
|
|
481
|
-
this._editor.html.set(this._model || '');
|
|
482
|
-
// This will reset the undo stack everytime the model changes externally. Can we fix this?
|
|
483
|
-
this._editor.undo.reset();
|
|
484
|
-
this._editor.undo.saveStep();
|
|
485
|
-
}
|
|
486
|
-
setContent(firstTime = false) {
|
|
487
|
-
const self = this;
|
|
488
|
-
// Set initial content
|
|
489
|
-
if (this._model || this._model == '') {
|
|
490
|
-
this._oldModel = this._model;
|
|
491
|
-
if (this._hasSpecialTag) {
|
|
492
|
-
const tags = this._model;
|
|
493
|
-
// add tags on element
|
|
494
|
-
if (tags) {
|
|
495
|
-
for (const attr in tags) {
|
|
496
|
-
if (tags.hasOwnProperty(attr) && attr != this.INNER_HTML_ATTR) {
|
|
497
|
-
this._element.setAttribute(attr, tags[attr]);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
if (tags.hasOwnProperty(this.INNER_HTML_ATTR)) {
|
|
501
|
-
this._element.innerHTML = tags[this.INNER_HTML_ATTR];
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
else {
|
|
506
|
-
if (firstTime) {
|
|
507
|
-
this.registerEvent('initialized', function () {
|
|
508
|
-
self.setHtml();
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
else {
|
|
512
|
-
self.setHtml();
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
destroyEditor() {
|
|
518
|
-
if (this._editorInitialized) {
|
|
519
|
-
this._editor.destroy();
|
|
520
|
-
this._editorInitialized = false;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
getEditor() {
|
|
524
|
-
if (this._element) {
|
|
525
|
-
return this._editor;
|
|
526
|
-
}
|
|
527
|
-
return null;
|
|
528
|
-
}
|
|
529
|
-
// send manual editor initialization
|
|
530
|
-
generateManualController() {
|
|
531
|
-
const controls = {
|
|
532
|
-
initialize: this.createEditor.bind(this),
|
|
533
|
-
destroy: this.destroyEditor.bind(this),
|
|
534
|
-
getEditor: this.getEditor.bind(this),
|
|
535
|
-
};
|
|
536
|
-
this.froalaInit.emit(controls);
|
|
537
|
-
}
|
|
538
|
-
// TODO not sure if ngOnInit is executed after @inputs
|
|
539
|
-
ngAfterViewInit() {
|
|
540
|
-
// check if output froalaInit is present. Maybe observers is private and should not be used?? TODO how to better test that an output directive is present.
|
|
541
|
-
if (!this.froalaInit.observers.length) {
|
|
542
|
-
this.createEditor();
|
|
543
|
-
}
|
|
544
|
-
else {
|
|
545
|
-
this.generateManualController();
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
ngOnDestroy() {
|
|
549
|
-
this.destroyEditor();
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
SkFroalaEditorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkFroalaEditorDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
553
|
-
SkFroalaEditorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: SkFroalaEditorDirective, selector: "[froalaEditor]", inputs: { froalaEditor: "froalaEditor", froalaModel: "froalaModel" }, outputs: { froalaModelChange: "froalaModelChange", froalaInit: "froalaInit" }, providers: [{
|
|
554
|
-
provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SkFroalaEditorDirective),
|
|
555
|
-
multi: true
|
|
556
|
-
}], exportAs: ["froalaEditor"], ngImport: i0 });
|
|
557
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkFroalaEditorDirective, decorators: [{
|
|
558
|
-
type: Directive,
|
|
559
|
-
args: [{
|
|
560
|
-
selector: '[froalaEditor]',
|
|
561
|
-
exportAs: 'froalaEditor',
|
|
562
|
-
providers: [{
|
|
563
|
-
provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SkFroalaEditorDirective),
|
|
564
|
-
multi: true
|
|
565
|
-
}]
|
|
566
|
-
}]
|
|
567
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { froalaEditor: [{
|
|
568
|
-
type: Input
|
|
569
|
-
}], froalaModel: [{
|
|
570
|
-
type: Input
|
|
571
|
-
}], froalaModelChange: [{
|
|
572
|
-
type: Output
|
|
573
|
-
}], froalaInit: [{
|
|
574
|
-
type: Output
|
|
575
|
-
}] } });
|
|
576
|
-
|
|
577
|
-
class SkArticleEditorComponent {
|
|
578
|
-
constructor(_apiService, _articleService) {
|
|
579
|
-
this._apiService = _apiService;
|
|
580
|
-
this._articleService = _articleService;
|
|
581
|
-
this.toolbarType = 'default';
|
|
582
|
-
this._initOptions();
|
|
583
|
-
}
|
|
584
|
-
// -----------------------------------------------------------------------------------------------------
|
|
585
|
-
// @ Accessors
|
|
586
|
-
// ------------------------------------------1-----------------------------------------------------------
|
|
587
|
-
// -----------------------------------------------------------------------------------------------------
|
|
588
|
-
// @ Lifecycle hooks
|
|
589
|
-
// -----------------------------------------------------------------------------------------------------
|
|
590
|
-
ngOnInit() {
|
|
591
|
-
}
|
|
592
|
-
ngOnChanges(changes) {
|
|
593
|
-
this._initData();
|
|
594
|
-
this._initOptions();
|
|
595
|
-
}
|
|
596
|
-
// -----------------------------------------------------------------------------------------------------
|
|
597
|
-
// @ Public methods
|
|
598
|
-
// -----------------------------------------------------------------------------------------------------
|
|
599
|
-
getData() {
|
|
600
|
-
return { content: this.content, images: this.images };
|
|
601
|
-
}
|
|
602
|
-
// -----------------------------------------------------------------------------------------------------
|
|
603
|
-
// @ Private methods
|
|
604
|
-
// -----------------------------------------------------------------------------------------------------
|
|
605
|
-
_initData() {
|
|
606
|
-
if (!this.article) {
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
this.content = this.article.content;
|
|
610
|
-
this.images = this.article.images || [];
|
|
611
|
-
}
|
|
612
|
-
_initOptions() {
|
|
613
|
-
this.editorConfig = Object.assign({}, this._articleService.getBaseConfig(), Object.assign({ requestHeaders: {
|
|
614
|
-
'Authorization': 'Bearer ' + this._apiService.getToken(),
|
|
615
|
-
'ngsw-bypass': 'true'
|
|
616
|
-
}, imageUploadParams: {
|
|
617
|
-
imageUrl: this._articleService.environment.apiServer + '/api/public/images/'
|
|
618
|
-
}, imageUploadParam: 'file', imageUploadRemoteUrls: true, imageUploadURL: this._articleService.environment.apiServer + '/external/froala/upload', fileUploadParams: {
|
|
619
|
-
imageUrl: this._articleService.environment.apiServer + '/api/public/files/'
|
|
620
|
-
}, fileUploadParam: 'file', fileUploadURL: this._articleService.environment.apiServer + '/external/froala/upload', events: {
|
|
621
|
-
'image.inserted': ($img, response) => {
|
|
622
|
-
this._addImage(JSON.parse(response).file);
|
|
623
|
-
},
|
|
624
|
-
'image.removed': ($img) => {
|
|
625
|
-
console.log($img, $img.dataset);
|
|
626
|
-
for (let i = 0; i < $img.length; i++) {
|
|
627
|
-
this._removeImage(Number($img[i].dataset.id));
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
} }, this._articleService.getToolbar(this.toolbarType)));
|
|
631
|
-
}
|
|
632
|
-
_addImage(file) {
|
|
633
|
-
this.images.push(new SkFile(file));
|
|
634
|
-
}
|
|
635
|
-
_removeImage(id) {
|
|
636
|
-
const index = this.images.findIndex(value => value.id === id);
|
|
637
|
-
if (index > -1) {
|
|
638
|
-
this.images.splice(index, 1);
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
SkArticleEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleEditorComponent, deps: [{ token: i1.SkApiService }, { token: SkArticleService }], target: i0.ɵɵFactoryTarget.Component });
|
|
643
|
-
SkArticleEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: SkArticleEditorComponent, selector: "sk-article-editor", inputs: { article: "article", toolbarType: "toolbarType" }, usesOnChanges: true, ngImport: i0, template: "<div [froalaEditor]=\"editorConfig\" [(froalaModel)]=\"content\"></div>\n", styles: [":host{position:relative;display:block}\n"], dependencies: [{ kind: "directive", type: SkFroalaEditorDirective, selector: "[froalaEditor]", inputs: ["froalaEditor", "froalaModel"], outputs: ["froalaModelChange", "froalaInit"], exportAs: ["froalaEditor"] }] });
|
|
644
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleEditorComponent, decorators: [{
|
|
645
|
-
type: Component,
|
|
646
|
-
args: [{ selector: 'sk-article-editor', template: "<div [froalaEditor]=\"editorConfig\" [(froalaModel)]=\"content\"></div>\n", styles: [":host{position:relative;display:block}\n"] }]
|
|
647
|
-
}], ctorParameters: function () { return [{ type: i1.SkApiService }, { type: SkArticleService }]; }, propDecorators: { article: [{
|
|
648
|
-
type: Input
|
|
649
|
-
}], toolbarType: [{
|
|
650
|
-
type: Input
|
|
651
|
-
}] } });
|
|
652
|
-
|
|
653
|
-
class SkArticleModule {
|
|
654
|
-
}
|
|
655
|
-
SkArticleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
656
|
-
SkArticleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: SkArticleModule, declarations: [SkArticleEditorComponent,
|
|
657
|
-
SkFroalaEditorDirective], imports: [CommonModule], exports: [SkArticleEditorComponent,
|
|
658
|
-
SkFroalaEditorDirective] });
|
|
659
|
-
SkArticleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleModule, imports: [CommonModule] });
|
|
660
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleModule, decorators: [{
|
|
661
|
-
type: NgModule,
|
|
662
|
-
args: [{
|
|
663
|
-
declarations: [
|
|
664
|
-
SkArticleEditorComponent,
|
|
665
|
-
SkFroalaEditorDirective
|
|
666
|
-
],
|
|
667
|
-
imports: [
|
|
668
|
-
CommonModule
|
|
669
|
-
],
|
|
670
|
-
exports: [
|
|
671
|
-
SkArticleEditorComponent,
|
|
672
|
-
SkFroalaEditorDirective
|
|
673
|
-
],
|
|
674
|
-
providers: []
|
|
675
|
-
}]
|
|
676
|
-
}] });
|
|
677
|
-
|
|
678
|
-
class SkArticleEditorServerComponent {
|
|
679
|
-
constructor(_apiService) {
|
|
680
|
-
this._apiService = _apiService;
|
|
681
|
-
this.toolbarType = 'default';
|
|
682
|
-
this._initOptions();
|
|
683
|
-
}
|
|
684
|
-
// -----------------------------------------------------------------------------------------------------
|
|
685
|
-
// @ Accessors
|
|
686
|
-
// ------------------------------------------1-----------------------------------------------------------
|
|
687
|
-
// -----------------------------------------------------------------------------------------------------
|
|
688
|
-
// @ Lifecycle hooks
|
|
689
|
-
// -----------------------------------------------------------------------------------------------------
|
|
690
|
-
ngOnInit() {
|
|
691
|
-
}
|
|
692
|
-
ngOnChanges(changes) {
|
|
693
|
-
this._initData();
|
|
694
|
-
this._initOptions();
|
|
695
|
-
}
|
|
696
|
-
// -----------------------------------------------------------------------------------------------------
|
|
697
|
-
// @ Public methods
|
|
698
|
-
// -----------------------------------------------------------------------------------------------------
|
|
699
|
-
getData() {
|
|
700
|
-
return { content: this.content, images: this.images };
|
|
701
|
-
}
|
|
702
|
-
// -----------------------------------------------------------------------------------------------------
|
|
703
|
-
// @ Private methods
|
|
704
|
-
// -----------------------------------------------------------------------------------------------------
|
|
705
|
-
_initData() {
|
|
706
|
-
if (!this.article) {
|
|
707
|
-
return;
|
|
708
|
-
}
|
|
709
|
-
this.content = this.article.content;
|
|
710
|
-
this.images = this.article.images || [];
|
|
711
|
-
}
|
|
712
|
-
_initOptions() {
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
SkArticleEditorServerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleEditorServerComponent, deps: [{ token: i1.SkApiService }], target: i0.ɵɵFactoryTarget.Component });
|
|
716
|
-
SkArticleEditorServerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: SkArticleEditorServerComponent, selector: "sk-article-editor", inputs: { article: "article", toolbarType: "toolbarType" }, usesOnChanges: true, ngImport: i0, template: "<div>Server</div>\n", styles: [":host{position:relative;display:block}\n"] });
|
|
717
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleEditorServerComponent, decorators: [{
|
|
718
|
-
type: Component,
|
|
719
|
-
args: [{ selector: 'sk-article-editor', template: "<div>Server</div>\n", styles: [":host{position:relative;display:block}\n"] }]
|
|
720
|
-
}], ctorParameters: function () { return [{ type: i1.SkApiService }]; }, propDecorators: { article: [{
|
|
721
|
-
type: Input
|
|
722
|
-
}], toolbarType: [{
|
|
723
|
-
type: Input
|
|
724
|
-
}] } });
|
|
725
|
-
|
|
726
|
-
class SkArticleServerModule {
|
|
727
|
-
static forRoot(environment) {
|
|
728
|
-
return {
|
|
729
|
-
ngModule: SkArticleServerModule,
|
|
730
|
-
providers: []
|
|
731
|
-
};
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
SkArticleServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
735
|
-
SkArticleServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: SkArticleServerModule, declarations: [SkArticleEditorServerComponent], imports: [CommonModule], exports: [SkArticleEditorServerComponent] });
|
|
736
|
-
SkArticleServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleServerModule, imports: [CommonModule] });
|
|
737
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SkArticleServerModule, decorators: [{
|
|
738
|
-
type: NgModule,
|
|
739
|
-
args: [{
|
|
740
|
-
declarations: [
|
|
741
|
-
SkArticleEditorServerComponent,
|
|
742
|
-
],
|
|
743
|
-
imports: [
|
|
744
|
-
CommonModule
|
|
745
|
-
],
|
|
746
|
-
exports: [
|
|
747
|
-
SkArticleEditorServerComponent,
|
|
748
|
-
],
|
|
749
|
-
providers: []
|
|
750
|
-
}]
|
|
751
|
-
}] });
|
|
752
|
-
|
|
753
|
-
/**
|
|
754
|
-
* Generated bundle index. Do not edit.
|
|
755
|
-
*/
|
|
756
|
-
|
|
757
|
-
export { SkArticleEditorComponent, SkArticleEditorServerComponent, SkArticleModule, SkArticleServerModule, SkArticleService, SkFroalaEditorDirective };
|
|
758
|
-
//# sourceMappingURL=sk-front-lib-article.mjs.map
|