@_sh/strapi-plugin-ckeditor 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +437 -448
  3. package/admin/src/components/CKEditorIcon.js +46 -46
  4. package/admin/src/components/Input/CKEditor/configs/base.js +636 -627
  5. package/admin/src/components/Input/CKEditor/configs/blockBalloon.js +25 -0
  6. package/admin/src/components/Input/CKEditor/configs/index.js +11 -11
  7. package/admin/src/components/Input/CKEditor/configs/toolbar.js +17 -17
  8. package/admin/src/components/Input/CKEditor/configs/toolbarBalloon.js +17 -0
  9. package/admin/src/components/Input/CKEditor/configuration.js +166 -165
  10. package/admin/src/components/Input/CKEditor/index.js +119 -119
  11. package/admin/src/components/Input/CKEditor/plugins/StrapiMediaLib.js +43 -43
  12. package/admin/src/components/Input/CKEditor/plugins/StrapiUploadAdapter.js +204 -203
  13. package/admin/src/components/Input/CKEditor/plugins/index.js +1 -1
  14. package/admin/src/components/Input/CKEditor/styling.js +16 -16
  15. package/admin/src/components/Input/CKEditor/theme/additional.js +186 -212
  16. package/admin/src/components/Input/CKEditor/theme/common.js +232 -232
  17. package/admin/src/components/Input/CKEditor/theme/dark.js +144 -144
  18. package/admin/src/components/Input/CKEditor/theme/index.js +12 -12
  19. package/admin/src/components/Input/CKEditor/theme/light.js +135 -135
  20. package/admin/src/components/Input/MediaLib/index.js +70 -79
  21. package/admin/src/components/Input/index.js +48 -48
  22. package/admin/src/index.js +110 -110
  23. package/admin/src/utils/getEditorConfig.js +37 -37
  24. package/admin/src/utils/pluginId.js +4 -4
  25. package/package.json +90 -86
  26. package/server/controllers/config.js +16 -16
  27. package/server/controllers/index.js +7 -7
  28. package/server/index.js +13 -13
  29. package/server/register.js +11 -11
  30. package/server/routes/index.js +15 -15
  31. package/server/services/config.js +19 -19
  32. package/server/services/index.js +7 -7
  33. package/strapi-admin.js +3 -3
  34. package/strapi-server.js +3 -3
  35. package/admin/src/components/Input/CKEditor/configs/blockBaloon.js +0 -25
  36. package/admin/src/components/Input/CKEditor/configs/toolbarBaloon.js +0 -17
@@ -1,628 +1,637 @@
1
- import ckeditor5Dll from "ckeditor5/build/ckeditor5-dll.js";
2
- import ckeditor5AlignmentDll from "@ckeditor/ckeditor5-alignment/build/alignment.js";
3
- import ckeditor5AutoformatDll from "@ckeditor/ckeditor5-autoformat/build/autoformat.js";
4
- import ckeditor5AutosaveDll from "@ckeditor/ckeditor5-autosave/build/autosave.js";
5
- import ckeditor5BasicStylesDll from "@ckeditor/ckeditor5-basic-styles/build/basic-styles.js";
6
- import ckeditor5BlockQuoteDll from "@ckeditor/ckeditor5-block-quote/build/block-quote.js";
7
- import ckeditor5CodeBlockDll from "@ckeditor/ckeditor5-code-block/build/code-block.js";
8
- import ckeditor5EssentialsDll from "@ckeditor/ckeditor5-essentials/build/essentials.js";
9
- import ckeditor5HeadingDll from "@ckeditor/ckeditor5-heading/build/heading.js";
10
- import ckeditor5HtmlEmbedDll from "@ckeditor/ckeditor5-html-embed/build/html-embed.js";
11
- import ckeditor5HtmlSupportDll from "@ckeditor/ckeditor5-html-support/build/html-support.js";
12
- import ckeditor5HorizontalLineDll from "@ckeditor/ckeditor5-horizontal-line/build/horizontal-line.js";
13
- import ckeditor5MediaEmbedDll from "@ckeditor/ckeditor5-media-embed/build/media-embed.js";
14
- import ckeditor5ImageDll from "@ckeditor/ckeditor5-image/build/image.js";
15
- import ckeditor5IndentDll from "@ckeditor/ckeditor5-indent/build/indent.js";
16
- import ckeditor5LinkDll from "@ckeditor/ckeditor5-link/build/link.js";
17
- import ckeditor5ListDll from "@ckeditor/ckeditor5-list/build/list.js";
18
- import ckeditor5PasteFromOfficeDll from "@ckeditor/ckeditor5-paste-from-office/build/paste-from-office.js";
19
- import ckeditor5RemoveFormatDll from "@ckeditor/ckeditor5-remove-format/build/remove-format.js";
20
- import ckeditor5TableDll from "@ckeditor/ckeditor5-table/build/table.js";
21
- import ckeditor5WordCountDll from "@ckeditor/ckeditor5-word-count/build/word-count.js";
22
- import ckeditor5FindAndReplaceDll from "@ckeditor/ckeditor5-find-and-replace/build/find-and-replace.js";
23
- import ckeditor5SpecialCharactersDll from "@ckeditor/ckeditor5-special-characters/build/special-characters.js";
24
- import ckeditor5PageBreakDll from "@ckeditor/ckeditor5-page-break/build/page-break.js";
25
- import ckeditor5SourceEditingDll from "@ckeditor/ckeditor5-source-editing/build/source-editing.js";
26
- import ckeditor5LanguageDll from "@ckeditor/ckeditor5-language/build/language.js";
27
- import ckeditor5HighlightDll from "@ckeditor/ckeditor5-highlight/build/highlight.js";
28
- import ckeditor5StyleDll from "@ckeditor/ckeditor5-style/build/style.js";
29
- import ckeditor5MentionDll from "@ckeditor/ckeditor5-mention/build/mention.js";
30
- import ckeditor5FontWithPickerDll from "@_sh/ckeditor5-font-with-picker/build/font-with-picker.js";
31
-
32
- import sanitizeHtml from "sanitize-html";
33
-
34
- import * as strapiPlugins from '../plugins'
35
- window.CKEditor5.strapiPlugins = strapiPlugins;
36
-
37
- const w = {
38
- Alignment: window.CKEditor5.alignment.Alignment,
39
- Autoformat: window.CKEditor5.autoformat.Autoformat,
40
- AutoImage: window.CKEditor5.image.AutoImage,
41
- AutoLink: window.CKEditor5.link.AutoLink,
42
- Autosave: window.CKEditor5.autosave.Autosave,
43
- BalloonToolbar: window.CKEditor5.ui.BalloonToolbar,
44
- BlockQuote: window.CKEditor5.blockQuote.BlockQuote,
45
- BlockToolbar: window.CKEditor5.ui.BlockToolbar,
46
- Bold: window.CKEditor5.basicStyles.Bold,
47
- Code: window.CKEditor5.basicStyles.Code,
48
- CodeBlock: window.CKEditor5.codeBlock.CodeBlock,
49
- DataFilter: window.CKEditor5.htmlSupport.DataFilter,
50
- DataSchema: window.CKEditor5.htmlSupport.DataSchema,
51
- DocumentList: window.CKEditor5.list.DocumentList,
52
- DocumentListProperties: window.CKEditor5.list.DocumentListProperties,
53
- Essentials: window.CKEditor5.essentials.Essentials,
54
- FindAndReplace: window.CKEditor5.findAndReplace.FindAndReplace,
55
- FontBackgroundColor: window.CKEditor5.fontWithPicker.FontBackgroundColor,
56
- FontColor: window.CKEditor5.fontWithPicker.FontColor,
57
- FontFamily: window.CKEditor5.fontWithPicker.FontFamily,
58
- FontSize: window.CKEditor5.fontWithPicker.FontSize,
59
- GeneralHtmlSupport: window.CKEditor5.htmlSupport.GeneralHtmlSupport,
60
- Heading: window.CKEditor5.heading.Heading,
61
- // HeadingButtonsUI: window.CKEditor5.heading.HeadingButtonsUI,
62
- Highlight: window.CKEditor5.highlight.Highlight,
63
- HorizontalLine: window.CKEditor5.horizontalLine.HorizontalLine,
64
- HtmlComment: window.CKEditor5.htmlSupport.HtmlComment,
65
- HtmlEmbed: window.CKEditor5.htmlEmbed.HtmlEmbed,
66
- Image: window.CKEditor5.image.Image,
67
- ImageCaption: window.CKEditor5.image.ImageCaption,
68
- ImageInsert: window.CKEditor5.image.ImageInsert,
69
- ImageResize: window.CKEditor5.image.ImageResize,
70
- ImageStyle: window.CKEditor5.image.ImageStyle,
71
- ImageToolbar: window.CKEditor5.image.ImageToolbar,
72
- ImageUpload: window.CKEditor5.image.ImageUpload,
73
- Indent: window.CKEditor5.indent.Indent,
74
- IndentBlock: window.CKEditor5.indent.IndentBlock,
75
- Italic: window.CKEditor5.basicStyles.Italic,
76
- Link: window.CKEditor5.link.Link,
77
- LinkImage: window.CKEditor5.link.LinkImage,
78
- List: window.CKEditor5.list.List,
79
- ListProperties: window.CKEditor5.list.ListProperties,
80
- MediaEmbed: window.CKEditor5.mediaEmbed.MediaEmbed,
81
- MediaEmbedToolbar: window.CKEditor5.mediaEmbed.MediaEmbedToolbar,
82
- Mention: window.CKEditor5.mention.Mention,
83
- PageBreak: window.CKEditor5.pageBreak.PageBreak,
84
- Paragraph: window.CKEditor5.paragraph.Paragraph,
85
- // ParagraphButtonUI: window.CKEditor5.paragraph.ParagraphButtonUI,
86
- PasteFromOffice: window.CKEditor5.pasteFromOffice.PasteFromOffice,
87
- RemoveFormat: window.CKEditor5.removeFormat.RemoveFormat,
88
- SourceEditing: window.CKEditor5.sourceEditing.SourceEditing,
89
- SpecialCharacters: window.CKEditor5.specialCharacters.SpecialCharacters,
90
- SpecialCharactersArrows: window.CKEditor5.specialCharacters.SpecialCharactersArrows,
91
- SpecialCharactersCurrency: window.CKEditor5.specialCharacters.SpecialCharactersCurrency,
92
- // SpecialCharactersEssentials: window.CKEditor5.specialCharacters.SpecialCharactersEssentials,
93
- SpecialCharactersLatin: window.CKEditor5.specialCharacters.SpecialCharactersLatin,
94
- SpecialCharactersMathematical: window.CKEditor5.specialCharacters.SpecialCharactersMathematical,
95
- SpecialCharactersText: window.CKEditor5.specialCharacters.SpecialCharactersText,
96
- StrapiMediaLib: window.CKEditor5.strapiPlugins.StrapiMediaLib,
97
- StrapiUploadAdapter: window.CKEditor5.strapiPlugins.StrapiUploadAdapter,
98
- Strikethrough: window.CKEditor5.basicStyles.Strikethrough,
99
- Style: window.CKEditor5.style.Style,
100
- Subscript: window.CKEditor5.basicStyles.Subscript,
101
- Superscript: window.CKEditor5.basicStyles.Superscript,
102
- Table: window.CKEditor5.table.Table,
103
- TableCaption: window.CKEditor5.table.TableCaption,
104
- TableCellProperties: window.CKEditor5.table.TableCellProperties,
105
- TableColumnResize: window.CKEditor5.table.TableColumnResize,
106
- TableProperties: window.CKEditor5.table.TableProperties,
107
- TableToolbar: window.CKEditor5.table.TableToolbar,
108
- TextPartLanguage: window.CKEditor5.language.TextPartLanguage,
109
- TodoList: window.CKEditor5.list.TodoList,
110
- Underline: window.CKEditor5.basicStyles.Underline,
111
- WordCount: window.CKEditor5.wordCount.WordCount
112
- }
113
-
114
- const REDUCED_MATERIAL_COLORS = [
115
- { label: "Red 50", color: "#ffebee" },
116
- { label: "Purple 50", color: "#f3e5f5" },
117
- { label: "Indigo 50", color: "#e8eaf6" },
118
- { label: "Blue 50", color: "#e3f2fd" },
119
- { label: "Cyan 50", color: "#e0f7fa" },
120
- { label: "Teal 50", color: "#e0f2f1" },
121
- { label: "Light green 50", color: "#f1f8e9" },
122
- { label: "Lime 50", color: "#f9fbe7" },
123
- { label: "Amber 50", color: "#fff8e1" },
124
- { label: "Orange 50", color: "#fff3e0" },
125
- { label: "Grey 50", color: "#fafafa" },
126
- { label: "Blue grey 50", color: "#eceff1" },
127
- { label: "Red 100", color: "#ffcdd2" },
128
- { label: "Purple 100", color: "#e1bee7" },
129
- { label: "Indigo 100", color: "#c5cae9" },
130
- { label: "Blue 100", color: "#bbdefb" },
131
- { label: "Cyan 100", color: "#b2ebf2" },
132
- { label: "Teal 100", color: "#b2dfdb" },
133
- { label: "Light green 100", color: "#dcedc8" },
134
- { label: "Lime 100", color: "#f0f4c3" },
135
- { label: "Amber 100", color: "#ffecb3" },
136
- { label: "Orange 100", color: "#ffe0b2" },
137
- { label: "Grey 100", color: "#f5f5f5" },
138
- { label: "Blue grey 100", color: "#cfd8dc" },
139
- { label: "Red 200", color: "#ef9a9a" },
140
- { label: "Purple 200", color: "#ce93d8" },
141
- { label: "Indigo 200", color: "#9fa8da" },
142
- { label: "Blue 200", color: "#90caf9" },
143
- { label: "Cyan 200", color: "#80deea" },
144
- { label: "Teal 200", color: "#80cbc4" },
145
- { label: "Light green 200", color: "#c5e1a5" },
146
- { label: "Lime 200", color: "#e6ee9c" },
147
- { label: "Amber 200", color: "#ffe082" },
148
- { label: "Orange 200", color: "#ffcc80" },
149
- { label: "Grey 200", color: "#eeeeee" },
150
- { label: "Blue grey 200", color: "#b0bec5" },
151
- { label: "Red 300", color: "#e57373" },
152
- { label: "Purple 300", color: "#ba68c8" },
153
- { label: "Indigo 300", color: "#7986cb" },
154
- { label: "Blue 300", color: "#64b5f6" },
155
- { label: "Cyan 300", color: "#4dd0e1" },
156
- { label: "Teal 300", color: "#4db6ac" },
157
- { label: "Light green 300", color: "#aed581" },
158
- { label: "Lime 300", color: "#dce775" },
159
- { label: "Amber 300", color: "#ffd54f" },
160
- { label: "Orange 300", color: "#ffb74d" },
161
- { label: "Grey 300", color: "#e0e0e0" },
162
- { label: "Blue grey 300", color: "#90a4ae" },
163
- { label: "Red 400", color: "#ef5350" },
164
- { label: "Purple 400", color: "#ab47bc" },
165
- { label: "Indigo 400", color: "#5c6bc0" },
166
- { label: "Blue 400", color: "#42a5f5" },
167
- { label: "Cyan 400", color: "#26c6da" },
168
- { label: "Teal 400", color: "#26a69a" },
169
- { label: "Light green 400", color: "#9ccc65" },
170
- { label: "Lime 400", color: "#d4e157" },
171
- { label: "Amber 400", color: "#ffca28" },
172
- { label: "Orange 400", color: "#ffa726" },
173
- { label: "Grey 400", color: "#bdbdbd" },
174
- { label: "Blue grey 400", color: "#78909c" },
175
- { label: "Red 500", color: "#f44336" },
176
- { label: "Purple 500", color: "#9c27b0" },
177
- { label: "Indigo 500", color: "#3f51b5" },
178
- { label: "Blue 500", color: "#2196f3" },
179
- { label: "Cyan 500", color: "#00bcd4" },
180
- { label: "Teal 500", color: "#009688" },
181
- { label: "Light green 500", color: "#8bc34a" },
182
- { label: "Lime 500", color: "#cddc39" },
183
- { label: "Amber 500", color: "#ffc107" },
184
- { label: "Orange 500", color: "#ff9800" },
185
- { label: "Grey 500", color: "#9e9e9e" },
186
- { label: "Blue grey 500", color: "#607d8b" },
187
- { label: "Red 600", color: "#e53935" },
188
- { label: "Purple 600", color: "#8e24aa" },
189
- { label: "Indigo 600", color: "#3949ab" },
190
- { label: "Blue 600", color: "#1e88e5" },
191
- { label: "Cyan 600", color: "#00acc1" },
192
- { label: "Teal 600", color: "#00897b" },
193
- { label: "Light green 600", color: "#7cb342" },
194
- { label: "Lime 600", color: "#c0ca33" },
195
- { label: "Amber 600", color: "#ffb300" },
196
- { label: "Orange 600", color: "#fb8c00" },
197
- { label: "Grey 600", color: "#757575" },
198
- { label: "Blue grey 600", color: "#546e7a" },
199
- { label: "Red 700", color: "#d32f2f" },
200
- { label: "Purple 700", color: "#7b1fa2" },
201
- { label: "Indigo 700", color: "#303f9f" },
202
- { label: "Blue 700", color: "#1976d2" },
203
- { label: "Cyan 700", color: "#0097a7" },
204
- { label: "Teal 700", color: "#00796b" },
205
- { label: "Light green 700", color: "#689f38" },
206
- { label: "Lime 700", color: "#afb42b" },
207
- { label: "Amber 700", color: "#ffa000" },
208
- { label: "Orange 700", color: "#f57c00" },
209
- { label: "Grey 700", color: "#616161" },
210
- { label: "Blue grey 700", color: "#455a64" },
211
- { label: "Red 800", color: "#c62828" },
212
- { label: "Purple 800", color: "#6a1b9a" },
213
- { label: "Indigo 800", color: "#283593" },
214
- { label: "Blue 800", color: "#1565c0" },
215
- { label: "Cyan 800", color: "#00838f" },
216
- { label: "Teal 800", color: "#00695c" },
217
- { label: "Light green 800", color: "#558b2f" },
218
- { label: "Lime 800", color: "#9e9d24" },
219
- { label: "Amber 800", color: "#ff8f00" },
220
- { label: "Orange 800", color: "#ef6c00" },
221
- { label: "Grey 800", color: "#424242" },
222
- { label: "Blue grey 800", color: "#37474f" },
223
- { label: "Red 900", color: "#b71c1c" },
224
- { label: "Purple 900", color: "#4a148c" },
225
- { label: "Indigo 900", color: "#1a237e" },
226
- { label: "Blue 900", color: "#0d47a1" },
227
- { label: "Cyan 900", color: "#006064" },
228
- { label: "Teal 900", color: "#004d40" },
229
- { label: "Light green 900", color: "#33691e" },
230
- { label: "Lime 900", color: "#827717" },
231
- { label: "Amber 900", color: "#ff6f00" },
232
- { label: "Orange 900", color: "#e65100" },
233
- { label: "Grey 900", color: "#212121" },
234
- { label: "Blue grey 900", color: "#263238" },
235
- ];
236
-
237
- const base = {
238
- fontFamily: {
239
- supportAllValues: true,
240
- },
241
- fontSize: {
242
- options: [10, 12, 14, "default", 18, 20, 22],
243
- supportAllValues: true,
244
- },
245
- fontColor: {
246
- columns: 12,
247
- documentColors: 12,
248
- colors: REDUCED_MATERIAL_COLORS,
249
- },
250
- fontBackgroundColor: {
251
- columns: 12,
252
- documentColors: 12,
253
- colors: REDUCED_MATERIAL_COLORS,
254
- },
255
- heading: {
256
- options: [
257
- { model: "paragraph", title: "Paragraph", class: "ck-heading_paragraph" },
258
- { model: "heading1", view: "h1", title: "Heading 1", class: "ck-heading_heading1" },
259
- { model: "heading2", view: "h2", title: "Heading 2", class: "ck-heading_heading2" },
260
- { model: "heading3", view: "h3", title: "Heading 3", class: "ck-heading_heading3" },
261
- { model: "heading4", view: "h4", title: "Heading 4", class: "ck-heading_heading4" },
262
- { model: "heading5", view: "h5", title: "Heading 5", class: "ck-heading_heading5" },
263
- { model: "heading6", view: "h6", title: "Heading 6", class: "ck-heading_heading6" },
264
- ],
265
- },
266
- htmlSupport: {
267
- allow: [
268
- {
269
- name: /.*/,
270
- attributes: true,
271
- classes: true,
272
- styles: true,
273
- },
274
- ],
275
- disallow: [
276
- {
277
- attributes: [
278
- { key: /^on(.*)/i, value: true },
279
- { key: /.*/, value: /(\b)(on\S+)(\s*)=|javascript:|(<\s*)(\/*)script/i },
280
- { key: /.*/, value: /data:(?!image\/(png|jpeg|gif|webp))/i },
281
- ],
282
- },
283
- { name: "script" },
284
- ],
285
- },
286
- htmlEmbed: {
287
- showPreviews: true,
288
- sanitizeHtml: (inputHtml) => {
289
- const outputHtml = sanitizeHtml(inputHtml);
290
- return {
291
- html: outputHtml,
292
- hasChanged: true,
293
- };
294
- },
295
- },
296
- list: {
297
- properties: {
298
- styles: true,
299
- startIndex: true,
300
- reversed: true,
301
- },
302
- },
303
- table: {
304
- contentToolbar: [
305
- "tableColumn",
306
- "tableRow",
307
- "mergeTableCells",
308
- "tableProperties",
309
- "tableCellProperties",
310
- "toggleTableCaption",
311
- ],
312
- },
313
- image: {
314
- styles: {
315
- options: [
316
- 'inline', 'alignLeft', 'alignRight',
317
- 'alignCenter', 'alignBlockLeft', 'alignBlockRight',
318
- 'block', 'side'
319
- ]
320
- },
321
- resizeOptions: [
322
- {
323
- name: "resizeImage:original",
324
- label: "Default image width",
325
- value: null,
326
- },
327
- {
328
- name: "resizeImage:50",
329
- label: "50% page width",
330
- value: "50",
331
- },
332
- {
333
- name: "resizeImage:75",
334
- label: "75% page width",
335
- value: "75",
336
- },
337
- ],
338
- toolbar: [
339
- "imageTextAlternative",
340
- "toggleImageCaption",
341
- "linkImage",
342
- "|",
343
- "imageStyle:inline",
344
- "imageStyle:wrapText",
345
- "imageStyle:breakText",
346
- "imageStyle:side",
347
- "|",
348
- "resizeImage",
349
- ],
350
- insert: {
351
- integrations: ["insertImageViaUrl"],
352
- },
353
- },
354
- link: {
355
- decorators: {
356
- openInNewTab: {
357
- mode: "manual",
358
- label: "Open in a new tab",
359
- defaultValue: true,
360
- attributes: {
361
- target: "_blank",
362
- rel: "noopener noreferrer",
363
- },
364
- },
365
- toggleDownloadable: {
366
- mode: "manual",
367
- label: "Downloadable",
368
- attributes: {
369
- download: "file",
370
- },
371
- },
372
- },
373
- addTargetToExternalLinks: true,
374
- defaultProtocol: "https://",
375
- },
376
- style: {
377
- definitions: [
378
- {
379
- name: "Title",
380
- element: "h1",
381
- classes: ["document-title"],
382
- },
383
- {
384
- name: "Subtitle",
385
- element: "h2",
386
- classes: ["document-subtitle"],
387
- },
388
- {
389
- name: "Callout",
390
- element: "p",
391
- classes: ["callout"],
392
- },
393
- {
394
- name: "Side quote",
395
- element: "blockquote",
396
- classes: ["side-quote"],
397
- },
398
- {
399
- name: "Needs clarification",
400
- element: "span",
401
- classes: ["needs-clarification"],
402
- },
403
- {
404
- name: "Wide spacing",
405
- element: "span",
406
- classes: ["wide-spacing"],
407
- },
408
- {
409
- name: "Small caps",
410
- element: "span",
411
- classes: ["small-caps"],
412
- },
413
- {
414
- name: "Code (dark)",
415
- element: "pre",
416
- classes: ["stylish-code", "stylish-code-dark"],
417
- },
418
- {
419
- name: "Code (bright)",
420
- element: "pre",
421
- classes: ["stylish-code", "stylish-code-bright"],
422
- },
423
- ],
424
- },
425
- };
426
-
427
-
428
-
429
- const basePlugins = [
430
- w.Alignment,
431
- w.Autoformat,
432
- w.AutoImage,
433
- w.BlockQuote,
434
- w.Bold,
435
- w.Code,
436
- w.CodeBlock,
437
- w.DocumentList,
438
- w.DocumentListProperties,
439
- w.Essentials,
440
- w.FontBackgroundColor,
441
- w.FontColor,
442
- w.FontFamily,
443
- w.FontSize,
444
- w.GeneralHtmlSupport,
445
- w.Heading,
446
- w.HorizontalLine,
447
- w.HtmlEmbed,
448
- w.Image,
449
- w.ImageCaption,
450
- w.ImageInsert,
451
- w.ImageResize,
452
- w.ImageStyle,
453
- w.ImageToolbar,
454
- w.ImageUpload,
455
- w.Indent,
456
- w.IndentBlock,
457
- w.Italic,
458
- w.Link,
459
- w.LinkImage,
460
- w.LinkImage,
461
- w.MediaEmbed,
462
- w.PageBreak,
463
- w.Paragraph,
464
- w.PasteFromOffice,
465
- w.RemoveFormat,
466
- w.SourceEditing,
467
- w.SpecialCharacters,
468
- w.SpecialCharactersArrows,
469
- w.SpecialCharactersCurrency,
470
- w.SpecialCharactersLatin,
471
- w.SpecialCharactersMathematical,
472
- w.SpecialCharactersText,
473
- w.StrapiMediaLib,
474
- w.StrapiUploadAdapter,
475
- w.Strikethrough,
476
- w.Style,
477
- w.Subscript,
478
- w.Superscript,
479
- w.Table,
480
- w.TableCaption,
481
- w.TableCellProperties,
482
- w.TableColumnResize,
483
- w.TableProperties,
484
- w.TableToolbar,
485
- w.Underline,
486
- w.WordCount,
487
- ];
488
-
489
- export const toolbarEditorConfig = {
490
- plugins:basePlugins,
491
- ...base,
492
- toolbar: [
493
- {
494
- label:' ',
495
- tooltip: null,
496
- icon:'paragraph',
497
- items: [ 'heading','style','SourceEditing']
498
- },
499
- '|',
500
- {
501
- label:' ',
502
- tooltip: null,
503
- icon:'text',
504
- items: [ 'bold', 'italic','fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor' ]
505
- },
506
- {
507
- label:' ',
508
- tooltip: null,
509
- icon:`
510
- <svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
511
- <rect x="0" fill="none" width="24" height="24"/>
512
- <g>
513
- <path d="M14.348 12H21v2h-4.613c.24.515.368 1.094.368 1.748 0 1.317-.474 2.355-1.423 3.114-.947.76-2.266 1.138-3.956 1.138-1.557 0-2.934-.293-4.132-.878v-2.874c.985.44 1.818.75 2.5.928.682.18 1.306.27 1.872.27.68 0 1.2-.13 1.562-.39.363-.26.545-.644.545-1.158 0-.285-.08-.54-.24-.763-.16-.222-.394-.437-.704-.643-.18-.12-.483-.287-.88-.49H3v-2H14.347zm-3.528-2c-.073-.077-.143-.155-.193-.235-.126-.202-.19-.44-.19-.713 0-.44.157-.795.47-1.068.313-.273.762-.41 1.348-.41.492 0 .993.064 1.502.19.51.127 1.153.35 1.93.67l1-2.405c-.753-.327-1.473-.58-2.16-.76-.69-.18-1.414-.27-2.173-.27-1.544 0-2.753.37-3.628 1.108-.874.738-1.312 1.753-1.312 3.044 0 .302.036.58.088.848h3.318z"/>
514
- </g>
515
- </svg>`,
516
- items: [ 'underline', 'strikethrough', 'superscript', 'subscript' ]
517
- },
518
- 'removeFormat',
519
- '|',
520
- 'alignment',
521
- 'outdent',
522
- 'indent',
523
- '|',
524
- 'bulletedList', 'numberedList',
525
- '|',
526
- 'insertImage','mediaEmbed','strapiMediaLib','link','blockquote','insertTable','specialCharacters','htmlEmbed','codeBlock',
527
- '|', 'horizontalLine', 'pageBreak', '|',
528
- '|', 'undo', 'redo', '|',
529
- ],
530
-
531
- }
532
-
533
- export const toolbarBaloonEditorConfig = {
534
- plugins:[...basePlugins, w.BalloonToolbar],
535
- ...base,
536
- toolbar: [
537
- {
538
- label:' ',
539
- tooltip: null,
540
- icon:'paragraph',
541
- items: [ 'heading','style']
542
- },
543
- '|',
544
- 'alignment',
545
- 'outdent',
546
- 'indent',
547
- '|',
548
- 'bulletedList', 'numberedList',
549
- '|',
550
- 'insertImage','mediaEmbed','strapiMediaLib','link','blockquote','insertTable','specialCharacters','htmlEmbed','codeBlock',
551
- '|', 'horizontalLine', 'pageBreak', '|','SourceEditing',
552
- '|', 'undo', 'redo', '|',
553
- ],
554
- balloonToolbar: [
555
- 'bold', 'italic','fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor',
556
- {
557
- label:' ',
558
- tooltip: null,
559
- icon:`
560
- <svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
561
- <rect x="0" fill="none" width="24" height="24"/>
562
- <g>
563
- <path d="M14.348 12H21v2h-4.613c.24.515.368 1.094.368 1.748 0 1.317-.474 2.355-1.423 3.114-.947.76-2.266 1.138-3.956 1.138-1.557 0-2.934-.293-4.132-.878v-2.874c.985.44 1.818.75 2.5.928.682.18 1.306.27 1.872.27.68 0 1.2-.13 1.562-.39.363-.26.545-.644.545-1.158 0-.285-.08-.54-.24-.763-.16-.222-.394-.437-.704-.643-.18-.12-.483-.287-.88-.49H3v-2H14.347zm-3.528-2c-.073-.077-.143-.155-.193-.235-.126-.202-.19-.44-.19-.713 0-.44.157-.795.47-1.068.313-.273.762-.41 1.348-.41.492 0 .993.064 1.502.19.51.127 1.153.35 1.93.67l1-2.405c-.753-.327-1.473-.58-2.16-.76-.69-.18-1.414-.27-2.173-.27-1.544 0-2.753.37-3.628 1.108-.874.738-1.312 1.753-1.312 3.044 0 .302.036.58.088.848h3.318z"/>
564
- </g>
565
- </svg>`,
566
- items: [ 'underline', 'strikethrough', 'superscript', 'subscript' ]
567
- },
568
- '|',
569
- 'removeFormat',
570
- ]
571
- }
572
-
573
- export const blockBaloonEditorConfig = {
574
- plugins:[
575
- ...basePlugins.filter(({pluginName})=>
576
- pluginName !== "SourceEditing" &&
577
- pluginName !== "SpecialCharacters" &&
578
- pluginName !== "SpecialCharactersArrows" &&
579
- pluginName !== "SpecialCharactersCurrency" &&
580
- pluginName !== "SpecialCharactersEssentials" &&
581
- pluginName !== "SpecialCharactersLatin" &&
582
- pluginName !== "SpecialCharactersMathematical" &&
583
- pluginName !== "SpecialCharactersText" &&
584
- pluginName !== "PageBreak" &&
585
- pluginName !== "HorizontalLine" &&
586
- pluginName !== "MediaEmbed" &&
587
- pluginName !== "HtmlEmbed" &&
588
- pluginName !== "Code" &&
589
- pluginName !== "CodeBlock"
590
- ),
591
- w.BlockToolbar, w.BalloonToolbar
592
- ],
593
- ...base,
594
- blockToolbar: [
595
- {
596
- label:' ',
597
- tooltip: null,
598
- icon:'paragraph',
599
- items: [ 'heading','style']
600
- },
601
- '|',
602
- 'bulletedList', 'numberedList',
603
- '|',
604
- 'alignment',
605
- 'outdent',
606
- 'indent',
607
- '|',
608
- 'insertImage','strapiMediaLib','link','blockquote','insertTable',
609
- '|', 'undo', 'redo', '|',
610
- ],
611
- balloonToolbar: [
612
- 'bold', 'italic','fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor',
613
- {
614
- label:' ',
615
- tooltip: null,
616
- icon:`
617
- <svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
618
- <rect x="0" fill="none" width="24" height="24"/>
619
- <g>
620
- <path d="M14.348 12H21v2h-4.613c.24.515.368 1.094.368 1.748 0 1.317-.474 2.355-1.423 3.114-.947.76-2.266 1.138-3.956 1.138-1.557 0-2.934-.293-4.132-.878v-2.874c.985.44 1.818.75 2.5.928.682.18 1.306.27 1.872.27.68 0 1.2-.13 1.562-.39.363-.26.545-.644.545-1.158 0-.285-.08-.54-.24-.763-.16-.222-.394-.437-.704-.643-.18-.12-.483-.287-.88-.49H3v-2H14.347zm-3.528-2c-.073-.077-.143-.155-.193-.235-.126-.202-.19-.44-.19-.713 0-.44.157-.795.47-1.068.313-.273.762-.41 1.348-.41.492 0 .993.064 1.502.19.51.127 1.153.35 1.93.67l1-2.405c-.753-.327-1.473-.58-2.16-.76-.69-.18-1.414-.27-2.173-.27-1.544 0-2.753.37-3.628 1.108-.874.738-1.312 1.753-1.312 3.044 0 .302.036.58.088.848h3.318z"/>
621
- </g>
622
- </svg>`,
623
- items: [ 'underline', 'strikethrough', 'superscript', 'subscript' ]
624
- },
625
- '|',
626
- 'removeFormat',
627
- ]
1
+ import ckeditor5Dll from "ckeditor5/build/ckeditor5-dll.js";
2
+ import ckeditor5AlignmentDll from "@ckeditor/ckeditor5-alignment/build/alignment.js";
3
+ import ckeditor5AutoformatDll from "@ckeditor/ckeditor5-autoformat/build/autoformat.js";
4
+ import ckeditor5AutosaveDll from "@ckeditor/ckeditor5-autosave/build/autosave.js";
5
+ import ckeditor5BasicStylesDll from "@ckeditor/ckeditor5-basic-styles/build/basic-styles.js";
6
+ import ckeditor5BlockQuoteDll from "@ckeditor/ckeditor5-block-quote/build/block-quote.js";
7
+ import ckeditor5CodeBlockDll from "@ckeditor/ckeditor5-code-block/build/code-block.js";
8
+ import ckeditor5EssentialsDll from "@ckeditor/ckeditor5-essentials/build/essentials.js";
9
+ import ckeditor5HeadingDll from "@ckeditor/ckeditor5-heading/build/heading.js";
10
+ import ckeditor5HtmlEmbedDll from "@ckeditor/ckeditor5-html-embed/build/html-embed.js";
11
+ import ckeditor5HtmlSupportDll from "@ckeditor/ckeditor5-html-support/build/html-support.js";
12
+ import ckeditor5HorizontalLineDll from "@ckeditor/ckeditor5-horizontal-line/build/horizontal-line.js";
13
+ import ckeditor5MediaEmbedDll from "@ckeditor/ckeditor5-media-embed/build/media-embed.js";
14
+ import ckeditor5ImageDll from "@ckeditor/ckeditor5-image/build/image.js";
15
+ import ckeditor5IndentDll from "@ckeditor/ckeditor5-indent/build/indent.js";
16
+ import ckeditor5LinkDll from "@ckeditor/ckeditor5-link/build/link.js";
17
+ import ckeditor5ListDll from "@ckeditor/ckeditor5-list/build/list.js";
18
+ import ckeditor5PasteFromOfficeDll from "@ckeditor/ckeditor5-paste-from-office/build/paste-from-office.js";
19
+ import ckeditor5RemoveFormatDll from "@ckeditor/ckeditor5-remove-format/build/remove-format.js";
20
+ import ckeditor5TableDll from "@ckeditor/ckeditor5-table/build/table.js";
21
+ import ckeditor5WordCountDll from "@ckeditor/ckeditor5-word-count/build/word-count.js";
22
+ import ckeditor5FindAndReplaceDll from "@ckeditor/ckeditor5-find-and-replace/build/find-and-replace.js";
23
+ import ckeditor5SpecialCharactersDll from "@ckeditor/ckeditor5-special-characters/build/special-characters.js";
24
+ import ckeditor5PageBreakDll from "@ckeditor/ckeditor5-page-break/build/page-break.js";
25
+ import ckeditor5SourceEditingDll from "@ckeditor/ckeditor5-source-editing/build/source-editing.js";
26
+ import ckeditor5LanguageDll from "@ckeditor/ckeditor5-language/build/language.js";
27
+ import ckeditor5HighlightDll from "@ckeditor/ckeditor5-highlight/build/highlight.js";
28
+ import ckeditor5StyleDll from "@ckeditor/ckeditor5-style/build/style.js";
29
+ import ckeditor5MentionDll from "@ckeditor/ckeditor5-mention/build/mention.js";
30
+ import ckeditor5FontDll from "@ckeditor/ckeditor5-font/build/font.js";
31
+ import ckeditor5ShowBlocksDll from "@ckeditor/ckeditor5-show-blocks/build/show-blocks.js";
32
+
33
+
34
+ import sanitizeHtml from "sanitize-html";
35
+
36
+ import * as strapiPlugins from '../plugins'
37
+ window.CKEditor5.strapiPlugins = strapiPlugins;
38
+
39
+ const w = {
40
+ Alignment: window.CKEditor5.alignment.Alignment,
41
+ Autoformat: window.CKEditor5.autoformat.Autoformat,
42
+ AutoImage: window.CKEditor5.image.AutoImage,
43
+ AutoLink: window.CKEditor5.link.AutoLink,
44
+ Autosave: window.CKEditor5.autosave.Autosave,
45
+ BalloonToolbar: window.CKEditor5.ui.BalloonToolbar,
46
+ BlockQuote: window.CKEditor5.blockQuote.BlockQuote,
47
+ BlockToolbar: window.CKEditor5.ui.BlockToolbar,
48
+ Bold: window.CKEditor5.basicStyles.Bold,
49
+ Code: window.CKEditor5.basicStyles.Code,
50
+ CodeBlock: window.CKEditor5.codeBlock.CodeBlock,
51
+ DataFilter: window.CKEditor5.htmlSupport.DataFilter,
52
+ DataSchema: window.CKEditor5.htmlSupport.DataSchema,
53
+ DocumentList: window.CKEditor5.list.DocumentList,
54
+ DocumentListProperties: window.CKEditor5.list.DocumentListProperties,
55
+ Essentials: window.CKEditor5.essentials.Essentials,
56
+ FindAndReplace: window.CKEditor5.findAndReplace.FindAndReplace,
57
+ FontBackgroundColor: window.CKEditor5.font.FontBackgroundColor,
58
+ FontColor: window.CKEditor5.font.FontColor,
59
+ FontFamily: window.CKEditor5.font.FontFamily,
60
+ FontSize: window.CKEditor5.font.FontSize,
61
+ GeneralHtmlSupport: window.CKEditor5.htmlSupport.GeneralHtmlSupport,
62
+ Heading: window.CKEditor5.heading.Heading,
63
+ // HeadingButtonsUI: window.CKEditor5.heading.HeadingButtonsUI,
64
+ Highlight: window.CKEditor5.highlight.Highlight,
65
+ HorizontalLine: window.CKEditor5.horizontalLine.HorizontalLine,
66
+ HtmlComment: window.CKEditor5.htmlSupport.HtmlComment,
67
+ HtmlEmbed: window.CKEditor5.htmlEmbed.HtmlEmbed,
68
+ Image: window.CKEditor5.image.Image,
69
+ ImageCaption: window.CKEditor5.image.ImageCaption,
70
+ ImageInsert: window.CKEditor5.image.ImageInsert,
71
+ ImageResize: window.CKEditor5.image.ImageResize,
72
+ ImageStyle: window.CKEditor5.image.ImageStyle,
73
+ ImageToolbar: window.CKEditor5.image.ImageToolbar,
74
+ ImageUpload: window.CKEditor5.image.ImageUpload,
75
+ Indent: window.CKEditor5.indent.Indent,
76
+ IndentBlock: window.CKEditor5.indent.IndentBlock,
77
+ Italic: window.CKEditor5.basicStyles.Italic,
78
+ Link: window.CKEditor5.link.Link,
79
+ LinkImage: window.CKEditor5.link.LinkImage,
80
+ List: window.CKEditor5.list.List,
81
+ ListProperties: window.CKEditor5.list.ListProperties,
82
+ MediaEmbed: window.CKEditor5.mediaEmbed.MediaEmbed,
83
+ MediaEmbedToolbar: window.CKEditor5.mediaEmbed.MediaEmbedToolbar,
84
+ Mention: window.CKEditor5.mention.Mention,
85
+ PageBreak: window.CKEditor5.pageBreak.PageBreak,
86
+ Paragraph: window.CKEditor5.paragraph.Paragraph,
87
+ // ParagraphButtonUI: window.CKEditor5.paragraph.ParagraphButtonUI,
88
+ PasteFromOffice: window.CKEditor5.pasteFromOffice.PasteFromOffice,
89
+ PictureEditing: window.CKEditor5.image.PictureEditing,
90
+ RemoveFormat: window.CKEditor5.removeFormat.RemoveFormat,
91
+ SourceEditing: window.CKEditor5.sourceEditing.SourceEditing,
92
+ SpecialCharacters: window.CKEditor5.specialCharacters.SpecialCharacters,
93
+ SpecialCharactersArrows: window.CKEditor5.specialCharacters.SpecialCharactersArrows,
94
+ SpecialCharactersCurrency: window.CKEditor5.specialCharacters.SpecialCharactersCurrency,
95
+ // SpecialCharactersEssentials: window.CKEditor5.specialCharacters.SpecialCharactersEssentials,
96
+ SpecialCharactersLatin: window.CKEditor5.specialCharacters.SpecialCharactersLatin,
97
+ SpecialCharactersMathematical: window.CKEditor5.specialCharacters.SpecialCharactersMathematical,
98
+ SpecialCharactersText: window.CKEditor5.specialCharacters.SpecialCharactersText,
99
+ StrapiMediaLib: window.CKEditor5.strapiPlugins.StrapiMediaLib,
100
+ StrapiUploadAdapter: window.CKEditor5.strapiPlugins.StrapiUploadAdapter,
101
+ Strikethrough: window.CKEditor5.basicStyles.Strikethrough,
102
+ Style: window.CKEditor5.style.Style,
103
+ Subscript: window.CKEditor5.basicStyles.Subscript,
104
+ Superscript: window.CKEditor5.basicStyles.Superscript,
105
+ ShowBlocks: window.CKEditor5.showBlocks.ShowBlocks,
106
+ Table: window.CKEditor5.table.Table,
107
+ TableCaption: window.CKEditor5.table.TableCaption,
108
+ TableCellProperties: window.CKEditor5.table.TableCellProperties,
109
+ TableColumnResize: window.CKEditor5.table.TableColumnResize,
110
+ TableProperties: window.CKEditor5.table.TableProperties,
111
+ TableToolbar: window.CKEditor5.table.TableToolbar,
112
+ TextPartLanguage: window.CKEditor5.language.TextPartLanguage,
113
+ TodoList: window.CKEditor5.list.TodoList,
114
+ Underline: window.CKEditor5.basicStyles.Underline,
115
+ WordCount: window.CKEditor5.wordCount.WordCount
116
+ }
117
+
118
+ const REDUCED_MATERIAL_COLORS = [
119
+ { label: "Red 50", color: "#ffebee" },
120
+ { label: "Purple 50", color: "#f3e5f5" },
121
+ { label: "Indigo 50", color: "#e8eaf6" },
122
+ { label: "Blue 50", color: "#e3f2fd" },
123
+ { label: "Cyan 50", color: "#e0f7fa" },
124
+ { label: "Teal 50", color: "#e0f2f1" },
125
+ { label: "Light green 50", color: "#f1f8e9" },
126
+ { label: "Lime 50", color: "#f9fbe7" },
127
+ { label: "Amber 50", color: "#fff8e1" },
128
+ { label: "Orange 50", color: "#fff3e0" },
129
+ { label: "Grey 50", color: "#fafafa" },
130
+ { label: "Blue grey 50", color: "#eceff1" },
131
+ { label: "Red 100", color: "#ffcdd2" },
132
+ { label: "Purple 100", color: "#e1bee7" },
133
+ { label: "Indigo 100", color: "#c5cae9" },
134
+ { label: "Blue 100", color: "#bbdefb" },
135
+ { label: "Cyan 100", color: "#b2ebf2" },
136
+ { label: "Teal 100", color: "#b2dfdb" },
137
+ { label: "Light green 100", color: "#dcedc8" },
138
+ { label: "Lime 100", color: "#f0f4c3" },
139
+ { label: "Amber 100", color: "#ffecb3" },
140
+ { label: "Orange 100", color: "#ffe0b2" },
141
+ { label: "Grey 100", color: "#f5f5f5" },
142
+ { label: "Blue grey 100", color: "#cfd8dc" },
143
+ { label: "Red 200", color: "#ef9a9a" },
144
+ { label: "Purple 200", color: "#ce93d8" },
145
+ { label: "Indigo 200", color: "#9fa8da" },
146
+ { label: "Blue 200", color: "#90caf9" },
147
+ { label: "Cyan 200", color: "#80deea" },
148
+ { label: "Teal 200", color: "#80cbc4" },
149
+ { label: "Light green 200", color: "#c5e1a5" },
150
+ { label: "Lime 200", color: "#e6ee9c" },
151
+ { label: "Amber 200", color: "#ffe082" },
152
+ { label: "Orange 200", color: "#ffcc80" },
153
+ { label: "Grey 200", color: "#eeeeee" },
154
+ { label: "Blue grey 200", color: "#b0bec5" },
155
+ { label: "Red 300", color: "#e57373" },
156
+ { label: "Purple 300", color: "#ba68c8" },
157
+ { label: "Indigo 300", color: "#7986cb" },
158
+ { label: "Blue 300", color: "#64b5f6" },
159
+ { label: "Cyan 300", color: "#4dd0e1" },
160
+ { label: "Teal 300", color: "#4db6ac" },
161
+ { label: "Light green 300", color: "#aed581" },
162
+ { label: "Lime 300", color: "#dce775" },
163
+ { label: "Amber 300", color: "#ffd54f" },
164
+ { label: "Orange 300", color: "#ffb74d" },
165
+ { label: "Grey 300", color: "#e0e0e0" },
166
+ { label: "Blue grey 300", color: "#90a4ae" },
167
+ { label: "Red 400", color: "#ef5350" },
168
+ { label: "Purple 400", color: "#ab47bc" },
169
+ { label: "Indigo 400", color: "#5c6bc0" },
170
+ { label: "Blue 400", color: "#42a5f5" },
171
+ { label: "Cyan 400", color: "#26c6da" },
172
+ { label: "Teal 400", color: "#26a69a" },
173
+ { label: "Light green 400", color: "#9ccc65" },
174
+ { label: "Lime 400", color: "#d4e157" },
175
+ { label: "Amber 400", color: "#ffca28" },
176
+ { label: "Orange 400", color: "#ffa726" },
177
+ { label: "Grey 400", color: "#bdbdbd" },
178
+ { label: "Blue grey 400", color: "#78909c" },
179
+ { label: "Red 500", color: "#f44336" },
180
+ { label: "Purple 500", color: "#9c27b0" },
181
+ { label: "Indigo 500", color: "#3f51b5" },
182
+ { label: "Blue 500", color: "#2196f3" },
183
+ { label: "Cyan 500", color: "#00bcd4" },
184
+ { label: "Teal 500", color: "#009688" },
185
+ { label: "Light green 500", color: "#8bc34a" },
186
+ { label: "Lime 500", color: "#cddc39" },
187
+ { label: "Amber 500", color: "#ffc107" },
188
+ { label: "Orange 500", color: "#ff9800" },
189
+ { label: "Grey 500", color: "#9e9e9e" },
190
+ { label: "Blue grey 500", color: "#607d8b" },
191
+ { label: "Red 600", color: "#e53935" },
192
+ { label: "Purple 600", color: "#8e24aa" },
193
+ { label: "Indigo 600", color: "#3949ab" },
194
+ { label: "Blue 600", color: "#1e88e5" },
195
+ { label: "Cyan 600", color: "#00acc1" },
196
+ { label: "Teal 600", color: "#00897b" },
197
+ { label: "Light green 600", color: "#7cb342" },
198
+ { label: "Lime 600", color: "#c0ca33" },
199
+ { label: "Amber 600", color: "#ffb300" },
200
+ { label: "Orange 600", color: "#fb8c00" },
201
+ { label: "Grey 600", color: "#757575" },
202
+ { label: "Blue grey 600", color: "#546e7a" },
203
+ { label: "Red 700", color: "#d32f2f" },
204
+ { label: "Purple 700", color: "#7b1fa2" },
205
+ { label: "Indigo 700", color: "#303f9f" },
206
+ { label: "Blue 700", color: "#1976d2" },
207
+ { label: "Cyan 700", color: "#0097a7" },
208
+ { label: "Teal 700", color: "#00796b" },
209
+ { label: "Light green 700", color: "#689f38" },
210
+ { label: "Lime 700", color: "#afb42b" },
211
+ { label: "Amber 700", color: "#ffa000" },
212
+ { label: "Orange 700", color: "#f57c00" },
213
+ { label: "Grey 700", color: "#616161" },
214
+ { label: "Blue grey 700", color: "#455a64" },
215
+ { label: "Red 800", color: "#c62828" },
216
+ { label: "Purple 800", color: "#6a1b9a" },
217
+ { label: "Indigo 800", color: "#283593" },
218
+ { label: "Blue 800", color: "#1565c0" },
219
+ { label: "Cyan 800", color: "#00838f" },
220
+ { label: "Teal 800", color: "#00695c" },
221
+ { label: "Light green 800", color: "#558b2f" },
222
+ { label: "Lime 800", color: "#9e9d24" },
223
+ { label: "Amber 800", color: "#ff8f00" },
224
+ { label: "Orange 800", color: "#ef6c00" },
225
+ { label: "Grey 800", color: "#424242" },
226
+ { label: "Blue grey 800", color: "#37474f" },
227
+ { label: "Red 900", color: "#b71c1c" },
228
+ { label: "Purple 900", color: "#4a148c" },
229
+ { label: "Indigo 900", color: "#1a237e" },
230
+ { label: "Blue 900", color: "#0d47a1" },
231
+ { label: "Cyan 900", color: "#006064" },
232
+ { label: "Teal 900", color: "#004d40" },
233
+ { label: "Light green 900", color: "#33691e" },
234
+ { label: "Lime 900", color: "#827717" },
235
+ { label: "Amber 900", color: "#ff6f00" },
236
+ { label: "Orange 900", color: "#e65100" },
237
+ { label: "Grey 900", color: "#212121" },
238
+ { label: "Blue grey 900", color: "#263238" },
239
+ ];
240
+
241
+ const base = {
242
+ fontFamily: {
243
+ supportAllValues: true,
244
+ },
245
+ fontSize: {
246
+ options: [10, 12, 14, "default", 18, 20, 22],
247
+ supportAllValues: true,
248
+ },
249
+ fontColor: {
250
+ columns: 12,
251
+ documentColors: 12,
252
+ colors: REDUCED_MATERIAL_COLORS,
253
+ },
254
+ fontBackgroundColor: {
255
+ columns: 12,
256
+ documentColors: 12,
257
+ colors: REDUCED_MATERIAL_COLORS,
258
+ },
259
+ heading: {
260
+ options: [
261
+ { model: "paragraph", title: "Paragraph", class: "ck-heading_paragraph" },
262
+ { model: "heading1", view: "h1", title: "Heading 1", class: "ck-heading_heading1" },
263
+ { model: "heading2", view: "h2", title: "Heading 2", class: "ck-heading_heading2" },
264
+ { model: "heading3", view: "h3", title: "Heading 3", class: "ck-heading_heading3" },
265
+ { model: "heading4", view: "h4", title: "Heading 4", class: "ck-heading_heading4" },
266
+ { model: "heading5", view: "h5", title: "Heading 5", class: "ck-heading_heading5" },
267
+ { model: "heading6", view: "h6", title: "Heading 6", class: "ck-heading_heading6" },
268
+ ],
269
+ },
270
+ htmlSupport: {
271
+ allow: [
272
+ {
273
+ name: /.*/,
274
+ attributes: true,
275
+ classes: true,
276
+ styles: true,
277
+ },
278
+ ],
279
+ disallow: [
280
+ {
281
+ attributes: [
282
+ { key: /^on(.*)/i, value: true },
283
+ { key: /.*/, value: /(\b)(on\S+)(\s*)=|javascript:|(<\s*)(\/*)script/i },
284
+ { key: /.*/, value: /data:(?!image\/(png|jpeg|gif|webp))/i },
285
+ ],
286
+ },
287
+ { name: "script" },
288
+ ],
289
+ },
290
+ htmlEmbed: {
291
+ showPreviews: true,
292
+ sanitizeHtml: (inputHtml) => {
293
+ const outputHtml = sanitizeHtml(inputHtml);
294
+ return {
295
+ html: outputHtml,
296
+ hasChanged: true,
297
+ };
298
+ },
299
+ },
300
+ list: {
301
+ properties: {
302
+ styles: true,
303
+ startIndex: true,
304
+ reversed: true,
305
+ },
306
+ },
307
+ table: {
308
+ contentToolbar: [
309
+ "tableColumn",
310
+ "tableRow",
311
+ "mergeTableCells",
312
+ "tableProperties",
313
+ "tableCellProperties",
314
+ "toggleTableCaption",
315
+ ],
316
+ },
317
+ image: {
318
+ styles: {
319
+ options: [
320
+ 'inline', 'alignLeft', 'alignRight',
321
+ 'alignCenter', 'alignBlockLeft', 'alignBlockRight',
322
+ 'block', 'side'
323
+ ]
324
+ },
325
+ resizeOptions: [
326
+ {
327
+ name: "resizeImage:original",
328
+ label: "Default image width",
329
+ value: null,
330
+ },
331
+ {
332
+ name: "resizeImage:50",
333
+ label: "50% page width",
334
+ value: "50",
335
+ },
336
+ {
337
+ name: "resizeImage:75",
338
+ label: "75% page width",
339
+ value: "75",
340
+ },
341
+ ],
342
+ toolbar: [
343
+ "imageTextAlternative",
344
+ "toggleImageCaption",
345
+ "linkImage",
346
+ "|",
347
+ "imageStyle:inline",
348
+ "imageStyle:wrapText",
349
+ "imageStyle:breakText",
350
+ "imageStyle:side",
351
+ "|",
352
+ "resizeImage",
353
+ ],
354
+ insert: {
355
+ integrations: ["insertImageViaUrl"],
356
+ },
357
+ },
358
+ link: {
359
+ decorators: {
360
+ openInNewTab: {
361
+ mode: "manual",
362
+ label: "Open in a new tab",
363
+ defaultValue: true,
364
+ attributes: {
365
+ target: "_blank",
366
+ rel: "noopener noreferrer",
367
+ },
368
+ },
369
+ toggleDownloadable: {
370
+ mode: "manual",
371
+ label: "Downloadable",
372
+ attributes: {
373
+ download: "file",
374
+ },
375
+ },
376
+ },
377
+ addTargetToExternalLinks: true,
378
+ defaultProtocol: "https://",
379
+ },
380
+ style: {
381
+ definitions: [
382
+ {
383
+ name: "Title",
384
+ element: "h1",
385
+ classes: ["document-title"],
386
+ },
387
+ {
388
+ name: "Subtitle",
389
+ element: "h2",
390
+ classes: ["document-subtitle"],
391
+ },
392
+ {
393
+ name: "Callout",
394
+ element: "p",
395
+ classes: ["callout"],
396
+ },
397
+ {
398
+ name: "Side quote",
399
+ element: "blockquote",
400
+ classes: ["side-quote"],
401
+ },
402
+ {
403
+ name: "Needs clarification",
404
+ element: "span",
405
+ classes: ["needs-clarification"],
406
+ },
407
+ {
408
+ name: "Wide spacing",
409
+ element: "span",
410
+ classes: ["wide-spacing"],
411
+ },
412
+ {
413
+ name: "Small caps",
414
+ element: "span",
415
+ classes: ["small-caps"],
416
+ },
417
+ {
418
+ name: "Code (dark)",
419
+ element: "pre",
420
+ classes: ["stylish-code", "stylish-code-dark"],
421
+ },
422
+ {
423
+ name: "Code (bright)",
424
+ element: "pre",
425
+ classes: ["stylish-code", "stylish-code-bright"],
426
+ },
427
+ ],
428
+ },
429
+ };
430
+
431
+
432
+
433
+ const basePlugins = [
434
+ w.Alignment,
435
+ w.Autoformat,
436
+ w.AutoImage,
437
+ w.BlockQuote,
438
+ w.Bold,
439
+ w.Code,
440
+ w.CodeBlock,
441
+ w.DocumentList,
442
+ w.DocumentListProperties,
443
+ w.Essentials,
444
+ w.FontBackgroundColor,
445
+ w.FontColor,
446
+ w.FontFamily,
447
+ w.FontSize,
448
+ w.GeneralHtmlSupport,
449
+ w.Heading,
450
+ w.HorizontalLine,
451
+ w.HtmlEmbed,
452
+ w.Image,
453
+ w.ImageCaption,
454
+ w.ImageInsert,
455
+ w.ImageResize,
456
+ w.ImageStyle,
457
+ w.ImageToolbar,
458
+ w.ImageUpload,
459
+ w.Indent,
460
+ w.IndentBlock,
461
+ w.Italic,
462
+ w.Link,
463
+ w.LinkImage,
464
+ w.LinkImage,
465
+ w.MediaEmbed,
466
+ w.PageBreak,
467
+ w.Paragraph,
468
+ w.PasteFromOffice,
469
+ w.PictureEditing,
470
+ w.RemoveFormat,
471
+ w.SourceEditing,
472
+ w.SpecialCharacters,
473
+ w.SpecialCharactersArrows,
474
+ w.SpecialCharactersCurrency,
475
+ w.SpecialCharactersLatin,
476
+ w.SpecialCharactersMathematical,
477
+ w.SpecialCharactersText,
478
+ w.StrapiMediaLib,
479
+ w.StrapiUploadAdapter,
480
+ w.Strikethrough,
481
+ w.Style,
482
+ w.Subscript,
483
+ w.Superscript,
484
+ w.ShowBlocks,
485
+ w.Table,
486
+ w.TableCaption,
487
+ w.TableCellProperties,
488
+ w.TableColumnResize,
489
+ w.TableProperties,
490
+ w.TableToolbar,
491
+ w.Underline,
492
+ w.WordCount,
493
+ ];
494
+
495
+ export const toolbarEditorConfig = {
496
+ plugins:basePlugins,
497
+ ...base,
498
+ toolbar: [
499
+ {
500
+ label:' ',
501
+ tooltip: null,
502
+ icon:'paragraph',
503
+ items: [ 'heading','style','SourceEditing']
504
+ },
505
+ '|',
506
+ {
507
+ label:' ',
508
+ tooltip: null,
509
+ icon:'text',
510
+ items: [ 'bold', 'italic','fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor' ]
511
+ },
512
+ {
513
+ label:' ',
514
+ tooltip: null,
515
+ icon:`
516
+ <svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
517
+ <rect x="0" fill="none" width="24" height="24"/>
518
+ <g>
519
+ <path d="M14.348 12H21v2h-4.613c.24.515.368 1.094.368 1.748 0 1.317-.474 2.355-1.423 3.114-.947.76-2.266 1.138-3.956 1.138-1.557 0-2.934-.293-4.132-.878v-2.874c.985.44 1.818.75 2.5.928.682.18 1.306.27 1.872.27.68 0 1.2-.13 1.562-.39.363-.26.545-.644.545-1.158 0-.285-.08-.54-.24-.763-.16-.222-.394-.437-.704-.643-.18-.12-.483-.287-.88-.49H3v-2H14.347zm-3.528-2c-.073-.077-.143-.155-.193-.235-.126-.202-.19-.44-.19-.713 0-.44.157-.795.47-1.068.313-.273.762-.41 1.348-.41.492 0 .993.064 1.502.19.51.127 1.153.35 1.93.67l1-2.405c-.753-.327-1.473-.58-2.16-.76-.69-.18-1.414-.27-2.173-.27-1.544 0-2.753.37-3.628 1.108-.874.738-1.312 1.753-1.312 3.044 0 .302.036.58.088.848h3.318z"/>
520
+ </g>
521
+ </svg>`,
522
+ items: [ 'underline', 'strikethrough', 'superscript', 'subscript' ]
523
+ },
524
+ 'removeFormat',
525
+ '|',
526
+ 'alignment',
527
+ 'outdent',
528
+ 'indent',
529
+ '|',
530
+ 'bulletedList', 'numberedList',
531
+ '|',
532
+ 'insertImage','mediaEmbed','strapiMediaLib','link','blockquote','insertTable','specialCharacters','htmlEmbed','codeBlock',
533
+ '|', 'horizontalLine', 'pageBreak', '|',
534
+ '|', 'showBlocks',
535
+ '|', 'undo', 'redo', '|',
536
+ ],
537
+
538
+ }
539
+
540
+ export const toolbarBalloonEditorConfig = {
541
+ plugins:[...basePlugins, w.BalloonToolbar],
542
+ ...base,
543
+ toolbar: [
544
+ {
545
+ label:' ',
546
+ tooltip: null,
547
+ icon:'paragraph',
548
+ items: [ 'heading','style']
549
+ },
550
+ '|',
551
+ 'alignment',
552
+ 'outdent',
553
+ 'indent',
554
+ '|',
555
+ 'bulletedList', 'numberedList',
556
+ '|',
557
+ 'insertImage','mediaEmbed','strapiMediaLib','link','blockquote','insertTable','specialCharacters','htmlEmbed','codeBlock',
558
+ '|', 'horizontalLine', 'pageBreak', '|','SourceEditing',
559
+ '|', 'showBlocks',
560
+ '|', 'undo', 'redo', '|',
561
+ ],
562
+ balloonToolbar: [
563
+ 'bold', 'italic','fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor',
564
+ {
565
+ label:' ',
566
+ tooltip: null,
567
+ icon:`
568
+ <svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
569
+ <rect x="0" fill="none" width="24" height="24"/>
570
+ <g>
571
+ <path d="M14.348 12H21v2h-4.613c.24.515.368 1.094.368 1.748 0 1.317-.474 2.355-1.423 3.114-.947.76-2.266 1.138-3.956 1.138-1.557 0-2.934-.293-4.132-.878v-2.874c.985.44 1.818.75 2.5.928.682.18 1.306.27 1.872.27.68 0 1.2-.13 1.562-.39.363-.26.545-.644.545-1.158 0-.285-.08-.54-.24-.763-.16-.222-.394-.437-.704-.643-.18-.12-.483-.287-.88-.49H3v-2H14.347zm-3.528-2c-.073-.077-.143-.155-.193-.235-.126-.202-.19-.44-.19-.713 0-.44.157-.795.47-1.068.313-.273.762-.41 1.348-.41.492 0 .993.064 1.502.19.51.127 1.153.35 1.93.67l1-2.405c-.753-.327-1.473-.58-2.16-.76-.69-.18-1.414-.27-2.173-.27-1.544 0-2.753.37-3.628 1.108-.874.738-1.312 1.753-1.312 3.044 0 .302.036.58.088.848h3.318z"/>
572
+ </g>
573
+ </svg>`,
574
+ items: [ 'underline', 'strikethrough', 'superscript', 'subscript' ]
575
+ },
576
+ '|',
577
+ 'removeFormat',
578
+ ]
579
+ }
580
+
581
+ export const blockBalloonEditorConfig = {
582
+ plugins:[
583
+ ...basePlugins.filter(({pluginName})=>
584
+ pluginName !== "SourceEditing" &&
585
+ pluginName !== "SpecialCharacters" &&
586
+ pluginName !== "SpecialCharactersArrows" &&
587
+ pluginName !== "SpecialCharactersCurrency" &&
588
+ pluginName !== "SpecialCharactersEssentials" &&
589
+ pluginName !== "SpecialCharactersLatin" &&
590
+ pluginName !== "SpecialCharactersMathematical" &&
591
+ pluginName !== "SpecialCharactersText" &&
592
+ pluginName !== "PageBreak" &&
593
+ pluginName !== "HorizontalLine" &&
594
+ pluginName !== "MediaEmbed" &&
595
+ pluginName !== "HtmlEmbed" &&
596
+ pluginName !== "Code" &&
597
+ pluginName !== "CodeBlock"
598
+ ),
599
+ w.BlockToolbar, w.BalloonToolbar
600
+ ],
601
+ ...base,
602
+ blockToolbar: [
603
+ {
604
+ label:' ',
605
+ tooltip: null,
606
+ icon:'paragraph',
607
+ items: [ 'heading','style']
608
+ },
609
+ '|',
610
+ 'bulletedList', 'numberedList',
611
+ '|',
612
+ 'alignment',
613
+ 'outdent',
614
+ 'indent',
615
+ '|',
616
+ 'insertImage','strapiMediaLib','link','blockquote','insertTable',
617
+ '|', 'showBlocks',
618
+ '|', 'undo', 'redo', '|',
619
+ ],
620
+ balloonToolbar: [
621
+ 'bold', 'italic','fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor',
622
+ {
623
+ label:' ',
624
+ tooltip: null,
625
+ icon:`
626
+ <svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
627
+ <rect x="0" fill="none" width="24" height="24"/>
628
+ <g>
629
+ <path d="M14.348 12H21v2h-4.613c.24.515.368 1.094.368 1.748 0 1.317-.474 2.355-1.423 3.114-.947.76-2.266 1.138-3.956 1.138-1.557 0-2.934-.293-4.132-.878v-2.874c.985.44 1.818.75 2.5.928.682.18 1.306.27 1.872.27.68 0 1.2-.13 1.562-.39.363-.26.545-.644.545-1.158 0-.285-.08-.54-.24-.763-.16-.222-.394-.437-.704-.643-.18-.12-.483-.287-.88-.49H3v-2H14.347zm-3.528-2c-.073-.077-.143-.155-.193-.235-.126-.202-.19-.44-.19-.713 0-.44.157-.795.47-1.068.313-.273.762-.41 1.348-.41.492 0 .993.064 1.502.19.51.127 1.153.35 1.93.67l1-2.405c-.753-.327-1.473-.58-2.16-.76-.69-.18-1.414-.27-2.173-.27-1.544 0-2.753.37-3.628 1.108-.874.738-1.312 1.753-1.312 3.044 0 .302.036.58.088.848h3.318z"/>
630
+ </g>
631
+ </svg>`,
632
+ items: [ 'underline', 'strikethrough', 'superscript', 'subscript' ]
633
+ },
634
+ '|',
635
+ 'removeFormat',
636
+ ]
628
637
  }