@_sh/strapi-plugin-ckeditor 4.0.5 → 4.0.7

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