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