@_sh/strapi-plugin-ckeditor 4.0.3 → 4.0.4

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