@_sh/strapi-plugin-ckeditor 1.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +360 -863
- package/admin/src/components/CKEditorIcon.js +46 -0
- package/admin/src/components/Input/CKEditor/configs/base.js +628 -0
- package/admin/src/components/Input/CKEditor/configs/blockBaloon.js +25 -0
- package/admin/src/components/Input/CKEditor/configs/index.js +11 -0
- package/admin/src/components/Input/CKEditor/configs/toolbar.js +17 -0
- package/admin/src/components/Input/CKEditor/configs/toolbarBaloon.js +17 -0
- package/admin/src/components/Input/CKEditor/configuration.js +166 -0
- package/admin/src/components/Input/CKEditor/index.js +120 -0
- package/admin/src/components/Input/CKEditor/plugins/StrapiMediaLib.js +43 -0
- package/admin/src/components/Input/CKEditor/plugins/StrapiUploadAdapter.js +203 -0
- package/admin/src/components/Input/CKEditor/plugins/index.js +2 -0
- package/admin/src/components/Input/CKEditor/styling.js +16 -0
- package/admin/src/components/Input/CKEditor/theme/additional.js +167 -0
- package/admin/src/components/Input/CKEditor/theme/common.js +277 -0
- package/admin/src/components/Input/CKEditor/theme/dark.js +144 -0
- package/admin/src/components/Input/CKEditor/theme/index.js +13 -0
- package/admin/src/components/Input/CKEditor/theme/light.js +135 -0
- package/admin/src/components/Input/MediaLib/index.js +79 -0
- package/admin/src/components/Input/index.js +48 -0
- package/admin/src/index.js +110 -18
- package/admin/src/utils/getEditorConfig.js +37 -0
- package/admin/src/utils/pluginId.js +5 -0
- package/package.json +86 -50
- package/server/controllers/config.js +16 -14
- package/server/controllers/index.js +7 -7
- package/server/index.js +13 -25
- package/server/register.js +11 -5
- package/server/routes/index.js +15 -8
- package/server/services/config.js +11 -6
- package/server/services/index.js +7 -7
- package/strapi-admin.js +3 -3
- package/strapi-server.js +3 -3
- package/admin/src/components/CKEditor/build/ckeditor.js +0 -7
- package/admin/src/components/CKEditor/build/ckeditor.js.map +0 -1
- package/admin/src/components/CKEditor/build/translations/af.js +0 -1
- package/admin/src/components/CKEditor/build/translations/ar.js +0 -1
- package/admin/src/components/CKEditor/build/translations/ast.js +0 -1
- package/admin/src/components/CKEditor/build/translations/az.js +0 -1
- package/admin/src/components/CKEditor/build/translations/bg.js +0 -1
- package/admin/src/components/CKEditor/build/translations/bn.js +0 -1
- package/admin/src/components/CKEditor/build/translations/bs.js +0 -1
- package/admin/src/components/CKEditor/build/translations/ca.js +0 -1
- package/admin/src/components/CKEditor/build/translations/cs.js +0 -1
- package/admin/src/components/CKEditor/build/translations/da.js +0 -1
- package/admin/src/components/CKEditor/build/translations/de-ch.js +0 -1
- package/admin/src/components/CKEditor/build/translations/de.js +0 -1
- package/admin/src/components/CKEditor/build/translations/el.js +0 -1
- package/admin/src/components/CKEditor/build/translations/en-au.js +0 -1
- package/admin/src/components/CKEditor/build/translations/en-gb.js +0 -1
- package/admin/src/components/CKEditor/build/translations/eo.js +0 -1
- package/admin/src/components/CKEditor/build/translations/es.js +0 -1
- package/admin/src/components/CKEditor/build/translations/et.js +0 -1
- package/admin/src/components/CKEditor/build/translations/eu.js +0 -1
- package/admin/src/components/CKEditor/build/translations/fa.js +0 -1
- package/admin/src/components/CKEditor/build/translations/fi.js +0 -1
- package/admin/src/components/CKEditor/build/translations/fr.js +0 -1
- package/admin/src/components/CKEditor/build/translations/gl.js +0 -1
- package/admin/src/components/CKEditor/build/translations/gu.js +0 -1
- package/admin/src/components/CKEditor/build/translations/he.js +0 -1
- package/admin/src/components/CKEditor/build/translations/hi.js +0 -1
- package/admin/src/components/CKEditor/build/translations/hr.js +0 -1
- package/admin/src/components/CKEditor/build/translations/hu.js +0 -1
- package/admin/src/components/CKEditor/build/translations/id.js +0 -1
- package/admin/src/components/CKEditor/build/translations/it.js +0 -1
- package/admin/src/components/CKEditor/build/translations/ja.js +0 -1
- package/admin/src/components/CKEditor/build/translations/jv.js +0 -1
- package/admin/src/components/CKEditor/build/translations/kk.js +0 -1
- package/admin/src/components/CKEditor/build/translations/km.js +0 -1
- package/admin/src/components/CKEditor/build/translations/kn.js +0 -1
- package/admin/src/components/CKEditor/build/translations/ko.js +0 -1
- package/admin/src/components/CKEditor/build/translations/ku.js +0 -1
- package/admin/src/components/CKEditor/build/translations/lt.js +0 -1
- package/admin/src/components/CKEditor/build/translations/lv.js +0 -1
- package/admin/src/components/CKEditor/build/translations/ms.js +0 -1
- package/admin/src/components/CKEditor/build/translations/nb.js +0 -1
- package/admin/src/components/CKEditor/build/translations/ne.js +0 -1
- package/admin/src/components/CKEditor/build/translations/nl.js +0 -1
- package/admin/src/components/CKEditor/build/translations/no.js +0 -1
- package/admin/src/components/CKEditor/build/translations/oc.js +0 -1
- package/admin/src/components/CKEditor/build/translations/pl.js +0 -1
- package/admin/src/components/CKEditor/build/translations/pt-br.js +0 -1
- package/admin/src/components/CKEditor/build/translations/pt.js +0 -1
- package/admin/src/components/CKEditor/build/translations/ro.js +0 -1
- package/admin/src/components/CKEditor/build/translations/ru.js +0 -1
- package/admin/src/components/CKEditor/build/translations/si.js +0 -1
- package/admin/src/components/CKEditor/build/translations/sk.js +0 -1
- package/admin/src/components/CKEditor/build/translations/sl.js +0 -1
- package/admin/src/components/CKEditor/build/translations/sq.js +0 -1
- package/admin/src/components/CKEditor/build/translations/sr-latn.js +0 -1
- package/admin/src/components/CKEditor/build/translations/sr.js +0 -1
- package/admin/src/components/CKEditor/build/translations/sv.js +0 -1
- package/admin/src/components/CKEditor/build/translations/th.js +0 -1
- package/admin/src/components/CKEditor/build/translations/tk.js +0 -1
- package/admin/src/components/CKEditor/build/translations/tr.js +0 -1
- package/admin/src/components/CKEditor/build/translations/tt.js +0 -1
- package/admin/src/components/CKEditor/build/translations/ug.js +0 -1
- package/admin/src/components/CKEditor/build/translations/uk.js +0 -1
- package/admin/src/components/CKEditor/build/translations/ur.js +0 -1
- package/admin/src/components/CKEditor/build/translations/uz.js +0 -1
- package/admin/src/components/CKEditor/build/translations/vi.js +0 -1
- package/admin/src/components/CKEditor/build/translations/zh-cn.js +0 -1
- package/admin/src/components/CKEditor/build/translations/zh.js +0 -1
- package/admin/src/components/CKEditor/index.js +0 -194
- package/admin/src/components/CKEditor/styles.js +0 -511
- package/admin/src/components/CKEditor/theme.js +0 -313
- package/admin/src/components/Initializer/index.js +0 -26
- package/admin/src/components/MediaLib/index.js +0 -44
- package/admin/src/components/Wysiwyg/index.js +0 -77
- package/admin/src/pages/App/index.js +0 -25
- package/admin/src/pages/HomePage/index.js +0 -20
- package/admin/src/pluginId.js +0 -6
- package/admin/src/translations/en.json +0 -1
- package/admin/src/translations/fr.json +0 -1
- package/admin/src/utils/axiosInstance.js +0 -40
- package/admin/src/utils/getTrad.js +0 -5
- package/server/bootstrap.js +0 -5
- package/server/config/index.js +0 -6
- package/server/content-types/index.js +0 -3
- package/server/destroy.js +0 -5
- package/server/middlewares/index.js +0 -3
- package/server/policies/index.js +0 -3
package/README.md
CHANGED
|
@@ -1,59 +1,45 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="
|
|
2
|
+
<img src="assets/ckeditor5_2_0.png" width="700" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h1 align="center">CKEditor 5 for Strapi</h1>
|
|
6
6
|
|
|
7
|
-
<p align="center">
|
|
7
|
+
<p align="center">Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Unofficial integration)</p>
|
|
8
8
|
|
|
9
9
|
## 👋 Get Started
|
|
10
10
|
|
|
11
11
|
* [Features](#features)
|
|
12
12
|
* [Installation](#installation)
|
|
13
13
|
* [Configuration](#configuration)
|
|
14
|
-
* [
|
|
14
|
+
* [Contributing](#contributing)
|
|
15
15
|
* [Requirements](#requirements)
|
|
16
|
-
* [Thanks](#thanks)
|
|
17
16
|
|
|
18
17
|
## <a id="features"></a>✨ Features
|
|
19
18
|
|
|
20
|
-
* **
|
|
21
|
-
* **
|
|
22
|
-
* **
|
|
23
|
-
* **
|
|
24
|
-
* **
|
|
25
|
-
* **
|
|
26
|
-
|
|
27
|
-
* **Language support:** you can set the preferred language for the UI or the content in the configuration, by default it will use the language defined in the user profile if that language [is supported](https://github.com/nshenderov/strapi-plugin-ckeditor/tree/master/admin/src/components/CKEditor/build/translations). i18 also supported.
|
|
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
|
+
|
|
28
26
|
|
|
29
27
|
## <a id="installation"></a>🔧 Installation
|
|
28
|
+
___
|
|
30
29
|
|
|
31
|
-
Inside your Strapi app, add the package:
|
|
30
|
+
* Inside your Strapi app, add the package:
|
|
32
31
|
|
|
33
|
-
With `npm`:
|
|
34
32
|
```bash
|
|
35
33
|
npm install @_sh/strapi-plugin-ckeditor
|
|
36
34
|
```
|
|
37
|
-
With `yarn`:
|
|
38
|
-
```bash
|
|
39
|
-
yarn add @_sh/strapi-plugin-ckeditor
|
|
40
|
-
```
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
```js
|
|
44
|
-
ckeditor: true
|
|
45
|
-
```
|
|
36
|
+
or
|
|
46
37
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
module.exports = () => {
|
|
50
|
-
return {
|
|
51
|
-
ckeditor: true
|
|
52
|
-
}
|
|
53
|
-
}
|
|
38
|
+
```bash
|
|
39
|
+
yarn add @_sh/strapi-plugin-ckeditor
|
|
54
40
|
```
|
|
55
41
|
|
|
56
|
-
Then run build:
|
|
42
|
+
* Then run build:
|
|
57
43
|
```bash
|
|
58
44
|
npm run build
|
|
59
45
|
```
|
|
@@ -63,891 +49,402 @@ or
|
|
|
63
49
|
yarn build
|
|
64
50
|
```
|
|
65
51
|
|
|
66
|
-
> 💡 `sizes` and `loading` attributes for image can be set in source mode.
|
|
67
|
-
> If you use default upload provider and you want prefix img url with api path you need to add `baseURL` in `api.js` file `(config/api.js)`
|
|
68
52
|
|
|
69
53
|
|
|
70
54
|
## <a id="configuration"></a>⚙️ Configuration
|
|
71
|
-
|
|
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)
|
|
72
57
|
|
|
73
|
-
|
|
58
|
+
Plugin configuration should be defined in the `/config/ckeditor.txt` file.
|
|
74
59
|
|
|
75
|
-
|
|
60
|
+
It's highly recommended to explore [**the official ckeditor documentation**](https://ckeditor.com/docs/ckeditor5/latest/features/index.html)
|
|
76
61
|
|
|
77
|
-
|
|
62
|
+
Content from ckeditor.txt will be passed into a script tag through the initialization process.
|
|
78
63
|
|
|
79
|
-
|
|
64
|
+
> 📂 Default configs: [**admin/src/components/Input/CKEditor/configs**](admin/src/components/Input/CKEditor/configs)
|
|
80
65
|
|
|
81
|
-
|
|
82
|
-
<summary>(spoiler) <b>Built in plugins:</b> </summary>
|
|
66
|
+
> 📂 Default theme: [**admin/src/components/Input/CKEditor/theme**](admin/src/components/Input/CKEditor/theme)
|
|
83
67
|
|
|
84
|
-
|
|
85
|
-
plugins: [
|
|
86
|
-
StrapiUploadAdapter,
|
|
87
|
-
Alignment,
|
|
88
|
-
Autoformat,
|
|
89
|
-
AutoImage,
|
|
90
|
-
AutoLink,
|
|
91
|
-
Autosave,
|
|
92
|
-
BlockQuote,
|
|
93
|
-
Bold,
|
|
94
|
-
Code,
|
|
95
|
-
CodeBlock,
|
|
96
|
-
DataFilter,
|
|
97
|
-
DataSchema,
|
|
98
|
-
Essentials,
|
|
99
|
-
FindAndReplace,
|
|
100
|
-
FontBackgroundColor,
|
|
101
|
-
FontColor,
|
|
102
|
-
FontFamily,
|
|
103
|
-
FontSize,
|
|
104
|
-
GeneralHtmlSupport,
|
|
105
|
-
Heading,
|
|
106
|
-
HeadingButtonsUI,
|
|
107
|
-
ParagraphButtonUI,
|
|
108
|
-
Highlight,
|
|
109
|
-
HorizontalLine,
|
|
110
|
-
HtmlComment,
|
|
111
|
-
HtmlEmbed,
|
|
112
|
-
Image,
|
|
113
|
-
ImageCaption,
|
|
114
|
-
ImageInsert,
|
|
115
|
-
ImageResize,
|
|
116
|
-
ImageStyle,
|
|
117
|
-
ImageToolbar,
|
|
118
|
-
ImageUpload,
|
|
119
|
-
Indent,
|
|
120
|
-
IndentBlock,
|
|
121
|
-
Italic,
|
|
122
|
-
Link,
|
|
123
|
-
LinkImage,
|
|
124
|
-
List,
|
|
125
|
-
ListProperties,
|
|
126
|
-
MediaEmbed,
|
|
127
|
-
MediaEmbedToolbar,
|
|
128
|
-
Mention,
|
|
129
|
-
PageBreak,
|
|
130
|
-
Paragraph,
|
|
131
|
-
PasteFromOffice,
|
|
132
|
-
RemoveFormat,
|
|
133
|
-
SourceEditing,
|
|
134
|
-
SpecialCharacters,
|
|
135
|
-
SpecialCharactersArrows,
|
|
136
|
-
SpecialCharactersCurrency,
|
|
137
|
-
SpecialCharactersEssentials,
|
|
138
|
-
SpecialCharactersLatin,
|
|
139
|
-
SpecialCharactersMathematical,
|
|
140
|
-
SpecialCharactersText,
|
|
141
|
-
StandardEditingMode,
|
|
142
|
-
Strikethrough,
|
|
143
|
-
Subscript,
|
|
144
|
-
Superscript,
|
|
145
|
-
Table,
|
|
146
|
-
TableCaption,
|
|
147
|
-
TableCellProperties,
|
|
148
|
-
TableProperties,
|
|
149
|
-
TableToolbar,
|
|
150
|
-
TextPartLanguage,
|
|
151
|
-
TextTransformation,
|
|
152
|
-
TodoList,
|
|
153
|
-
Underline,
|
|
154
|
-
WordCount,
|
|
155
|
-
Markdown,
|
|
156
|
-
StrapiMediaLib,
|
|
157
|
-
FullScreen,
|
|
158
|
-
BlockToolbar,
|
|
159
|
-
BalloonToolbar,
|
|
160
|
-
Style
|
|
161
|
-
]
|
|
68
|
+
**ckeditor.txt example:**
|
|
162
69
|
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
</details>
|
|
166
|
-
|
|
167
|
-
**Default configuration:**
|
|
168
70
|
```js
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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:{}
|
|
192
94
|
},
|
|
193
|
-
|
|
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
|
-
'insertTable',
|
|
227
|
-
'blockQuote',
|
|
228
|
-
'mediaEmbed',
|
|
229
|
-
'link',
|
|
230
|
-
'highlight',
|
|
231
|
-
'|',
|
|
232
|
-
'htmlEmbed',
|
|
233
|
-
'sourceEditing',
|
|
234
|
-
'code',
|
|
235
|
-
'codeBlock',
|
|
236
|
-
'|',
|
|
237
|
-
'subscript',
|
|
238
|
-
'superscript',
|
|
239
|
-
'strikethrough',
|
|
240
|
-
'specialCharacters',
|
|
241
|
-
'|',
|
|
242
|
-
'heading',
|
|
243
|
-
"fullScreen",
|
|
244
|
-
'undo',
|
|
245
|
-
'redo'
|
|
246
|
-
]
|
|
247
|
-
},
|
|
248
|
-
// https://ckeditor.com/docs/ckeditor5/latest/features/font.html
|
|
249
|
-
fontSize: {
|
|
250
|
-
options: [
|
|
251
|
-
9,
|
|
252
|
-
11,
|
|
253
|
-
13,
|
|
254
|
-
'default',
|
|
255
|
-
17,
|
|
256
|
-
19,
|
|
257
|
-
21,
|
|
258
|
-
27,
|
|
259
|
-
35,
|
|
260
|
-
],
|
|
261
|
-
supportAllValues: false
|
|
262
|
-
},
|
|
263
|
-
fontFamily: {
|
|
264
|
-
options: [
|
|
265
|
-
'default',
|
|
266
|
-
'Arial, Helvetica Neue, Helvetica, Source Sans Pro, sans-serif',
|
|
267
|
-
'Courier New, Courier, monospace',
|
|
268
|
-
'Georgia, serif',
|
|
269
|
-
'Lucida Sans Unicode, Lucida Grande, sans-serif',
|
|
270
|
-
'Tahoma, Geneva, sans-serif',
|
|
271
|
-
'Times New Roman, Times, serif',
|
|
272
|
-
'Trebuchet MS, Helvetica, sans-serif',
|
|
273
|
-
'Verdana, Geneva, sans-serif',
|
|
274
|
-
'Roboto, Roboto Black, Roboto Medium, Roboto Light, sans-serif',
|
|
275
|
-
],
|
|
276
|
-
supportAllValues: true
|
|
277
|
-
},
|
|
278
|
-
fontColor: {
|
|
279
|
-
columns: 5,
|
|
280
|
-
documentColors: 10,
|
|
281
|
-
},
|
|
282
|
-
fontBackgroundColor: {
|
|
283
|
-
columns: 5,
|
|
284
|
-
documentColors: 10,
|
|
285
|
-
},
|
|
286
|
-
// https://ckeditor.com/docs/ckeditor5/latest/features/ui-language.html
|
|
287
|
-
// default language: 'en',
|
|
288
|
-
// https://ckeditor.com/docs/ckeditor5/latest/features/images/images-overview.html
|
|
289
|
-
image: {
|
|
290
|
-
resizeUnit: "%",
|
|
291
|
-
resizeOptions: [ {
|
|
292
|
-
name: 'resizeImage:original',
|
|
293
|
-
value: null,
|
|
294
|
-
icon: 'original'
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
name: 'resizeImage:25',
|
|
298
|
-
value: '25',
|
|
299
|
-
icon: 'small'
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
name: 'resizeImage:50',
|
|
303
|
-
value: '50',
|
|
304
|
-
icon: 'medium'
|
|
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
|
+
},
|
|
305
128
|
},
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
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
|
-
|
|
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
|
+
]
|
|
351
209
|
}
|
|
352
|
-
|
|
353
|
-
]
|
|
354
|
-
},
|
|
210
|
+
}
|
|
355
211
|
}
|
|
356
|
-
|
|
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:``
|
|
357
221
|
}
|
|
358
|
-
|
|
222
|
+
|
|
359
223
|
}
|
|
360
224
|
```
|
|
361
|
-
**Some of configuration:**
|
|
362
225
|
|
|
363
|
-
|
|
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
|
+
```
|
|
364
237
|
|
|
365
|
-
|
|
366
|
-
<img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/balloonblockstyles.gif" alt="CKEditor5-Strapi" width="800" />
|
|
367
|
-
</p>
|
|
238
|
+
> In order to display some content from an external source on your `admin` side you should configure your middlewares.js [**check docs about this**](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/required/middlewares.html)
|
|
368
239
|
|
|
369
|
-
|
|
370
|
-
|
|
240
|
+
## How to add plugins
|
|
241
|
+
|
|
242
|
+
___
|
|
243
|
+
Markdown plugin example
|
|
244
|
+
|
|
245
|
+
* Inside your app:
|
|
371
246
|
|
|
372
247
|
```js
|
|
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
|
-
padding: 0;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
.ck.ck-content p.info-box {
|
|
415
|
-
--background-size: 30px;
|
|
416
|
-
--background-color: #e91e63;
|
|
417
|
-
padding: 1.2em 2em;
|
|
418
|
-
border: 1px solid var(--background-color);
|
|
419
|
-
background: linear-gradient(135deg, var(--background-color) 0%, var(--background-color) var(--background-size), transparent var(--background-size)), linear-gradient(135deg, transparent calc(100% - var(--background-size)), var(--background-color) calc(100% - var(--background-size)), var(--background-color));
|
|
420
|
-
border-radius: 10px;
|
|
421
|
-
margin: 1.5em 2em;
|
|
422
|
-
box-shadow: 5px 5px 0 #ffe6ef;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
.ck.ck-content blockquote.side-quote {
|
|
426
|
-
font-family: 'Bebas Neue';
|
|
427
|
-
font-style: normal;
|
|
428
|
-
float: right;
|
|
429
|
-
width: 35%;
|
|
430
|
-
position: relative;
|
|
431
|
-
border: 0;
|
|
432
|
-
overflow: visible;
|
|
433
|
-
z-index: 1;
|
|
434
|
-
margin-left: 1em;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
.ck.ck-content blockquote.side-quote::before {
|
|
438
|
-
content: "“";
|
|
439
|
-
position: absolute;
|
|
440
|
-
top: -37px;
|
|
441
|
-
left: -10px;
|
|
442
|
-
display: block;
|
|
443
|
-
font-size: 200px;
|
|
444
|
-
color: #e7e7e7;
|
|
445
|
-
z-index: -1;
|
|
446
|
-
line-height: 1;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
.ck.ck-content blockquote.side-quote p {
|
|
450
|
-
font-size: 2em;
|
|
451
|
-
line-height: 1;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
.ck.ck-content blockquote.side-quote p:last-child:not(:first-child) {
|
|
455
|
-
font-size: 1.3em;
|
|
456
|
-
text-align: right;
|
|
457
|
-
color: #555;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
.ck.ck-content span.marker {
|
|
461
|
-
background: yellow;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
.ck.ck-content span.spoiler {
|
|
465
|
-
background: #000;
|
|
466
|
-
color: #000;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
.ck.ck-content span.spoiler:hover {
|
|
470
|
-
background: #000;
|
|
471
|
-
color: #fff;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
.ck.ck-content pre.fancy-code {
|
|
475
|
-
border: 0;
|
|
476
|
-
margin-left: 2em;
|
|
477
|
-
margin-right: 2em;
|
|
478
|
-
border-radius: 10px;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
.ck.ck-content pre.fancy-code::before {
|
|
482
|
-
content: "";
|
|
483
|
-
display: block;
|
|
484
|
-
height: 13px;
|
|
485
|
-
background: url(data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1NCAxMyI+CiAgPGNpcmNsZSBjeD0iNi41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiNGMzZCNUMiLz4KICA8Y2lyY2xlIGN4PSIyNi41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiNGOUJFNEQiLz4KICA8Y2lyY2xlIGN4PSI0Ny41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiM1NkM0NTMiLz4KPC9zdmc+Cg==);
|
|
486
|
-
margin-bottom: 8px;
|
|
487
|
-
background-repeat: no-repeat;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
.ck.ck-content pre.fancy-code-dark {
|
|
491
|
-
background: #272822;
|
|
492
|
-
color: #fff;
|
|
493
|
-
box-shadow: 5px 5px 0 #0000001f;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
.ck.ck-content pre.fancy-code-bright {
|
|
497
|
-
background: #dddfe0;
|
|
498
|
-
color: #000;
|
|
499
|
-
box-shadow: 5px 5px 0 #b3b3b3;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
`
|
|
503
|
-
},
|
|
504
|
-
editor:{
|
|
505
|
-
toolbar:[],
|
|
506
|
-
// https://ckeditor.com/docs/ckeditor5/latest/features/toolbar/blocktoolbar.html
|
|
507
|
-
blockToolbar: {
|
|
508
|
-
items: [
|
|
509
|
-
'heading','style',
|
|
510
|
-
'|',
|
|
511
|
-
'outdent',
|
|
512
|
-
'indent',
|
|
513
|
-
'horizontalLine',
|
|
514
|
-
'|',
|
|
515
|
-
'StrapiMediaLib',
|
|
516
|
-
'-',
|
|
517
|
-
'bulletedList', 'numberedList',
|
|
518
|
-
'|',
|
|
519
|
-
'insertTable', 'blockQuote',
|
|
520
|
-
'|',
|
|
521
|
-
'code'
|
|
522
|
-
],
|
|
523
|
-
},
|
|
524
|
-
balloonToolbar: [
|
|
525
|
-
'bold',
|
|
526
|
-
'italic',
|
|
527
|
-
'fontColor',
|
|
528
|
-
'FontBackgroundColor',
|
|
529
|
-
'fontFamily',
|
|
530
|
-
'fontSize',
|
|
531
|
-
'alignment',
|
|
532
|
-
'|',
|
|
533
|
-
'removeFormat',
|
|
534
|
-
'undo',
|
|
535
|
-
'redo'
|
|
536
|
-
],
|
|
537
|
-
// https://ckeditor.com/docs/ckeditor5/latest/features/style.html
|
|
538
|
-
style: {
|
|
539
|
-
definitions: [
|
|
540
|
-
{
|
|
541
|
-
name: 'Article category',
|
|
542
|
-
element: 'h3',
|
|
543
|
-
classes: [ 'category' ]
|
|
544
|
-
},
|
|
545
|
-
{
|
|
546
|
-
name: 'Title',
|
|
547
|
-
element: 'h2',
|
|
548
|
-
classes: [ 'document-title' ]
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
name: 'Subtitle',
|
|
552
|
-
element: 'h3',
|
|
553
|
-
classes: [ 'document-subtitle' ]
|
|
554
|
-
},
|
|
555
|
-
{
|
|
556
|
-
name: 'Info box',
|
|
557
|
-
element: 'p',
|
|
558
|
-
classes: [ 'info-box' ]
|
|
559
|
-
},
|
|
560
|
-
{
|
|
561
|
-
name: 'Side quote',
|
|
562
|
-
element: 'blockquote',
|
|
563
|
-
classes: [ 'side-quote' ]
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
name: 'Marker',
|
|
567
|
-
element: 'span',
|
|
568
|
-
classes: [ 'marker' ]
|
|
569
|
-
},
|
|
570
|
-
{
|
|
571
|
-
name: 'Spoiler',
|
|
572
|
-
element: 'span',
|
|
573
|
-
classes: [ 'spoiler' ]
|
|
574
|
-
},
|
|
575
|
-
{
|
|
576
|
-
name: 'Code (dark)',
|
|
577
|
-
element: 'pre',
|
|
578
|
-
classes: [ 'fancy-code', 'fancy-code-dark' ]
|
|
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/armin/**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",
|
|
579
286
|
},
|
|
580
|
-
|
|
581
|
-
name: 'Code (bright)',
|
|
582
|
-
element: 'pre',
|
|
583
|
-
classes: [ 'fancy-code', 'fancy-code-bright' ]
|
|
584
|
-
}
|
|
585
|
-
]
|
|
586
|
-
},
|
|
587
|
-
fontSize: {
|
|
588
|
-
options: [
|
|
589
|
-
9,
|
|
590
|
-
11,
|
|
591
|
-
13,
|
|
592
|
-
'default',
|
|
593
|
-
17,
|
|
594
|
-
19,
|
|
595
|
-
21,
|
|
596
|
-
27,
|
|
597
|
-
35,
|
|
598
|
-
],
|
|
599
|
-
supportAllValues: false
|
|
600
|
-
},
|
|
601
|
-
fontFamily: {
|
|
602
|
-
options: [
|
|
603
|
-
'default',
|
|
604
|
-
'Arial, Helvetica Neue, Helvetica, Source Sans Pro, sans-serif',
|
|
605
|
-
'Courier New, Courier, monospace',
|
|
606
|
-
'Georgia, serif',
|
|
607
|
-
'Lucida Sans Unicode, Lucida Grande, sans-serif',
|
|
608
|
-
'Tahoma, Geneva, sans-serif',
|
|
609
|
-
'Times New Roman, Times, serif',
|
|
610
|
-
'Trebuchet MS, Helvetica, sans-serif',
|
|
611
|
-
'Verdana, Geneva, sans-serif',
|
|
612
|
-
'Roboto, Roboto Black, Roboto Medium, Roboto Light, sans-serif',
|
|
613
|
-
],
|
|
614
|
-
supportAllValues: true
|
|
615
|
-
},
|
|
616
|
-
fontColor: {
|
|
617
|
-
columns: 5,
|
|
618
|
-
documentColors: 10,
|
|
619
|
-
},
|
|
620
|
-
fontBackgroundColor: {
|
|
621
|
-
columns: 5,
|
|
622
|
-
documentColors: 10,
|
|
623
|
-
},
|
|
624
|
-
image: {
|
|
625
|
-
resizeUnit: "%",
|
|
626
|
-
resizeOptions: [ {
|
|
627
|
-
name: 'resizeImage:original',
|
|
628
|
-
value: null,
|
|
629
|
-
icon: 'original'
|
|
630
|
-
},
|
|
631
|
-
{
|
|
632
|
-
name: 'resizeImage:25',
|
|
633
|
-
value: '25',
|
|
634
|
-
icon: 'small'
|
|
635
|
-
},
|
|
636
|
-
{
|
|
637
|
-
name: 'resizeImage:50',
|
|
638
|
-
value: '50',
|
|
639
|
-
icon: 'medium'
|
|
287
|
+
},
|
|
640
288
|
},
|
|
641
|
-
{
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
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
|
+
]
|
|
683
361
|
},
|
|
684
|
-
|
|
685
|
-
},
|
|
362
|
+
}
|
|
686
363
|
}
|
|
687
|
-
}
|
|
688
364
|
}
|
|
689
|
-
}
|
|
690
365
|
}
|
|
366
|
+
```
|
|
691
367
|
|
|
368
|
+
* Then rebuild your app:
|
|
369
|
+
```bash
|
|
370
|
+
npm run build
|
|
692
371
|
```
|
|
693
|
-
</details>
|
|
694
372
|
|
|
695
|
-
|
|
373
|
+
or
|
|
374
|
+
```bash
|
|
375
|
+
yarn build
|
|
376
|
+
```
|
|
696
377
|
|
|
697
|
-
<
|
|
698
|
-
|
|
699
|
-
</p>
|
|
378
|
+
## <a id="contributing"></a>🛠 Contributing
|
|
379
|
+
___
|
|
700
380
|
|
|
701
381
|
<details>
|
|
702
|
-
<summary><b>
|
|
382
|
+
<summary><b>This section covers the way how to configure your environment if you want to contribute to this package.</b> </summary>
|
|
383
|
+
|
|
384
|
+
### Setting up the environment
|
|
703
385
|
|
|
704
|
-
|
|
705
|
-
module.exports = () => {
|
|
706
|
-
return {
|
|
707
|
-
ckeditor: {
|
|
708
|
-
enabled: true,
|
|
709
|
-
config:{
|
|
710
|
-
editor:{
|
|
711
|
-
toolbar: {
|
|
712
|
-
items: [
|
|
713
|
-
'paragraph',
|
|
714
|
-
'heading1',
|
|
715
|
-
'heading2',
|
|
716
|
-
'|',
|
|
717
|
-
'bulletedList',
|
|
718
|
-
'todoList',
|
|
719
|
-
'numberedList',
|
|
720
|
-
'|',
|
|
721
|
-
'outdent',
|
|
722
|
-
'indent',
|
|
723
|
-
'horizontalLine',
|
|
724
|
-
'|',
|
|
725
|
-
'StrapiMediaLib',
|
|
726
|
-
'insertTable',
|
|
727
|
-
'blockQuote',
|
|
728
|
-
'mediaEmbed',
|
|
729
|
-
'link',
|
|
730
|
-
'highlight',
|
|
731
|
-
'|',
|
|
732
|
-
'htmlEmbed',
|
|
733
|
-
'sourceEditing',
|
|
734
|
-
'code',
|
|
735
|
-
'codeBlock',
|
|
736
|
-
'|',
|
|
737
|
-
'subscript',
|
|
738
|
-
'superscript',
|
|
739
|
-
'strikethrough',
|
|
740
|
-
'specialCharacters',
|
|
741
|
-
'|',
|
|
742
|
-
'heading',
|
|
743
|
-
"fullScreen",
|
|
744
|
-
'undo',
|
|
745
|
-
'redo'
|
|
746
|
-
]
|
|
747
|
-
},
|
|
748
|
-
balloonToolbar: [
|
|
749
|
-
'bold',
|
|
750
|
-
'italic',
|
|
751
|
-
'fontColor',
|
|
752
|
-
'FontBackgroundColor',
|
|
753
|
-
'fontFamily',
|
|
754
|
-
'fontSize',
|
|
755
|
-
'alignment',
|
|
756
|
-
'|',
|
|
757
|
-
'removeFormat',
|
|
758
|
-
'undo',
|
|
759
|
-
'redo'
|
|
760
|
-
],
|
|
761
|
-
fontSize: {
|
|
762
|
-
options: [
|
|
763
|
-
9,
|
|
764
|
-
11,
|
|
765
|
-
13,
|
|
766
|
-
'default',
|
|
767
|
-
17,
|
|
768
|
-
19,
|
|
769
|
-
21,
|
|
770
|
-
27,
|
|
771
|
-
35,
|
|
772
|
-
],
|
|
773
|
-
supportAllValues: false
|
|
774
|
-
},
|
|
775
|
-
fontFamily: {
|
|
776
|
-
options: [
|
|
777
|
-
'default',
|
|
778
|
-
'Arial, Helvetica Neue, Helvetica, Source Sans Pro, sans-serif',
|
|
779
|
-
'Courier New, Courier, monospace',
|
|
780
|
-
'Georgia, serif',
|
|
781
|
-
'Lucida Sans Unicode, Lucida Grande, sans-serif',
|
|
782
|
-
'Tahoma, Geneva, sans-serif',
|
|
783
|
-
'Times New Roman, Times, serif',
|
|
784
|
-
'Trebuchet MS, Helvetica, sans-serif',
|
|
785
|
-
'Verdana, Geneva, sans-serif',
|
|
786
|
-
'Roboto, Roboto Black, Roboto Medium, Roboto Light, sans-serif',
|
|
787
|
-
],
|
|
788
|
-
supportAllValues: true
|
|
789
|
-
},
|
|
790
|
-
fontColor: {
|
|
791
|
-
columns: 5,
|
|
792
|
-
documentColors: 10,
|
|
793
|
-
},
|
|
794
|
-
fontBackgroundColor: {
|
|
795
|
-
columns: 5,
|
|
796
|
-
documentColors: 10,
|
|
797
|
-
},
|
|
798
|
-
image: {
|
|
799
|
-
resizeUnit: "%",
|
|
800
|
-
resizeOptions: [ {
|
|
801
|
-
name: 'resizeImage:original',
|
|
802
|
-
value: null,
|
|
803
|
-
icon: 'original'
|
|
804
|
-
},
|
|
805
|
-
{
|
|
806
|
-
name: 'resizeImage:25',
|
|
807
|
-
value: '25',
|
|
808
|
-
icon: 'small'
|
|
809
|
-
},
|
|
810
|
-
{
|
|
811
|
-
name: 'resizeImage:50',
|
|
812
|
-
value: '50',
|
|
813
|
-
icon: 'medium'
|
|
814
|
-
},
|
|
815
|
-
{
|
|
816
|
-
name: 'resizeImage:75',
|
|
817
|
-
value: '75',
|
|
818
|
-
icon: 'large'
|
|
819
|
-
} ],
|
|
820
|
-
toolbar: [
|
|
821
|
-
'toggleImageCaption',
|
|
822
|
-
'imageTextAlternative',
|
|
823
|
-
'imageStyle:inline',
|
|
824
|
-
'imageStyle:block',
|
|
825
|
-
'imageStyle:side',
|
|
826
|
-
'linkImage',
|
|
827
|
-
'resizeImage:25', 'resizeImage:50', 'resizeImage:75', 'resizeImage:original'
|
|
828
|
-
]
|
|
829
|
-
},
|
|
830
|
-
table: {
|
|
831
|
-
contentToolbar: [
|
|
832
|
-
'tableColumn',
|
|
833
|
-
'tableRow',
|
|
834
|
-
'mergeTableCells',
|
|
835
|
-
'tableCellProperties',
|
|
836
|
-
'tableProperties',
|
|
837
|
-
'toggleTableCaption'
|
|
838
|
-
]
|
|
839
|
-
},
|
|
840
|
-
heading: {
|
|
841
|
-
options: [
|
|
842
|
-
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
|
|
843
|
-
{ model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
|
|
844
|
-
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
|
|
845
|
-
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
|
|
846
|
-
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
|
|
847
|
-
]
|
|
848
|
-
},
|
|
849
|
-
htmlSupport: {
|
|
850
|
-
allow: [
|
|
851
|
-
{
|
|
852
|
-
name: 'img',
|
|
853
|
-
attributes: {
|
|
854
|
-
sizes:true,
|
|
855
|
-
loading:true,
|
|
856
|
-
}
|
|
857
|
-
},
|
|
858
|
-
]
|
|
859
|
-
},
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
}
|
|
386
|
+
In order to start making changes in the plugin you first need to install Strapi infrastructure on top of the plugin repository.
|
|
865
387
|
|
|
866
388
|
```
|
|
867
|
-
|
|
389
|
+
npx create-strapi-app --quickstart strapi
|
|
390
|
+
cd strapi
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
By default Strapi does not create plugins folder so we need to create it.
|
|
394
|
+
|
|
395
|
+
```
|
|
396
|
+
mkdir -p src/plugins
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Now we should clone this repository so we can work on it.
|
|
868
400
|
|
|
869
|
-
|
|
870
|
-
|
|
401
|
+
```
|
|
402
|
+
git clone git@github.com:nshenderov/strapi-plugin-ckeditor.git src/plugins/strapi-plugin-ckeditor
|
|
403
|
+
```
|
|
871
404
|
|
|
872
|
-
|
|
405
|
+
Let's add an entry inside `./package.json` file so, we won't need to use `yarn` inside plugin itself.
|
|
873
406
|
|
|
874
|
-
|
|
407
|
+
```
|
|
408
|
+
"workspaces": ["./src/plugins/strapi-plugin-ckeditor"]
|
|
409
|
+
```
|
|
875
410
|
|
|
876
|
-
|
|
411
|
+
Install dependencies:
|
|
877
412
|
|
|
878
|
-
|
|
413
|
+
```
|
|
414
|
+
yarn install
|
|
415
|
+
```
|
|
879
416
|
|
|
880
|
-
|
|
417
|
+
Now we need to register plugin so strapi can use it. In order to do that we need
|
|
418
|
+
to create (if not already created) `./config/plugins.js` file and add entry to it.
|
|
881
419
|
|
|
882
|
-
|
|
420
|
+
```
|
|
421
|
+
module.exports = ({ env }) => ({
|
|
422
|
+
ckeditor5: {
|
|
423
|
+
enabled: true,
|
|
424
|
+
resolve: "./src/plugins/strapi-plugin-ckeditor"
|
|
425
|
+
},
|
|
426
|
+
});
|
|
427
|
+
```
|
|
883
428
|
|
|
884
|
-
|
|
885
|
-
```js
|
|
886
|
-
// plugins.js
|
|
887
|
-
const styles = require('./styles.js')
|
|
888
|
-
|
|
889
|
-
module.exports = () => {
|
|
890
|
-
return {
|
|
891
|
-
ckeditor: {
|
|
892
|
-
enabled: true,
|
|
893
|
-
config:{
|
|
894
|
-
plugin:{
|
|
895
|
-
// disable data-theme tag setting //
|
|
896
|
-
// setAttribute:false,
|
|
897
|
-
|
|
898
|
-
// disable strapi theme, will use default ckeditor theme //
|
|
899
|
-
// strapiTheme:false,
|
|
900
|
-
|
|
901
|
-
// styles applied to editor container, e.g:
|
|
902
|
-
styles:`
|
|
903
|
-
${styles()}
|
|
904
|
-
.ck-editor__styled__container{
|
|
905
|
-
background:red;
|
|
906
|
-
}
|
|
907
|
-
html[data-theme='light'] {
|
|
908
|
-
--ck-scroll-track-background:red;
|
|
909
|
-
--ck-scroll-thumb-background:red;
|
|
910
|
-
--ck-scroll-thumb-border-color:red;
|
|
911
|
-
--ck-scroll-thumb-hover-background:red;
|
|
912
|
-
--ck-scroll-thumb-active-background:red;
|
|
913
|
-
--ck-color-base-border: red;
|
|
914
|
-
--ck-color-base-background:red;
|
|
915
|
-
--ck-custom-background: red;
|
|
916
|
-
--ck-custom-foreground: red;
|
|
917
|
-
--ck-custom-border: red;
|
|
918
|
-
--ck-custom-white: red;
|
|
919
|
-
}
|
|
920
|
-
`
|
|
921
|
-
},
|
|
922
|
-
// editor default config
|
|
923
|
-
editor:{
|
|
924
|
-
//...
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
}
|
|
429
|
+
Rebuild the project and start the server:
|
|
930
430
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
max-height: 200px;
|
|
935
|
-
}
|
|
936
|
-
.ck.ck-editor__main .ck-focused{
|
|
937
|
-
max-height: 500px;
|
|
938
|
-
}
|
|
939
|
-
`
|
|
940
|
-
module.exports = styles;
|
|
431
|
+
```
|
|
432
|
+
yarn build
|
|
433
|
+
yarn develop
|
|
941
434
|
```
|
|
942
435
|
|
|
943
|
-
|
|
944
|
-
Strapi **v4.1.8+**
|
|
436
|
+
</details>
|
|
945
437
|
|
|
946
|
-
Node **14 - 16**
|
|
947
438
|
|
|
948
|
-
Tested on **v4.1.8 - 4.3.4**
|
|
949
439
|
|
|
950
|
-
|
|
440
|
+
|
|
441
|
+
## <a id="requirements"></a>⚠️ Requirements
|
|
442
|
+
___
|
|
443
|
+
Strapi **v4.4.0+**
|
|
444
|
+
|
|
445
|
+
Node **>=14.19.1 <=18.x.x**
|
|
446
|
+
|
|
447
|
+
### 👍 This build includes some useful plugins based on these repos so thanks to them:
|
|
951
448
|
https://github.com/Roslovets-Inc/strapi-plugin-ckeditor5
|
|
952
449
|
|
|
953
450
|
https://github.com/leknoppix/ckeditor5-fullscreen
|