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