@_sh/strapi-plugin-ckeditor 4.0.10 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +586 -575
  2. package/dist/_chunks/Field-8Nh0dMSc.mjs +574 -0
  3. package/dist/_chunks/Field-BKtrDFjh.js +598 -0
  4. package/dist/_chunks/index-CNalXcwy.mjs +1330 -0
  5. package/dist/_chunks/index-DO2vqIdx.js +1350 -0
  6. package/dist/admin/index.js +11 -4
  7. package/dist/admin/index.mjs +10 -4
  8. package/dist/admin/src/components/CKEReact.d.ts +6 -0
  9. package/dist/admin/src/components/CKEditorIcon.d.ts +1 -0
  10. package/dist/admin/src/components/Editor.d.ts +1 -0
  11. package/dist/admin/src/components/EditorLayout.d.ts +4 -0
  12. package/dist/admin/src/components/EditorProvider.d.ts +20 -0
  13. package/dist/admin/src/components/Field.d.ts +20 -0
  14. package/dist/admin/src/components/GlobalStyling.d.ts +4 -0
  15. package/dist/admin/src/components/MediaLib.d.ts +9 -0
  16. package/dist/admin/src/config/htmlPreset.d.ts +2 -0
  17. package/dist/admin/src/config/index.d.ts +5 -0
  18. package/dist/admin/src/config/language.d.ts +15 -0
  19. package/dist/admin/src/config/markdownPreset.d.ts +2 -0
  20. package/dist/admin/src/config/pluginConfig.d.ts +23 -0
  21. package/dist/admin/src/config/types.d.ts +123 -0
  22. package/dist/admin/src/exports.d.ts +9 -0
  23. package/dist/admin/src/index.d.ts +6 -0
  24. package/dist/admin/src/plugins/StrapiMediaLib.d.ts +15 -0
  25. package/dist/admin/src/plugins/StrapiUploadAdapter.d.ts +12 -0
  26. package/dist/admin/src/plugins/index.d.ts +2 -0
  27. package/dist/admin/src/theme/additional.d.ts +1 -0
  28. package/dist/admin/src/theme/colors.d.ts +1 -0
  29. package/dist/admin/src/theme/common.d.ts +1 -0
  30. package/dist/admin/src/theme/dark.d.ts +1 -0
  31. package/dist/admin/src/theme/index.d.ts +2 -0
  32. package/dist/admin/src/theme/light.d.ts +1 -0
  33. package/dist/admin/src/utils/index.d.ts +4 -0
  34. package/dist/admin/src/utils/isImageResponsive.d.ts +3 -0
  35. package/dist/admin/src/utils/localStorage.d.ts +3 -0
  36. package/dist/admin/src/utils/pluginId.d.ts +1 -0
  37. package/dist/admin/src/utils/prefixWithBackendUrl.d.ts +1 -0
  38. package/dist/server/index.js +61 -119
  39. package/dist/server/index.mjs +61 -117
  40. package/dist/server/src/index.d.ts +7 -0
  41. package/package.json +50 -22
  42. package/dist/_chunks/index-0XricxMA.js +0 -3548
  43. package/dist/_chunks/index-0XricxMA.js.map +0 -1
  44. package/dist/_chunks/index-28M_cjfZ.js +0 -1150
  45. package/dist/_chunks/index-28M_cjfZ.js.map +0 -1
  46. package/dist/_chunks/index-B3VZXRRM.mjs +0 -1124
  47. package/dist/_chunks/index-B3VZXRRM.mjs.map +0 -1
  48. package/dist/_chunks/index-BEYONTI5.js +0 -1150
  49. package/dist/_chunks/index-BEYONTI5.js.map +0 -1
  50. package/dist/_chunks/index-B_BYkSZj.js +0 -1150
  51. package/dist/_chunks/index-B_BYkSZj.js.map +0 -1
  52. package/dist/_chunks/index-BeoZd6fh.mjs +0 -3530
  53. package/dist/_chunks/index-BeoZd6fh.mjs.map +0 -1
  54. package/dist/_chunks/index-BiwTLCLk.mjs +0 -1124
  55. package/dist/_chunks/index-BiwTLCLk.mjs.map +0 -1
  56. package/dist/_chunks/index-BliHiZJM.js +0 -3548
  57. package/dist/_chunks/index-BliHiZJM.js.map +0 -1
  58. package/dist/_chunks/index-BnZp4Mbc.mjs +0 -3530
  59. package/dist/_chunks/index-BnZp4Mbc.mjs.map +0 -1
  60. package/dist/_chunks/index-BsSnWl8P.js +0 -990
  61. package/dist/_chunks/index-BsSnWl8P.js.map +0 -1
  62. package/dist/_chunks/index-CpmwvDcE.mjs +0 -3530
  63. package/dist/_chunks/index-CpmwvDcE.mjs.map +0 -1
  64. package/dist/_chunks/index-DOdOcVer.mjs +0 -986
  65. package/dist/_chunks/index-DOdOcVer.mjs.map +0 -1
  66. package/dist/_chunks/index-DXRXMzTP.js +0 -3548
  67. package/dist/_chunks/index-DXRXMzTP.js.map +0 -1
  68. package/dist/_chunks/index-TbPGn87z.js +0 -3548
  69. package/dist/_chunks/index-TbPGn87z.js.map +0 -1
  70. package/dist/_chunks/index-Z38y6cY4.mjs +0 -1124
  71. package/dist/_chunks/index-Z38y6cY4.mjs.map +0 -1
  72. package/dist/_chunks/index-eczlqHt8.mjs +0 -3530
  73. package/dist/_chunks/index-eczlqHt8.mjs.map +0 -1
  74. package/dist/admin/index.js.map +0 -1
  75. package/dist/admin/index.mjs.map +0 -1
  76. package/dist/server/index.js.map +0 -1
  77. package/dist/server/index.mjs.map +0 -1
  78. package/strapi-server.js +0 -3
@@ -1,990 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
5
- const PropTypes = require("prop-types");
6
- const designSystem = require("@strapi/design-system");
7
- const styled = require("styled-components");
8
- const ckeditor5React = require("@ckeditor/ckeditor5-react");
9
- const cke = require("ckeditor5");
10
- const admin = require("@strapi/strapi/admin");
11
- require("ckeditor5/ckeditor5.css");
12
- const index = require("./index-DXRXMzTP.js");
13
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
14
- const React__default = /* @__PURE__ */ _interopDefault(React);
15
- const PropTypes__default = /* @__PURE__ */ _interopDefault(PropTypes);
16
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
17
- const prefixFileUrlWithBackendUrl = (fileURL) => {
18
- return !!fileURL && fileURL.startsWith("/") ? `${window.strapi.backendURL}${fileURL}` : fileURL;
19
- };
20
- const MediaLib = ({ isOpen = false, onToggle = () => {
21
- }, editor }) => {
22
- const components = admin.useStrapiApp("MediaLib", ({ components: components2 }) => components2);
23
- const MediaLibraryDialog = components["media-library"];
24
- const handleChangeAssets = (assets) => {
25
- let newValue = "";
26
- assets.map(({ name, url, alt, formats, mime, width, height }) => {
27
- if (mime.includes("image")) {
28
- if (formats && globalThis.SH_CKE_UPLOAD_ADAPTER_IS_RESPONSIVE) {
29
- let set = "";
30
- let keys = Object.keys(formats).sort((a, b) => formats[a].width - formats[b].width);
31
- keys.map((k) => set += prefixFileUrlWithBackendUrl(formats[k].url) + ` ${formats[k].width}w,`);
32
- newValue = `<img src="${url}" alt="${alt}" width="${width}" height="${height}" srcset="${set}" />`;
33
- } else {
34
- newValue = `<img src="${url}" alt="${alt}" width="${width}" height="${height}" />`;
35
- }
36
- } else if (mime.includes("video")) {
37
- newValue = `
38
- <video class="video" controls width="500px">
39
- <source src="${url}" type="${mime}" />
40
- </video>`;
41
- } else {
42
- newValue = `<a href="${url}">${name || "Open document"}</a>`;
43
- }
44
- });
45
- const viewFragment = editor.data.processor.toView(newValue);
46
- const modelFragment = editor.data.toModel(viewFragment);
47
- editor.model.insertContent(modelFragment);
48
- onToggle();
49
- };
50
- const handleSelectAssets = (files) => {
51
- const formattedFiles = files.map((f) => ({
52
- name: f.name,
53
- alt: f.alternativeText || f.name,
54
- url: prefixFileUrlWithBackendUrl(f.url),
55
- mime: f.mime,
56
- formats: f.formats,
57
- width: f.width,
58
- height: f.height
59
- }));
60
- handleChangeAssets(formattedFiles);
61
- };
62
- if (!isOpen) {
63
- return null;
64
- }
65
- return /* @__PURE__ */ jsxRuntime.jsx(
66
- MediaLibraryDialog,
67
- {
68
- onClose: onToggle,
69
- onSelectAssets: handleSelectAssets
70
- }
71
- );
72
- };
73
- MediaLib.propTypes = {
74
- isOpen: PropTypes__default.default.bool,
75
- onToggle: PropTypes__default.default.func
76
- };
77
- const STORAGE_KEYS = {
78
- TOKEN: "jwtToken",
79
- PREFERED_LANGUAGE: "strapi-admin-language",
80
- PROFILE_THEME: "STRAPI_THEME"
81
- };
82
- const getProfileTheme = () => {
83
- const theme = localStorage.getItem(STORAGE_KEYS.PROFILE_THEME);
84
- return theme;
85
- };
86
- const getConfiguredPreset = async (presetName, { toggleMediaLib, strapiFieldPlaceholder }) => {
87
- const { presets: userPresets, dontMergePresets } = globalThis.SH_CKE_CONFIG || {};
88
- const preset = dontMergePresets ? userPresets[presetName] : index.basePresets[presetName];
89
- const clonedPreset = {
90
- ...preset,
91
- editorConfig: {
92
- ...preset.editorConfig
93
- // placeholder: strapiFieldPlaceholder || preset.editorConfig.placeholder,
94
- }
95
- };
96
- return clonedPreset;
97
- };
98
- const common = styled.css`
99
- .ck {
100
- --ck-color-image-caption-background: hsl(0, 0%, 97%);
101
- --ck-color-image-caption-text: hsl(0, 0%, 20%);
102
- --ck-color-mention-background: hsla(341, 100%, 30%, 0.1);
103
- --ck-color-mention-text: hsl(341, 100%, 30%);
104
- --ck-color-table-caption-background: hsl(0, 0%, 97%);
105
- --ck-color-table-caption-text: hsl(0, 0%, 20%);
106
- --ck-highlight-marker-blue: hsl(201, 97%, 72%);
107
- --ck-highlight-marker-green: hsl(120, 93%, 68%);
108
- --ck-highlight-marker-pink: hsl(345, 96%, 73%);
109
- --ck-highlight-marker-yellow: hsl(60, 97%, 73%);
110
- --ck-highlight-pen-green: hsl(112, 100%, 27%);
111
- --ck-highlight-pen-red: hsl(0, 85%, 49%);
112
- --ck-image-style-spacing: 1.5em;
113
- --ck-inline-image-style-spacing: calc(var(--ck-image-style-spacing) / 2);
114
- --ck-todo-list-checkmark-size: 16px;
115
- font-size: 14px;
116
- }
117
-
118
- .ck.ck-sticky-panel .ck-sticky-panel__content_sticky {
119
- top: 64px !important;
120
- }
121
- .ck.ck-reset.ck-dropdown__panel.ck-dropdown__panel_sw.ck-dropdown__panel-visible {
122
- border-radius: 4px;
123
- }
124
-
125
- .ck-editor__main {
126
- --ck-font-face: 'Source Sans Pro', system-ui, Roboto, 'Helvetica Neue',
127
- 'Helvetica', Arial, sans-serif;
128
-
129
- color: var(--ck-color-editor-base-text);
130
- font-family: var(--ck-font-face);
131
-
132
- * {
133
- font: revert;
134
- margin: revert;
135
- }
136
-
137
- h1 {
138
- font-size: 2.3em;
139
- }
140
-
141
- h2 {
142
- font-size: 1.84em;
143
- }
144
-
145
- h3 {
146
- font-size: 1.48em;
147
- }
148
-
149
- h4 {
150
- font-size: 1.22em;
151
- }
152
-
153
- h5 {
154
- font-size: 1.06em;
155
- }
156
-
157
- h6 {
158
- font-size: 1em;
159
- }
160
-
161
- h1,
162
- h2,
163
- h3,
164
- h4,
165
- h5,
166
- h6 {
167
- line-height: 1.2em;
168
- padding-top: 0.8em;
169
- margin-bottom: 0.4em;
170
- }
171
-
172
- blockquote,
173
- ol,
174
- p,
175
- ul {
176
- font-size: 1em;
177
- line-height: 1.6em;
178
- padding-top: 0.2em;
179
- margin-bottom: var(--ck-spacing-large);
180
- }
181
-
182
- figcaption {
183
- background-color: var(--ck-color-image-caption-background);
184
- caption-side: bottom;
185
- color: var(--ck-color-image-caption-text);
186
- display: table-caption;
187
- font-size: 0.75em;
188
- outline-offset: -1px;
189
- padding: 0.6em;
190
- word-break: break-word;
191
- }
192
-
193
- a {
194
- text-decoration: none;
195
- color: #1b3af2;
196
- }
197
-
198
- a:hover {
199
- text-decoration: underline;
200
- }
201
-
202
- .table {
203
- margin: 0;
204
- }
205
-
206
- ul.todo-list {
207
- list-style: none;
208
- margin: revert;
209
- color: revert;
210
- font-family: revert;
211
- margin-left: 2rem;
212
- }
213
-
214
- ul,
215
- ol {
216
- list-style: initial;
217
- margin-left: 2rem;
218
- }
219
-
220
- ol {
221
- list-style: decimal;
222
- }
223
-
224
- sub {
225
- vertical-align: sub;
226
- }
227
-
228
- sup {
229
- vertical-align: super;
230
- }
231
-
232
- .ck.ck-content.ck-editor__editable {
233
- line-height: initial;
234
- min-height: 12.5rem;
235
- border-bottom-left-radius: 0.25rem;
236
- border-bottom-right-radius: 0.25rem;
237
- transition-property: border-color, box-shadow, max-height;
238
- transition-timing-function: ease-in-out;
239
- transition-duration: 0.5s;
240
- &.ck-focused:not(.ck-editor__nested-editable) {
241
- border: 1px solid var(--ck-color-base-border);
242
- /* border: var(--ck-focus-ring); */
243
- box-shadow: none;
244
- transition-property: border-color, box-shadow, max-height;
245
- transition-timing-function: ease-in-out;
246
- transition-duration: 0.5s;
247
- }
248
- }
249
-
250
- .ck-focused,
251
- .ck-blurred {
252
- overflow-y: auto;
253
- overflow-x: hidden;
254
- transition: max-height 0.5s ease-in-out, min-height 0.5s ease-in-out !important;
255
- ::-webkit-scrollbar {
256
- width: 7px;
257
- }
258
- ::-webkit-scrollbar-track {
259
- background: var(--ck-scroll-track-background);
260
- border: none;
261
- }
262
- ::-webkit-scrollbar-thumb {
263
- transition: background 2s;
264
- background: var(--ck-scroll-thumb-background);
265
- border: 1px solid var(--ck-scroll-thumb-border-color);
266
- }
267
- ::-webkit-scrollbar-thumb:hover {
268
- transition: background 2s;
269
- background: var(--ck-scroll-thumb-hover-background);
270
- }
271
- ::-webkit-scrollbar-thumb:active {
272
- background: var(--ck-scroll-thumb-active-background);
273
- }
274
- }
275
- }
276
-
277
- .ck .ck-source-editing-area textarea {
278
- color: var(--ck-color-text);
279
- background-color: var(--ck-color-base-background);
280
- border: 1px solid var(--ck-color-base-border) !important;
281
- box-shadow: none !important;
282
- }
283
-
284
- .ck .ck-block-toolbar-button {
285
- min-width: 0 !important;
286
- min-height: 0 !important;
287
- width: 20px !important;
288
- height: 25px !important;
289
- margin-left: -2px !important ;
290
-
291
- & svg {
292
- color: var(--ck-color-text) !important;
293
- position: absolute;
294
- width: 20px;
295
- height: 20px;
296
- }
297
- }
298
-
299
- .ck-word-count {
300
- margin-top: 0.3rem;
301
- display: flex;
302
- justify-content: end;
303
- gap: 0.3rem;
304
- font-size: 1rem;
305
- font-weight: 500;
306
- text-transform: lowercase;
307
- /* color: #b3b3c4; */
308
- }
309
-
310
- .ck[dir='rtl'] {
311
- .ck-block-toolbar-button {
312
- margin-left: 2px !important ;
313
- }
314
- & + div {
315
- justify-content: flex-start;
316
- & > .ck-word-count {
317
- & > div:first-child {
318
- order: 2;
319
- }
320
- & > div:last-child {
321
- order: 1;
322
- }
323
- }
324
- }
325
- }
326
-
327
- .ck.ck-editor__editable > .ck-placeholder::before {
328
- color: var(--ck-color-editor-base-text);
329
- opacity: 0.65;
330
- }
331
- `;
332
- const light = styled.css`
333
- :root {
334
- --ck-color-focus-outer-shadow: rgba(77, 115, 255, 0.2) !important;
335
- --ck-color-focus-disabled-shadow: #e4e3ff !important;
336
- --ck-focus-ring: 1px solid rgb(73, 69, 255) !important;
337
- --ck-color-button-default-hover-background: #f0f0ff !important;
338
- }
339
-
340
- .ck.ck-powered-by > a > svg > path:first-child {
341
- fill: #001234;
342
- }
343
-
344
- .ck {
345
- --ck-scroll-track-background: rgb(242, 242, 242);
346
- --ck-scroll-thumb-background: rgb(236, 236, 236);
347
- --ck-scroll-thumb-border-color: #cdcdf8;
348
- --ck-scroll-thumb-hover-background: #f0f0ff;
349
- --ck-scroll-thumb-active-background: #d9d8ff;
350
-
351
- --ck-color-editor-base-text: #001234;
352
- /* Overrides the border radius setting in the theme. */
353
- --ck-border-radius: 4px;
354
-
355
- /* Helper variables to avoid duplication in the colors. */
356
- --ck-color-base-border: #dcdce4;
357
- --ck-color-base-background: #ffffff;
358
- --ck-custom-background: #ffffff;
359
- --ck-custom-foreground: #dedede;
360
- --ck-custom-border: #dcdce4;
361
- --ck-custom-white: hsl(0, 0%, 100%);
362
-
363
- --ck-color-base-focus: #bbbaf1;
364
- --ck-color-base-active: #f0f0ff;
365
- --ck-color-base-active-focus: #e2e2fd;
366
-
367
- /* -- Overrides generic colors. ----------------------------------------- */
368
-
369
- --ck-color-base-foreground: var(--ck-custom-background);
370
-
371
- --ck-color-focus-border: rgb(73, 69, 255);
372
-
373
- --ck-color-text: #32324d;
374
- --ck-color-shadow-drop: hsla(250, 31%, 80%, 0.1);
375
- --ck-color-shadow-inner: hsla(250, 31%, 80%, 0.1);
376
-
377
- /* -- Overrides the default .ck-button class colors. -------------------- */
378
-
379
- --ck-color-button-default-background: var(--ck-custom-background);
380
- --ck-color-button-default-hover-background: #f0f0ff;
381
- --ck-color-button-default-active-background: #f6f6f9;
382
- --ck-color-button-default-active-shadow: #dedefb;
383
- --ck-color-button-default-disabled-background: var(--ck-custom-background);
384
-
385
- --ck-color-button-on-color: rgb(73, 69, 255);
386
- --ck-color-button-on-background: #f0f0ff;
387
- --ck-color-button-on-hover-background: #e6e9fc;
388
- --ck-color-button-on-active-background: #f6f6f9;
389
- --ck-color-button-on-active-shadow: #cdcdf8;
390
- --ck-color-button-on-disabled-background: var(--ck-custom-foreground);
391
-
392
- --ck-color-button-action-background: hsl(168, 76%, 42%);
393
- --ck-color-button-action-hover-background: hsl(168, 76%, 38%);
394
- --ck-color-button-action-active-background: hsl(168, 76%, 36%);
395
- --ck-color-button-action-active-shadow: hsl(168, 75%, 34%);
396
- --ck-color-button-action-disabled-background: hsl(168, 76%, 42%);
397
- --ck-color-button-action-text: var(--ck-custom-white);
398
-
399
- --ck-color-button-save: hsl(120, 100%, 46%);
400
- --ck-color-button-cancel: hsl(15, 100%, 56%);
401
-
402
- /* -- Overrides the default .ck-dropdown class colors. ------------------ */
403
-
404
- --ck-color-dropdown-panel-background: var(--ck-custom-background);
405
- --ck-color-dropdown-panel-border: var(--ck-custom-foreground);
406
-
407
- /* -- Overrides the default .ck-splitbutton class colors. --------------- */
408
-
409
- --ck-color-split-button-hover-background: var(
410
- --ck-color-button-default-hover-background
411
- );
412
- --ck-color-split-button-hover-border: var(--ck-custom-foreground);
413
-
414
- /* -- Overrides the default .ck-input class colors. --------------------- */
415
-
416
- --ck-color-input-background: var(--ck-custom-background);
417
- --ck-color-input-border: hsl(257, 3%, 43%);
418
- --ck-color-input-text: hsl(0, 0%, 98%);
419
- --ck-color-input-disabled-background: hsl(0, 0%, 97%);
420
- --ck-color-input-disabled-border: rgb(214, 214, 214);
421
- --ck-color-input-disabled-text: hsl(0, 0%, 78%);
422
-
423
- /* -- Overrides the default .ck-labeled-field-view class colors. -------- */
424
-
425
- --ck-color-labeled-field-label-background: var(--ck-custom-background);
426
-
427
- /* -- Overrides the default .ck-list class colors. ---------------------- */
428
-
429
- --ck-color-list-background: var(--ck-custom-background);
430
- --ck-color-list-button-hover-background: #f4f4fb;
431
- --ck-color-list-button-on-background: var(--ck-color-base-active);
432
- --ck-color-list-button-on-background-focus: var(
433
- --ck-color-base-active-focus
434
- );
435
- --ck-color-list-button-on-text: #271fe2;
436
-
437
- /* -- Overrides the default .ck-balloon-panel class colors. ------------- */
438
-
439
- --ck-color-panel-background: var(--ck-custom-background);
440
- --ck-color-panel-border: var(--ck-custom-border);
441
-
442
- /* -- Overrides the default .ck-toolbar class colors. ------------------- */
443
-
444
- --ck-color-toolbar-background: var(--ck-custom-background);
445
- --ck-color-toolbar-border: var(--ck-custom-border);
446
-
447
- /* -- Overrides the default .ck-tooltip class colors. ------------------- */
448
-
449
- --ck-color-tooltip-background: #3a3955;
450
- --ck-color-tooltip-text: hsl(0, 0%, 93%);
451
-
452
- /* -- Overrides the default colors used by the ckeditor5-image package. - */
453
-
454
- --ck-color-image-caption-background: hsl(0, 0%, 97%);
455
- --ck-color-image-caption-text: hsl(0, 0%, 20%);
456
-
457
- /* -- Overrides the default colors used by the ckeditor5-widget package. */
458
-
459
- --ck-color-widget-blurred-border: #cfcffa;
460
- --ck-color-widget-hover-border: #c9c9e4;
461
- --ck-color-widget-editable-focus-background: var(--ck-custom-white);
462
-
463
- /* -- Overrides the default colors used by the ckeditor5-link package. -- */
464
-
465
- --ck-color-link-default: hsl(209, 89%, 33%);
466
-
467
- --ck-powered-by-background: transparrent;
468
- --ck-powered-by-border-color: var(--ck-color-base-background);
469
-
470
- --ck-color-dialog-background: var(--ck-custom-background);
471
- --ck-color-dialog-form-header-border: var(--ck-color-base-border);
472
- }
473
- `;
474
- const dark = styled.css`
475
- :root {
476
- --ck-color-focus-outer-shadow: rgba(77, 115, 255, 0.2) !important;
477
- --ck-color-focus-disabled-shadow: rgba(106, 114, 143, 0.4) !important;
478
- --ck-focus-ring: 1px solid #4945ff !important;
479
- --ck-color-button-default-hover-background: #262630 !important;
480
- }
481
-
482
- .ck.ck-powered-by > a > svg > path:first-child {
483
- fill: rgb(236, 236, 236);
484
- }
485
-
486
- .ck.ck-powered-by > a > svg > path:nth-child(3) {
487
- fill: rgb(172, 156, 251);
488
- }
489
-
490
- .ck {
491
- --ck-scroll-track-background: #3d3d57;
492
- --ck-scroll-thumb-background: #181826;
493
- --ck-scroll-thumb-border-color: rgb(70, 70, 70);
494
- --ck-scroll-thumb-hover-background: #202033;
495
- --ck-scroll-thumb-active-background: #2b2b45;
496
-
497
- --ck-color-editor-base-text: rgb(236, 236, 236);
498
- /* Overrides the border radius setting in the theme. */
499
- --ck-border-radius: 4px;
500
-
501
- /* Helper variables to avoid duplication in the colors. */
502
- --ck-color-base-border: #4a4a6a;
503
- --ck-color-base-background: #212134;
504
- --ck-custom-background: #181826;
505
- --ck-custom-foreground: #26263b;
506
- --ck-custom-border: #4a4a6a;
507
- --ck-custom-white: hsl(0, 0%, 100%);
508
-
509
- --ck-color-focus-outer-shadow: #212134;
510
-
511
- --ck-color-base-focus: #bbbaf1;
512
- --ck-color-base-active: #2e2e5c;
513
- --ck-color-base-active-focus: #28284d;
514
-
515
- /* -- Overrides generic colors. ----------------------------------------- */
516
-
517
- --ck-color-base-foreground: var(--ck-custom-background);
518
- --ck-color-focus-border: #6765bd;
519
- --ck-color-text: hsl(0, 0%, 93%);
520
- --ck-color-shadow-drop: hsla(0, 0%, 0%, 0.2);
521
- --ck-color-shadow-inner: hsla(0, 0%, 0%, 0.1);
522
-
523
- /* -- Overrides the default .ck-button class colors. -------------------- */
524
-
525
- --ck-color-button-default-background: rgb(33, 33, 52);
526
-
527
- --ck-color-button-default-hover-background: #262630;
528
- --ck-color-button-default-active-background: #3c3c47;
529
- --ck-color-button-default-active-shadow: #3c3c47;
530
- --ck-color-button-default-disabled-background: var(--ck-custom-background);
531
-
532
- --ck-color-button-on-color: #7b79ff;
533
- --ck-color-button-on-background: #2b2b36;
534
- --ck-color-button-on-hover-background: #30303b;
535
- --ck-color-button-on-active-background: #3c3c47;
536
- --ck-color-button-on-active-shadow: #3c3c47;
537
- --ck-color-button-on-disabled-background: var(--ck-custom-foreground);
538
-
539
- --ck-color-button-action-background: hsl(168, 76%, 42%);
540
- --ck-color-button-action-hover-background: hsl(168, 76%, 38%);
541
- --ck-color-button-action-active-background: hsl(168, 76%, 36%);
542
- --ck-color-button-action-active-shadow: hsl(168, 75%, 34%);
543
- --ck-color-button-action-disabled-background: hsl(168, 76%, 42%);
544
- --ck-color-button-action-text: var(--ck-custom-white);
545
-
546
- --ck-color-button-save: hsl(120, 100%, 46%);
547
- --ck-color-button-cancel: hsl(15, 100%, 56%);
548
-
549
- /* -- Overrides the default .ck-dropdown class colors. ------------------ */
550
-
551
- --ck-color-dropdown-panel-background: var(--ck-custom-background);
552
- --ck-color-dropdown-panel-border: var(--ck-custom-foreground);
553
-
554
- /* -- Overrides the default .ck-splitbutton class colors. --------------- */
555
-
556
- --ck-color-split-button-hover-background: var(
557
- --ck-color-button-default-hover-background
558
- );
559
- --ck-color-split-button-hover-border: var(--ck-custom-foreground);
560
-
561
- /* -- Overrides the default .ck-input class colors. --------------------- */
562
-
563
- --ck-color-input-background: var(--ck-custom-background);
564
- --ck-color-input-border: hsl(257, 3%, 43%);
565
- --ck-color-input-text: hsl(0, 0%, 98%);
566
- --ck-color-input-disabled-background: hsl(255, 4%, 21%);
567
- --ck-color-input-disabled-border: hsl(250, 3%, 38%);
568
- --ck-color-input-disabled-text: hsl(0, 0%, 78%);
569
-
570
- /* -- Overrides the default .ck-labeled-field-view class colors. ---------*/
571
-
572
- --ck-color-labeled-field-label-background: var(--ck-custom-background);
573
-
574
- /* -- Overrides the default .ck-list class colors. ---------------------- */
575
-
576
- --ck-color-list-background: var(--ck-custom-background);
577
- --ck-color-list-button-hover-background: #121221;
578
- --ck-color-list-button-on-background: var(--ck-color-base-active);
579
- --ck-color-list-button-on-background-focus: var(
580
- --ck-color-base-active-focus
581
- );
582
- --ck-color-list-button-on-text: #ffffff;
583
-
584
- /* -- Overrides the default .ck-balloon-panel class colors. ------------- */
585
-
586
- --ck-color-panel-background: var(--ck-custom-background);
587
- --ck-color-panel-border: var(--ck-custom-border);
588
-
589
- /* -- Overrides the default .ck-toolbar class colors. ------------------- */
590
-
591
- --ck-color-toolbar-background: var(--ck-custom-background);
592
- --ck-color-toolbar-border: var(--ck-custom-border);
593
-
594
- /* -- Overrides the default .ck-tooltip class colors. ------------------- */
595
-
596
- --ck-color-tooltip-background: #3a3955;
597
- --ck-color-tooltip-text: hsl(0, 0%, 93%);
598
-
599
- /* -- Overrides the default colors used by the ckeditor5-image package. - */
600
-
601
- --ck-color-image-caption-background: hsl(0, 0%, 97%);
602
- --ck-color-image-caption-text: hsl(0, 0%, 20%);
603
-
604
- /* -- Overrides the default colors used by the ckeditor5-widget package. */
605
-
606
- --ck-color-widget-blurred-border: #7c7c96;
607
- --ck-color-widget-hover-border: #666687;
608
- --ck-color-widget-editable-focus-background: var(--ck-custom-white);
609
-
610
- /* -- Overrides the default colors used by the ckeditor5-link package. -- */
611
-
612
- --ck-color-link-default: hsl(216, 100%, 75%);
613
-
614
- --ck-powered-by-background: transparrent;
615
- --ck-powered-by-border-color: var(--ck-color-base-background);
616
-
617
- --ck-color-dialog-background: var(--ck-custom-background);
618
- --ck-color-dialog-form-header-border: var(--ck-color-base-border);
619
- }
620
- `;
621
- const additional = styled.css`
622
- /* --- expanding --- */
623
-
624
- .ck.ck-editor__main .ck-blurred {
625
- max-height: 200px !important;
626
- }
627
- .ck.ck-editor__main .ck-focused {
628
- min-height: 200px !important;
629
- max-height: 700px !important;
630
- }
631
-
632
- /* --- color-grid --- */
633
-
634
- .ck.ck-color-ui-dropdown {
635
- --ck-color-grid-tile-size: 22px !important;
636
- }
637
- .ck.ck-color-grid__tile {
638
- width: auto;
639
- }
640
- .ck.ck-color-ui-dropdown .ck-color-grid {
641
- grid-gap: 2px;
642
- }
643
- .ck.ck-color-ui-dropdown .ck-color-grid .ck-button {
644
- border-radius: 2px;
645
- }
646
- .ck.ck-color-ui-dropdown
647
- .ck.ck-color-grid
648
- .ck-color-grid__tile:hover:not(.ck-disabled),
649
- .ck.ck-color-ui-dropdown
650
- .ck.ck-color-grid
651
- .ck-color-grid__tile:focus:not(.ck-disabled) {
652
- z-index: 1;
653
- transform: scale(1.1);
654
- border-radius: 2px;
655
- }
656
-
657
- /* ---- Styles feature ------------------------------------------------------ */
658
-
659
- :root {
660
- --ck-georgia-serif-font-stack: Georgia, Times, Times New Roman, serif;
661
- }
662
-
663
- .ck-content h1.document-title {
664
- font-family: var(--ck-georgia-serif-font-stack);
665
- font-size: 50px;
666
- font-weight: bold;
667
- border: 0;
668
- }
669
-
670
- .ck-content h2.document-subtitle {
671
- font-family: var(--ck-georgia-serif-font-stack);
672
- font-size: 20px;
673
- font-weight: bold;
674
- color: #d1d1d1;
675
- letter-spacing: 10px;
676
- }
677
-
678
- .ck-content p.callout {
679
- --border-color: #e91e1e;
680
- padding: 1.2em 2em;
681
- border: 1px solid var(--border-color);
682
- border-left: 10px solid var(--border-color);
683
- background: #fff9fb;
684
- border-radius: 5px;
685
- margin: 1.5em 2em;
686
- box-shadow: 5px 5px 0 #ffe6ef;
687
- }
688
-
689
- .ck-content blockquote.side-quote {
690
- font-family: var(--ck-georgia-serif-font-stack);
691
- font-style: normal;
692
- float: right;
693
- width: 35%;
694
- position: relative;
695
- border: 0;
696
- overflow: visible;
697
- z-index: 1;
698
- margin-left: 1em;
699
- }
700
-
701
- .ck-content blockquote.side-quote::before {
702
- content: '“';
703
- position: absolute;
704
- top: -37px;
705
- left: -10px;
706
- display: block;
707
- font-size: 200px;
708
- color: #e7e7e7;
709
- z-index: -1;
710
- line-height: 1;
711
- }
712
-
713
- .ck-content blockquote.side-quote p {
714
- font-size: 2em;
715
- line-height: 1;
716
- }
717
-
718
- .ck-content blockquote.side-quote p:last-child:not(:first-child) {
719
- font-size: 1.3em;
720
- text-align: right;
721
- color: #555;
722
- }
723
-
724
- .ck-content span.needs-clarification {
725
- outline: 1px dashed #c8a24b;
726
- background: #ffe19c;
727
- border-radius: 2px;
728
- position: relative;
729
- }
730
-
731
- .ck-content span.needs-clarification::after {
732
- content: '?';
733
- display: inline-block;
734
- color: #fff;
735
- background: #3b3b3b;
736
- font-size: 12px;
737
- vertical-align: super;
738
- width: 12px;
739
- height: 12px;
740
- line-height: 12px;
741
- border-radius: 10px;
742
- text-align: center;
743
- position: absolute;
744
- right: -6px;
745
- top: -6px;
746
- font-weight: bold;
747
- letter-spacing: initial;
748
- }
749
-
750
- .ck-content span.wide-spacing {
751
- letter-spacing: 0.3em;
752
- }
753
-
754
- .ck-content span.small-caps {
755
- font-variant: small-caps;
756
- }
757
-
758
- .ck-content span.spoiler {
759
- background: #000;
760
- color: #000;
761
- }
762
-
763
- .ck-content span.spoiler:hover {
764
- background: #000;
765
- color: #fff;
766
- }
767
-
768
- .ck-content pre.stylish-code {
769
- border-color: transparent;
770
- margin-left: 2em;
771
- margin-right: 2em;
772
- border-radius: 10px;
773
- }
774
-
775
- .ck-content pre.stylish-code::before {
776
- content: '';
777
- display: block;
778
- height: 13px;
779
- background: url(data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1NCAxMyI+CiAgPGNpcmNsZSBjeD0iNi41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiNGMzZCNUMiLz4KICA8Y2lyY2xlIGN4PSIyNi41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiNGOUJFNEQiLz4KICA8Y2lyY2xlIGN4PSI0Ny41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiM1NkM0NTMiLz4KPC9zdmc+Cg==);
780
- margin-bottom: 8px;
781
- background-repeat: no-repeat;
782
- }
783
-
784
- .ck-content pre.stylish-code-dark,
785
- .ck-content pre.stylish-code-bright {
786
- padding: 1em;
787
- }
788
-
789
- .ck-content pre.stylish-code-dark {
790
- background: #272822;
791
- box-shadow: 5px 5px 0 #0000001f;
792
- color: white;
793
- }
794
-
795
- .ck-content pre.stylish-code-dark code {
796
- color: white;
797
- }
798
-
799
- .ck-content pre.stylish-code-bright {
800
- background: #dddfe0;
801
- color: #000;
802
- box-shadow: 5px 5px 0 #b3b3b3;
803
- }
804
-
805
- .ck-content pre.stylish-code-bright code {
806
- color: #222;
807
- }
808
- `;
809
- const baseTheme = {
810
- common,
811
- light,
812
- dark,
813
- additional
814
- };
815
- const GlobalStyle = styled.createGlobalStyle`
816
- ${({ theme }) => theme.common}
817
- ${({ theme, variant }) => theme[variant]}
818
- ${({ theme }) => theme.additional}
819
- `;
820
- const getSystemColorScheme = () => window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
821
- const GlobalStyling = () => {
822
- const { theme: userTheme, dontMergeTheme } = globalThis.SH_CKE_CONFIG || {};
823
- const profileTheme = getProfileTheme();
824
- const variant = profileTheme && profileTheme !== "system" ? profileTheme : getSystemColorScheme();
825
- const theme = dontMergeTheme ? userTheme : { ...baseTheme, ...userTheme };
826
- return /* @__PURE__ */ jsxRuntime.jsx(GlobalStyle, { theme, variant });
827
- };
828
- const MemoizedGlobalStyling = React__default.default.memo(GlobalStyling);
829
- const Wrapper = styled__default.default("div")`
830
- ${({ styles }) => styles}
831
- `;
832
- const Editor = ({
833
- name,
834
- disabled,
835
- presetName,
836
- maxLength,
837
- placeholder
838
- }) => {
839
- const { onChange, value } = admin.useField(name);
840
- const [editorInstance, setEditorInstance] = React.useState(false);
841
- const [mediaLibVisible, setMediaLibVisible] = React.useState(false);
842
- const [preset, setPreset] = React.useState(null);
843
- const [lengthMax, setLengthMax] = React.useState(false);
844
- const wordCounter = React.useRef(null);
845
- const handleToggleMediaLib = () => setMediaLibVisible((prev) => !prev);
846
- const handleCounter = (number) => number > maxLength ? setLengthMax(true) : setLengthMax(false);
847
- React.useEffect(() => {
848
- (async () => {
849
- const currentPreset = await getConfiguredPreset(presetName, {
850
- toggleMediaLib: handleToggleMediaLib,
851
- strapiFieldPlaceholder: placeholder
852
- });
853
- setPreset(currentPreset);
854
- })();
855
- }, []);
856
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
857
- preset && /* @__PURE__ */ jsxRuntime.jsx(MemoizedGlobalStyling, {}),
858
- /* @__PURE__ */ jsxRuntime.jsxs(Wrapper, { styles: preset?.styles, children: [
859
- !preset && /* @__PURE__ */ jsxRuntime.jsx(LoaderBox, { hasRadius: true, background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Loading..." }) }),
860
- preset && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
861
- /* @__PURE__ */ jsxRuntime.jsx(
862
- ckeditor5React.CKEditor,
863
- {
864
- editor: cke.ClassicEditor,
865
- config: preset.editorConfig,
866
- disabled,
867
- data: value ?? "",
868
- onReady: (editor) => {
869
- if (preset.editorConfig.WordCountPlugin) {
870
- const wordCountPlugin = editor.plugins.get("WordCount");
871
- wordCountPlugin.on(
872
- "update",
873
- (evt, stats) => handleCounter(stats.characters)
874
- );
875
- const wordCountWrapper = wordCounter.current;
876
- wordCountWrapper?.appendChild(
877
- wordCountPlugin.wordCountContainer
878
- );
879
- }
880
- if (editor.plugins.has("ImageUploadEditing")) {
881
- editor.plugins.get("ImageUploadEditing").on(
882
- "uploadComplete",
883
- (evt, { data, imageElement }) => editor.model.change(
884
- (writer) => writer.setAttribute("alt", data.alt, imageElement)
885
- )
886
- );
887
- }
888
- setEditorInstance(editor);
889
- },
890
- onChange: (event, editor) => {
891
- const data = editor.getData();
892
- onChange({ target: { name, value: data } });
893
- }
894
- }
895
- ),
896
- /* @__PURE__ */ jsxRuntime.jsx(
897
- MediaLib,
898
- {
899
- isOpen: mediaLibVisible,
900
- onToggle: handleToggleMediaLib,
901
- editor: editorInstance
902
- }
903
- ),
904
- preset.editorConfig.WordCountPlugin && /* @__PURE__ */ jsxRuntime.jsx(
905
- CounterLoaderBox,
906
- {
907
- color: lengthMax ? "danger500" : "neutral400",
908
- ref: wordCounter,
909
- children: !editorInstance && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true, children: "Loading..." })
910
- }
911
- )
912
- ] })
913
- ] })
914
- ] });
915
- };
916
- Editor.propTypes = {
917
- name: PropTypes__default.default.string.isRequired,
918
- disabled: PropTypes__default.default.bool,
919
- presetName: PropTypes__default.default.string.isRequired,
920
- maxLength: PropTypes__default.default.number,
921
- placeholder: PropTypes__default.default.string
922
- };
923
- const CounterLoaderBox = styled__default.default(designSystem.Box)`
924
- display: flex;
925
- width: 100%;
926
- justify-content: flex-end;
927
- align-items: center;
928
- `;
929
- const LoaderBox = styled__default.default(designSystem.Box)`
930
- display: flex;
931
- height: 200px;
932
- width: 100%;
933
- justify-content: center;
934
- align-items: center;
935
- `;
936
- const Input = ({
937
- name,
938
- attribute,
939
- value = "",
940
- labelAction = null,
941
- label,
942
- disabled = false,
943
- error = null,
944
- required = false,
945
- hint = "",
946
- placeholder
947
- }) => {
948
- const { preset, maxLengthCharacters, ...options } = attribute.options;
949
- return /* @__PURE__ */ jsxRuntime.jsx(
950
- designSystem.Field.Root,
951
- {
952
- name,
953
- id: name,
954
- error,
955
- hint,
956
- required,
957
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
958
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
959
- /* @__PURE__ */ jsxRuntime.jsx(
960
- Editor,
961
- {
962
- disabled,
963
- name,
964
- value,
965
- presetName: preset,
966
- maxLength: maxLengthCharacters,
967
- placeholder
968
- }
969
- ),
970
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
971
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
972
- ] })
973
- }
974
- );
975
- };
976
- Input.propTypes = {
977
- name: PropTypes__default.default.string.isRequired,
978
- attribute: PropTypes__default.default.object.isRequired,
979
- value: PropTypes__default.default.string,
980
- labelAction: PropTypes__default.default.object,
981
- label: PropTypes__default.default.string,
982
- disabled: PropTypes__default.default.bool,
983
- error: PropTypes__default.default.string,
984
- required: PropTypes__default.default.bool,
985
- hint: PropTypes__default.default.string,
986
- placeholder: PropTypes__default.default.string
987
- };
988
- const MemoizedInput = React__default.default.memo(Input);
989
- exports.default = MemoizedInput;
990
- //# sourceMappingURL=index-BsSnWl8P.js.map