@_sh/strapi-plugin-ckeditor 2.0.3 → 2.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/LICENSE +20 -20
- package/README.md +437 -448
- package/admin/src/components/CKEditorIcon.js +46 -46
- package/admin/src/components/Input/CKEditor/configs/base.js +636 -627
- package/admin/src/components/Input/CKEditor/configs/blockBalloon.js +25 -0
- package/admin/src/components/Input/CKEditor/configs/index.js +11 -11
- package/admin/src/components/Input/CKEditor/configs/toolbar.js +17 -17
- package/admin/src/components/Input/CKEditor/configs/toolbarBalloon.js +17 -0
- package/admin/src/components/Input/CKEditor/configuration.js +166 -165
- package/admin/src/components/Input/CKEditor/index.js +119 -119
- package/admin/src/components/Input/CKEditor/plugins/StrapiMediaLib.js +43 -43
- package/admin/src/components/Input/CKEditor/plugins/StrapiUploadAdapter.js +204 -203
- package/admin/src/components/Input/CKEditor/plugins/index.js +1 -1
- package/admin/src/components/Input/CKEditor/styling.js +16 -16
- package/admin/src/components/Input/CKEditor/theme/additional.js +186 -212
- package/admin/src/components/Input/CKEditor/theme/common.js +232 -232
- package/admin/src/components/Input/CKEditor/theme/dark.js +144 -144
- package/admin/src/components/Input/CKEditor/theme/index.js +12 -12
- package/admin/src/components/Input/CKEditor/theme/light.js +135 -135
- package/admin/src/components/Input/MediaLib/index.js +70 -79
- package/admin/src/components/Input/index.js +48 -48
- package/admin/src/index.js +110 -110
- package/admin/src/utils/getEditorConfig.js +37 -37
- package/admin/src/utils/pluginId.js +4 -4
- package/package.json +90 -86
- package/server/controllers/config.js +16 -16
- package/server/controllers/index.js +7 -7
- package/server/index.js +13 -13
- package/server/register.js +11 -11
- package/server/routes/index.js +15 -15
- package/server/services/config.js +19 -19
- package/server/services/index.js +7 -7
- package/strapi-admin.js +3 -3
- package/strapi-server.js +3 -3
- package/admin/src/components/Input/CKEditor/configs/blockBaloon.js +0 -25
- package/admin/src/components/Input/CKEditor/configs/toolbarBaloon.js +0 -17
package/README.md
CHANGED
|
@@ -1,448 +1,437 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/ckeditor5_2_0.png" width="700" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<h1 align="center">CKEditor 5 for Strapi</h1>
|
|
6
|
-
|
|
7
|
-
<p align="center">Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Unofficial integration)</p>
|
|
8
|
-
|
|
9
|
-
## 👋 Get Started
|
|
10
|
-
|
|
11
|
-
* [Features](#features)
|
|
12
|
-
* [Installation](#installation)
|
|
13
|
-
* [Configuration](#configuration)
|
|
14
|
-
* [Contributing](#contributing)
|
|
15
|
-
* [Requirements](#requirements)
|
|
16
|
-
|
|
17
|
-
## <a id="features"></a>✨ Features
|
|
18
|
-
|
|
19
|
-
* **Media library integration**
|
|
20
|
-
* **Supports responsive images**
|
|
21
|
-
* **Supports Strapi's theme switching with the
|
|
22
|
-
* **Supports i18n
|
|
23
|
-
* **Few predefined editor configs with the
|
|
24
|
-
* **Possible to add new plugins**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## <a id="installation"></a>🔧 Installation
|
|
28
|
-
___
|
|
29
|
-
|
|
30
|
-
* Inside your Strapi app, add the package:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
npm install @_sh/strapi-plugin-ckeditor
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
or
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
yarn add @_sh/strapi-plugin-ckeditor
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
* Then run build:
|
|
43
|
-
```bash
|
|
44
|
-
npm run build
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
or
|
|
48
|
-
```bash
|
|
49
|
-
yarn build
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## <a id="configuration"></a>⚙️ Configuration
|
|
55
|
-
___
|
|
56
|
-
The plugin
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
It's highly recommended to explore [**the official ckeditor documentation**](https://ckeditor.com/docs/ckeditor5/latest/features/index.html)
|
|
61
|
-
|
|
62
|
-
Content
|
|
63
|
-
|
|
64
|
-
> 📂 Default configs: [**admin/src/components/Input/CKEditor/configs**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/Input/CKEditor/configs)
|
|
65
|
-
|
|
66
|
-
> 📂 Default theme: [**admin/src/components/Input/CKEditor/theme**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/Input/CKEditor/theme)
|
|
67
|
-
|
|
68
|
-
**ckeditor.txt example:**
|
|
69
|
-
|
|
70
|
-
```js
|
|
71
|
-
globalThis.CKEditorConfig = {
|
|
72
|
-
|
|
73
|
-
/* By default configs and theme
|
|
74
|
-
|
|
75
|
-
default configs and theme
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
//
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
CKEditor5.
|
|
135
|
-
CKEditor5.
|
|
136
|
-
CKEditor5.
|
|
137
|
-
CKEditor5.
|
|
138
|
-
CKEditor5.
|
|
139
|
-
CKEditor5.image.
|
|
140
|
-
CKEditor5.image.
|
|
141
|
-
CKEditor5.image.
|
|
142
|
-
CKEditor5.
|
|
143
|
-
CKEditor5.
|
|
144
|
-
CKEditor5.
|
|
145
|
-
CKEditor5.
|
|
146
|
-
CKEditor5.
|
|
147
|
-
CKEditor5.
|
|
148
|
-
CKEditor5.
|
|
149
|
-
CKEditor5.table.
|
|
150
|
-
CKEditor5.table.
|
|
151
|
-
CKEditor5.
|
|
152
|
-
CKEditor5.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
'
|
|
175
|
-
'|',
|
|
176
|
-
'
|
|
177
|
-
'|',
|
|
178
|
-
'
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
{ model: '
|
|
185
|
-
{ model: '
|
|
186
|
-
{ model: '
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
'imageStyle:
|
|
194
|
-
'
|
|
195
|
-
'
|
|
196
|
-
'
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
'
|
|
204
|
-
'
|
|
205
|
-
'
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
//
|
|
218
|
-
//
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
CKEditor5.
|
|
293
|
-
CKEditor5.
|
|
294
|
-
CKEditor5.
|
|
295
|
-
CKEditor5.
|
|
296
|
-
CKEditor5.
|
|
297
|
-
CKEditor5.image.
|
|
298
|
-
CKEditor5.image.
|
|
299
|
-
CKEditor5.image.
|
|
300
|
-
CKEditor5.
|
|
301
|
-
CKEditor5.
|
|
302
|
-
CKEditor5.
|
|
303
|
-
CKEditor5.
|
|
304
|
-
CKEditor5.
|
|
305
|
-
CKEditor5.
|
|
306
|
-
CKEditor5.
|
|
307
|
-
CKEditor5.
|
|
308
|
-
CKEditor5.
|
|
309
|
-
CKEditor5.
|
|
310
|
-
CKEditor5.
|
|
311
|
-
CKEditor5.
|
|
312
|
-
CKEditor5.
|
|
313
|
-
CKEditor5.
|
|
314
|
-
CKEditor5.
|
|
315
|
-
CKEditor5.
|
|
316
|
-
CKEditor5.
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
'
|
|
323
|
-
'
|
|
324
|
-
'
|
|
325
|
-
'
|
|
326
|
-
'
|
|
327
|
-
'
|
|
328
|
-
'
|
|
329
|
-
'
|
|
330
|
-
'
|
|
331
|
-
'
|
|
332
|
-
'
|
|
333
|
-
'
|
|
334
|
-
'
|
|
335
|
-
'
|
|
336
|
-
'
|
|
337
|
-
'
|
|
338
|
-
'
|
|
339
|
-
'
|
|
340
|
-
'
|
|
341
|
-
'
|
|
342
|
-
'
|
|
343
|
-
'
|
|
344
|
-
'
|
|
345
|
-
'
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
{ language: '
|
|
357
|
-
{ language: '
|
|
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
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
Node **>=14.19.1 <=18.x.x**
|
|
440
|
-
|
|
441
|
-
### 👍 This build includes some useful plugins based on these repos so thanks to them:
|
|
442
|
-
https://github.com/Roslovets-Inc/strapi-plugin-ckeditor5
|
|
443
|
-
|
|
444
|
-
https://github.com/leknoppix/ckeditor5-fullscreen
|
|
445
|
-
|
|
446
|
-
https://github.com/gtomato/ckeditor5-strapi-upload-plugin
|
|
447
|
-
|
|
448
|
-
https://github.com/pshurygin/ckeditor5-font-color
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/ckeditor5_2_0.png" width="700" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">CKEditor 5 for Strapi</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Unofficial integration)</p>
|
|
8
|
+
|
|
9
|
+
## 👋 Get Started
|
|
10
|
+
|
|
11
|
+
* [Features](#features)
|
|
12
|
+
* [Installation](#installation)
|
|
13
|
+
* [Configuration](#configuration)
|
|
14
|
+
* [Contributing](#contributing)
|
|
15
|
+
* [Requirements](#requirements)
|
|
16
|
+
|
|
17
|
+
## <a id="features"></a>✨ Features
|
|
18
|
+
|
|
19
|
+
* **Media library integration**
|
|
20
|
+
* **Supports responsive images**
|
|
21
|
+
* **Supports Strapi's theme switching with the ability to set a custom theme**
|
|
22
|
+
* **Supports i18n and different UI translations**
|
|
23
|
+
* **Few predefined editor configs with the ability to add custom ones**
|
|
24
|
+
* **Possible to add new plugins**
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## <a id="installation"></a>🔧 Installation
|
|
28
|
+
___
|
|
29
|
+
|
|
30
|
+
* Inside your Strapi app, add the package:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install @_sh/strapi-plugin-ckeditor
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
or
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
yarn add @_sh/strapi-plugin-ckeditor
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
* Then run build:
|
|
43
|
+
```bash
|
|
44
|
+
npm run build
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
or
|
|
48
|
+
```bash
|
|
49
|
+
yarn build
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## <a id="configuration"></a>⚙️ Configuration
|
|
55
|
+
___
|
|
56
|
+
The plugin uses [**Strapi custom fields API**](https://docs.strapi.io/developer-docs/latest/development/custom-fields.html#registering-a-custom-field-on-the-server) and [**CKEditor dll build**](https://ckeditor.com/docs/ckeditor5/latest/installation/advanced/alternative-setups/dll-builds.html)
|
|
57
|
+
|
|
58
|
+
The plugin configuration should be defined in the `/config/ckeditor.txt` file.
|
|
59
|
+
|
|
60
|
+
It's highly recommended to explore [**the official ckeditor documentation**](https://ckeditor.com/docs/ckeditor5/latest/features/index.html)
|
|
61
|
+
|
|
62
|
+
Content of ckeditor.txt will be passed into the script tag during the initialization process.
|
|
63
|
+
|
|
64
|
+
> 📂 Default configs: [**admin/src/components/Input/CKEditor/configs**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/Input/CKEditor/configs)
|
|
65
|
+
|
|
66
|
+
> 📂 Default theme: [**admin/src/components/Input/CKEditor/theme**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/Input/CKEditor/theme)
|
|
67
|
+
|
|
68
|
+
**ckeditor.txt example:**
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
globalThis.CKEditorConfig = {
|
|
72
|
+
|
|
73
|
+
/* By default custom configs and theme
|
|
74
|
+
defined in this file are going to be spread into
|
|
75
|
+
default configs and theme these two properties below
|
|
76
|
+
allow you to redefine default objects completely: */
|
|
77
|
+
|
|
78
|
+
//configsOverwrite:true,
|
|
79
|
+
//themeOverwrite:true,
|
|
80
|
+
|
|
81
|
+
/* Here you can redefine default configs
|
|
82
|
+
or add completely new ones.
|
|
83
|
+
Each config includes:
|
|
84
|
+
"styles", "field" and "editorConfig" properties.
|
|
85
|
+
Property "field" is required. */
|
|
86
|
+
|
|
87
|
+
configs:{
|
|
88
|
+
toolbar:{
|
|
89
|
+
// styles:``,
|
|
90
|
+
// field:{},
|
|
91
|
+
// editorConfig:{}
|
|
92
|
+
},
|
|
93
|
+
custom:{
|
|
94
|
+
|
|
95
|
+
/* Styles for this specific editor version.
|
|
96
|
+
This will be passed into the editor's parent container. */
|
|
97
|
+
|
|
98
|
+
styles:`
|
|
99
|
+
// --ck-focus-ring:3px dashed #5CB176;
|
|
100
|
+
|
|
101
|
+
// .ck.ck-content.ck-editor__editable {
|
|
102
|
+
// &.ck-focused:not(.ck-editor__nested-editable) {
|
|
103
|
+
// border: var(--ck-focus-ring) !important;
|
|
104
|
+
// }
|
|
105
|
+
// }
|
|
106
|
+
// .ck.ck-content.ck-editor__editable.ck-rounded-corners.ck-editor__editable_inline.ck-blurred{
|
|
107
|
+
// min-height: 400px;
|
|
108
|
+
// max-height: 400px;
|
|
109
|
+
// }
|
|
110
|
+
// .ck.ck-content.ck-editor__editable.ck-rounded-corners.ck-editor__editable_inline.ck-focused{
|
|
111
|
+
// min-height: 400px;
|
|
112
|
+
// max-height: 1700px;
|
|
113
|
+
// }
|
|
114
|
+
`,
|
|
115
|
+
|
|
116
|
+
/* Custom field option */
|
|
117
|
+
field: {
|
|
118
|
+
key: "custom",
|
|
119
|
+
value: "custom",
|
|
120
|
+
metadatas: {
|
|
121
|
+
intlLabel: {
|
|
122
|
+
id: "ckeditor5.preset.custom.label",
|
|
123
|
+
defaultMessage: "Custom version",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
/* CKEditor configuration */
|
|
128
|
+
editorConfig:{
|
|
129
|
+
/* You can find all available built-in plugins
|
|
130
|
+
in the admin/src/components/Input/CKEditor/configs/base.js */
|
|
131
|
+
plugins: [
|
|
132
|
+
CKEditor5.autoformat.Autoformat,
|
|
133
|
+
CKEditor5.basicStyles.Bold,
|
|
134
|
+
CKEditor5.basicStyles.Italic,
|
|
135
|
+
CKEditor5.essentials.Essentials,
|
|
136
|
+
CKEditor5.heading.Heading,
|
|
137
|
+
CKEditor5.image.Image,
|
|
138
|
+
CKEditor5.image.ImageCaption,
|
|
139
|
+
CKEditor5.image.ImageStyle,
|
|
140
|
+
CKEditor5.image.ImageToolbar,
|
|
141
|
+
CKEditor5.image.ImageUpload,
|
|
142
|
+
CKEditor5.indent.Indent,
|
|
143
|
+
CKEditor5.link.Link,
|
|
144
|
+
CKEditor5.list.List,
|
|
145
|
+
CKEditor5.paragraph.Paragraph,
|
|
146
|
+
CKEditor5.pasteFromOffice.PasteFromOffice,
|
|
147
|
+
CKEditor5.table.Table,
|
|
148
|
+
CKEditor5.table.TableToolbar,
|
|
149
|
+
CKEditor5.table.TableColumnResize,
|
|
150
|
+
CKEditor5.table.TableCaption,
|
|
151
|
+
CKEditor5.strapiPlugins.StrapiMediaLib,
|
|
152
|
+
CKEditor5.strapiPlugins.StrapiUploadAdapter,
|
|
153
|
+
],
|
|
154
|
+
|
|
155
|
+
/* By default, the language of the plugin's UI will be chosen
|
|
156
|
+
based on the language defined in this config file
|
|
157
|
+
or on the preferred language from the strapi's user config
|
|
158
|
+
and if both of them are not set then 'en' will be used as a fallback.
|
|
159
|
+
( language.ui -> preferred language -> 'en' ) */
|
|
160
|
+
|
|
161
|
+
/* For content it will chose the language based on i18n (if! ignorei18n)
|
|
162
|
+
or on language.content property defined here
|
|
163
|
+
and it will use UI language as a fallback.
|
|
164
|
+
ignorei18n ? language.content : i18n; -> language.ui */
|
|
165
|
+
|
|
166
|
+
language:{
|
|
167
|
+
// ignorei18n: true,
|
|
168
|
+
// ui:'he',
|
|
169
|
+
// content:'he'
|
|
170
|
+
},
|
|
171
|
+
toolbar: [
|
|
172
|
+
'heading',
|
|
173
|
+
'|',
|
|
174
|
+
'bold', 'italic', 'link', 'bulletedList', 'numberedList',
|
|
175
|
+
'|',
|
|
176
|
+
'strapiMediaLib', 'insertTable',
|
|
177
|
+
'|',
|
|
178
|
+
'undo', 'redo'
|
|
179
|
+
],
|
|
180
|
+
heading: {
|
|
181
|
+
options: [
|
|
182
|
+
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
|
|
183
|
+
{ model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
|
|
184
|
+
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
|
|
185
|
+
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
|
|
186
|
+
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
image: {
|
|
190
|
+
toolbar: [
|
|
191
|
+
'imageStyle:inline',
|
|
192
|
+
'imageStyle:block',
|
|
193
|
+
'imageStyle:side',
|
|
194
|
+
'|',
|
|
195
|
+
'toggleImageCaption',
|
|
196
|
+
'imageTextAlternative'
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
table: {
|
|
200
|
+
contentToolbar: [
|
|
201
|
+
'tableColumn',
|
|
202
|
+
'tableRow',
|
|
203
|
+
'mergeTableCells',
|
|
204
|
+
'|',
|
|
205
|
+
'toggleTableCaption'
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
/* Here you can customize the plugin's theme.
|
|
213
|
+
This will be passed as "createGlobalStyle". */
|
|
214
|
+
theme:{
|
|
215
|
+
// common:``,
|
|
216
|
+
// light:``,
|
|
217
|
+
// dark:``,
|
|
218
|
+
// additional:``
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
> If you use the default (local) upload provider you should specify the `url` property in the `config/server.js` in order to get the full URL on uploaded files eg:
|
|
225
|
+
```js
|
|
226
|
+
module.exports = ({ env }) => ({
|
|
227
|
+
url: env("PUBLIC_URL", "http://localhost:1337"),
|
|
228
|
+
host: env('HOST', '0.0.0.0'),
|
|
229
|
+
port: env.int('PORT', 1337),
|
|
230
|
+
app: {
|
|
231
|
+
keys: env.array('APP_KEYS'),
|
|
232
|
+
},
|
|
233
|
+
});
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
> In order to display a content from an external source in your `admin` you should configure your middlewares.js [**check the docs about this**](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/required/middlewares.html)
|
|
237
|
+
|
|
238
|
+
## How to add plugins
|
|
239
|
+
|
|
240
|
+
___
|
|
241
|
+
Markdown plugin example
|
|
242
|
+
|
|
243
|
+
* Inside your app:
|
|
244
|
+
|
|
245
|
+
```js
|
|
246
|
+
yarn add @ckeditor/ckeditor5-markdown-gfm
|
|
247
|
+
```
|
|
248
|
+
or
|
|
249
|
+
```js
|
|
250
|
+
npm install @ckeditor/ckeditor5-markdown-gfm
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
* your-app/src/admin/**app.js**
|
|
254
|
+
|
|
255
|
+
```js
|
|
256
|
+
import ckeditor5Dll from "ckeditor5/build/ckeditor5-dll.js";
|
|
257
|
+
import ckeditor5MrkdownDll from "@ckeditor/ckeditor5-markdown-gfm/build/markdown-gfm.js";
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
const config = {};
|
|
261
|
+
|
|
262
|
+
const bootstrap = (app) => {};
|
|
263
|
+
|
|
264
|
+
export default {
|
|
265
|
+
config,
|
|
266
|
+
bootstrap,
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
* your-app/config/**ckeditor.txt**
|
|
272
|
+
|
|
273
|
+
```js
|
|
274
|
+
globalThis.CKEditorConfig = {
|
|
275
|
+
configs:{
|
|
276
|
+
markdown:{
|
|
277
|
+
field: {
|
|
278
|
+
key: "markdown",
|
|
279
|
+
value: "markdown",
|
|
280
|
+
metadatas: {
|
|
281
|
+
intlLabel: {
|
|
282
|
+
id: "ckeditor.preset.markdown.label",
|
|
283
|
+
defaultMessage: "Markdown version",
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
editorConfig:{
|
|
288
|
+
placeholder: 'Markdown editor',
|
|
289
|
+
plugins: [
|
|
290
|
+
CKEditor5.essentials.Essentials,
|
|
291
|
+
CKEditor5.autoformat.Autoformat,
|
|
292
|
+
CKEditor5.blockQuote.BlockQuote,
|
|
293
|
+
CKEditor5.basicStyles.Bold,
|
|
294
|
+
CKEditor5.heading.Heading,
|
|
295
|
+
CKEditor5.image.Image,
|
|
296
|
+
CKEditor5.image.ImageCaption,
|
|
297
|
+
CKEditor5.image.ImageStyle,
|
|
298
|
+
CKEditor5.image.ImageToolbar,
|
|
299
|
+
CKEditor5.image.ImageUpload,
|
|
300
|
+
CKEditor5.indent.Indent,
|
|
301
|
+
CKEditor5.basicStyles.Italic,
|
|
302
|
+
CKEditor5.link.Link,
|
|
303
|
+
CKEditor5.list.List,
|
|
304
|
+
CKEditor5.mediaEmbed.MediaEmbed,
|
|
305
|
+
CKEditor5.paragraph.Paragraph,
|
|
306
|
+
CKEditor5.table.Table,
|
|
307
|
+
CKEditor5.table.TableToolbar,
|
|
308
|
+
CKEditor5.sourceEditing.SourceEditing,
|
|
309
|
+
CKEditor5.strapiPlugins.StrapiMediaLib,
|
|
310
|
+
CKEditor5.strapiPlugins.StrapiUploadAdapter,
|
|
311
|
+
CKEditor5.markdownGfm.Markdown,
|
|
312
|
+
CKEditor5.basicStyles.Code,
|
|
313
|
+
CKEditor5.codeBlock.CodeBlock,
|
|
314
|
+
CKEditor5.list.TodoList,
|
|
315
|
+
CKEditor5.basicStyles.Strikethrough,
|
|
316
|
+
CKEditor5.horizontalLine.HorizontalLine
|
|
317
|
+
],
|
|
318
|
+
toolbar: {
|
|
319
|
+
items: [
|
|
320
|
+
'heading',
|
|
321
|
+
'|',
|
|
322
|
+
'bold',
|
|
323
|
+
'italic',
|
|
324
|
+
'strikethrough',
|
|
325
|
+
'link',
|
|
326
|
+
'|',
|
|
327
|
+
'bulletedList',
|
|
328
|
+
'numberedList',
|
|
329
|
+
'todoList',
|
|
330
|
+
'|',
|
|
331
|
+
'code',
|
|
332
|
+
'codeBlock',
|
|
333
|
+
'|',
|
|
334
|
+
'uploadImage',
|
|
335
|
+
'strapiMediaLib',
|
|
336
|
+
'blockQuote',
|
|
337
|
+
'horizontalLine',
|
|
338
|
+
'-',
|
|
339
|
+
'sourceEditing',
|
|
340
|
+
'|',
|
|
341
|
+
'outdent',
|
|
342
|
+
'indent',
|
|
343
|
+
'|',
|
|
344
|
+
'undo',
|
|
345
|
+
'redo'
|
|
346
|
+
],
|
|
347
|
+
shouldNotGroupWhenFull: true
|
|
348
|
+
},
|
|
349
|
+
image: {
|
|
350
|
+
toolbar: [ 'imageStyle:inline', 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ]
|
|
351
|
+
},
|
|
352
|
+
codeBlock: {
|
|
353
|
+
languages: [
|
|
354
|
+
{ language: 'css', label: 'CSS' },
|
|
355
|
+
{ language: 'html', label: 'HTML' },
|
|
356
|
+
{ language: 'javascript', label: 'JavaScript' },
|
|
357
|
+
{ language: 'php', label: 'PHP' }
|
|
358
|
+
]
|
|
359
|
+
},
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
* Then rebuild your app:
|
|
367
|
+
```bash
|
|
368
|
+
npm run build
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
or
|
|
372
|
+
```bash
|
|
373
|
+
yarn build
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
## <a id="contributing"></a>🛠 Contributing
|
|
377
|
+
___
|
|
378
|
+
|
|
379
|
+
This section covers the way how to configure your environment if you want to contribute to this package.
|
|
380
|
+
|
|
381
|
+
### Setting up the environment
|
|
382
|
+
|
|
383
|
+
In order to start making changes in the plugin you first need to install Strapi infrastructure on top of the plugin repository.
|
|
384
|
+
|
|
385
|
+
```
|
|
386
|
+
npx create-strapi-app --quickstart strapi
|
|
387
|
+
cd strapi
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
By default Strapi does not create plugins folder so we need to create it.
|
|
391
|
+
|
|
392
|
+
```
|
|
393
|
+
mkdir -p src/plugins
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
Now we should clone this repository so we can work on it.
|
|
397
|
+
|
|
398
|
+
```
|
|
399
|
+
git clone git@github.com:nshenderov/strapi-plugin-ckeditor.git src/plugins/strapi-plugin-ckeditor
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
Let's add an entry inside `./package.json` file so, we won't need to use `yarn` inside plugin itself.
|
|
403
|
+
|
|
404
|
+
```
|
|
405
|
+
"workspaces": ["./src/plugins/strapi-plugin-ckeditor"]
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
Install dependencies:
|
|
409
|
+
|
|
410
|
+
```
|
|
411
|
+
yarn install
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
Now we need to register plugin so strapi can use it. In order to do that we need
|
|
415
|
+
to create (if not already created) `./config/plugins.js` file and add entry to it.
|
|
416
|
+
|
|
417
|
+
```
|
|
418
|
+
module.exports = ({ env }) => ({
|
|
419
|
+
ckeditor5: {
|
|
420
|
+
enabled: true,
|
|
421
|
+
resolve: "./src/plugins/strapi-plugin-ckeditor"
|
|
422
|
+
},
|
|
423
|
+
});
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Rebuild the project and start the server:
|
|
427
|
+
|
|
428
|
+
```
|
|
429
|
+
yarn build
|
|
430
|
+
yarn develop
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
## <a id="requirements"></a>⚠️ Requirements
|
|
434
|
+
___
|
|
435
|
+
Strapi **v4.13.0+**
|
|
436
|
+
|
|
437
|
+
Node **>=18.0.0 <=20.x.x**
|