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