@_sh/strapi-plugin-ckeditor 1.0.9 → 1.1.2
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 +602 -106
- 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/af.js +1 -1
- package/admin/src/components/CKEditor/build/translations/ar.js +1 -1
- package/admin/src/components/CKEditor/build/translations/ast.js +1 -1
- package/admin/src/components/CKEditor/build/translations/az.js +1 -1
- package/admin/src/components/CKEditor/build/translations/bg.js +1 -1
- package/admin/src/components/CKEditor/build/translations/bn.js +1 -0
- 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/eo.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/eu.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/gu.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/km.js +1 -1
- package/admin/src/components/CKEditor/build/translations/kn.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/ms.js +1 -0
- 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/oc.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/si.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/tt.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/ur.js +1 -0
- 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 +165 -140
- package/admin/src/components/CKEditor/styles.js +12 -62
- package/admin/src/components/CKEditor/theme.js +313 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
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.
|
|
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). i18 also supported.
|
|
28
28
|
|
|
29
29
|
## <a id="installation"></a>🔧 Installation
|
|
30
30
|
|
|
@@ -63,8 +63,18 @@ or
|
|
|
63
63
|
yarn build
|
|
64
64
|
```
|
|
65
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
|
+
|
|
66
70
|
## <a id="configuration"></a>⚙️ Configuration
|
|
67
|
-
CKEditor config should be defined in `config.editor` field.
|
|
71
|
+
CKEditor config should be defined in `config.editor` field in `plugins.js` file.
|
|
72
|
+
|
|
73
|
+
**⚠️ `plugins.js` not `plugin.js` ⚠️**
|
|
74
|
+
|
|
75
|
+
**`plugins.js` file should be placed in `config` folder.**
|
|
76
|
+
|
|
77
|
+
**💡`fullscreen mode` and `source mode` not supported with `balloon` and `block` toolbars.**
|
|
68
78
|
|
|
69
79
|
Learn more about configuration from [official documentation](https://ckeditor.com/docs/ckeditor5/latest/installation/getting-started/configuration.html).
|
|
70
80
|
|
|
@@ -81,7 +91,6 @@ AutoLink,
|
|
|
81
91
|
Autosave,
|
|
82
92
|
BlockQuote,
|
|
83
93
|
Bold,
|
|
84
|
-
CloudServices,
|
|
85
94
|
Code,
|
|
86
95
|
CodeBlock,
|
|
87
96
|
DataFilter,
|
|
@@ -145,7 +154,10 @@ Underline,
|
|
|
145
154
|
WordCount,
|
|
146
155
|
Markdown,
|
|
147
156
|
StrapiMediaLib,
|
|
148
|
-
FullScreen
|
|
157
|
+
FullScreen,
|
|
158
|
+
BlockToolbar,
|
|
159
|
+
BalloonToolbar,
|
|
160
|
+
Style
|
|
149
161
|
]
|
|
150
162
|
|
|
151
163
|
```
|
|
@@ -156,17 +168,35 @@ FullScreen
|
|
|
156
168
|
```js
|
|
157
169
|
// plugins.js
|
|
158
170
|
module.exports = () => {
|
|
159
|
-
|
|
171
|
+
return {
|
|
160
172
|
ckeditor: {
|
|
161
173
|
enabled: true,
|
|
162
174
|
config:{
|
|
163
175
|
plugin:{
|
|
164
|
-
|
|
176
|
+
// disable data-theme tag setting //
|
|
177
|
+
// setAttribute:false,
|
|
178
|
+
|
|
179
|
+
// disable strapi theme, will use default ckeditor theme //
|
|
180
|
+
// strapiTheme:false,
|
|
181
|
+
|
|
182
|
+
// styles applied to editor container (global scope) //
|
|
183
|
+
// styles:`
|
|
184
|
+
// .ck.ck-editor__main .ck-focused{
|
|
185
|
+
// max-height: 700px;
|
|
186
|
+
// }
|
|
187
|
+
// :root{
|
|
188
|
+
// --ck-color-focus-border:red;
|
|
189
|
+
// --ck-color-text:red;
|
|
190
|
+
// }
|
|
191
|
+
// `
|
|
165
192
|
},
|
|
166
193
|
editor:{ // editor default config
|
|
194
|
+
|
|
167
195
|
// https://ckeditor.com/docs/ckeditor5/latest/features/markdown.html
|
|
168
|
-
// if you need markdown support and output set
|
|
169
|
-
// default is
|
|
196
|
+
// if you need markdown support and output set: removePlugins: [''],
|
|
197
|
+
// default is
|
|
198
|
+
// removePlugins: ['Markdown'],
|
|
199
|
+
|
|
170
200
|
// https://ckeditor.com/docs/ckeditor5/latest/features/toolbar/toolbar.html
|
|
171
201
|
toolbar: {
|
|
172
202
|
items: [
|
|
@@ -227,10 +257,6 @@ module.exports = () => {
|
|
|
227
257
|
21,
|
|
228
258
|
27,
|
|
229
259
|
35,
|
|
230
|
-
"tiny",
|
|
231
|
-
"small",
|
|
232
|
-
"big",
|
|
233
|
-
"huge"
|
|
234
260
|
],
|
|
235
261
|
supportAllValues: false
|
|
236
262
|
},
|
|
@@ -311,111 +337,554 @@ module.exports = () => {
|
|
|
311
337
|
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
|
|
312
338
|
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
|
|
313
339
|
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
|
|
314
|
-
{ model: 'heading5', view: 'h5', title: 'Heading 5', class: 'ck-heading_heading5' },
|
|
315
|
-
{ model: 'heading6', view: 'h6', title: 'Heading 6', class: 'ck-heading_heading6' },
|
|
316
|
-
{
|
|
317
|
-
model: 'h1b',
|
|
318
|
-
view: {name: 'h1', classes: 'ck-heading_h1_b'},
|
|
319
|
-
title: 'H1 (border)',
|
|
320
|
-
class: 'ck-heading_heading1',
|
|
321
|
-
converterPriority: 'high'
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
model: 'h2b',
|
|
325
|
-
view: {name: 'h2', classes: 'ck-heading_h2_b'},
|
|
326
|
-
title: 'H2 (border)',
|
|
327
|
-
class: 'ck-heading_heading2',
|
|
328
|
-
converterPriority: 'high'
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
model: 'h3b',
|
|
332
|
-
view: {name: 'h3', classes: 'ck-heading_h3_b'},
|
|
333
|
-
title: 'H3 (border)',
|
|
334
|
-
class: 'ck-heading_heading3',
|
|
335
|
-
converterPriority: 'high'
|
|
336
|
-
},
|
|
337
|
-
{ model: 'custom',
|
|
338
|
-
view: {name: 'custom', classes: 'Heading 1'},
|
|
339
|
-
title: 'custom',
|
|
340
|
-
class: 'ck-heading_heading3',
|
|
341
|
-
converterPriority: 'high'
|
|
342
|
-
}
|
|
343
340
|
]
|
|
344
341
|
},
|
|
345
342
|
// https://ckeditor.com/docs/ckeditor5/latest/features/general-html-support.html
|
|
346
|
-
//
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
343
|
+
// Regular expressions (/.*/ /^(p|h[2-4])$/' etc) for htmlSupport does not allowed in this config
|
|
344
|
+
htmlSupport: {
|
|
345
|
+
allow: [
|
|
346
|
+
{
|
|
347
|
+
name: 'img',
|
|
348
|
+
attributes: {
|
|
349
|
+
sizes:true,
|
|
350
|
+
loading:true,
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
**Some of configuration:**
|
|
362
|
+
|
|
363
|
+
<h3 align="center">Balloon+Block+Style</h3>
|
|
364
|
+
|
|
365
|
+
<p align="center">
|
|
366
|
+
<img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/balloonblockstyles.gif" alt="CKEditor5-Strapi" width="800" />
|
|
367
|
+
</p>
|
|
368
|
+
|
|
369
|
+
<details>
|
|
370
|
+
<summary><b>Balloon+Block+Style config:</b> </summary>
|
|
371
|
+
|
|
372
|
+
```js
|
|
373
|
+
module.exports = () => {
|
|
374
|
+
return {
|
|
375
|
+
ckeditor: {
|
|
376
|
+
enabled: true,
|
|
377
|
+
config:{
|
|
378
|
+
plugin:{
|
|
379
|
+
styles:`
|
|
380
|
+
.ck-content{
|
|
381
|
+
border-radius:4px !important;
|
|
382
|
+
}
|
|
383
|
+
.ck-sticky-panel{
|
|
384
|
+
display:none !important;
|
|
385
|
+
}
|
|
387
386
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
387
|
+
.ck.ck-content h3.category {
|
|
388
|
+
font-family: 'Bebas Neue';
|
|
389
|
+
font-size: 20px;
|
|
390
|
+
font-weight: bold;
|
|
391
|
+
color: #d1d1d1;
|
|
392
|
+
letter-spacing: 10px;
|
|
393
|
+
margin: 0;
|
|
394
|
+
padding: 0;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.ck.ck-content h2.document-title {
|
|
398
|
+
font-family: 'Bebas Neue';
|
|
399
|
+
font-size: 50px;
|
|
400
|
+
font-weight: bold;
|
|
401
|
+
margin: 0;
|
|
402
|
+
padding: 0;
|
|
403
|
+
border: 0;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.ck.ck-content h3.document-subtitle {
|
|
407
|
+
font-size: 20px;
|
|
408
|
+
color: #e91e63;
|
|
409
|
+
margin: 0 0 1em;
|
|
410
|
+
font-weight: normal;
|
|
411
|
+
padding: 0;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.ck.ck-content p.info-box {
|
|
415
|
+
--background-size: 30px;
|
|
416
|
+
--background-color: #e91e63;
|
|
417
|
+
padding: 1.2em 2em;
|
|
418
|
+
border: 1px solid var(--background-color);
|
|
419
|
+
background: linear-gradient(135deg, var(--background-color) 0%, var(--background-color) var(--background-size), transparent var(--background-size)), linear-gradient(135deg, transparent calc(100% - var(--background-size)), var(--background-color) calc(100% - var(--background-size)), var(--background-color));
|
|
420
|
+
border-radius: 10px;
|
|
421
|
+
margin: 1.5em 2em;
|
|
422
|
+
box-shadow: 5px 5px 0 #ffe6ef;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.ck.ck-content blockquote.side-quote {
|
|
426
|
+
font-family: 'Bebas Neue';
|
|
427
|
+
font-style: normal;
|
|
428
|
+
float: right;
|
|
429
|
+
width: 35%;
|
|
430
|
+
position: relative;
|
|
431
|
+
border: 0;
|
|
432
|
+
overflow: visible;
|
|
433
|
+
z-index: 1;
|
|
434
|
+
margin-left: 1em;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.ck.ck-content blockquote.side-quote::before {
|
|
438
|
+
content: "“";
|
|
439
|
+
position: absolute;
|
|
440
|
+
top: -37px;
|
|
441
|
+
left: -10px;
|
|
442
|
+
display: block;
|
|
443
|
+
font-size: 200px;
|
|
444
|
+
color: #e7e7e7;
|
|
445
|
+
z-index: -1;
|
|
446
|
+
line-height: 1;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.ck.ck-content blockquote.side-quote p {
|
|
450
|
+
font-size: 2em;
|
|
451
|
+
line-height: 1;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.ck.ck-content blockquote.side-quote p:last-child:not(:first-child) {
|
|
455
|
+
font-size: 1.3em;
|
|
456
|
+
text-align: right;
|
|
457
|
+
color: #555;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.ck.ck-content span.marker {
|
|
461
|
+
background: yellow;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.ck.ck-content span.spoiler {
|
|
465
|
+
background: #000;
|
|
466
|
+
color: #000;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.ck.ck-content span.spoiler:hover {
|
|
470
|
+
background: #000;
|
|
471
|
+
color: #fff;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.ck.ck-content pre.fancy-code {
|
|
475
|
+
border: 0;
|
|
476
|
+
margin-left: 2em;
|
|
477
|
+
margin-right: 2em;
|
|
478
|
+
border-radius: 10px;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.ck.ck-content pre.fancy-code::before {
|
|
482
|
+
content: "";
|
|
483
|
+
display: block;
|
|
484
|
+
height: 13px;
|
|
485
|
+
background: url(data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1NCAxMyI+CiAgPGNpcmNsZSBjeD0iNi41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiNGMzZCNUMiLz4KICA8Y2lyY2xlIGN4PSIyNi41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiNGOUJFNEQiLz4KICA8Y2lyY2xlIGN4PSI0Ny41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiM1NkM0NTMiLz4KPC9zdmc+Cg==);
|
|
486
|
+
margin-bottom: 8px;
|
|
487
|
+
background-repeat: no-repeat;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.ck.ck-content pre.fancy-code-dark {
|
|
491
|
+
background: #272822;
|
|
492
|
+
color: #fff;
|
|
493
|
+
box-shadow: 5px 5px 0 #0000001f;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.ck.ck-content pre.fancy-code-bright {
|
|
497
|
+
background: #dddfe0;
|
|
498
|
+
color: #000;
|
|
499
|
+
box-shadow: 5px 5px 0 #b3b3b3;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
`
|
|
503
|
+
},
|
|
504
|
+
editor:{
|
|
505
|
+
toolbar:[],
|
|
506
|
+
// https://ckeditor.com/docs/ckeditor5/latest/features/toolbar/blocktoolbar.html
|
|
507
|
+
blockToolbar: {
|
|
508
|
+
items: [
|
|
509
|
+
'heading','style',
|
|
510
|
+
'|',
|
|
511
|
+
'outdent',
|
|
512
|
+
'indent',
|
|
513
|
+
'horizontalLine',
|
|
514
|
+
'|',
|
|
515
|
+
'StrapiMediaLib',
|
|
516
|
+
'-',
|
|
517
|
+
'bulletedList', 'numberedList',
|
|
518
|
+
'|',
|
|
519
|
+
'insertTable', 'blockQuote',
|
|
520
|
+
'|',
|
|
521
|
+
'code'
|
|
522
|
+
],
|
|
523
|
+
},
|
|
524
|
+
balloonToolbar: [
|
|
525
|
+
'bold',
|
|
526
|
+
'italic',
|
|
527
|
+
'fontColor',
|
|
528
|
+
'FontBackgroundColor',
|
|
529
|
+
'fontFamily',
|
|
530
|
+
'fontSize',
|
|
531
|
+
'alignment',
|
|
532
|
+
'|',
|
|
533
|
+
'removeFormat',
|
|
534
|
+
'undo',
|
|
535
|
+
'redo'
|
|
536
|
+
],
|
|
537
|
+
// https://ckeditor.com/docs/ckeditor5/latest/features/style.html
|
|
538
|
+
style: {
|
|
539
|
+
definitions: [
|
|
540
|
+
{
|
|
541
|
+
name: 'Article category',
|
|
542
|
+
element: 'h3',
|
|
543
|
+
classes: [ 'category' ]
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
name: 'Title',
|
|
547
|
+
element: 'h2',
|
|
548
|
+
classes: [ 'document-title' ]
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
name: 'Subtitle',
|
|
552
|
+
element: 'h3',
|
|
553
|
+
classes: [ 'document-subtitle' ]
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
name: 'Info box',
|
|
557
|
+
element: 'p',
|
|
558
|
+
classes: [ 'info-box' ]
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
name: 'Side quote',
|
|
562
|
+
element: 'blockquote',
|
|
563
|
+
classes: [ 'side-quote' ]
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
name: 'Marker',
|
|
567
|
+
element: 'span',
|
|
568
|
+
classes: [ 'marker' ]
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
name: 'Spoiler',
|
|
572
|
+
element: 'span',
|
|
573
|
+
classes: [ 'spoiler' ]
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
name: 'Code (dark)',
|
|
577
|
+
element: 'pre',
|
|
578
|
+
classes: [ 'fancy-code', 'fancy-code-dark' ]
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
name: 'Code (bright)',
|
|
582
|
+
element: 'pre',
|
|
583
|
+
classes: [ 'fancy-code', 'fancy-code-bright' ]
|
|
584
|
+
}
|
|
585
|
+
]
|
|
586
|
+
},
|
|
587
|
+
fontSize: {
|
|
588
|
+
options: [
|
|
589
|
+
9,
|
|
590
|
+
11,
|
|
591
|
+
13,
|
|
592
|
+
'default',
|
|
593
|
+
17,
|
|
594
|
+
19,
|
|
595
|
+
21,
|
|
596
|
+
27,
|
|
597
|
+
35,
|
|
598
|
+
],
|
|
599
|
+
supportAllValues: false
|
|
600
|
+
},
|
|
601
|
+
fontFamily: {
|
|
602
|
+
options: [
|
|
603
|
+
'default',
|
|
604
|
+
'Arial, Helvetica Neue, Helvetica, Source Sans Pro, sans-serif',
|
|
605
|
+
'Courier New, Courier, monospace',
|
|
606
|
+
'Georgia, serif',
|
|
607
|
+
'Lucida Sans Unicode, Lucida Grande, sans-serif',
|
|
608
|
+
'Tahoma, Geneva, sans-serif',
|
|
609
|
+
'Times New Roman, Times, serif',
|
|
610
|
+
'Trebuchet MS, Helvetica, sans-serif',
|
|
611
|
+
'Verdana, Geneva, sans-serif',
|
|
612
|
+
'Roboto, Roboto Black, Roboto Medium, Roboto Light, sans-serif',
|
|
613
|
+
],
|
|
614
|
+
supportAllValues: true
|
|
615
|
+
},
|
|
616
|
+
fontColor: {
|
|
617
|
+
columns: 5,
|
|
618
|
+
documentColors: 10,
|
|
619
|
+
},
|
|
620
|
+
fontBackgroundColor: {
|
|
621
|
+
columns: 5,
|
|
622
|
+
documentColors: 10,
|
|
623
|
+
},
|
|
624
|
+
image: {
|
|
625
|
+
resizeUnit: "%",
|
|
626
|
+
resizeOptions: [ {
|
|
627
|
+
name: 'resizeImage:original',
|
|
628
|
+
value: null,
|
|
629
|
+
icon: 'original'
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
name: 'resizeImage:25',
|
|
633
|
+
value: '25',
|
|
634
|
+
icon: 'small'
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
name: 'resizeImage:50',
|
|
638
|
+
value: '50',
|
|
639
|
+
icon: 'medium'
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
name: 'resizeImage:75',
|
|
643
|
+
value: '75',
|
|
644
|
+
icon: 'large'
|
|
645
|
+
} ],
|
|
646
|
+
toolbar: [
|
|
647
|
+
'toggleImageCaption',
|
|
648
|
+
'imageTextAlternative',
|
|
649
|
+
'imageStyle:inline',
|
|
650
|
+
'imageStyle:block',
|
|
651
|
+
'imageStyle:side',
|
|
652
|
+
'linkImage',
|
|
653
|
+
'resizeImage:25', 'resizeImage:50', 'resizeImage:75', 'resizeImage:original'
|
|
654
|
+
]
|
|
655
|
+
},
|
|
656
|
+
table: {
|
|
657
|
+
contentToolbar: [
|
|
658
|
+
'tableColumn',
|
|
659
|
+
'tableRow',
|
|
660
|
+
'mergeTableCells',
|
|
661
|
+
'tableCellProperties',
|
|
662
|
+
'tableProperties',
|
|
663
|
+
'toggleTableCaption'
|
|
664
|
+
]
|
|
665
|
+
},
|
|
666
|
+
heading: {
|
|
667
|
+
options: [
|
|
668
|
+
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
|
|
669
|
+
{ model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
|
|
670
|
+
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
|
|
671
|
+
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
|
|
672
|
+
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
|
|
673
|
+
]
|
|
674
|
+
},
|
|
675
|
+
htmlSupport: {
|
|
676
|
+
allow: [
|
|
677
|
+
{
|
|
678
|
+
name: 'img',
|
|
679
|
+
attributes: {
|
|
680
|
+
sizes:true,
|
|
681
|
+
loading:true,
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
]
|
|
685
|
+
},
|
|
396
686
|
}
|
|
397
687
|
}
|
|
398
688
|
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
```
|
|
693
|
+
</details>
|
|
694
|
+
|
|
695
|
+
<h3 align="center">Classic+Balloon</h3>
|
|
696
|
+
|
|
697
|
+
<p align="center">
|
|
698
|
+
<img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/230222.jpg" alt="CKEditor5-Strapi" width="800" />
|
|
699
|
+
</p>
|
|
700
|
+
|
|
701
|
+
<details>
|
|
702
|
+
<summary><b>Classic+Balloon config:</b> </summary>
|
|
703
|
+
|
|
704
|
+
```js
|
|
705
|
+
module.exports = () => {
|
|
706
|
+
return {
|
|
707
|
+
ckeditor: {
|
|
708
|
+
enabled: true,
|
|
709
|
+
config:{
|
|
710
|
+
editor:{
|
|
711
|
+
toolbar: {
|
|
712
|
+
items: [
|
|
713
|
+
'paragraph',
|
|
714
|
+
'heading1',
|
|
715
|
+
'heading2',
|
|
716
|
+
'|',
|
|
717
|
+
'bulletedList',
|
|
718
|
+
'todoList',
|
|
719
|
+
'numberedList',
|
|
720
|
+
'|',
|
|
721
|
+
'outdent',
|
|
722
|
+
'indent',
|
|
723
|
+
'horizontalLine',
|
|
724
|
+
'|',
|
|
725
|
+
'StrapiMediaLib',
|
|
726
|
+
'insertTable',
|
|
727
|
+
'blockQuote',
|
|
728
|
+
'mediaEmbed',
|
|
729
|
+
'link',
|
|
730
|
+
'highlight',
|
|
731
|
+
'|',
|
|
732
|
+
'htmlEmbed',
|
|
733
|
+
'sourceEditing',
|
|
734
|
+
'code',
|
|
735
|
+
'codeBlock',
|
|
736
|
+
'|',
|
|
737
|
+
'subscript',
|
|
738
|
+
'superscript',
|
|
739
|
+
'strikethrough',
|
|
740
|
+
'specialCharacters',
|
|
741
|
+
'|',
|
|
742
|
+
'heading',
|
|
743
|
+
"fullScreen",
|
|
744
|
+
'undo',
|
|
745
|
+
'redo'
|
|
746
|
+
]
|
|
747
|
+
},
|
|
748
|
+
balloonToolbar: [
|
|
749
|
+
'bold',
|
|
750
|
+
'italic',
|
|
751
|
+
'fontColor',
|
|
752
|
+
'FontBackgroundColor',
|
|
753
|
+
'fontFamily',
|
|
754
|
+
'fontSize',
|
|
755
|
+
'alignment',
|
|
756
|
+
'|',
|
|
757
|
+
'removeFormat',
|
|
758
|
+
'undo',
|
|
759
|
+
'redo'
|
|
760
|
+
],
|
|
761
|
+
fontSize: {
|
|
762
|
+
options: [
|
|
763
|
+
9,
|
|
764
|
+
11,
|
|
765
|
+
13,
|
|
766
|
+
'default',
|
|
767
|
+
17,
|
|
768
|
+
19,
|
|
769
|
+
21,
|
|
770
|
+
27,
|
|
771
|
+
35,
|
|
772
|
+
],
|
|
773
|
+
supportAllValues: false
|
|
774
|
+
},
|
|
775
|
+
fontFamily: {
|
|
776
|
+
options: [
|
|
777
|
+
'default',
|
|
778
|
+
'Arial, Helvetica Neue, Helvetica, Source Sans Pro, sans-serif',
|
|
779
|
+
'Courier New, Courier, monospace',
|
|
780
|
+
'Georgia, serif',
|
|
781
|
+
'Lucida Sans Unicode, Lucida Grande, sans-serif',
|
|
782
|
+
'Tahoma, Geneva, sans-serif',
|
|
783
|
+
'Times New Roman, Times, serif',
|
|
784
|
+
'Trebuchet MS, Helvetica, sans-serif',
|
|
785
|
+
'Verdana, Geneva, sans-serif',
|
|
786
|
+
'Roboto, Roboto Black, Roboto Medium, Roboto Light, sans-serif',
|
|
787
|
+
],
|
|
788
|
+
supportAllValues: true
|
|
789
|
+
},
|
|
790
|
+
fontColor: {
|
|
791
|
+
columns: 5,
|
|
792
|
+
documentColors: 10,
|
|
793
|
+
},
|
|
794
|
+
fontBackgroundColor: {
|
|
795
|
+
columns: 5,
|
|
796
|
+
documentColors: 10,
|
|
797
|
+
},
|
|
798
|
+
image: {
|
|
799
|
+
resizeUnit: "%",
|
|
800
|
+
resizeOptions: [ {
|
|
801
|
+
name: 'resizeImage:original',
|
|
802
|
+
value: null,
|
|
803
|
+
icon: 'original'
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
name: 'resizeImage:25',
|
|
807
|
+
value: '25',
|
|
808
|
+
icon: 'small'
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
name: 'resizeImage:50',
|
|
812
|
+
value: '50',
|
|
813
|
+
icon: 'medium'
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
name: 'resizeImage:75',
|
|
817
|
+
value: '75',
|
|
818
|
+
icon: 'large'
|
|
819
|
+
} ],
|
|
820
|
+
toolbar: [
|
|
821
|
+
'toggleImageCaption',
|
|
822
|
+
'imageTextAlternative',
|
|
823
|
+
'imageStyle:inline',
|
|
824
|
+
'imageStyle:block',
|
|
825
|
+
'imageStyle:side',
|
|
826
|
+
'linkImage',
|
|
827
|
+
'resizeImage:25', 'resizeImage:50', 'resizeImage:75', 'resizeImage:original'
|
|
828
|
+
]
|
|
829
|
+
},
|
|
830
|
+
table: {
|
|
831
|
+
contentToolbar: [
|
|
832
|
+
'tableColumn',
|
|
833
|
+
'tableRow',
|
|
834
|
+
'mergeTableCells',
|
|
835
|
+
'tableCellProperties',
|
|
836
|
+
'tableProperties',
|
|
837
|
+
'toggleTableCaption'
|
|
838
|
+
]
|
|
839
|
+
},
|
|
840
|
+
heading: {
|
|
841
|
+
options: [
|
|
842
|
+
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
|
|
843
|
+
{ model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
|
|
844
|
+
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
|
|
845
|
+
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
|
|
846
|
+
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
|
|
847
|
+
]
|
|
848
|
+
},
|
|
849
|
+
htmlSupport: {
|
|
850
|
+
allow: [
|
|
851
|
+
{
|
|
852
|
+
name: 'img',
|
|
853
|
+
attributes: {
|
|
854
|
+
sizes:true,
|
|
855
|
+
loading:true,
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
]
|
|
859
|
+
},
|
|
860
|
+
}
|
|
861
|
+
}
|
|
399
862
|
}
|
|
863
|
+
}
|
|
400
864
|
}
|
|
865
|
+
|
|
401
866
|
```
|
|
867
|
+
</details>
|
|
868
|
+
|
|
402
869
|
## <a id="themecustomization"></a>💅 Theme customization
|
|
403
|
-
If you want to customize editor styles you should define styles in `config.plugin.styles` field
|
|
870
|
+
If you want to customize editor styles you should define styles in `config.plugin.styles` field.
|
|
404
871
|
|
|
405
872
|
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).
|
|
406
873
|
|
|
407
|
-
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']`
|
|
874
|
+
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`
|
|
875
|
+
|
|
876
|
+
If you want default ckeditor theme you can set `strapiTheme:false`
|
|
408
877
|
|
|
409
|
-
|
|
878
|
+
More [info about ckeditor theming](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/deep-dive/ui/theme-customization.html)
|
|
410
879
|
|
|
411
|
-
[**👔 Default styles**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/CKEditor/styles.js
|
|
880
|
+
[**👔 Default styles**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/CKEditor/styles.js)
|
|
412
881
|
|
|
413
|
-
[**🎨 Default
|
|
882
|
+
[**🎨 Default theme**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/CKEditor/theme.js)
|
|
414
883
|
|
|
415
884
|
**Example of customization:**
|
|
416
885
|
```js
|
|
417
886
|
// plugins.js
|
|
418
|
-
const
|
|
887
|
+
const styles = require('./styles.js')
|
|
419
888
|
|
|
420
889
|
module.exports = () => {
|
|
421
890
|
return {
|
|
@@ -423,10 +892,31 @@ module.exports = () => {
|
|
|
423
892
|
enabled: true,
|
|
424
893
|
config:{
|
|
425
894
|
plugin:{
|
|
426
|
-
//
|
|
895
|
+
// disable data-theme tag setting //
|
|
896
|
+
// setAttribute:false,
|
|
897
|
+
|
|
898
|
+
// disable strapi theme, will use default ckeditor theme //
|
|
899
|
+
// strapiTheme:false,
|
|
900
|
+
|
|
901
|
+
// styles applied to editor container, e.g:
|
|
427
902
|
styles:`
|
|
428
|
-
${
|
|
429
|
-
|
|
903
|
+
${styles()}
|
|
904
|
+
.ck-editor__styled__container{
|
|
905
|
+
background:red;
|
|
906
|
+
}
|
|
907
|
+
html[data-theme='light'] {
|
|
908
|
+
--ck-scroll-track-background:red;
|
|
909
|
+
--ck-scroll-thumb-background:red;
|
|
910
|
+
--ck-scroll-thumb-border-color:red;
|
|
911
|
+
--ck-scroll-thumb-hover-background:red;
|
|
912
|
+
--ck-scroll-thumb-active-background:red;
|
|
913
|
+
--ck-color-base-border: red;
|
|
914
|
+
--ck-color-base-background:red;
|
|
915
|
+
--ck-custom-background: red;
|
|
916
|
+
--ck-custom-foreground: red;
|
|
917
|
+
--ck-custom-border: red;
|
|
918
|
+
--ck-custom-white: red;
|
|
919
|
+
}
|
|
430
920
|
`
|
|
431
921
|
},
|
|
432
922
|
// editor default config
|
|
@@ -439,17 +929,23 @@ module.exports = () => {
|
|
|
439
929
|
}
|
|
440
930
|
|
|
441
931
|
// styles.js
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
932
|
+
const styles = () =>`
|
|
933
|
+
.ck.ck-editor__main .ck-blurred{
|
|
934
|
+
max-height: 200px;
|
|
935
|
+
}
|
|
936
|
+
.ck.ck-editor__main .ck-focused{
|
|
937
|
+
max-height: 500px;
|
|
938
|
+
}
|
|
939
|
+
`
|
|
940
|
+
module.exports = styles;
|
|
447
941
|
```
|
|
448
942
|
|
|
449
943
|
## <a id="requirements"></a>⚠️ Requirements
|
|
450
|
-
Strapi **v4
|
|
944
|
+
Strapi **v4.1.8+**
|
|
945
|
+
|
|
946
|
+
Node **14 - 16**
|
|
451
947
|
|
|
452
|
-
Tested on **v4.
|
|
948
|
+
Tested on **v4.1.8 - 4.3.4**
|
|
453
949
|
|
|
454
950
|
## <a id="thanks"></a>👍 This build includes some useful plugins based on these repos so thanks to them:
|
|
455
951
|
https://github.com/Roslovets-Inc/strapi-plugin-ckeditor5
|