magic-editor-x 2.2.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +493 -168
  3. package/dist/admin/{ConfigurationPage-YvnPnna6.js → ConfigurationPage-CFP3lp9p.js} +479 -50
  4. package/dist/admin/{ConfigurationPage-3Dir3dAf.mjs → ConfigurationPage-CYGDLjM7.mjs} +450 -21
  5. package/dist/admin/ConfirmAction-DuQwvRYi.mjs +125 -0
  6. package/dist/admin/ConfirmAction-zLuIFj8t.js +124 -0
  7. package/dist/admin/{CustomBlocksPage-CR2BaP9O.mjs → CustomBlocksPage-B5Q33N-s.mjs} +92 -41
  8. package/dist/admin/{CustomBlocksPage-BiiL2ORG.js → CustomBlocksPage-DzPOSpfn.js} +135 -84
  9. package/dist/admin/DraftSync-BIA8cZgA.js +11 -0
  10. package/dist/admin/DraftSync-CUxOMG-E.mjs +12 -0
  11. package/dist/admin/TemplatesPage-4A8JNO_Z.mjs +993 -0
  12. package/dist/admin/TemplatesPage-BVkgafCK.js +993 -0
  13. package/dist/admin/{de-BmmLBJli.mjs → de-1cFMs-4c.mjs} +2 -0
  14. package/dist/admin/{de-BteRx2iA.js → de-2Ie5jy7j.js} +79 -1
  15. package/dist/admin/{de-62Vxb2iw.js → de-B1X46JJZ.js} +205 -2
  16. package/dist/admin/{de-CFX5atOk.mjs → de-BMY2LBaa.mjs} +79 -1
  17. package/dist/admin/{de-Bt6pYIWi.mjs → de-BUS1hUw0.mjs} +145 -0
  18. package/dist/admin/{de-CVbi685U.js → de-C3AsGauQ.js} +145 -0
  19. package/dist/admin/{de-BVvwSYYO.mjs → de-DOiGaTNX.mjs} +205 -2
  20. package/dist/admin/{de-DaJwN6nk.js → de-Dn8athM8.js} +2 -0
  21. package/dist/admin/{en-CyjAcccB.js → en-Ah-Cw0Wd.js} +79 -1
  22. package/dist/admin/{en-BX362fTp.js → en-BkEjpC3i.js} +145 -0
  23. package/dist/admin/{en-VlkaIzrM.js → en-CDg_18Bt.js} +205 -2
  24. package/dist/admin/{en-Cn78RZs-.js → en-CIZ5Ggod.js} +2 -0
  25. package/dist/admin/{en-Cg2Ak5Cr.mjs → en-CU6UzV4g.mjs} +205 -2
  26. package/dist/admin/{en-ea0tfA5i.mjs → en-CvFiqti2.mjs} +79 -1
  27. package/dist/admin/{en-D7mZWLGp.mjs → en-Dc9y-6n9.mjs} +2 -0
  28. package/dist/admin/{en-B_HltUxZ.mjs → en-GCzgS9Aw.mjs} +145 -0
  29. package/dist/admin/{es-BT9oAcHf.js → es-BCpJmUEM.js} +205 -2
  30. package/dist/admin/{es-C9-cXdb6.mjs → es-BmfffNM2.mjs} +205 -2
  31. package/dist/admin/{es-BmGtLkJD.js → es-C4IRHV5d.js} +2 -0
  32. package/dist/admin/{es-CHHEZi44.js → es-C4pEnDRv.js} +145 -0
  33. package/dist/admin/{es-C8GZFGjv.js → es-Cr8JH85N.js} +79 -1
  34. package/dist/admin/{es-joykG5I9.mjs → es-D2Kw6E4N.mjs} +2 -0
  35. package/dist/admin/{es-CrhwOq-5.mjs → es-DHBBZKl2.mjs} +145 -0
  36. package/dist/admin/{es-CEi_ycX8.mjs → es-DbKHZz5l.mjs} +79 -1
  37. package/dist/admin/{fr-CrzxGe5e.mjs → fr-BOvvfEH7.mjs} +2 -0
  38. package/dist/admin/{fr-B3SL0TBV.js → fr-C2aLSwEu.js} +145 -0
  39. package/dist/admin/{fr-BAMSvQbR.mjs → fr-DQJ_7aq5.mjs} +79 -1
  40. package/dist/admin/{fr-DpU_qiXR.mjs → fr-DZd2XJP6.mjs} +205 -2
  41. package/dist/admin/{fr-5djKfQ3s.mjs → fr-Dvq4xk2e.mjs} +145 -0
  42. package/dist/admin/{fr-oRCJNdeJ.js → fr-OJ4VW1kh.js} +79 -1
  43. package/dist/admin/{fr-D6KJqPWi.js → fr-ZcN0yM_2.js} +205 -2
  44. package/dist/admin/{fr-Ct_uPqxV.js → fr-Zkb8vfjN.js} +2 -0
  45. package/dist/admin/{EditorField-Diq1j8kc.js → index-DQVE0ymw.js} +13712 -6767
  46. package/dist/admin/index-DR8sHkTk.js +1940 -0
  47. package/dist/admin/index-My6FjjHB.mjs +1939 -0
  48. package/dist/admin/{EditorField-B8pyAxPE.mjs → index-k8_a5o1A.mjs} +10223 -3278
  49. package/dist/admin/index.js +1 -1
  50. package/dist/admin/index.mjs +2 -2
  51. package/dist/admin/{pt-chN2jrXl.js → pt-1IUyx6ae.js} +2 -0
  52. package/dist/admin/{pt-CQrfqsCN.mjs → pt-BSLzA17U.mjs} +79 -1
  53. package/dist/admin/{pt-jUqOR7Xh.mjs → pt-C3UdeIpd.mjs} +205 -2
  54. package/dist/admin/{pt-BOrl6x-r.js → pt-CImqDnLB.js} +205 -2
  55. package/dist/admin/{pt-BdnY2Cth.mjs → pt-CilDggGF.mjs} +145 -0
  56. package/dist/admin/{pt-tUeJ2Ywd.js → pt-D0I0_JYs.js} +79 -1
  57. package/dist/admin/{pt-EVwCuBUK.js → pt-DX0OAIoL.js} +145 -0
  58. package/dist/admin/{pt-Ga-4Hsv0.mjs → pt-etwsg3G4.mjs} +2 -0
  59. package/dist/admin/useBreakpoint-D30eNTkF.js +37 -0
  60. package/dist/admin/useBreakpoint-DCfn6pDG.mjs +38 -0
  61. package/dist/admin/useT-Cmg1jwwG.mjs +65 -0
  62. package/dist/admin/{useT-BWZ_-Hel.js → useT-DNphiBQR.js} +4 -70
  63. package/dist/blocks/index.d.mts +167 -0
  64. package/dist/blocks/index.d.ts +167 -0
  65. package/dist/blocks/index.js +631 -0
  66. package/dist/blocks/index.mjs +609 -0
  67. package/dist/react/index.d.mts +39 -0
  68. package/dist/react/index.d.ts +39 -0
  69. package/dist/react/index.js +2687 -0
  70. package/dist/react/index.mjs +2657 -0
  71. package/dist/render/index.d.mts +131 -5
  72. package/dist/render/index.d.ts +131 -5
  73. package/dist/render/index.js +1679 -181
  74. package/dist/render/index.mjs +1679 -181
  75. package/dist/server/index.js +10645 -3716
  76. package/dist/server/index.mjs +10645 -3716
  77. package/dist/vue/index.d.mts +41 -0
  78. package/dist/vue/index.d.ts +41 -0
  79. package/dist/vue/index.js +2630 -0
  80. package/dist/vue/index.mjs +2610 -0
  81. package/package.json +30 -6
  82. package/schema/magic-editor-x.schema.json +540 -1
  83. package/types/blocks.d.ts +167 -0
  84. package/types/index.d.ts +127 -0
  85. package/types/react.d.ts +39 -0
  86. package/types/render.d.ts +131 -5
  87. package/types/vue.d.ts +41 -0
  88. package/dist/admin/api-Dsq53giv.js +0 -37
  89. package/dist/admin/api-RZ0Fz0BD.mjs +0 -38
  90. package/dist/admin/index-C-lyON1B.mjs +0 -303
  91. package/dist/admin/index-iA0lued_.js +0 -302
  92. package/dist/admin/sanitize-Cb4jvBhj.js +0 -628
  93. package/dist/admin/sanitize-ClkX823p.mjs +0 -627
  94. package/dist/admin/useT-pvHmgBFj.mjs +0 -131
@@ -4,21 +4,15 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const designSystem = require("@strapi/design-system");
5
5
  const admin = require("@strapi/strapi/admin");
6
6
  const icons = require("@strapi/icons");
7
- const index = require("./index-iA0lued_.js");
8
- const useT = require("./useT-BWZ_-Hel.js");
9
- const react = require("react");
7
+ const index = require("./index-DR8sHkTk.js");
8
+ const useT = require("./useT-DNphiBQR.js");
9
+ const ConfirmAction = require("./ConfirmAction-zLuIFj8t.js");
10
+ const DraftSync = require("./DraftSync-BIA8cZgA.js");
11
+ const ReactNamespace = require("react");
10
12
  const styled = require("styled-components");
11
- const api = require("./api-Dsq53giv.js");
12
13
  const reactIntl = require("react-intl");
13
14
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
14
15
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
15
- const DraftSync = ({ values }) => {
16
- const setValues = admin.useForm("MagicEditorXDraftSync", (state) => state.setValues);
17
- react.useEffect(() => {
18
- setValues(values);
19
- }, [values, setValues]);
20
- return null;
21
- };
22
16
  const PropertyList = ({ items }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "dl", margin: 0, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 3, children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
23
17
  designSystem.Flex,
24
18
  {
@@ -43,7 +37,19 @@ const LIMITS = Object.freeze({
43
37
  maxOutputTokens: Object.freeze({ min: 64, max: 16e3 })
44
38
  });
45
39
  const EDITABLE = ["enabled", "provider", "baseUrl", "model", "maxInputChars", "maxOutputTokens"];
46
- const toDraft = (ai) => ({
40
+ const SWITCHES = ["allowImages", "allowFieldActions"];
41
+ const LANGUAGE_TOOL_EDITABLE = ["enabled", "baseUrl", "username", "level"];
42
+ const toLanguageToolDraft = (languageTool) => languageTool ? {
43
+ enabled: Boolean(languageTool.enabled),
44
+ baseUrl: languageTool.baseUrl || "",
45
+ username: languageTool.username || "",
46
+ level: languageTool.level === "picky" ? "picky" : "default",
47
+ apiKeyMode: "keep",
48
+ apiKey: ""
49
+ } : void 0;
50
+ const toDraft = (ai, languageTool) => ({
51
+ ...Object.fromEntries(SWITCHES.filter((key) => typeof ai[key] === "boolean").map((key) => [key, ai[key]])),
52
+ ...languageTool ? { languageTool: toLanguageToolDraft(languageTool) } : {},
47
53
  enabled: Boolean(ai.enabled),
48
54
  provider: PROVIDERS.includes(ai.provider) ? ai.provider : "anthropic",
49
55
  baseUrl: ai.baseUrl || "",
@@ -108,7 +114,52 @@ const toPayload = (draft) => {
108
114
  };
109
115
  if (draft.apiKeyMode === "remove") ai.apiKey = "";
110
116
  if (draft.apiKeyMode === "replace") ai.apiKey = String(draft.apiKey || "").trim();
111
- return { ai };
117
+ for (const key of SWITCHES) if (typeof draft[key] === "boolean") ai[key] = draft[key];
118
+ const languageTool = draft.languageTool ? toLanguageToolPayload(draft.languageTool) : null;
119
+ return languageTool ? { ai, languageTool } : { ai };
120
+ };
121
+ const toLanguageToolPayload = (lt) => {
122
+ const out = {
123
+ enabled: Boolean(lt.enabled),
124
+ baseUrl: String(lt.baseUrl || "").trim().replace(/\/+$/, ""),
125
+ username: String(lt.username || "").trim(),
126
+ level: lt.level === "picky" ? "picky" : "default"
127
+ };
128
+ if (lt.apiKeyMode === "remove") out.apiKey = "";
129
+ if (lt.apiKeyMode === "replace") out.apiKey = String(lt.apiKey || "").trim();
130
+ return out;
131
+ };
132
+ const validateLanguageTool = (lt, { saved, dto, environment } = {}) => {
133
+ const errors = {};
134
+ if (!lt) return errors;
135
+ const allowPrivate = Boolean(
136
+ environment && environment.languageTool && environment.languageTool.allowPrivateBaseUrl
137
+ );
138
+ const baseUrl = String(lt.baseUrl || "").trim();
139
+ if (!baseUrl && lt.enabled) errors["languageTool.baseUrl"] = "required";
140
+ if (baseUrl) {
141
+ const url = (() => {
142
+ try {
143
+ return new URL(baseUrl);
144
+ } catch {
145
+ return null;
146
+ }
147
+ })();
148
+ if (!url || !["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash || baseUrl.length > 500)
149
+ errors["languageTool.baseUrl"] = "url";
150
+ else if (url.protocol !== "https:" && !allowPrivate) errors["languageTool.baseUrl"] = "httpsLanguageTool";
151
+ }
152
+ if (String(lt.username || "").length > 200) errors["languageTool.username"] = "invalid";
153
+ if (lt.apiKeyMode === "replace") {
154
+ const key = String(lt.apiKey || "").trim();
155
+ if (!key) errors["languageTool.apiKey"] = "required";
156
+ else if (key.length > 500) errors["languageTool.apiKey"] = "tooLong";
157
+ else if (dto && !dto.canStoreApiKey) errors["languageTool.apiKey"] = "cannotStore";
158
+ if (!String(lt.username || "").trim()) errors["languageTool.username"] = "required";
159
+ } else if (lt.apiKeyMode === "keep" && saved && dto && dto.hasApiKey && (String(lt.baseUrl || "").trim() !== saved.baseUrl || String(lt.username || "").trim() !== saved.username)) {
160
+ errors["languageTool.apiKey"] = "reenterLanguageTool";
161
+ }
162
+ return errors;
112
163
  };
113
164
  const adjustedFields = (draft, stored) => EDITABLE.filter((key) => {
114
165
  const sent = key === "baseUrl" || key === "model" ? String(draft[key] || "").trim() : draft[key];
@@ -120,7 +171,8 @@ const mapServerErrors = (details) => {
120
171
  for (const [key, messages] of Object.entries(fieldErrors)) {
121
172
  const message = Array.isArray(messages) ? messages[0] : String(messages || "");
122
173
  const field = key.startsWith("ai.") ? key.slice(3) : null;
123
- if (field && EDITABLE.concat(["apiKey"]).includes(field)) out[field] = message;
174
+ if (field && EDITABLE.concat(["apiKey"], SWITCHES).includes(field)) out[field] = message;
175
+ else if (/^languageTool\.(enabled|baseUrl|username|level|apiKey)$/.test(key)) out[key] = message;
124
176
  else out._form = message;
125
177
  }
126
178
  if (!Object.keys(out).length && details && Array.isArray(details.formErrors) && details.formErrors[0]) {
@@ -128,29 +180,34 @@ const mapServerErrors = (details) => {
128
180
  }
129
181
  return out;
130
182
  };
131
- const sameDraft = (a, b) => EDITABLE.every((key) => a[key] === b[key]) && a.apiKeyMode === b.apiKeyMode && (a.apiKeyMode !== "replace" || a.apiKey === b.apiKey);
183
+ const sameDraft = (a, b) => EDITABLE.every((key) => a[key] === b[key]) && SWITCHES.every((key) => a[key] === b[key]) && a.apiKeyMode === b.apiKeyMode && (a.apiKeyMode !== "replace" || a.apiKey === b.apiKey) && sameLanguageTool(a.languageTool, b.languageTool);
184
+ const sameLanguageTool = (a, b) => {
185
+ if (!a || !b) return a === b;
186
+ return LANGUAGE_TOOL_EDITABLE.every((key) => a[key] === b[key]) && a.apiKeyMode === b.apiKeyMode && (a.apiKeyMode !== "replace" || a.apiKey === b.apiKey);
187
+ };
132
188
  const useConfigurationForm = () => {
133
189
  const { get, put, post } = admin.useFetchClient();
134
- const [status, setStatus] = react.useState("loading");
135
- const [dto, setDto] = react.useState(null);
136
- const [saved, setSaved] = react.useState(null);
137
- const [draft, setDraft] = react.useState(null);
138
- const [serverErrors, setServerErrors] = react.useState({});
139
- const [showErrors, setShowErrors] = react.useState(false);
140
- const [saving, setSaving] = react.useState(false);
141
- const [testing, setTesting] = react.useState(false);
142
- const mounted = react.useRef(true);
143
- react.useEffect(() => {
190
+ const [status, setStatus] = ReactNamespace.useState("loading");
191
+ const [dto, setDto] = ReactNamespace.useState(null);
192
+ const [saved, setSaved] = ReactNamespace.useState(null);
193
+ const [draft, setDraft] = ReactNamespace.useState(null);
194
+ const [serverErrors, setServerErrors] = ReactNamespace.useState({});
195
+ const [showErrors, setShowErrors] = ReactNamespace.useState(false);
196
+ const [saving, setSaving] = ReactNamespace.useState(false);
197
+ const [testing, setTesting] = ReactNamespace.useState(false);
198
+ const [testingLanguageTool, setTestingLanguageTool] = ReactNamespace.useState(false);
199
+ const mounted = ReactNamespace.useRef(true);
200
+ ReactNamespace.useEffect(() => {
144
201
  mounted.current = true;
145
202
  return () => {
146
203
  mounted.current = false;
147
204
  };
148
205
  }, []);
149
- const fetchSettings = react.useCallback(
150
- () => get(api.API.settings).then(
206
+ const fetchSettings = ReactNamespace.useCallback(
207
+ () => get(ConfirmAction.API.settings).then(
151
208
  ({ data }) => {
152
209
  if (!mounted.current) return;
153
- const next = toDraft(data.data.ai);
210
+ const next = toDraft(data.data.ai, data.data.languageTool);
154
211
  setDto(data.data);
155
212
  setSaved(next);
156
213
  setDraft(next);
@@ -164,18 +221,25 @@ const useConfigurationForm = () => {
164
221
  ),
165
222
  [get]
166
223
  );
167
- react.useEffect(() => {
224
+ ReactNamespace.useEffect(() => {
168
225
  fetchSettings();
169
226
  }, [fetchSettings]);
170
- const load = react.useCallback(() => {
227
+ const load = ReactNamespace.useCallback(() => {
171
228
  setStatus("loading");
172
229
  fetchSettings();
173
230
  }, [fetchSettings]);
174
- const errors = react.useMemo(() => {
231
+ const errors = ReactNamespace.useMemo(() => {
175
232
  if (!draft || !dto) return {};
176
- return validateDraft(draft, { saved, ai: dto.ai, environment: dto.environment });
233
+ return {
234
+ ...validateDraft(draft, { saved, ai: dto.ai, environment: dto.environment }),
235
+ ...validateLanguageTool(draft.languageTool, {
236
+ saved: saved && saved.languageTool,
237
+ dto: dto.languageTool,
238
+ environment: dto.environment
239
+ })
240
+ };
177
241
  }, [draft, dto, saved]);
178
- const setField = react.useCallback((key, value) => {
242
+ const setField = ReactNamespace.useCallback((key, value) => {
179
243
  setDraft((current) => ({ ...current, [key]: value }));
180
244
  setServerErrors((current) => {
181
245
  if (!current[key] && !current._form) return current;
@@ -185,16 +249,27 @@ const useConfigurationForm = () => {
185
249
  return next;
186
250
  });
187
251
  }, []);
188
- const replaceDraft = react.useCallback((next) => setDraft(next), []);
252
+ const replaceDraft = ReactNamespace.useCallback((next) => setDraft(next), []);
253
+ const setLanguageToolField = ReactNamespace.useCallback((key, value) => {
254
+ setDraft((current) => ({ ...current, languageTool: { ...current.languageTool, [key]: value } }));
255
+ setServerErrors((current) => {
256
+ const name = `languageTool.${key}`;
257
+ if (!current[name] && !current._form) return current;
258
+ const next = { ...current };
259
+ delete next[name];
260
+ delete next._form;
261
+ return next;
262
+ });
263
+ }, []);
189
264
  const dirty = Boolean(draft && saved && !sameDraft(draft, saved));
190
265
  const hasErrors = Object.keys(errors).length > 0;
191
- const save = react.useCallback(async () => {
266
+ const save = ReactNamespace.useCallback(async () => {
192
267
  setShowErrors(true);
193
268
  if (hasErrors) return { ok: false, invalid: true };
194
269
  setSaving(true);
195
270
  try {
196
- const { data } = await put(api.API.settings, toPayload(draft));
197
- const stored = toDraft(data.data.ai);
271
+ const { data } = await put(ConfirmAction.API.settings, toPayload(draft));
272
+ const stored = toDraft(data.data.ai, data.data.languageTool);
198
273
  const adjusted = adjustedFields(draft, stored);
199
274
  setDto(data.data);
200
275
  setSaved(stored);
@@ -203,37 +278,60 @@ const useConfigurationForm = () => {
203
278
  setShowErrors(false);
204
279
  return { ok: true, adjusted };
205
280
  } catch (error) {
206
- const info = api.readApiError(error);
281
+ const info = ConfirmAction.readApiError(error);
207
282
  setServerErrors(mapServerErrors(info.details));
208
283
  return { ok: false, message: info.status === 400 ? null : info.message };
209
284
  } finally {
210
285
  if (mounted.current) setSaving(false);
211
286
  }
212
287
  }, [draft, hasErrors, put]);
213
- const clearServerErrors = react.useCallback(() => setServerErrors({}), []);
214
- const discard = react.useCallback(() => {
288
+ const clearServerErrors = ReactNamespace.useCallback(() => setServerErrors({}), []);
289
+ const discard = ReactNamespace.useCallback(() => {
215
290
  setDraft(saved);
216
291
  setServerErrors({});
217
292
  setShowErrors(false);
218
293
  }, [saved]);
219
- const test = react.useCallback(async () => {
294
+ const test = ReactNamespace.useCallback(async () => {
220
295
  setShowErrors(true);
221
- const blocking = Object.keys(errors).filter((key) => key !== "apiKey" || draft.apiKeyMode === "replace");
296
+ const blocking = Object.keys(errors).filter(
297
+ (key) => !key.startsWith("languageTool.") && (key !== "apiKey" || draft.apiKeyMode === "replace")
298
+ );
222
299
  if (blocking.length) return { ok: false, invalid: true };
223
300
  setTesting(true);
224
301
  try {
225
302
  const payload = toPayload(draft);
226
303
  if (draft.apiKeyMode === "remove") delete payload.ai.apiKey;
227
- await post(api.API.settingsAiTest, payload);
304
+ await post(ConfirmAction.API.settingsAiTest, payload);
228
305
  return { ok: true };
229
306
  } catch (error) {
230
- const info = api.readApiError(error);
307
+ const info = ConfirmAction.readApiError(error);
231
308
  return { ok: false, code: info.code, status: info.status };
232
309
  } finally {
233
310
  if (mounted.current) setTesting(false);
234
311
  }
235
312
  }, [draft, errors, post]);
236
- const visibleErrors = react.useMemo(() => {
313
+ const testLanguageTool = ReactNamespace.useCallback(async () => {
314
+ setShowErrors(true);
315
+ const lt = draft && draft.languageTool;
316
+ const blocking = Object.keys(errors).filter(
317
+ (key) => key.startsWith("languageTool.") && (key !== "languageTool.apiKey" || lt.apiKeyMode === "replace")
318
+ );
319
+ if (!lt || !String(lt.baseUrl || "").trim()) return { ok: false, invalid: true, missingUrl: true };
320
+ if (blocking.length) return { ok: false, invalid: true };
321
+ setTestingLanguageTool(true);
322
+ try {
323
+ const payload = toLanguageToolPayload(lt);
324
+ if (lt.apiKeyMode === "remove") payload.apiKey = "";
325
+ await post(ConfirmAction.API.settingsLanguageToolTest, { languageTool: payload });
326
+ return { ok: true };
327
+ } catch (error) {
328
+ const info = ConfirmAction.readApiError(error);
329
+ return { ok: false, code: info.code, status: info.status };
330
+ } finally {
331
+ if (mounted.current) setTestingLanguageTool(false);
332
+ }
333
+ }, [draft, errors, post]);
334
+ const visibleErrors = ReactNamespace.useMemo(() => {
237
335
  const merged = showErrors ? { ...errors } : {};
238
336
  for (const [key, value] of Object.entries(serverErrors)) merged[key] = { server: value };
239
337
  return merged;
@@ -248,6 +346,9 @@ const useConfigurationForm = () => {
248
346
  hasErrors,
249
347
  saving,
250
348
  testing,
349
+ testingLanguageTool,
350
+ setLanguageToolField,
351
+ testLanguageTool,
251
352
  reload: load,
252
353
  setField,
253
354
  replaceDraft,
@@ -286,6 +387,16 @@ const errorText = (t, error, field) => {
286
387
  return t("settings.validation.cannotStore", "Set MAGIC_EDITOR_X_ENCRYPTION_KEY to store an API key.");
287
388
  case "tooLong":
288
389
  return t("settings.validation.keyTooLong", "The API key is too long.");
390
+ case "httpsLanguageTool":
391
+ return t(
392
+ "settings.languageTool.validation.https",
393
+ "Use an https URL. Private or http hosts need languageTool.allowPrivateBaseUrl in config/plugins.js."
394
+ );
395
+ case "reenterLanguageTool":
396
+ return t(
397
+ "settings.languageTool.validation.reenterKey",
398
+ "Enter the API key again when you change the base URL or user name."
399
+ );
289
400
  default:
290
401
  return t("settings.validation.invalid", "Check this value.");
291
402
  }
@@ -302,6 +413,25 @@ const providerName = (t, draft) => {
302
413
  })();
303
414
  return host || t("settings.ai.provider.compatible.name", "the server at the base URL");
304
415
  };
416
+ const SwitchRow = ({ id, label, hint, checked, disabled, onChange, t }) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "flex-start", justifyContent: "space-between", minWidth: 0, children: [
417
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, flex: "1 1 auto", children: [
418
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", textColor: "neutral800", id: `${id}-label`, children: label }),
419
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", id: `${id}-hint`, children: hint })
420
+ ] }),
421
+ /* @__PURE__ */ jsxRuntime.jsx(
422
+ designSystem.Switch,
423
+ {
424
+ checked,
425
+ onCheckedChange: (next) => onChange(next === true),
426
+ disabled,
427
+ "aria-labelledby": `${id}-label`,
428
+ "aria-describedby": `${id}-hint`,
429
+ onLabel: t("settings.switch.on", "On"),
430
+ offLabel: t("settings.switch.off", "Off"),
431
+ visibleLabels: true
432
+ }
433
+ )
434
+ ] });
305
435
  const KeyStatus = ({ ai, draft, t }) => {
306
436
  let tone = { backgroundColor: "neutral150", textColor: "neutral700" };
307
437
  let label = t("settings.ai.key.status.none", "No key stored");
@@ -371,6 +501,38 @@ const AiSection = ({ form, readOnly, onTest }) => {
371
501
  }
372
502
  )
373
503
  ] }),
504
+ typeof draft.allowImages === "boolean" ? /* @__PURE__ */ jsxRuntime.jsx(
505
+ SwitchRow,
506
+ {
507
+ id: "mex-ai-images",
508
+ t,
509
+ label: t("settings.ai.images.label", "Send images to the AI provider"),
510
+ hint: t(
511
+ "settings.ai.images.privacy",
512
+ "Lets editors ask for an alternative text suggestion. The image (a stored size of at most 1568 pixels) and the content language are sent to {provider}. Off by default.",
513
+ { provider: providerName(t, draft) }
514
+ ),
515
+ checked: draft.allowImages,
516
+ disabled: readOnly,
517
+ onChange: (checked) => setField("allowImages", checked)
518
+ }
519
+ ) : null,
520
+ typeof draft.allowFieldActions === "boolean" ? /* @__PURE__ */ jsxRuntime.jsx(
521
+ SwitchRow,
522
+ {
523
+ id: "mex-ai-field",
524
+ t,
525
+ label: t("settings.ai.fieldActions.label", "Allow whole-field AI actions"),
526
+ hint: t(
527
+ "settings.ai.fieldActions.privacy",
528
+ "Lets editors translate or summarize a whole field. The text of every block in the field, with its inline formatting and links, is sent to {provider}. Off by default.",
529
+ { provider: providerName(t, draft) }
530
+ ),
531
+ checked: draft.allowFieldActions,
532
+ disabled: readOnly,
533
+ onChange: (checked) => setField("allowFieldActions", checked)
534
+ }
535
+ ) : null,
374
536
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: { initial: 4, medium: 5 }, children: [
375
537
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, xs: 12, s: 12, m: 12, direction: "column", alignItems: "stretch", minWidth: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "provider", error: errorText(t, errors.provider, "provider"), required: true, children: [
376
538
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("settings.ai.provider.label", "Provider") }),
@@ -546,7 +708,7 @@ const megabytes = (t, formatNumber, bytes) => t("settings.environment.megabytes"
546
708
  });
547
709
  const EnvironmentSection = ({ environment }) => {
548
710
  const t = useT.useT();
549
- const { formatNumber } = reactIntl.useIntl();
711
+ const { formatNumber, formatDate } = reactIntl.useIntl();
550
712
  const on = (value) => value ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "success100", textColor: "success700", children: t("settings.environment.on", "On") }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "neutral150", textColor: "neutral700", children: t("settings.environment.off", "Off") });
551
713
  const rawHtml = {
552
714
  sanitize: t(
@@ -557,6 +719,35 @@ const EnvironmentSection = ({ environment }) => {
557
719
  disable: t("settings.environment.rawHtml.disable", "Emptied on save")
558
720
  }[environment.rawHtml] || environment.rawHtml;
559
721
  const collaboration = environment.collaboration || {};
722
+ const linkSchedule = environment.linkSchedule || null;
723
+ const lastRun = linkSchedule && linkSchedule.lastRun;
724
+ let linkScheduleHint;
725
+ if (linkSchedule && linkSchedule.enabled) {
726
+ const parts = [
727
+ t(
728
+ "settings.environment.linkScheduleHint",
729
+ "Rule {rule}, at most {max} links per run (qualityChecks.externalLinks.schedule).",
730
+ { rule: linkSchedule.rule || "", max: linkSchedule.maxUrlsPerRun ?? 0 }
731
+ ),
732
+ lastRun ? t(
733
+ "settings.environment.linkScheduleLastRun",
734
+ "Last run {date}: {checked, number} links checked, {problems, number} with problems.",
735
+ {
736
+ date: formatDate(new Date(lastRun.finishedAt), { dateStyle: "medium", timeStyle: "short" }),
737
+ checked: lastRun.checked ?? 0,
738
+ problems: lastRun.problems ?? 0
739
+ }
740
+ ) : t("settings.environment.linkScheduleNever", "No run yet.")
741
+ ];
742
+ if (lastRun && !lastRun.complete)
743
+ parts.push(
744
+ t(
745
+ "settings.environment.linkScheduleIncomplete",
746
+ "The last run did not finish; results of earlier runs were kept."
747
+ )
748
+ );
749
+ linkScheduleHint = parts.join(" ");
750
+ }
560
751
  return /* @__PURE__ */ jsxRuntime.jsx(
561
752
  useT.SectionCard,
562
753
  {
@@ -600,6 +791,12 @@ const EnvironmentSection = ({ environment }) => {
600
791
  label: t("settings.environment.maxFile", "Largest file upload"),
601
792
  value: megabytes(t, formatNumber, environment.uploads && environment.uploads.maxFileBytes)
602
793
  },
794
+ {
795
+ key: "linkSchedule",
796
+ label: t("settings.environment.linkSchedule", "Scheduled link check"),
797
+ value: on(Boolean(linkSchedule && linkSchedule.enabled)),
798
+ hint: linkScheduleHint
799
+ },
603
800
  {
604
801
  key: "privateAi",
605
802
  label: t("settings.environment.privateAi", "Private AI hosts allowed"),
@@ -647,8 +844,8 @@ const CspSection = ({ csp }) => {
647
844
  const t = useT.useT();
648
845
  const { copy } = admin.useClipboard();
649
846
  const { toggleNotification } = admin.useNotification();
650
- const codeRef = react.useRef(null);
651
- const [alertOpen, setAlertOpen] = react.useState(true);
847
+ const codeRef = ReactNamespace.useRef(null);
848
+ const [alertOpen, setAlertOpen] = ReactNamespace.useState(true);
652
849
  const frameMissing = csp && Array.isArray(csp.frameSrcMissing) && csp.frameSrcMissing || [];
653
850
  const imgMissing = Boolean(csp && csp.imgSrcMissing);
654
851
  if (!csp || !csp.active || !csp.snippet || !frameMissing.length && !imgMissing) return null;
@@ -733,6 +930,197 @@ const CspSection = ({ csp }) => {
733
930
  }
734
931
  );
735
932
  };
933
+ const hostOf = (t, baseUrl) => {
934
+ try {
935
+ return new URL(baseUrl).host || t("settings.languageTool.server", "the LanguageTool server");
936
+ } catch {
937
+ return t("settings.languageTool.server", "the LanguageTool server");
938
+ }
939
+ };
940
+ const LanguageToolSection = ({ form, readOnly, onTest }) => {
941
+ const t = useT.useT();
942
+ const { draft, dto, errors, setLanguageToolField, replaceDraft, testingLanguageTool } = form;
943
+ const lt = draft.languageTool;
944
+ const stored = dto.languageTool;
945
+ if (!lt || !stored) return null;
946
+ const environment = dto.environment.languageTool || { allowPrivateBaseUrl: false, requestsPerMinute: 30 };
947
+ const setKeyMode = (apiKeyMode, apiKey = "") => replaceDraft({ ...draft, languageTool: { ...lt, apiKeyMode, apiKey } });
948
+ const err = (name) => errorText(t, errors[`languageTool.${name}`], name);
949
+ let keyTone = { backgroundColor: "neutral150", textColor: "neutral700" };
950
+ let keyLabel = t("settings.ai.key.status.none", "No key stored");
951
+ if (lt.apiKeyMode === "remove") {
952
+ keyTone = { backgroundColor: "warning200", textColor: "neutral800" };
953
+ keyLabel = t("settings.ai.key.status.removing", "Removed when you save");
954
+ } else if (stored.apiKeyUnreadable) {
955
+ keyTone = { backgroundColor: "warning200", textColor: "neutral800" };
956
+ keyLabel = t("settings.ai.key.status.unreadable", "Stored key unreadable");
957
+ } else if (stored.hasApiKey) {
958
+ keyTone = { backgroundColor: "success100", textColor: "success700" };
959
+ keyLabel = t("settings.ai.key.status.stored", "Stored, encrypted");
960
+ }
961
+ return /* @__PURE__ */ jsxRuntime.jsxs(
962
+ useT.SectionCard,
963
+ {
964
+ title: t("settings.languageTool.title", "Grammar check (LanguageTool)"),
965
+ subtitle: t(
966
+ "settings.languageTool.subtitle",
967
+ "Editors can check spelling and grammar of a field with a LanguageTool server: your own (self-hosted) or a hosted service. It is off until you turn it on."
968
+ ),
969
+ action: /* @__PURE__ */ jsxRuntime.jsx(
970
+ designSystem.Button,
971
+ {
972
+ variant: "secondary",
973
+ onClick: onTest,
974
+ loading: testingLanguageTool,
975
+ disabled: testingLanguageTool,
976
+ children: t("settings.languageTool.test", "Test LanguageTool")
977
+ }
978
+ ),
979
+ children: [
980
+ /* @__PURE__ */ jsxRuntime.jsx(
981
+ SwitchRow,
982
+ {
983
+ id: "mex-lt-enabled",
984
+ t,
985
+ label: t("settings.languageTool.enabled.label", "Turn on the grammar check"),
986
+ hint: t(
987
+ "settings.languageTool.enabled.privacy",
988
+ "When an editor checks a field, the plain text of every block in it is sent to {host}. Nothing is sent while the check is off or until an editor starts a check.",
989
+ { host: hostOf(t, lt.baseUrl) }
990
+ ),
991
+ checked: lt.enabled,
992
+ disabled: readOnly,
993
+ onChange: (checked) => setLanguageToolField("enabled", checked)
994
+ }
995
+ ),
996
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: { initial: 4, medium: 5 }, children: [
997
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 12, direction: "column", alignItems: "stretch", minWidth: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
998
+ designSystem.Field.Root,
999
+ {
1000
+ name: "languageTool.baseUrl",
1001
+ error: err("baseUrl"),
1002
+ hint: t(
1003
+ "settings.languageTool.baseUrl.hint",
1004
+ "For example https://languagetool.example.com. Requests go to the base URL followed by /v2/check."
1005
+ ),
1006
+ required: lt.enabled,
1007
+ children: [
1008
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("settings.languageTool.baseUrl.label", "LanguageTool base URL") }),
1009
+ /* @__PURE__ */ jsxRuntime.jsx(
1010
+ designSystem.TextInput,
1011
+ {
1012
+ type: "url",
1013
+ value: lt.baseUrl,
1014
+ disabled: readOnly,
1015
+ placeholder: "https://",
1016
+ onChange: (event) => setLanguageToolField("baseUrl", event.target.value)
1017
+ }
1018
+ ),
1019
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
1020
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
1021
+ ]
1022
+ }
1023
+ ) }),
1024
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, xs: 12, s: 12, m: 6, direction: "column", alignItems: "stretch", minWidth: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
1025
+ designSystem.Field.Root,
1026
+ {
1027
+ name: "languageTool.username",
1028
+ error: err("username"),
1029
+ hint: t(
1030
+ "settings.languageTool.username.hint",
1031
+ "Only for hosted accounts that need a user name and API key. Leave empty for your own server."
1032
+ ),
1033
+ children: [
1034
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("settings.languageTool.username.label", "User name (optional)") }),
1035
+ /* @__PURE__ */ jsxRuntime.jsx(
1036
+ designSystem.TextInput,
1037
+ {
1038
+ value: lt.username,
1039
+ disabled: readOnly,
1040
+ autoComplete: "off",
1041
+ onChange: (event) => setLanguageToolField("username", event.target.value)
1042
+ }
1043
+ ),
1044
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
1045
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
1046
+ ]
1047
+ }
1048
+ ) }),
1049
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, xs: 12, s: 12, m: 6, direction: "column", alignItems: "stretch", minWidth: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
1050
+ designSystem.Field.Root,
1051
+ {
1052
+ name: "languageTool.level",
1053
+ hint: t("settings.languageTool.level.hint", "Strict adds style rules for formal text."),
1054
+ children: [
1055
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("settings.languageTool.level.label", "Rules") }),
1056
+ /* @__PURE__ */ jsxRuntime.jsxs(
1057
+ designSystem.SingleSelect,
1058
+ {
1059
+ value: lt.level,
1060
+ disabled: readOnly,
1061
+ onChange: (value) => setLanguageToolField("level", String(value)),
1062
+ children: [
1063
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "default", children: t("settings.languageTool.level.default", "Standard") }),
1064
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "picky", children: t("settings.languageTool.level.picky", "Strict") })
1065
+ ]
1066
+ }
1067
+ ),
1068
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
1069
+ ]
1070
+ }
1071
+ ) }),
1072
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Item, { col: 12, direction: "column", alignItems: "stretch", minWidth: 0, children: [
1073
+ /* @__PURE__ */ jsxRuntime.jsxs(
1074
+ designSystem.Field.Root,
1075
+ {
1076
+ name: "languageTool.apiKey",
1077
+ error: err("apiKey"),
1078
+ hint: stored.canStoreApiKey ? t(
1079
+ "settings.ai.key.hint",
1080
+ "Leave empty to keep the stored key. The key is never shown again after saving."
1081
+ ) : t(
1082
+ "settings.languageTool.key.cannotStoreHint",
1083
+ "Set MAGIC_EDITOR_X_ENCRYPTION_KEY (at least 32 characters) on the server to store a key."
1084
+ ),
1085
+ children: [
1086
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("settings.languageTool.key.label", "API key (optional)") }),
1087
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
1088
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...keyTone, children: keyLabel }) }),
1089
+ /* @__PURE__ */ jsxRuntime.jsx(
1090
+ designSystem.TextInput,
1091
+ {
1092
+ type: "password",
1093
+ autoComplete: "new-password",
1094
+ value: lt.apiKeyMode === "replace" ? lt.apiKey : "",
1095
+ disabled: readOnly || !stored.canStoreApiKey || lt.apiKeyMode === "remove",
1096
+ placeholder: t("settings.ai.key.placeholder", "Enter a new key"),
1097
+ onChange: (event) => {
1098
+ const value = event.target.value;
1099
+ setKeyMode(value ? "replace" : "keep", value);
1100
+ }
1101
+ }
1102
+ )
1103
+ ] }),
1104
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
1105
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
1106
+ ]
1107
+ }
1108
+ ),
1109
+ !readOnly && stored.hasApiKey ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, children: lt.apiKeyMode === "remove" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.TextButton, { onClick: () => setKeyMode("keep"), children: t("settings.ai.key.keep", "Keep the stored key") }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.TextButton, { onClick: () => setKeyMode("remove"), children: t("settings.ai.key.remove", "Remove the stored key") }) }) : null
1110
+ ] })
1111
+ ] }),
1112
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
1113
+ "settings.languageTool.rbacHint",
1114
+ 'Only roles with the "Use the grammar check (LanguageTool)" permission see the check. Checks per editor are limited to {count} per minute. Private or http servers need languageTool.allowPrivateBaseUrl in config/plugins.js ({state}).',
1115
+ {
1116
+ count: environment.requestsPerMinute,
1117
+ state: environment.allowPrivateBaseUrl ? t("settings.languageTool.private.on", "allowed") : t("settings.languageTool.private.off", "not allowed")
1118
+ }
1119
+ ) })
1120
+ ]
1121
+ }
1122
+ );
1123
+ };
736
1124
  const RBAC = [...index.PERMISSIONS.settingsRead, ...index.PERMISSIONS.settingsUpdate];
737
1125
  const testErrorText = (t, code) => {
738
1126
  switch (code) {
@@ -752,6 +1140,30 @@ const testErrorText = (t, code) => {
752
1140
  return t("settings.test.failed", "Connection failed. Check the provider, base URL, model and key.");
753
1141
  }
754
1142
  };
1143
+ const languageToolErrorText = (t, code) => {
1144
+ switch (code) {
1145
+ case "AUTH_FAILED":
1146
+ return t(
1147
+ "settings.languageTool.test.auth",
1148
+ "Connection failed: LanguageTool rejected the user name or key."
1149
+ );
1150
+ case "PROVIDER_RATE_LIMIT":
1151
+ return t(
1152
+ "settings.languageTool.test.rateLimit",
1153
+ "Connection failed: LanguageTool is busy or rate limited."
1154
+ );
1155
+ case "TIMEOUT":
1156
+ return t(
1157
+ "settings.languageTool.test.timeout",
1158
+ "Connection failed: LanguageTool did not answer in time."
1159
+ );
1160
+ default:
1161
+ return t(
1162
+ "settings.languageTool.test.failed",
1163
+ "Connection failed. Check the base URL and, for hosted accounts, the user name and key."
1164
+ );
1165
+ }
1166
+ };
755
1167
  const ConfigurationPage = () => {
756
1168
  const t = useT.useT();
757
1169
  const { toggleNotification } = admin.useNotification();
@@ -826,6 +1238,22 @@ const ConfigurationPage = () => {
826
1238
  toggleNotification({ type: "danger", message: testErrorText(t, result.code) });
827
1239
  }
828
1240
  };
1241
+ const onTestLanguageTool = async () => {
1242
+ const result = await form.testLanguageTool();
1243
+ if (result.ok) {
1244
+ toggleNotification({
1245
+ type: "success",
1246
+ message: t("settings.languageTool.test.success", "Connection works. LanguageTool answered.")
1247
+ });
1248
+ } else if (result.invalid) {
1249
+ toggleNotification({
1250
+ type: "warning",
1251
+ message: t("settings.test.invalid", "Fix the highlighted fields before testing.")
1252
+ });
1253
+ } else {
1254
+ toggleNotification({ type: "danger", message: languageToolErrorText(t, result.code) });
1255
+ }
1256
+ };
829
1257
  return /* @__PURE__ */ jsxRuntime.jsxs(
830
1258
  useT.PageShell,
831
1259
  {
@@ -848,7 +1276,7 @@ const ConfigurationPage = () => {
848
1276
  }
849
1277
  ),
850
1278
  secondaryAction: readOnly ? null : /* @__PURE__ */ jsxRuntime.jsx(
851
- useT.ConfirmAction,
1279
+ ConfirmAction.ConfirmAction,
852
1280
  {
853
1281
  disabled: !form.dirty || form.saving,
854
1282
  trigger: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", disabled: !form.dirty || form.saving, children: t("settings.discard", "Discard changes") }),
@@ -874,10 +1302,11 @@ const ConfigurationPage = () => {
874
1302
  }
875
1303
  ) : null,
876
1304
  /* @__PURE__ */ jsxRuntime.jsx(AiSection, { form, readOnly, onTest }),
1305
+ /* @__PURE__ */ jsxRuntime.jsx(LanguageToolSection, { form, readOnly, onTest: onTestLanguageTool }),
877
1306
  /* @__PURE__ */ jsxRuntime.jsx(EnvironmentSection, { environment: form.dto.environment }),
878
1307
  /* @__PURE__ */ jsxRuntime.jsx(CspSection, { csp: form.dto.environment && form.dto.environment.csp }),
879
1308
  /* @__PURE__ */ jsxRuntime.jsxs(admin.Form, { method: "PUT", initialValues: form.saved, children: [
880
- /* @__PURE__ */ jsxRuntime.jsx(DraftSync, { values: form.draft }),
1309
+ /* @__PURE__ */ jsxRuntime.jsx(DraftSync.DraftSync, { values: form.draft }),
881
1310
  /* @__PURE__ */ jsxRuntime.jsx(admin.Blocker, {})
882
1311
  ] })
883
1312
  ]