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