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