@_sh/strapi-plugin-ckeditor 4.0.3 → 4.0.4

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