@_sh/strapi-plugin-ckeditor 4.0.11 → 5.0.1

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 (78) hide show
  1. package/README.md +588 -575
  2. package/dist/_chunks/Field-BdtPMWJ1.js +600 -0
  3. package/dist/_chunks/Field-wVg5xgbq.mjs +576 -0
  4. package/dist/_chunks/index-CZRYkPJ8.js +1350 -0
  5. package/dist/_chunks/index-Clyv4ZPF.mjs +1330 -0
  6. package/dist/admin/index.js +11 -4
  7. package/dist/admin/index.mjs +10 -4
  8. package/dist/admin/src/components/CKEReact.d.ts +6 -0
  9. package/dist/admin/src/components/CKEditorIcon.d.ts +1 -0
  10. package/dist/admin/src/components/Editor.d.ts +1 -0
  11. package/dist/admin/src/components/EditorLayout.d.ts +4 -0
  12. package/dist/admin/src/components/EditorProvider.d.ts +20 -0
  13. package/dist/admin/src/components/Field.d.ts +20 -0
  14. package/dist/admin/src/components/GlobalStyling.d.ts +4 -0
  15. package/dist/admin/src/components/MediaLib.d.ts +9 -0
  16. package/dist/admin/src/config/htmlPreset.d.ts +2 -0
  17. package/dist/admin/src/config/index.d.ts +5 -0
  18. package/dist/admin/src/config/language.d.ts +15 -0
  19. package/dist/admin/src/config/markdownPreset.d.ts +2 -0
  20. package/dist/admin/src/config/pluginConfig.d.ts +23 -0
  21. package/dist/admin/src/config/types.d.ts +123 -0
  22. package/dist/admin/src/exports.d.ts +9 -0
  23. package/dist/admin/src/index.d.ts +6 -0
  24. package/dist/admin/src/plugins/StrapiMediaLib.d.ts +15 -0
  25. package/dist/admin/src/plugins/StrapiUploadAdapter.d.ts +12 -0
  26. package/dist/admin/src/plugins/index.d.ts +2 -0
  27. package/dist/admin/src/theme/additional.d.ts +1 -0
  28. package/dist/admin/src/theme/colors.d.ts +1 -0
  29. package/dist/admin/src/theme/common.d.ts +1 -0
  30. package/dist/admin/src/theme/dark.d.ts +1 -0
  31. package/dist/admin/src/theme/index.d.ts +2 -0
  32. package/dist/admin/src/theme/light.d.ts +1 -0
  33. package/dist/admin/src/utils/index.d.ts +4 -0
  34. package/dist/admin/src/utils/isImageResponsive.d.ts +3 -0
  35. package/dist/admin/src/utils/localStorage.d.ts +3 -0
  36. package/dist/admin/src/utils/pluginId.d.ts +1 -0
  37. package/dist/admin/src/utils/prefixWithBackendUrl.d.ts +1 -0
  38. package/dist/server/index.js +61 -119
  39. package/dist/server/index.mjs +61 -117
  40. package/dist/server/src/index.d.ts +7 -0
  41. package/package.json +50 -22
  42. package/dist/_chunks/index-5LGZsCS3.mjs +0 -1125
  43. package/dist/_chunks/index-5LGZsCS3.mjs.map +0 -1
  44. package/dist/_chunks/index-B5HkOicq.mjs +0 -3530
  45. package/dist/_chunks/index-B5HkOicq.mjs.map +0 -1
  46. package/dist/_chunks/index-BOqpyEaD.js +0 -1150
  47. package/dist/_chunks/index-BOqpyEaD.js.map +0 -1
  48. package/dist/_chunks/index-BQ7yqvCN.mjs +0 -1124
  49. package/dist/_chunks/index-BQ7yqvCN.mjs.map +0 -1
  50. package/dist/_chunks/index-BZP-quaN.mjs +0 -3530
  51. package/dist/_chunks/index-BZP-quaN.mjs.map +0 -1
  52. package/dist/_chunks/index-BZZiYjTp.mjs +0 -3530
  53. package/dist/_chunks/index-BZZiYjTp.mjs.map +0 -1
  54. package/dist/_chunks/index-Be-t5n4r.mjs +0 -1125
  55. package/dist/_chunks/index-Be-t5n4r.mjs.map +0 -1
  56. package/dist/_chunks/index-BiOS6ItS.js +0 -1150
  57. package/dist/_chunks/index-BiOS6ItS.js.map +0 -1
  58. package/dist/_chunks/index-C4BPSFZt.mjs +0 -3530
  59. package/dist/_chunks/index-C4BPSFZt.mjs.map +0 -1
  60. package/dist/_chunks/index-CFskHjqL.js +0 -3548
  61. package/dist/_chunks/index-CFskHjqL.js.map +0 -1
  62. package/dist/_chunks/index-CPBrnTwd.mjs +0 -1124
  63. package/dist/_chunks/index-CPBrnTwd.mjs.map +0 -1
  64. package/dist/_chunks/index-CRK4zk5I.js +0 -3548
  65. package/dist/_chunks/index-CRK4zk5I.js.map +0 -1
  66. package/dist/_chunks/index-CUmwBN9O.js +0 -1151
  67. package/dist/_chunks/index-CUmwBN9O.js.map +0 -1
  68. package/dist/_chunks/index-CaYpAgjX.js +0 -1151
  69. package/dist/_chunks/index-CaYpAgjX.js.map +0 -1
  70. package/dist/_chunks/index-pRK2Er3w.js +0 -3548
  71. package/dist/_chunks/index-pRK2Er3w.js.map +0 -1
  72. package/dist/_chunks/index-uYy-Myyv.js +0 -3548
  73. package/dist/_chunks/index-uYy-Myyv.js.map +0 -1
  74. package/dist/admin/index.js.map +0 -1
  75. package/dist/admin/index.mjs.map +0 -1
  76. package/dist/server/index.js.map +0 -1
  77. package/dist/server/index.mjs.map +0 -1
  78. package/strapi-server.js +0 -3
package/README.md CHANGED
@@ -1,40 +1,41 @@
1
1
  <p align="center">
2
- <img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/ckeditor5_2_0.png" width="700" />
2
+ <img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/v5-head.png"/>
3
3
  </p>
4
4
 
5
- <h1 align="center">CKEditor 5 for Strapi</h1>
5
+ <h1 align="center">Strapi CKEditor</h1>
6
6
 
7
- <p align="center">Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Unofficial integration)</p>
7
+ <p align="center">Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Community edition)</p>
8
8
 
9
9
  ## 👋 Get Started
10
10
 
11
- * [Features](#features)
12
- * [Installation](#installation)
13
- * [Usage](#usage)
14
- * [Configuration](#configuration)
15
- * [Contributing](#contributing)
16
- * [Migration](#migration)
17
- * [Requirements](#requirements)
11
+ - [Features](#features)
12
+ - [Installation](#installation)
13
+ - [Usage](#usage)
14
+ - [Configuration](#configuration)
15
+ - [Contributing](#contributing)
16
+ - [Migration](#migration)
17
+ - [Requirements](#requirements)
18
18
 
19
19
  ## <a id="features"></a>✨ Features
20
20
 
21
- * **Media library integration**
22
- * **Responsive images support**
23
- * **Strapi theme switching support**
24
- * **Supports custom styles for the editor**
25
- * **Supports i18n and different UI translations**
26
- * **Allows custom editor configrations**
27
- * **Plugins extensibility**
21
+ - **Extensive configuration**
22
+ - **Media Library integration**
23
+ - **Dark theme support**
24
+ - **Fullscreen expansion**
25
+ - **Responsive images support**
26
+ - **Automatic UI translations**
27
+ - **i18n support**
28
+ - **Self-Hosted**
28
29
 
29
30
  <p align="right">
30
31
  <a href="https://www.buymeacoffee.com/nshenderov" target="_blank">
31
- <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;max-width: 217px !important;" >
32
+ <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px; width: 217px;" >
32
33
  </a>
33
34
  </p>
34
35
 
35
-
36
36
  ## <a id="installation"></a>🔧 Installation
37
37
 
38
+ **Strapi v5:**
38
39
 
39
40
  Add the package to your Strapi application:
40
41
 
@@ -42,683 +43,695 @@ Add the package to your Strapi application:
42
43
  yarn add @_sh/strapi-plugin-ckeditor
43
44
  ```
44
45
 
45
- For Strapi v4:
46
- ```bash
47
- yarn add @_sh/strapi-plugin-ckeditor@strapi-v4-latest
48
- ```
49
-
50
46
  Then, build the app:
51
47
 
52
48
  ```bash
53
49
  yarn build
54
50
  ```
55
51
 
52
+ **Strapi v4:**
53
+
54
+ Version 3 of the plugin will remain available for Strapi v4 until March 2026.
55
+ Refer to the [**v3 installation guide**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/3.x.x/README.md#installation)
56
+ for setup instructions.
57
+
58
+ > Note: Version 3 receives only essential bug fixes. The configuration process and available
59
+ > features in version 3 differ significantly from the latest plugin versions.
60
+
56
61
  ## <a id="usage"></a>✍️ Usage
57
62
 
63
+ The field can be found in the Content-Type Builder under the `CUSTOM` tab:
64
+
58
65
  <p align="center">
59
- <img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/usage-guide.gif" width="700" />
66
+ <img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/v5-usage-guide-2.png" width="700" />
60
67
  </p>
61
68
 
69
+ **Presets**
70
+
71
+ A preset is a set of settings that define the editor's features and appearance. You
72
+ can specify a dedicated preset for each field. The available presets can be customized through the
73
+ [configuration](#configuration).
74
+
75
+ <p align="center">
76
+ <img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/v5-usage-guide-3.png" width="700" />
77
+ </p>
78
+
79
+ The plugin provides two presets out of the box: `Default HTML editor` and `Default Markdown editor`,
80
+ each has different output format: HTML and Markdown, respectively. Both presets include
81
+ an extensive set of non-premium CKEditor plugins.
82
+
62
83
  <details>
63
- <summary><b>Default preset:</b></summary>
64
-
84
+ <summary>Default HTML editor:</summary>
85
+
86
+ <p align="center">
87
+ <img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/v5-def-html-dark.png" width="700" />
88
+ </p>
89
+
90
+ <p align="center">
91
+ <img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/v5-def-html-light.png" width="700" />
92
+ </p>
93
+
65
94
  <p align="center">
66
- <img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/default-preset.gif" width="700" />
95
+ <img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/v5-def-html-light-full.png" width="700" />
67
96
  </p>
68
97
 
69
98
  </details>
70
99
 
71
- ## <a id="configuration"></a>⚙️ Configuration
100
+ <details>
101
+ <summary>Default Markdown editor:</summary>
72
102
 
103
+ <p align="center">
104
+ <img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/v5-def-mrk-dark.png" width="700" />
105
+ </p>
73
106
 
74
- > It is highly recommended to explore [**the official CKEditor5 documentation**](https://ckeditor.com/docs/ckeditor5/latest/features/index.html) and [**the Strapi Custom Field API**](https://docs.strapi.io/developer-docs/latest/development/custom-fields.html#registering-a-custom-field-on-the-server)
75
- >
76
- > To display content from external sources, such as images or videos, in your admin panel, you need to configure your `middlewares.js` file. [**Check the official documentation for details.**](https://docs.strapi.io/dev-docs/configurations/middlewares#security)
107
+ <p align="center">
108
+ <img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/v5-def-mrk-light.png" width="700" />
109
+ </p>
77
110
 
78
- The plugin configuration should be defined in `your-app/config/ckeditor.js` or in `ckeditor.ts` if you are using TypeScript in your project.
111
+ </details>
79
112
 
80
- By default, the plugin provides one default preset that can be modified in the config file, and you can expand the preset set as needed.
113
+ **Responsive images**
81
114
 
82
- The plugin exposes all default CKEditor packages to the global variable `SH_CKE`.
115
+ The plugin generates `srcset` attribute for inserted images if the image has any `formats` other than `thumbnail`.
83
116
 
84
- The config file must define a function called `CKEConfig` that returns the configuration object.
117
+ **UI language**: If you don't specify the UI language in the editor configuration, the plugin will
118
+ default to the Strapi admin's preferred language. If no preference is set, English will be used as a fallback.
85
119
 
86
- The structure of the configuration object is as follows:
120
+ **Content language**: i18n for the editor's content language can be enabled by checking the
121
+ `Enable localization for this field` option in the Advanced Settings tab.
87
122
 
88
- ```js
89
- {
90
- dontMergePresets:bool,
91
- dontMergeTheme:bool,
92
- presets:{
93
- default:{
94
- field:{...},
95
- styles:string,
96
- editorConfig:{...},
97
- },
98
- ...
99
- },
100
- theme:{
101
- common:string,
102
- light:string,
103
- dark:string,
104
- additional:string,
105
- }
106
- }
107
- ```
123
+ > 💡 It is important to use the content styles on the publishing side of your application. Otherwise, the content will look different in the editor and for your end users. [Follow the documentation](https://ckeditor.com/docs/ckeditor5/latest/getting-started/setup/css.html#styling-the-published-content).
108
124
 
109
- Every preset in the `presets` object contains three properties:
125
+ ## <a id="configuration"></a>⚙️ Configuration
110
126
 
111
- 1. `field (object)` Registers this configuration version in the Admin panel.
112
- 2. `styles (string)` Styles applied to the editor in this version.
113
- 3. `editorConfig (object)` The CKEditor configuration.
127
+ The plugin configuration must be defined on the front-end. The plugin provides a `setPluginConfig`
128
+ function, which accepts a plugin configuration (`PluginConfig`) that can include an array of presets
129
+ and a theme object:
114
130
 
115
- The `theme` object is used to modify the default global theme of the plugin.
116
- It contains four properties:
131
+ ```ts
132
+ import { setPluginConfig } from '@_sh/strapi-plugin-ckeditor';
117
133
 
118
- 1. `common (string)` Styles applied to the editor to ensure proper appearance of the input.
119
- 2. `light (string)` Styles applied to the editor when Strapi is in light mode.
120
- 3. `dark (string)` Styles applied to the editor when Strapi is in dark mode.
121
- 4. `additional (string)` Additional styles to further enhance the editors appearance.
134
+ function setPluginConfig(pluginConfig: {
135
+ presets: Preset[] | undefined;
136
+ theme: Theme | undefined;
137
+ }): void;
138
+ ```
122
139
 
123
- By default, everything defined in the user’s configuration is merged with the
124
- default configuration object. These two properties allow you to prevent
125
- this behavior:
140
+ **Key points:**
126
141
 
127
- 1. `dontMergePresets (bool)`
128
- 2. `dontMergeTheme (bool)`
142
+ - The function must be invoked before the admin panel's bootstrap lifecycle function. The general recommendation is to call it inside the admin panel's register lifecycle function.
143
+ - Provided properties will overwrite the default configuration values.
144
+ - The configuration becomes immutable after the first invocation, preventing further modifications.
129
145
 
130
- Since Strapi uses i18n for translation, the `ignorei18n` property is added to the
131
- `editorConfig.language` object. This property allows you to manually set the
132
- content language, bypassing i18n. The language object looks like this:
146
+ **Plugin configuration object** includes optional `presets` and `theme` properties:
133
147
 
134
- ```js
135
- language:{
136
- ignorei18n (bool),
137
- ui (string),
138
- content (string)
139
- }
148
+ ```ts
149
+ type PluginConfig = {
150
+ /**
151
+ * Presets are sets of settings that define the editor's features and appearance.
152
+ */
153
+ presets?: Preset[];
154
+ /**
155
+ * Styles applied globally to every editor instance.
156
+ */
157
+ theme?: Theme;
158
+ };
159
+ ```
160
+
161
+ `presets` is an array of objects of type `Preset`. Each preset includes the following properties:
162
+
163
+ ```ts
164
+ type Preset = {
165
+ /**
166
+ * Preset name, displayed in the schema.
167
+ */
168
+ name: string;
169
+ /**
170
+ * Preset description, displayed in the Content-Type Builder.
171
+ */
172
+ description: string;
173
+ /**
174
+ * CKEditor configuration object.
175
+ *
176
+ * @see {@link https://ckeditor.com/docs/ckeditor5/latest/getting-started/setup/configuration.html | CKEditor documentation}
177
+ */
178
+ editorConfig: EditorConfig;
179
+ /**
180
+ * Additional styles applied to the editor instance after the theme styles.
181
+ */
182
+ styles?: EditorStyles;
183
+ };
184
+ ```
185
+
186
+ `theme` object defines a plugin CSS styles applied to every editor instance. It includes the
187
+ following properties:
188
+
189
+ ```ts
190
+ /**
191
+ * The `common` styles are applied first, followed by `light` or `dark` styles
192
+ * according to user preferences, and finally `additional` styles.
193
+ */
194
+ type Theme = {
195
+ /**
196
+ * Core styles.
197
+ */
198
+ common?: EditorStyles;
199
+ /**
200
+ * Styles applied in light mode.
201
+ */
202
+ light?: EditorStyles;
203
+ /**
204
+ * Styles applied in dark mode.
205
+ */
206
+ dark?: EditorStyles;
207
+ /**
208
+ * Additional styles that complement the theme.
209
+ */
210
+ additional?: EditorStyles;
211
+ };
140
212
  ```
141
- The language determination follows this logic:
142
213
 
143
- - Plugin UI language:
144
- `language.ui || strapi admin preferred language || 'en'`
214
+ ```ts
215
+ /**
216
+ * Represents styles that can be applied to an editor instance.
217
+ * Can be a plain CSS string or an array of interpolations for dynamic styling.
218
+ */
219
+ export type EditorStyles = string | Interpolation<object>[];
220
+ ```
145
221
 
146
- - Content language:
147
- `(ignorei18n ? language.content : i18n) || language.ui`
222
+ **Default presets and theme**
148
223
 
149
- ### Configuration examples
224
+ To simplify the process of defining a new preset, the plugin exports default presets and
225
+ a default theme, which can be used as a base in custom configurations:
150
226
 
151
- Adding a new preset:
227
+ ```ts
228
+ import {
229
+ defaultTheme,
230
+ defaultHtmlPreset,
231
+ defaultMarkdownPreset,
232
+ } from '@_sh/strapi-plugin-ckeditor';
233
+ ```
152
234
 
153
- <details>
154
- <summary><b>ckeditor.js</b></summary>
235
+ **Integration with Strapi's Media Library**
155
236
 
156
- ```js
157
- const CKEConfig = () => ({
158
- presets: {
159
- markdown:{
160
- field: {
161
- key: "markdown",
162
- value: "markdown",
163
- metadatas: {
164
- intlLabel: {
165
- id: "ckeditor.preset.markdown.label",
166
- defaultMessage: "Markdown output",
167
- },
168
- },
169
- },
170
- editorConfig:{
171
- placeholder: 'Markdown editor',
172
- plugins: [
173
- globalThis.SH_CKE.Essentials,
174
- globalThis.SH_CKE.Autoformat,
175
- globalThis.SH_CKE.BlockQuote,
176
- globalThis.SH_CKE.Bold,
177
- globalThis.SH_CKE.Heading,
178
- globalThis.SH_CKE.Image,
179
- globalThis.SH_CKE.ImageCaption,
180
- globalThis.SH_CKE.ImageStyle,
181
- globalThis.SH_CKE.ImageToolbar,
182
- globalThis.SH_CKE.ImageUpload,
183
- globalThis.SH_CKE.Indent,
184
- globalThis.SH_CKE.Italic,
185
- globalThis.SH_CKE.Link,
186
- globalThis.SH_CKE.List,
187
- globalThis.SH_CKE.MediaEmbed,
188
- globalThis.SH_CKE.Paragraph,
189
- globalThis.SH_CKE.Table,
190
- globalThis.SH_CKE.TableToolbar,
191
- globalThis.SH_CKE.SourceEditing,
192
- globalThis.SH_CKE.StrapiMediaLib,
193
- globalThis.SH_CKE.StrapiUploadAdapter,
194
- globalThis.SH_CKE.Markdown,
195
- globalThis.SH_CKE.Code,
196
- globalThis.SH_CKE.CodeBlock,
197
- globalThis.SH_CKE.TodoList,
198
- globalThis.SH_CKE.Strikethrough,
199
- globalThis.SH_CKE.HorizontalLine
200
- ],
201
- toolbar: {
202
- items: [
203
- 'heading',
204
- '|',
205
- 'bold',
206
- 'italic',
207
- 'strikethrough',
208
- 'link',
209
- '|',
210
- 'bulletedList',
211
- 'numberedList',
212
- 'todoList',
213
- '|',
214
- 'code',
215
- 'codeBlock',
216
- '|',
217
- 'uploadImage',
218
- 'strapiMediaLib',
219
- 'blockQuote',
220
- 'horizontalLine',
221
- '-',
222
- 'sourceEditing',
223
- '|',
224
- 'outdent',
225
- 'indent',
226
- '|',
227
- 'undo',
228
- 'redo'
229
- ],
230
- shouldNotGroupWhenFull: true
231
- },
232
- image: {
233
- toolbar: [ 'imageStyle:inline', 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ]
234
- },
235
- codeBlock: {
236
- languages: [
237
- { language: 'css', label: 'CSS' },
238
- { language: 'html', label: 'HTML' },
239
- { language: 'javascript', label: 'JavaScript' },
240
- { language: 'php', label: 'PHP' }
241
- ]
242
- },
243
- }
244
- },
245
- }
246
- })
237
+ To integrate CKEditor with the Strapi's Media Library, the plugin provides two CKEditor plugins
238
+ that can be included in your presets without additional configuration:
239
+
240
+ ```ts
241
+ import { StrapiMediaLib, StrapiUploadAdapter } from '@_sh/strapi-plugin-ckeditor';
247
242
  ```
248
243
 
249
- </details>
244
+ **Available type definitions**
250
245
 
251
- ---
246
+ The following type definitions are available for use:
252
247
 
253
- Changing toolbar buttons, modifying the plugin list, adding styles to the default preset:
248
+ ```ts
249
+ import type {
250
+ PluginConfig,
251
+ Preset,
252
+ EditorConfig,
253
+ Theme,
254
+ EditorStyles,
255
+ } from '@_sh/strapi-plugin-ckeditor';
256
+ ```
254
257
 
255
258
  <details>
256
- <summary><b>ckeditor.js</b></summary>
257
-
258
- ```js
259
- const CKEConfig = () => ({
260
- presets:{
261
- default:{
262
- styles:`
263
- --ck-focus-ring:3px dashed #5CB176;
264
-
265
- .ck.ck-content.ck-editor__editable {
266
- &.ck-focused:not(.ck-editor__nested-editable) {
267
- border: var(--ck-focus-ring) !important;
268
- }
269
- }
270
- .ck.ck-content.ck-editor__editable.ck-rounded-corners.ck-editor__editable_inline.ck-blurred{
271
- min-height: 400px;
272
- max-height: 400px;
273
- }
274
- .ck.ck-content.ck-editor__editable.ck-rounded-corners.ck-editor__editable_inline.ck-focused{
275
- min-height: 400px;
276
- max-height: 1700px;
277
- }
278
- `,
279
- editorConfig:{
280
- plugins: [
281
- globalThis.SH_CKE.Bold,
282
- globalThis.SH_CKE.Italic,
283
- globalThis.SH_CKE.Essentials,
284
- globalThis.SH_CKE.Heading,
285
- globalThis.SH_CKE.Image,
286
- globalThis.SH_CKE.ImageCaption,
287
- globalThis.SH_CKE.ImageStyle,
288
- globalThis.SH_CKE.ImageToolbar,
289
- globalThis.SH_CKE.Link,
290
- globalThis.SH_CKE.List,
291
- globalThis.SH_CKE.Paragraph,
292
- globalThis.SH_CKE.StrapiMediaLib,
293
- globalThis.SH_CKE.StrapiUploadAdapter,
294
- ],
295
- toolbar: [
296
- 'heading',
297
- '|',
298
- 'bold', 'italic', 'link', 'bulletedList', 'numberedList',
299
- '|',
300
- 'strapiMediaLib', 'insertTable',
301
- '|',
302
- 'undo', 'redo'
303
- ]
304
- }
305
- }
306
- }
307
- })
259
+ <summary>Type definitions</summary>
260
+
261
+ ```ts
262
+ /**
263
+ * Plugin configuration object.
264
+ */
265
+ export type PluginConfig = {
266
+ /**
267
+ * Presets are sets of settings that define the editor's features and appearance.
268
+ */
269
+ presets?: Preset[];
270
+ /**
271
+ * Styles applied globally to every editor instance.
272
+ */
273
+ theme?: Theme;
274
+ };
308
275
  ```
309
276
 
310
- </details>
277
+ ```ts
278
+ /**
279
+ * Preset is a set of settings that define the editor's features and appearance.
280
+ */
281
+ export type Preset = {
282
+ /**
283
+ * Preset name, displayed in the schema.
284
+ */
285
+ name: string;
286
+ /**
287
+ * Preset description, displayed in the Content-Type Builder.
288
+ */
289
+ description: string;
290
+ /**
291
+ * Additional styles applied to the editor instance after the theme styles.
292
+ */
293
+ styles?: EditorStyles;
294
+ /**
295
+ * CKEditor configuration object.
296
+ *
297
+ * @see {@link https://ckeditor.com/docs/ckeditor5/latest/getting-started/setup/configuration.html | CKEditor documentation}
298
+ */
299
+ editorConfig: EditorConfig;
300
+ };
301
+ ```
311
302
 
312
- ---
303
+ ```ts
304
+ /**
305
+ * CKEditor configuration object.
306
+ *
307
+ * @see {@link https://ckeditor.com/docs/ckeditor5/latest/getting-started/setup/configuration.html | CKEditor documentation}
308
+ */
309
+ export type EditorConfig = CKE5EditorConfig;
310
+ ```
313
311
 
314
- > 📂 Default preset: [**admin/src/components/Input/presets/default.js**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/Input/presets/default.js)
315
- >
316
- > 📂 Default theme: [**admin/src/components/Input/theme**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/Input/theme)
312
+ ```ts
313
+ /**
314
+ * Styles applied globally to every editor instance.
315
+ *
316
+ * @remarks
317
+ *
318
+ * The `common` styles are applied first, followed by `light` or `dark` styles
319
+ * according to the preferences, and finally `additional` styles.
320
+ */
321
+ export type Theme = {
322
+ /**
323
+ * Core styles.
324
+ */
325
+ common?: EditorStyles;
326
+ /**
327
+ * Styles applied in light mode.
328
+ */
329
+ light?: EditorStyles;
330
+ /**
331
+ * Styles applied in dark mode.
332
+ */
333
+ dark?: EditorStyles;
334
+ /**
335
+ * Additional styles that complement the theme.
336
+ */
337
+ additional?: EditorStyles;
338
+ };
339
+ ```
317
340
 
318
- ### Adding plugins
341
+ ```ts
342
+ /**
343
+ * Represents styles that can be applied to an editor instance.
344
+ * Can be a plain CSS string or an array of interpolations for dynamic styling.
345
+ */
346
+ export type EditorStyles = string | Interpolation<object>[];
347
+ ```
319
348
 
320
- Your plugin must be available in the `global` object.
349
+ </details>
321
350
 
322
- **Example of adding the Timestamp plugin:**
351
+ ### Configuration examples:
323
352
 
324
- 1. Create the plugin:
353
+ <details>
354
+ <summary>Adding a new preset [JS]</summary>
325
355
 
326
356
  ```js
327
- // your-app/src/admin/timestamp.js
328
-
329
- class Timestamp extends globalThis.SH_CKE.Plugin {
330
- init() {
331
- const editor = this.editor;
332
- // The button must be registered among the UI components of the editor
333
- // to be displayed in the toolbar.
334
- editor.ui.componentFactory.add( 'timestamp', () => {
335
- // The button will be an instance of ButtonView.
336
- const button = new globalThis.SH_CKE.ButtonView();
337
-
338
- button.set( {
339
- label: 'Timestamp',
340
- withText: true
341
- } );
342
-
343
- // Execute a callback function when the button is clicked.
344
- button.on( 'execute', () => {
345
- const now = new Date();
346
-
347
- // Change the model using the model writer.
348
- editor.model.change( writer => {
349
-
350
- // Insert the text at the user's current position.
351
- editor.model.insertContent( writer.createText( now.toString() ) );
352
- } );
353
- } );
354
-
355
- return button;
356
- } );
357
- }
358
- }
359
-
360
- globalThis.Timestamp = Timestamp;
361
- ```
357
+ // src/admin/app.js
358
+
359
+ import {
360
+ Bold,
361
+ Italic,
362
+ Essentials,
363
+ Heading,
364
+ Image,
365
+ ImageCaption,
366
+ ImageStyle,
367
+ ImageToolbar,
368
+ ImageUpload,
369
+ Link,
370
+ List,
371
+ Paragraph,
372
+ } from 'ckeditor5';
373
+
374
+ import { setPluginConfig, StrapiMediaLib, StrapiUploadAdapter } from '@_sh/strapi-plugin-ckeditor';
375
+
376
+ const myCustomPreset = {
377
+ name: 'myCustomPreset',
378
+ description: 'myCustomPreset description',
379
+ editorConfig: {
380
+ licenseKey: 'GPL',
381
+ plugins: [
382
+ Bold,
383
+ Italic,
384
+ Essentials,
385
+ Heading,
386
+ Image,
387
+ ImageCaption,
388
+ ImageStyle,
389
+ ImageToolbar,
390
+ ImageUpload,
391
+ Link,
392
+ List,
393
+ Paragraph,
394
+ StrapiMediaLib,
395
+ StrapiUploadAdapter,
396
+ ],
397
+ toolbar: [
398
+ 'heading',
399
+ '|',
400
+ 'bold',
401
+ 'italic',
402
+ 'link',
403
+ 'bulletedList',
404
+ 'numberedList',
405
+ '|',
406
+ 'strapiMediaLib',
407
+ '|',
408
+ 'undo',
409
+ 'redo',
410
+ ],
411
+ },
412
+ };
362
413
 
363
- 2. Import the plugin:
414
+ const myConfig = {
415
+ /**
416
+ * Note: Since the provided `presets` include only `myCustomPreset`
417
+ * this configuration will overwrite default presets.
418
+ */
419
+ presets: [myCustomPreset],
420
+ };
364
421
 
365
- ```js
366
- // your-app/src/admin/app.js
422
+ export default {
423
+ register() {
424
+ setPluginConfig(myConfig);
425
+ },
426
+ };
427
+ ```
367
428
 
368
- import './timestamp.js'
429
+ </details>
369
430
 
370
- const config = {};
431
+ <details>
432
+ <summary>Adding a new preset [TS]</summary>
433
+
434
+ ```ts
435
+ // src/admin/app.tsx
436
+
437
+ import {
438
+ Bold,
439
+ Italic,
440
+ Essentials,
441
+ Heading,
442
+ Image,
443
+ ImageCaption,
444
+ ImageStyle,
445
+ ImageToolbar,
446
+ ImageUpload,
447
+ Link,
448
+ List,
449
+ Paragraph,
450
+ } from 'ckeditor5';
451
+
452
+ import {
453
+ type PluginConfig,
454
+ type Preset,
455
+ setPluginConfig,
456
+ StrapiMediaLib,
457
+ StrapiUploadAdapter,
458
+ } from '@_sh/strapi-plugin-ckeditor';
459
+
460
+ const myCustomPreset: Preset = {
461
+ name: 'myCustomPreset',
462
+ description: 'myCustomPreset description',
463
+ editorConfig: {
464
+ licenseKey: 'GPL',
465
+ plugins: [
466
+ Bold,
467
+ Italic,
468
+ Essentials,
469
+ Heading,
470
+ Image,
471
+ ImageCaption,
472
+ ImageStyle,
473
+ ImageToolbar,
474
+ ImageUpload,
475
+ Link,
476
+ List,
477
+ Paragraph,
478
+ StrapiMediaLib,
479
+ StrapiUploadAdapter,
480
+ ],
481
+ toolbar: [
482
+ 'heading',
483
+ '|',
484
+ 'bold',
485
+ 'italic',
486
+ 'link',
487
+ 'bulletedList',
488
+ 'numberedList',
489
+ '|',
490
+ 'strapiMediaLib',
491
+ '|',
492
+ 'undo',
493
+ 'redo',
494
+ ],
495
+ },
496
+ };
371
497
 
372
- const bootstrap = (app) => {};
498
+ const myConfig: PluginConfig = {
499
+ /**
500
+ * Note that since provided `presets` includes only `myCustomPreset`
501
+ * this configuration will overwrite default presets.
502
+ */
503
+ presets: [myCustomPreset],
504
+ };
373
505
 
374
506
  export default {
375
- config,
376
- bootstrap,
507
+ register() {
508
+ setPluginConfig(myConfig);
509
+ },
377
510
  };
378
-
379
511
  ```
380
512
 
381
- 3. Add the new plugin to your preset:
513
+ </details>
382
514
 
383
515
  <details>
384
- <summary><b>ckeditor.js</b></summary>
516
+ <summary>Default presets modification [TS]</summary>
517
+
518
+ ```ts
519
+ // src/admin/app.tsx
520
+
521
+ import { css } from 'styled-components';
522
+
523
+ import {
524
+ type PluginConfig,
525
+ type Preset,
526
+ setPluginConfig,
527
+ defaultHtmlPreset,
528
+ defaultMarkdownPreset,
529
+ } from '@_sh/strapi-plugin-ckeditor';
530
+
531
+ const defaultHtml: Preset = {
532
+ ...defaultHtmlPreset,
533
+ description: 'Modified default HTML editor',
534
+ styles: `
535
+ .ck {
536
+ color: red;
537
+ }
538
+ `,
539
+ editorConfig: {
540
+ ...defaultHtmlPreset.editorConfig,
541
+ placeholder: 'Modified default HTML editor',
542
+ toolbar: [
543
+ 'heading',
544
+ '|',
545
+ 'bold',
546
+ 'italic',
547
+ 'link',
548
+ 'bulletedList',
549
+ 'numberedList',
550
+ '|',
551
+ 'strapiMediaLib',
552
+ 'insertTable',
553
+ '|',
554
+ 'undo',
555
+ 'redo',
556
+ ],
557
+ },
558
+ };
385
559
 
386
- ```js
387
- // your-app/config/ckeditor.js
388
-
389
- const CKEConfig = () => ({
390
- presets: {
391
- myCustomPreset:{
392
- field: {
393
- key: "myCustomPreset",
394
- value: "myCustomPreset",
395
- metadatas: {
396
- intlLabel: {
397
- id: "ckeditor5.preset.myCustomPreset.label",
398
- defaultMessage: "My custom preset",
399
- },
400
- },
401
- },
402
- editorConfig:{
403
- plugins: [
404
- globalThis.Timestamp,
405
- globalThis.SH_CKE.Autoformat,
406
- globalThis.SH_CKE.Bold,
407
- globalThis.SH_CKE.Italic,
408
- globalThis.SH_CKE.Essentials,
409
- globalThis.SH_CKE.Heading,
410
- globalThis.SH_CKE.Image,
411
- globalThis.SH_CKE.ImageCaption,
412
- globalThis.SH_CKE.ImageStyle,
413
- globalThis.SH_CKE.ImageToolbar,
414
- globalThis.SH_CKE.ImageUpload,
415
- globalThis.SH_CKE.Indent,
416
- globalThis.SH_CKE.Link,
417
- globalThis.SH_CKE.List,
418
- globalThis.SH_CKE.Paragraph,
419
- globalThis.SH_CKE.PasteFromOffice,
420
- globalThis.SH_CKE.Table,
421
- globalThis.SH_CKE.TableToolbar,
422
- globalThis.SH_CKE.TableColumnResize,
423
- globalThis.SH_CKE.TableCaption,
424
- globalThis.SH_CKE.StrapiMediaLib,
425
- globalThis.SH_CKE.StrapiUploadAdapter,
426
- ],
427
- toolbar: [
428
- 'timestamp',
429
- 'heading',
430
- '|',
431
- 'bold', 'italic', 'link', 'bulletedList', 'numberedList',
432
- '|',
433
- 'strapiMediaLib', 'insertTable',
434
- '|',
435
- 'undo', 'redo'
436
- ],
437
-
438
- // ...
439
- }
440
- },
441
- }
442
- })
560
+ const defaultMarkdown: Preset = {
561
+ ...defaultMarkdownPreset,
562
+ description: 'Modified default Markdown editor',
563
+ styles: css`
564
+ .ck {
565
+ --ck-editor-max-width: 1500px;
566
+ --ck-editor-min-height: 700px;
567
+ --ck-editor-max-height: 700px;
568
+ }
569
+
570
+ .ck.ck-editor__main {
571
+ border: 3px dashed ${({ theme }) => theme.colors.warning500};
572
+ }
573
+ `,
574
+ };
575
+
576
+ const myConfig: PluginConfig = {
577
+ presets: [defaultHtml, defaultMarkdown],
578
+ };
579
+
580
+ export default {
581
+ register() {
582
+ setPluginConfig(myConfig);
583
+ },
584
+ };
443
585
  ```
444
586
 
445
- </details>
587
+ </details>
446
588
 
589
+ <details>
590
+ <summary>Modifying theme [TS]</summary>
591
+
592
+ ```ts
593
+ // src/admin/app.tsx
594
+
595
+ import { css } from 'styled-components';
596
+
597
+ import { type PluginConfig, setPluginConfig, defaultTheme } from '@_sh/strapi-plugin-ckeditor';
598
+
599
+ const myConfig: PluginConfig = {
600
+ theme: {
601
+ ...defaultTheme,
602
+ additional: css`
603
+ .ck {
604
+ --ck-editor-max-width: 1500px;
605
+ --ck-editor-min-height: 700px;
606
+ --ck-editor-max-height: 700px;
607
+ }
608
+
609
+ .ck.ck-editor__main {
610
+ border: 3px dashed ${({ theme }) => theme.colors.warning500};
611
+ }
612
+ `,
613
+ },
614
+ };
447
615
 
448
- 4. Then rebuild the application:
449
- ```bash
450
- yarn build
616
+ export default {
617
+ register() {
618
+ setPluginConfig(myConfig);
619
+ },
620
+ };
451
621
  ```
452
622
 
453
- **💡 Alternatively, you can define your plugin like this:**
623
+ </details>
454
624
 
455
625
  <details>
456
- <summary><b>ckeditor.js</b></summary>
626
+ <summary>Adding Timestamp plugin [JS]</summary>
457
627
 
458
- ```js
459
- const CKEConfig = () => {
460
- class Timestamp extends globalThis.SH_CKE.Plugin {
461
- init() {
462
- const editor = this.editor;
463
- // The button must be registered among the UI components of the editor
464
- // to be displayed in the toolbar.
465
- editor.ui.componentFactory.add("timestamp", () => {
466
- // The button will be an instance of ButtonView.
467
- const button = new globalThis.SH_CKE.ButtonView();
468
-
469
- button.set({
470
- label: "Timestamp",
471
- withText: true,
472
- });
628
+ ```ts
629
+ // src/admin/app.js
473
630
 
474
- // Execute a callback function when the button is clicked.
475
- button.on("execute", () => {
476
- const now = new Date();
631
+ import { Plugin, ButtonView } from 'ckeditor5';
477
632
 
478
- // Change the model using the model writer.
479
- editor.model.change((writer) => {
480
- // Insert the text at the user's current position.
481
- editor.model.insertContent(writer.createText(now.toString()));
482
- });
483
- });
633
+ import { setPluginConfig, defaultHtmlPreset } from '@_sh/strapi-plugin-ckeditor';
484
634
 
485
- return button;
635
+ class Timestamp extends Plugin {
636
+ init() {
637
+ const editor = this.editor;
638
+ editor.ui.componentFactory.add('timestamp', () => {
639
+ const button = new ButtonView();
640
+ button.set({
641
+ label: 'timestamp',
642
+ withText: true,
486
643
  });
487
- }
488
- }
489
-
490
- return {
491
- presets: {
492
- myCustomPreset:{
493
- field: {
494
- key: "myCustomPreset",
495
- value: "myCustomPreset",
496
- metadatas: {
497
- intlLabel: {
498
- id: "ckeditor5.preset.myCustomPreset.label",
499
- defaultMessage: "My custom preset",
500
- },
501
- },
502
- },
503
- editorConfig:{
504
- plugins: [
505
- Timestamp,
506
- globalThis.SH_CKE.Autoformat,
507
- globalThis.SH_CKE.Bold,
508
- globalThis.SH_CKE.Italic,
509
- globalThis.SH_CKE.Essentials,
510
- globalThis.SH_CKE.Heading,
511
- globalThis.SH_CKE.Image,
512
- globalThis.SH_CKE.ImageCaption,
513
- globalThis.SH_CKE.ImageStyle,
514
- globalThis.SH_CKE.ImageToolbar,
515
- globalThis.SH_CKE.ImageUpload,
516
- globalThis.SH_CKE.Indent,
517
- globalThis.SH_CKE.Link,
518
- globalThis.SH_CKE.List,
519
- globalThis.SH_CKE.Paragraph,
520
- globalThis.SH_CKE.PasteFromOffice,
521
- globalThis.SH_CKE.Table,
522
- globalThis.SH_CKE.TableToolbar,
523
- globalThis.SH_CKE.TableColumnResize,
524
- globalThis.SH_CKE.TableCaption,
525
- globalThis.SH_CKE.StrapiMediaLib,
526
- globalThis.SH_CKE.StrapiUploadAdapter,
527
- ],
528
- toolbar: [
529
- 'timestamp',
530
- 'heading',
531
- '|',
532
- 'bold', 'italic', 'link', 'bulletedList', 'numberedList',
533
- '|',
534
- 'strapiMediaLib', 'insertTable',
535
- '|',
536
- 'undo', 'redo'
537
- ],
538
-
539
- ...
540
- }
541
- },
644
+ button.on('execute', () => {
645
+ const now = new Date();
646
+ editor.model.change(writer => {
647
+ editor.model.insertContent(writer.createText(now.toString()));
648
+ });
649
+ });
650
+ return button;
651
+ });
542
652
  }
543
653
  }
654
+
655
+ export default {
656
+ register() {
657
+ defaultHtmlPreset.editorConfig.plugins.push(Timestamp);
658
+ defaultHtmlPreset.editorConfig.toolbar.unshift('timestamp');
659
+ setPluginConfig({ presets: [defaultHtmlPreset] });
660
+ },
661
+ };
544
662
  ```
545
663
 
546
- </details>
664
+ </details>
547
665
 
666
+ <br />
548
667
 
668
+ 📂 Default HTML preset: [**admin/src/config/htmlPreset.ts**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/config/htmlPreset.ts)
549
669
 
550
- ## <a id="contributing"></a>🛠 Contributing
670
+ 📂 Default Markdown preset: [**admin/src/config/markdownPreset.ts**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/config/markdownPreset.ts)
551
671
 
672
+ 📂 Default theme: [**admin/src/theme**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/theme)
552
673
 
553
- This section explains how to set up your environment if you want to contribute to this package.
674
+ > 📌 It is highly recommended to explore [**the official CKEditor5 documentation**](https://ckeditor.com/docs/ckeditor5/latest/getting-started/setup/configuration.html).
554
675
 
555
- [Strapi Plugin SDK docs](https://docs.strapi.io/dev-docs/plugins/development/create-a-plugin#linking-the-plugin-to-your-project)
676
+ > 💡 To display content from external sources, such as images or videos, in your admin panel,
677
+ > you need to configure your `middlewares.js` file.
678
+ > [**Check the documentation for details.**](https://docs.strapi.io/dev-docs/configurations/middlewares#security)
556
679
 
557
- Clone the repository:
680
+ ## <a id="contributing"></a>🛠 Contributing
558
681
 
559
- ```bash
560
- git clone https://github.com/nshenderov/strapi-plugin-ckeditor.git ./strapi-plugin-ckeditor
561
- ```
562
- Navigate to the downloaded folder:
682
+ Feel free to [fork the repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo)
683
+ and open a pull request, any help is appreciated.
563
684
 
564
- ```bash
565
- cd ./strapi-plugin-ckeditor
566
- ```
685
+ Follow these steps to set up a plugin development environment:
686
+
687
+ 1. Clone the repository.
567
688
 
568
- Install dependencies:
689
+ 2. Read [the Strapi Plugin SDK documentation](https://docs.strapi.io/dev-docs/plugins/development/create-a-plugin#linking-the-plugin-to-your-project).
690
+
691
+ 3. Navigate to the cloned plugin folder and install dependencies, run:
569
692
 
570
693
  ```bash
571
694
  yarn install
572
695
  ```
573
696
 
574
- Link the plugin to your project:
697
+ 4. Link the plugin to your project:
575
698
 
576
- In the plugin directory, run:
577
- ```bash
578
- yarn watch:link
579
- ```
699
+ - In the plugin folder, run:
580
700
 
581
- Open new terminal window and in your project directory, run:
582
- ```bash
583
- yarn dlx yalc add --link @_sh/strapi-plugin-ckeditor && yarn install
584
- ```
701
+ ```bash
702
+ yarn watch:link
703
+ ```
704
+
705
+ - Open a new terminal, navigate to your Strapi project directory, and run:
706
+
707
+ ```bash
708
+ yarn dlx yalc add --link @_sh/strapi-plugin-ckeditor && yarn install
709
+ ```
585
710
 
586
- Rebuild the project and start the server:
711
+ 5. Rebuild the project and start the server:
587
712
 
588
713
  ```bash
589
714
  yarn build
590
715
  yarn develop
591
716
  ```
592
717
 
593
-
594
718
  ## <a id="migration"></a>✈️ Migration
595
719
 
596
- ### From v3 to v4
597
-
598
- - The new version introduces support for Strapi v5 and is incompatible with Strapi v4. You will need to update your Strapi project to version 5 before upgrading.
599
-
600
- - The plugin development process has changed. Please refer to the updated contribution guide for more information.
601
-
602
- ### From v2 to v3
603
-
604
- - The default editor configurations (toolbar, toolbarBalloon, blockBalloon) have been removed and now there is only one preset by default. You will need to update your fields in the Content-Type Builder.
605
-
606
- - Config file extension has changed from `.txt` to `.js` or `.ts`
607
- - Configuration object properties have been renamed:
608
- - `configsOverwrite` -> `dontMergePresets`
609
- - `themeOverwrite` -> `dontMergeTheme`
610
- - `configs` -> `presets`
611
- - From v3 instead of globalThis.CKEditorConfig = {..}, the config file must define a function called CKEConfig that returns the configuration object.
612
-
613
- Example of the new configuration file:
614
-
615
- <details>
616
- <summary><b>ckeditor.js</b></summary>
617
-
618
- ```js
619
- const CKEConfig = () => ({
620
- presets:{
621
- myCustomPreset:{
622
- field: {
623
- key: "myCustomPreset",
624
- value: "myCustomPreset",
625
- metadatas: {
626
- intlLabel: {
627
- id: "ckeditor5.preset.myCustomPreset.label",
628
- defaultMessage: "My custom preset",
629
- },
630
- },
631
- },
632
- editorConfig:{
633
- plugins: [
634
- globalThis.SH_CKE.Autoformat,
635
- globalThis.SH_CKE.Bold,
636
- globalThis.SH_CKE.Italic,
637
- globalThis.SH_CKE.Essentials,
638
- globalThis.SH_CKE.Heading,
639
- globalThis.SH_CKE.Image,
640
- globalThis.SH_CKE.ImageCaption,
641
- globalThis.SH_CKE.ImageStyle,
642
- globalThis.SH_CKE.ImageToolbar,
643
- globalThis.SH_CKE.ImageUpload,
644
- globalThis.SH_CKE.Indent,
645
- globalThis.SH_CKE.Link,
646
- globalThis.SH_CKE.List,
647
- globalThis.SH_CKE.Paragraph,
648
- globalThis.SH_CKE.PasteFromOffice,
649
- globalThis.SH_CKE.Table,
650
- globalThis.SH_CKE.TableToolbar,
651
- globalThis.SH_CKE.TableColumnResize,
652
- globalThis.SH_CKE.TableCaption,
653
- globalThis.SH_CKE.StrapiMediaLib,
654
- globalThis.SH_CKE.StrapiUploadAdapter,
655
- ],
656
- toolbar: [
657
- 'heading',
658
- '|',
659
- 'bold', 'italic', 'link', 'bulletedList', 'numberedList',
660
- '|',
661
- 'strapiMediaLib', 'insertTable',
662
- '|',
663
- 'undo', 'redo'
664
- ],
665
- heading: {
666
- options: [
667
- { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
668
- { model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
669
- { model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
670
- { model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
671
- { model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
672
- ]
673
- },
674
- image: {
675
- toolbar: [
676
- 'imageStyle:inline',
677
- 'imageStyle:block',
678
- 'imageStyle:side',
679
- '|',
680
- 'toggleImageCaption',
681
- 'imageTextAlternative'
682
- ]
683
- },
684
- table: {
685
- contentToolbar: [
686
- 'tableColumn',
687
- 'tableRow',
688
- 'mergeTableCells',
689
- '|',
690
- 'toggleTableCaption'
691
- ]
692
- }
693
- }
694
- }
695
- }
696
- })
697
- ```
698
-
699
- </details>
700
-
701
- ### From v1 to v2
702
-
703
- - You will need to update Strapi to version v4.4.x for plugin v2.0.x, or to v4.13.0+ for v2.1.x.
704
-
705
- - Starting with v2, the plugin uses the Custom Field API, so you'll need to manually update your schema.
706
-
707
- - The plugin configuration should be defined in /config/ckeditor.txt from v2 onward. [Please refer to the v2 configuration guide for details.](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/e782475f54b8a50a04f55275c89ef5bf61a15745/README.md?plain=1#L54)
720
+ To upgrade to the latest version, follow the dedicated [migration guide](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/MIGRATION.md)
721
+ for detailed instructions.
708
722
 
709
723
  ## <a id="requirements"></a>⚠️ Requirements
710
724
 
711
-
712
- **v4.x.x**
725
+ **v5.x.x**
713
726
 
714
727
  Strapi **>= 5.0.0**
715
728
 
716
- Node **>= 18.0.0 <= 20.x.x**
729
+ Node **>= 18.0.0 <= 22.x.x**
717
730
 
718
- ___
731
+ ---
719
732
 
720
733
  **v3.x.x**
721
734
 
722
735
  Strapi **>= 4.13.0 < 5.0.0**
723
736
 
724
- Node **>= 18.0.0 <= 20.x.x**
737
+ Node **>= 18.0.0 <= 20.x.x**