@_sh/strapi-plugin-ckeditor 3.0.2 → 4.0.1

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