@_sh/strapi-plugin-ckeditor 1.0.2 → 1.0.5
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 +100 -134
- package/admin/src/index.js +0 -1
- package/assets/ckeditor5.png +0 -0
- package/package.json +1 -1
- package/assets/ckeditor-d-1.jpg +0 -0
- package/assets/ckeditor-d-2.jpg +0 -0
- package/assets/ckeditor-d-3.jpg +0 -0
- package/assets/ckeditor-fontcolor1.jpg +0 -0
- package/assets/ckeditor-fontcolor2.jpg +0 -0
- package/assets/ckeditor-fontcolor3.jpg +0 -0
- package/assets/ckeditor-tables.jpg +0 -0
- package/assets/ckeditor-toolbar.jpg +0 -0
- package/assets/ckeditor.jpg +0 -0
- package/assets/ckeditor1.jpg +0 -0
package/README.md
CHANGED
|
@@ -1,110 +1,84 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/nshenderov/strapi-plugin-ckeditor/master/assets/ckeditor5.png" alt="CKEditor5-Strapi" width="700" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
<br/>
|
|
6
|
-
|
|
7
|
-
Replaces the default Strapi WYSIWYG editor with a customized build of CKEditor 5 html editor packed with useful plugins.
|
|
8
|
-
|
|
9
|
-
This plugin works on custom build of CKEditor 5 html editor packed with useful plugins.
|
|
10
|
-
|
|
11
|
-
<br/>
|
|
5
|
+
<h1 align="center">CKEditor 5 for Strapi</h1>
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<br/>
|
|
16
|
-
|
|
17
|
-
- <b>Lots of default plugins:</b>
|
|
18
|
-
|
|
19
|
-
For styling text, images, tables and so on.
|
|
7
|
+
<p align="center">Replaces the default Strapi WYSIWYG editor with a customized build of CKEditor 5 packed with useful plugins.</p>
|
|
20
8
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Gives you ability to choose colors for font styling that's not defined in config from the color palette.
|
|
24
|
-
|
|
25
|
-
- <b>Upload adapter for Strapi:</b>
|
|
26
|
-
|
|
27
|
-
For upload images to your library when you drop an image into the editor.
|
|
9
|
+
## 👋 Get Started
|
|
28
10
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
* [Features](#features)
|
|
12
|
+
* [Installation](#installation)
|
|
13
|
+
* [Configuration](#configuration)
|
|
14
|
+
* [Theme customization](#themecustomization)
|
|
15
|
+
* [Requirements](#requirements)
|
|
16
|
+
* [Thanks](#thanks)
|
|
32
17
|
|
|
33
|
-
|
|
18
|
+
## <a id="features"></a>✨ Features
|
|
19
|
+
This plugin works on custom build of CKEditor 5 packed with useful plugins.
|
|
20
|
+
* **Lots of default plugins:** for styling text, images, tables and so on.
|
|
21
|
+
* **Font color picker:** choose colors for font styling that's not defined in config from the color palette.
|
|
22
|
+
* **Upload adapter for Strapi:** for upload images to your library when you drop an image into the editor.
|
|
23
|
+
* **Fullscreen mode button.**
|
|
24
|
+
* **Strapi media library button.**
|
|
25
|
+
* **Supports strapi theme swithing.**
|
|
26
|
+
* **Supports responsive images:** plugin adds srcset attribute to images based on their `formats` if responsive enable in strapi settings.
|
|
34
27
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Plugin adds srcset attribute to images based on their "formats" if responsive enable in strapi settings</b>
|
|
28
|
+
## <a id="installation"></a>🔧 Installation
|
|
38
29
|
|
|
39
|
-
|
|
40
|
-
<img src="./assets/ckeditor-toolbar.jpg" width="900"/>
|
|
41
|
-
<br/>
|
|
42
|
-
<img src="./assets/ckeditor-tables.jpg" width="900"/>
|
|
43
|
-
|
|
44
|
-
<img src="./assets/ckeditor-d-2.jpg" width="900"/>
|
|
30
|
+
Inside your Strapi app, add the package:
|
|
45
31
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<tr>
|
|
49
|
-
<td><img src="./assets/ckeditor-fontcolor1.jpg" width=200></td>
|
|
50
|
-
<td><img src="./assets/ckeditor-fontcolor3.jpg" width=200></td>
|
|
51
|
-
</tr>
|
|
52
|
-
</table>
|
|
53
|
-
|
|
54
|
-
## How to install
|
|
55
|
-
Install the dependency via npm
|
|
56
|
-
```
|
|
32
|
+
With `npm`:
|
|
33
|
+
```bash
|
|
57
34
|
npm install @_sh/strapi-plugin-ckeditor
|
|
58
35
|
```
|
|
59
|
-
|
|
60
|
-
```
|
|
36
|
+
With `yarn`:
|
|
37
|
+
```bash
|
|
61
38
|
yarn add @_sh/strapi-plugin-ckeditor
|
|
62
39
|
```
|
|
63
|
-
|
|
64
|
-
|
|
40
|
+
|
|
41
|
+
In `config/plugins.js` file add:
|
|
42
|
+
```js
|
|
65
43
|
ckeditor: true
|
|
66
44
|
```
|
|
45
|
+
|
|
67
46
|
If you do not yet have this file, then create and add:
|
|
68
|
-
```
|
|
69
|
-
module.exports = (
|
|
47
|
+
```js
|
|
48
|
+
module.exports = () => {
|
|
70
49
|
return {
|
|
71
50
|
ckeditor: true
|
|
72
51
|
}
|
|
73
52
|
}
|
|
74
53
|
```
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
|
|
55
|
+
Then run build:
|
|
56
|
+
```bash
|
|
77
57
|
npm run build
|
|
78
58
|
```
|
|
59
|
+
|
|
79
60
|
or
|
|
80
|
-
```
|
|
61
|
+
```bash
|
|
81
62
|
yarn build
|
|
82
63
|
```
|
|
83
64
|
|
|
84
|
-
##
|
|
85
|
-
|
|
86
|
-
Via config in plugins.js
|
|
87
|
-
|
|
88
|
-
Ckeditor settings should be defined in <b>config.editor</b> field
|
|
89
|
-
|
|
90
|
-
Read more about configuration https://ckeditor.com/docs/ckeditor5/latest/installation/getting-started/configuration.html
|
|
91
|
-
|
|
65
|
+
## <a id="configuration"></a>🔧 Configuration
|
|
66
|
+
CKEditor config should be defined in `config.editor` field.
|
|
92
67
|
|
|
93
|
-
|
|
94
|
-
<summary><b>Default config</b></summary>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
```javascript
|
|
68
|
+
Learn more about configuration from [official documentation](https://ckeditor.com/docs/ckeditor5/latest/installation/getting-started/configuration.html).
|
|
98
69
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
70
|
+
**Default configuration:**
|
|
71
|
+
```js
|
|
72
|
+
// plugins.js
|
|
73
|
+
module.exports = () => {
|
|
74
|
+
return {
|
|
75
|
+
ckeditor: {
|
|
76
|
+
enabled: true,
|
|
77
|
+
config:{
|
|
102
78
|
plugin:{
|
|
103
|
-
|
|
104
|
-
styles:``
|
|
79
|
+
styles:` // styles applied to editor container `
|
|
105
80
|
},
|
|
106
|
-
|
|
107
|
-
editor:{
|
|
81
|
+
editor:{ // editor default config
|
|
108
82
|
toolbar: {
|
|
109
83
|
items: [
|
|
110
84
|
'paragraph',
|
|
@@ -274,74 +248,66 @@ Via config in plugins.js
|
|
|
274
248
|
}
|
|
275
249
|
}
|
|
276
250
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
<
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
## <a id="themecustomization"></a>💅 Theme customization
|
|
255
|
+
If you want to customize editor styles you should define styles in `config.plugin.styles` field it will replace default styles applied to the editor.
|
|
256
|
+
|
|
257
|
+
Since Strapi resets css styles, it needs some styles to revert back, these styles defined below, also check [official documentation](https://ckeditor.com/docs/ckeditor5/latest/installation/advanced/content-styles.html).
|
|
258
|
+
|
|
259
|
+
For theme colors switching this plugin uses css variables depending on html data-theme attribute, e.g. `html[data-theme='light']` or `html[data-theme='dark']`
|
|
281
260
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
Since Strapi resets css styles, it needs some styles to revert back, those styles defined below also check https://ckeditor.com/docs/ckeditor5/latest/installation/advanced/content-styles.html
|
|
285
|
-
|
|
286
|
-
Also for theme colors switching this plugin uses css variables depending on html data-theme attribute, e.g. html[data-theme='light'] or html[data-theme='dark']
|
|
287
|
-
|
|
288
|
-
More info about theming https://ckeditor.com/docs/ckeditor5/latest/framework/guides/deep-dive/ui/theme-customization.html
|
|
261
|
+
[More info about theming](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/deep-dive/ui/theme-customization.html)
|
|
289
262
|
|
|
290
|
-
|
|
291
|
-
<summary><b>Example of customizing</b></summary>
|
|
292
|
-
|
|
293
|
-
```javascript
|
|
294
|
-
# plugins.js
|
|
263
|
+
[**👔 Default styles**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/CKEditor/styles.js#L3-L517)
|
|
295
264
|
|
|
265
|
+
[**🎨 Default colour variables**](https://github.com/nshenderov/strapi-plugin-ckeditor/blob/master/admin/src/components/CKEditor/theme-colors.css#L105-L333)
|
|
266
|
+
|
|
267
|
+
**Example of customization:**
|
|
268
|
+
```js
|
|
269
|
+
// plugins.js
|
|
296
270
|
const defStyles = require('./styles.js')
|
|
297
271
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
272
|
+
module.exports = () => {
|
|
273
|
+
return {
|
|
274
|
+
ckeditor: {
|
|
275
|
+
enabled: true,
|
|
276
|
+
config:{
|
|
277
|
+
plugin:{
|
|
278
|
+
// styles applied to editor container
|
|
279
|
+
styles:`
|
|
280
|
+
${defStyles()}
|
|
281
|
+
--ck-color-editor-base-text:red;
|
|
282
|
+
`
|
|
283
|
+
},
|
|
284
|
+
// editor default config
|
|
285
|
+
editor:{
|
|
286
|
+
//...
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
315
292
|
|
|
316
|
-
|
|
293
|
+
// styles.js
|
|
294
|
+
const defStyles = () =>`
|
|
317
295
|
|
|
318
|
-
|
|
319
|
-
### all default styles from link below ###
|
|
296
|
+
### All default styles ###
|
|
320
297
|
`
|
|
321
|
-
|
|
298
|
+
module.exports = defStyles;
|
|
299
|
+
```
|
|
322
300
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
</details>
|
|
326
|
-
|
|
327
|
-
<br/>
|
|
301
|
+
## <a id="requirements"></a>⚠️ Requirements
|
|
302
|
+
Strapi **v4**
|
|
328
303
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
<b>[Default styles](admin/src/components/CKEditor/styles.js)</b>
|
|
304
|
+
Tested on **v4.18 - 4.19**
|
|
332
305
|
|
|
333
|
-
|
|
334
|
-
|
|
306
|
+
## <a id="thanks"></a>👍 This build includes some useful plugins based on these repos so thanks to them:
|
|
307
|
+
https://github.com/Roslovets-Inc/strapi-plugin-ckeditor5
|
|
335
308
|
|
|
336
|
-
|
|
337
|
-
Strapi v4
|
|
338
|
-
|
|
339
|
-
Tested on v4.18 - 4.19
|
|
309
|
+
https://github.com/leknoppix/ckeditor5-fullscreen
|
|
340
310
|
|
|
311
|
+
https://github.com/gtomato/ckeditor5-strapi-upload-plugin
|
|
341
312
|
|
|
342
|
-
|
|
343
|
-
https://github.com/Roslovets-Inc/strapi-plugin-ckeditor5
|
|
344
|
-
https://github.com/leknoppix/ckeditor5-fullscreen
|
|
345
|
-
https://github.com/gtomato/ckeditor5-strapi-upload-plugin
|
|
346
|
-
https://github.com/pshurygin/ckeditor5-font-color
|
|
347
|
-
|
|
313
|
+
https://github.com/pshurygin/ckeditor5-font-color
|
package/admin/src/index.js
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/assets/ckeditor-d-1.jpg
DELETED
|
Binary file
|
package/assets/ckeditor-d-2.jpg
DELETED
|
Binary file
|
package/assets/ckeditor-d-3.jpg
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/assets/ckeditor.jpg
DELETED
|
Binary file
|
package/assets/ckeditor1.jpg
DELETED
|
Binary file
|