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