@_sh/strapi-plugin-ckeditor 1.0.7 → 1.1.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.
- package/README.md +172 -39
- package/admin/src/components/CKEditor/build/ckeditor.js +2 -2
- package/admin/src/components/CKEditor/build/ckeditor.js.map +1 -1
- package/admin/src/components/CKEditor/build/translations/ar.js +1 -1
- package/admin/src/components/CKEditor/build/translations/az.js +1 -1
- package/admin/src/components/CKEditor/build/translations/bs.js +1 -1
- package/admin/src/components/CKEditor/build/translations/ca.js +1 -1
- package/admin/src/components/CKEditor/build/translations/cs.js +1 -1
- package/admin/src/components/CKEditor/build/translations/da.js +1 -1
- package/admin/src/components/CKEditor/build/translations/de-ch.js +1 -1
- package/admin/src/components/CKEditor/build/translations/de.js +1 -1
- package/admin/src/components/CKEditor/build/translations/el.js +1 -1
- package/admin/src/components/CKEditor/build/translations/en-au.js +1 -1
- package/admin/src/components/CKEditor/build/translations/en-gb.js +1 -1
- package/admin/src/components/CKEditor/build/translations/es.js +1 -1
- package/admin/src/components/CKEditor/build/translations/et.js +1 -1
- package/admin/src/components/CKEditor/build/translations/fa.js +1 -1
- package/admin/src/components/CKEditor/build/translations/fi.js +1 -1
- package/admin/src/components/CKEditor/build/translations/fr.js +1 -1
- package/admin/src/components/CKEditor/build/translations/gl.js +1 -1
- package/admin/src/components/CKEditor/build/translations/he.js +1 -1
- package/admin/src/components/CKEditor/build/translations/hi.js +1 -1
- package/admin/src/components/CKEditor/build/translations/hr.js +1 -1
- package/admin/src/components/CKEditor/build/translations/hu.js +1 -1
- package/admin/src/components/CKEditor/build/translations/id.js +1 -1
- package/admin/src/components/CKEditor/build/translations/it.js +1 -1
- package/admin/src/components/CKEditor/build/translations/ja.js +1 -1
- package/admin/src/components/CKEditor/build/translations/jv.js +1 -1
- package/admin/src/components/CKEditor/build/translations/ko.js +1 -1
- package/admin/src/components/CKEditor/build/translations/ku.js +1 -1
- package/admin/src/components/CKEditor/build/translations/lt.js +1 -1
- package/admin/src/components/CKEditor/build/translations/lv.js +1 -1
- package/admin/src/components/CKEditor/build/translations/nb.js +1 -1
- package/admin/src/components/CKEditor/build/translations/ne.js +1 -1
- package/admin/src/components/CKEditor/build/translations/nl.js +1 -1
- package/admin/src/components/CKEditor/build/translations/no.js +1 -1
- package/admin/src/components/CKEditor/build/translations/pl.js +1 -1
- package/admin/src/components/CKEditor/build/translations/pt-br.js +1 -1
- package/admin/src/components/CKEditor/build/translations/pt.js +1 -1
- package/admin/src/components/CKEditor/build/translations/ro.js +1 -1
- package/admin/src/components/CKEditor/build/translations/ru.js +1 -1
- package/admin/src/components/CKEditor/build/translations/sk.js +1 -1
- package/admin/src/components/CKEditor/build/translations/sl.js +1 -1
- package/admin/src/components/CKEditor/build/translations/sq.js +1 -1
- package/admin/src/components/CKEditor/build/translations/sr-latn.js +1 -1
- package/admin/src/components/CKEditor/build/translations/sr.js +1 -1
- package/admin/src/components/CKEditor/build/translations/sv.js +1 -1
- package/admin/src/components/CKEditor/build/translations/th.js +1 -1
- package/admin/src/components/CKEditor/build/translations/tk.js +1 -1
- package/admin/src/components/CKEditor/build/translations/tr.js +1 -1
- package/admin/src/components/CKEditor/build/translations/ug.js +1 -1
- package/admin/src/components/CKEditor/build/translations/uk.js +1 -1
- package/admin/src/components/CKEditor/build/translations/uz.js +1 -1
- package/admin/src/components/CKEditor/build/translations/vi.js +1 -1
- package/admin/src/components/CKEditor/build/translations/zh-cn.js +1 -1
- package/admin/src/components/CKEditor/build/translations/zh.js +1 -1
- package/admin/src/components/CKEditor/index.js +140 -117
- package/admin/src/components/CKEditor/styles.js +12 -19
- package/admin/src/components/CKEditor/{theme-colors.css → theme.js} +65 -116
- package/package.json +7 -1
- package/assets/ckeditor5.png +0 -0
package/README.md
CHANGED
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
## <a id="features"></a>✨ Features
|
|
19
19
|
|
|
20
20
|
* **Lots of default plugins:** for styling text, images, tables and so on.
|
|
21
|
-
* **Font color picker:** choose
|
|
21
|
+
* **Font color picker:** choose color for font styling that's not defined in default palette.
|
|
22
22
|
* **Upload adapter for Strapi:** for upload images to your library when you drop an image into the editor.
|
|
23
23
|
* **Fullscreen mode button.**
|
|
24
24
|
* **Strapi media library button.**
|
|
25
25
|
* **Supports strapi theme swithing.**
|
|
26
26
|
* **Supports responsive images:** plugin adds srcset attribute to images based on their `formats` if responsive enable in strapi settings.
|
|
27
|
+
* **Language support:** you can set the preferred language for the UI or the content in the configuration, by default it will use the language defined in the user profile if that language [is supported](https://github.com/nshenderov/strapi-plugin-ckeditor/tree/master/admin/src/components/CKEditor/build/translations).
|
|
27
28
|
|
|
28
29
|
## <a id="installation"></a>🔧 Installation
|
|
29
30
|
|
|
@@ -62,23 +63,129 @@ or
|
|
|
62
63
|
yarn build
|
|
63
64
|
```
|
|
64
65
|
|
|
66
|
+
> 💡 `sizes` and `loading` attributes for image can be set in source mode.
|
|
67
|
+
> If you use default upload provider and you want prefix img url with api path you need to add `baseURL` in `api.js` file `(config/api.js)`
|
|
68
|
+
|
|
69
|
+
|
|
65
70
|
## <a id="configuration"></a>⚙️ Configuration
|
|
66
71
|
CKEditor config should be defined in `config.editor` field.
|
|
67
72
|
|
|
68
73
|
Learn more about configuration from [official documentation](https://ckeditor.com/docs/ckeditor5/latest/installation/getting-started/configuration.html).
|
|
69
74
|
|
|
75
|
+
<details>
|
|
76
|
+
<summary>(spoiler) <b>Built in plugins:</b> </summary>
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
plugins: [
|
|
80
|
+
StrapiUploadAdapter,
|
|
81
|
+
Alignment,
|
|
82
|
+
Autoformat,
|
|
83
|
+
AutoImage,
|
|
84
|
+
AutoLink,
|
|
85
|
+
Autosave,
|
|
86
|
+
BlockQuote,
|
|
87
|
+
Bold,
|
|
88
|
+
Code,
|
|
89
|
+
CodeBlock,
|
|
90
|
+
DataFilter,
|
|
91
|
+
DataSchema,
|
|
92
|
+
Essentials,
|
|
93
|
+
FindAndReplace,
|
|
94
|
+
FontBackgroundColor,
|
|
95
|
+
FontColor,
|
|
96
|
+
FontFamily,
|
|
97
|
+
FontSize,
|
|
98
|
+
GeneralHtmlSupport,
|
|
99
|
+
Heading,
|
|
100
|
+
HeadingButtonsUI,
|
|
101
|
+
ParagraphButtonUI,
|
|
102
|
+
Highlight,
|
|
103
|
+
HorizontalLine,
|
|
104
|
+
HtmlComment,
|
|
105
|
+
HtmlEmbed,
|
|
106
|
+
Image,
|
|
107
|
+
ImageCaption,
|
|
108
|
+
ImageInsert,
|
|
109
|
+
ImageResize,
|
|
110
|
+
ImageStyle,
|
|
111
|
+
ImageToolbar,
|
|
112
|
+
ImageUpload,
|
|
113
|
+
Indent,
|
|
114
|
+
IndentBlock,
|
|
115
|
+
Italic,
|
|
116
|
+
Link,
|
|
117
|
+
LinkImage,
|
|
118
|
+
List,
|
|
119
|
+
ListProperties,
|
|
120
|
+
MediaEmbed,
|
|
121
|
+
MediaEmbedToolbar,
|
|
122
|
+
Mention,
|
|
123
|
+
PageBreak,
|
|
124
|
+
Paragraph,
|
|
125
|
+
PasteFromOffice,
|
|
126
|
+
RemoveFormat,
|
|
127
|
+
SourceEditing,
|
|
128
|
+
SpecialCharacters,
|
|
129
|
+
SpecialCharactersArrows,
|
|
130
|
+
SpecialCharactersCurrency,
|
|
131
|
+
SpecialCharactersEssentials,
|
|
132
|
+
SpecialCharactersLatin,
|
|
133
|
+
SpecialCharactersMathematical,
|
|
134
|
+
SpecialCharactersText,
|
|
135
|
+
StandardEditingMode,
|
|
136
|
+
Strikethrough,
|
|
137
|
+
Subscript,
|
|
138
|
+
Superscript,
|
|
139
|
+
Table,
|
|
140
|
+
TableCaption,
|
|
141
|
+
TableCellProperties,
|
|
142
|
+
TableProperties,
|
|
143
|
+
TableToolbar,
|
|
144
|
+
TextPartLanguage,
|
|
145
|
+
TextTransformation,
|
|
146
|
+
TodoList,
|
|
147
|
+
Underline,
|
|
148
|
+
WordCount,
|
|
149
|
+
Markdown,
|
|
150
|
+
StrapiMediaLib,
|
|
151
|
+
FullScreen
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
</details>
|
|
157
|
+
|
|
70
158
|
**Default configuration:**
|
|
71
159
|
```js
|
|
72
160
|
// plugins.js
|
|
73
161
|
module.exports = () => {
|
|
74
|
-
|
|
162
|
+
return {
|
|
75
163
|
ckeditor: {
|
|
76
164
|
enabled: true,
|
|
77
165
|
config:{
|
|
78
166
|
plugin:{
|
|
79
|
-
|
|
167
|
+
// disable data-theme tag setting //
|
|
168
|
+
// setAttribute:false,
|
|
169
|
+
|
|
170
|
+
// disable strapi theme, will use default ckeditor theme //
|
|
171
|
+
// strapiTheme:false,
|
|
172
|
+
|
|
173
|
+
// styles applied to editor container (global scope) //
|
|
174
|
+
// styles:`
|
|
175
|
+
// :root{
|
|
176
|
+
// --ck-color-focus-border:red;
|
|
177
|
+
// --ck-color-text:red;
|
|
178
|
+
// }
|
|
179
|
+
// `
|
|
80
180
|
},
|
|
81
181
|
editor:{ // editor default config
|
|
182
|
+
|
|
183
|
+
// https://ckeditor.com/docs/ckeditor5/latest/features/markdown.html
|
|
184
|
+
// if you need markdown support and output set: removePlugins: [''],
|
|
185
|
+
// default is
|
|
186
|
+
removePlugins: ['Markdown'],
|
|
187
|
+
|
|
188
|
+
// https://ckeditor.com/docs/ckeditor5/latest/features/toolbar/toolbar.html
|
|
82
189
|
toolbar: {
|
|
83
190
|
items: [
|
|
84
191
|
'paragraph',
|
|
@@ -126,6 +233,7 @@ module.exports = () => {
|
|
|
126
233
|
'redo'
|
|
127
234
|
]
|
|
128
235
|
},
|
|
236
|
+
// https://ckeditor.com/docs/ckeditor5/latest/features/font.html
|
|
129
237
|
fontSize: {
|
|
130
238
|
options: [
|
|
131
239
|
9,
|
|
@@ -137,10 +245,6 @@ module.exports = () => {
|
|
|
137
245
|
21,
|
|
138
246
|
27,
|
|
139
247
|
35,
|
|
140
|
-
"tiny",
|
|
141
|
-
"small",
|
|
142
|
-
"big",
|
|
143
|
-
"huge"
|
|
144
248
|
],
|
|
145
249
|
supportAllValues: false
|
|
146
250
|
},
|
|
@@ -167,7 +271,9 @@ module.exports = () => {
|
|
|
167
271
|
columns: 5,
|
|
168
272
|
documentColors: 10,
|
|
169
273
|
},
|
|
170
|
-
language
|
|
274
|
+
// https://ckeditor.com/docs/ckeditor5/latest/features/ui-language.html
|
|
275
|
+
// default language: 'en',
|
|
276
|
+
// https://ckeditor.com/docs/ckeditor5/latest/features/images/images-overview.html
|
|
171
277
|
image: {
|
|
172
278
|
resizeUnit: "%",
|
|
173
279
|
resizeOptions: [ {
|
|
@@ -200,6 +306,7 @@ module.exports = () => {
|
|
|
200
306
|
'resizeImage:25', 'resizeImage:50', 'resizeImage:75', 'resizeImage:original'
|
|
201
307
|
]
|
|
202
308
|
},
|
|
309
|
+
// https://ckeditor.com/docs/ckeditor5/latest/features/table.html
|
|
203
310
|
table: {
|
|
204
311
|
contentToolbar: [
|
|
205
312
|
'tableColumn',
|
|
@@ -210,6 +317,7 @@ module.exports = () => {
|
|
|
210
317
|
'toggleTableCaption'
|
|
211
318
|
]
|
|
212
319
|
},
|
|
320
|
+
// https://ckeditor.com/docs/ckeditor5/latest/features/headings.html
|
|
213
321
|
heading: {
|
|
214
322
|
options: [
|
|
215
323
|
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
|
|
@@ -217,45 +325,45 @@ module.exports = () => {
|
|
|
217
325
|
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
|
|
218
326
|
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
|
|
219
327
|
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
|
|
220
|
-
{ model: 'heading5', view: 'h5', title: 'Heading 5', class: 'ck-heading_heading5' },
|
|
221
|
-
{ model: 'heading6', view: 'h6', title: 'Heading 6', class: 'ck-heading_heading6' },
|
|
222
|
-
{
|
|
223
|
-
model: 'h1b',
|
|
224
|
-
view: {name: 'h1', classes: 'ck-heading_h1_b'}, title: 'H1 (border)', class: 'ck-heading_heading1', converterPriority: 'high'
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
model: 'h2b',
|
|
228
|
-
view: {name: 'h2', classes: 'ck-heading_h2_b'}, title: 'H2 (border)', class: 'ck-heading_heading2', converterPriority: 'high'
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
model: 'h3b',
|
|
232
|
-
view: {name: 'h3', classes: 'ck-heading_h3_b'}, title: 'H3 (border)', class: 'ck-heading_heading3', converterPriority: 'high'
|
|
233
|
-
}
|
|
234
328
|
]
|
|
235
|
-
}
|
|
329
|
+
},
|
|
330
|
+
// https://ckeditor.com/docs/ckeditor5/latest/features/general-html-support.html
|
|
331
|
+
htmlSupport: {
|
|
332
|
+
allow: [
|
|
333
|
+
{
|
|
334
|
+
name: 'img',
|
|
335
|
+
attributes: {
|
|
336
|
+
sizes:true,
|
|
337
|
+
loading:true,
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
]
|
|
341
|
+
},
|
|
236
342
|
}
|
|
237
343
|
}
|
|
238
344
|
}
|
|
239
|
-
|
|
345
|
+
}
|
|
240
346
|
}
|
|
241
347
|
```
|
|
242
348
|
## <a id="themecustomization"></a>💅 Theme customization
|
|
243
|
-
If you want to customize editor styles you should define styles in `config.plugin.styles` field
|
|
349
|
+
If you want to customize editor styles you should define styles in `config.plugin.styles` field.
|
|
244
350
|
|
|
245
351
|
Since Strapi resets css styles, it needs some styles to revert back, these styles defined below, also check [official documentation](https://ckeditor.com/docs/ckeditor5/latest/installation/advanced/content-styles.html).
|
|
246
352
|
|
|
247
|
-
For theme colors switching this plugin uses css variables depending on html data-theme attribute, e.g. `html[data-theme='light']` or `html[data-theme='dark']`
|
|
353
|
+
For theme colors switching this plugin uses css variables depending on html data-theme attribute, e.g. `html[data-theme='light']` or `html[data-theme='dark']` you cand disable it by `setAttribute:false`
|
|
354
|
+
|
|
355
|
+
If you want default ckeditor theme you can set `strapiTheme:false`
|
|
248
356
|
|
|
249
|
-
|
|
357
|
+
More [info about ckeditor theming](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/deep-dive/ui/theme-customization.html)
|
|
250
358
|
|
|
251
|
-
[**👔 Default styles**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/CKEditor/styles.js
|
|
359
|
+
[**👔 Default styles**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/CKEditor/styles.js)
|
|
252
360
|
|
|
253
|
-
[**🎨 Default
|
|
361
|
+
[**🎨 Default theme**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/CKEditor/theme.js)
|
|
254
362
|
|
|
255
363
|
**Example of customization:**
|
|
256
364
|
```js
|
|
257
365
|
// plugins.js
|
|
258
|
-
const
|
|
366
|
+
const styles = require('./styles.js')
|
|
259
367
|
|
|
260
368
|
module.exports = () => {
|
|
261
369
|
return {
|
|
@@ -263,10 +371,31 @@ module.exports = () => {
|
|
|
263
371
|
enabled: true,
|
|
264
372
|
config:{
|
|
265
373
|
plugin:{
|
|
266
|
-
//
|
|
374
|
+
// disable data-theme tag setting //
|
|
375
|
+
// setAttribute:false,
|
|
376
|
+
|
|
377
|
+
// disable strapi theme, will use default ckeditor theme //
|
|
378
|
+
// strapiTheme:false,
|
|
379
|
+
|
|
380
|
+
// styles applied to editor container, e.g:
|
|
267
381
|
styles:`
|
|
268
|
-
${
|
|
269
|
-
|
|
382
|
+
${styles()}
|
|
383
|
+
.ck-editor__styled__container{
|
|
384
|
+
background:red;
|
|
385
|
+
}
|
|
386
|
+
html[data-theme='light'] {
|
|
387
|
+
--ck-scroll-track-background:red;
|
|
388
|
+
--ck-scroll-thumb-background:red;
|
|
389
|
+
--ck-scroll-thumb-border-color:red;
|
|
390
|
+
--ck-scroll-thumb-hover-background:red;
|
|
391
|
+
--ck-scroll-thumb-active-background:red;
|
|
392
|
+
--ck-color-base-border: red;
|
|
393
|
+
--ck-color-base-background:red;
|
|
394
|
+
--ck-custom-background: red;
|
|
395
|
+
--ck-custom-foreground: red;
|
|
396
|
+
--ck-custom-border: red;
|
|
397
|
+
--ck-custom-white: red;
|
|
398
|
+
}
|
|
270
399
|
`
|
|
271
400
|
},
|
|
272
401
|
// editor default config
|
|
@@ -279,17 +408,21 @@ module.exports = () => {
|
|
|
279
408
|
}
|
|
280
409
|
|
|
281
410
|
// styles.js
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
411
|
+
const styles = () =>`
|
|
412
|
+
.ck.ck-editor__main .ck-blurred{
|
|
413
|
+
max-height: 200px;
|
|
414
|
+
}
|
|
415
|
+
.ck.ck-editor__main .ck-focused{
|
|
416
|
+
max-height: 500px;
|
|
417
|
+
}
|
|
418
|
+
`
|
|
419
|
+
module.exports = styles;
|
|
287
420
|
```
|
|
288
421
|
|
|
289
422
|
## <a id="requirements"></a>⚠️ Requirements
|
|
290
423
|
Strapi **v4**
|
|
291
424
|
|
|
292
|
-
Tested on **v4.18 - 4.
|
|
425
|
+
Tested on **v4.18 - 4.1.11**
|
|
293
426
|
|
|
294
427
|
## <a id="thanks"></a>👍 This build includes some useful plugins based on these repos so thanks to them:
|
|
295
428
|
https://github.com/Roslovets-Inc/strapi-plugin-ckeditor5
|