@_sh/strapi-plugin-ckeditor 3.0.1 → 4.0.0

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