magic-editor-x 2.3.1 → 2.4.0
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.
- package/CHANGELOG.md +74 -0
- package/README.md +299 -142
- package/dist/admin/AuditPage-C2u6z4aN.js +381 -0
- package/dist/admin/AuditPage-guB0SiGS.mjs +381 -0
- package/dist/admin/{ConfigurationPage-CFP3lp9p.js → ConfigurationPage-D6uya-J1.js} +228 -13
- package/dist/admin/{ConfigurationPage-CYGDLjM7.mjs → ConfigurationPage-DiEpF1Rr.mjs} +222 -7
- package/dist/admin/ConfirmAction-CUhpngYU.js +71 -0
- package/dist/admin/ConfirmAction-CZjpduc3.mjs +72 -0
- package/dist/admin/{CustomBlocksPage-B5Q33N-s.mjs → CustomBlocksPage-Byt10-6c.mjs} +6 -4
- package/dist/admin/{CustomBlocksPage-DzPOSpfn.js → CustomBlocksPage-DP3h_wNd.js} +21 -19
- package/dist/admin/MentionsWidget-C2OCAmqq.js +227 -0
- package/dist/admin/MentionsWidget-sMkM9mHX.mjs +225 -0
- package/dist/admin/{TemplatesPage-BVkgafCK.js → TemplatesPage-DrSJdteI.js} +313 -17
- package/dist/admin/{TemplatesPage-4A8JNO_Z.mjs → TemplatesPage-Yp4OqFE2.mjs} +305 -9
- package/dist/admin/{ConfirmAction-DuQwvRYi.mjs → api-2ZRpHM3d.mjs} +19 -70
- package/dist/admin/{ConfirmAction-zLuIFj8t.js → api-bix9RLLI.js} +19 -70
- package/dist/admin/auditText-DIIYVR6k.mjs +110 -0
- package/dist/admin/auditText-DUhWu2Nx.js +109 -0
- package/dist/admin/comments-C7P41lan.js +86 -0
- package/dist/admin/comments-hfIbLQNO.mjs +87 -0
- package/dist/admin/{de-BMY2LBaa.mjs → de-BNPIGqhs.mjs} +41 -2
- package/dist/admin/{de-2Ie5jy7j.js → de-BhhGss1l.js} +41 -2
- package/dist/admin/{de-DOiGaTNX.mjs → de-CKz6CG3V.mjs} +191 -5
- package/dist/admin/{de-C3AsGauQ.js → de-CbBDnXeT.js} +140 -1
- package/dist/admin/{de-BUS1hUw0.mjs → de-DiCZrmH8.mjs} +140 -1
- package/dist/admin/{de-B1X46JJZ.js → de-zcV8D7nt.js} +191 -5
- package/dist/admin/{en-Ah-Cw0Wd.js → en-B9ApE1y1.js} +41 -2
- package/dist/admin/{en-CDg_18Bt.js → en-BMWhILnj.js} +191 -5
- package/dist/admin/{en-BkEjpC3i.js → en-CpehF0Kv.js} +140 -1
- package/dist/admin/{en-GCzgS9Aw.mjs → en-DCPMqFIa.mjs} +140 -1
- package/dist/admin/{en-CU6UzV4g.mjs → en-cYzqbASF.mjs} +191 -5
- package/dist/admin/{en-CvFiqti2.mjs → en-gFLeK9Ng.mjs} +41 -2
- package/dist/admin/{es-DbKHZz5l.mjs → es-BmwBgEgz.mjs} +41 -2
- package/dist/admin/{es-Cr8JH85N.js → es-C0W31rl8.js} +41 -2
- package/dist/admin/{es-BCpJmUEM.js → es-CQPh8PXw.js} +191 -5
- package/dist/admin/{es-C4pEnDRv.js → es-CawpzwyC.js} +140 -1
- package/dist/admin/{es-DHBBZKl2.mjs → es-Chs37IBR.mjs} +140 -1
- package/dist/admin/{es-BmfffNM2.mjs → es-DCamt1ek.mjs} +191 -5
- package/dist/admin/{fr-DQJ_7aq5.mjs → fr-CMWBNE5D.mjs} +41 -2
- package/dist/admin/{fr-C2aLSwEu.js → fr-COOsqexl.js} +140 -1
- package/dist/admin/{fr-Dvq4xk2e.mjs → fr-Dp5-XP29.mjs} +140 -1
- package/dist/admin/{fr-ZcN0yM_2.js → fr-DpC44Ol8.js} +191 -5
- package/dist/admin/{fr-OJ4VW1kh.js → fr-iGeIfEcU.js} +41 -2
- package/dist/admin/{fr-DZd2XJP6.mjs → fr-oW0t8bT5.mjs} +191 -5
- package/dist/admin/{index-DQVE0ymw.js → index-64wc26Bl.js} +17467 -10369
- package/dist/admin/{index-k8_a5o1A.mjs → index-BVjf1gVC.mjs} +13786 -6687
- package/dist/admin/{index-DR8sHkTk.js → index-D6Z7i8ba.js} +1003 -53
- package/dist/admin/{index-My6FjjHB.mjs → index-D_Fv8Non.mjs} +1032 -82
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.mjs +3 -2
- package/dist/admin/math-CIQ4Z_mY.mjs +47 -0
- package/dist/admin/math-vsK_06ZR.js +49 -0
- package/dist/admin/{pt-D0I0_JYs.js → pt-BHmXk2d9.js} +41 -2
- package/dist/admin/{pt-CImqDnLB.js → pt-Bo0Pm_Pt.js} +191 -5
- package/dist/admin/{pt-CilDggGF.mjs → pt-DALDvfBn.mjs} +140 -1
- package/dist/admin/{pt-BSLzA17U.mjs → pt-DFNgZ5_k.mjs} +41 -2
- package/dist/admin/{pt-DX0OAIoL.js → pt-DXy7G1x7.js} +140 -1
- package/dist/admin/{pt-C3UdeIpd.mjs → pt-uGpfRQLC.mjs} +191 -5
- package/dist/admin/{useT-DNphiBQR.js → useT-BXJLIPN4.js} +1 -1
- package/dist/admin/{useT-Cmg1jwwG.mjs → useT-CLPhBmBC.mjs} +1 -1
- package/dist/blocks/index.d.mts +2 -0
- package/dist/blocks/index.d.ts +2 -0
- package/dist/blocks/index.js +13 -2
- package/dist/blocks/index.mjs +13 -2
- package/dist/math/index.d.mts +27 -0
- package/dist/math/index.d.ts +27 -0
- package/dist/math/index.js +164 -0
- package/dist/math/index.mjs +134 -0
- package/dist/react/index.js +673 -91
- package/dist/react/index.mjs +673 -91
- package/dist/render/index.d.mts +26 -0
- package/dist/render/index.d.ts +26 -0
- package/dist/render/index.js +779 -106
- package/dist/render/index.mjs +779 -106
- package/dist/server/index.js +10419 -4103
- package/dist/server/index.mjs +10419 -4103
- package/dist/vue/index.js +673 -91
- package/dist/vue/index.mjs +673 -91
- package/package.json +8 -2
- package/schema/magic-editor-x.schema.json +127 -2
- package/types/blocks.d.ts +2 -0
- package/types/index.d.ts +42 -0
- package/types/math.d.ts +27 -0
- package/types/render.d.ts +26 -0
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useEffect, useCallback, useMemo } from "react";
|
|
3
3
|
import { useSearchParams } from "react-router-dom";
|
|
4
|
-
import { Flex, Box, Badge, Typography, Table, Thead, Tr, Th, VisuallyHidden, Tbody, Td, Switch, IconButton, Loader, Button,
|
|
5
|
-
import { Eye, Pencil, Duplicate, ArrowUp, ArrowDown, Trash, ArrowLeft, Check, Plus } from "@strapi/icons";
|
|
4
|
+
import { Flex, Box, Badge, Typography, Table, Thead, Tr, Th, VisuallyHidden, Tbody, Td, Switch, IconButton, Loader, Button, Field, TextInput, Tabs, Dialog, Alert, Grid, Radio, Textarea, MultiSelect, MultiSelectOption, EmptyStateLayout, SingleSelect, SingleSelectOption, Modal } from "@strapi/design-system";
|
|
5
|
+
import { Eye, Pencil, Duplicate, ArrowUp, ArrowDown, Trash, ArrowClockwise, ArrowLeft, Check, Plus } from "@strapi/icons";
|
|
6
6
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
7
|
-
import { useFetchClient, Form, Blocker,
|
|
8
|
-
import { P as PERMISSIONS } from "./index-
|
|
9
|
-
import { A as API,
|
|
10
|
-
import { u as useT,
|
|
7
|
+
import { useFetchClient, useNotification, ConfirmDialog, Form, Blocker, useRBAC, Page } from "@strapi/strapi/admin";
|
|
8
|
+
import { P as PERMISSIONS } from "./index-D_Fv8Non.mjs";
|
|
9
|
+
import { A as API, r as readApiError } from "./api-2ZRpHM3d.mjs";
|
|
10
|
+
import { u as useT, S as SectionCard, P as PageShell } from "./useT-CLPhBmBC.mjs";
|
|
11
|
+
import { C as ConfirmAction, r as refocusIfLost } from "./ConfirmAction-CZjpduc3.mjs";
|
|
11
12
|
import "styled-components";
|
|
12
|
-
import { n as normalizeScope, T as TEMPLATE_LIMITS, i as isEmptyDocument, c as containsSynced, P as PRESET_NAMES, E as EditorFieldBody, R as RenderedContent, r as resetEditorConfigCache } from "./index-
|
|
13
|
+
import { n as normalizeScope, T as TEMPLATE_LIMITS, i as isEmptyDocument, c as containsSynced, V as VersionDiff, p as previewLines, P as PRESET_NAMES, E as EditorFieldBody, R as RenderedContent, r as resetEditorConfigCache } from "./index-BVjf1gVC.mjs";
|
|
13
14
|
import { u as useBreakpoint } from "./useBreakpoint-DCfn6pDG.mjs";
|
|
14
15
|
import { D as DraftSync } from "./DraftSync-CUxOMG-E.mjs";
|
|
16
|
+
import { useIntl } from "react-intl";
|
|
15
17
|
const fieldKey = (entry) => `${entry.uid}|${entry.field}`;
|
|
16
18
|
const fieldFromKey = (key) => {
|
|
17
19
|
const [uid, field] = String(key).split("|");
|
|
@@ -397,6 +399,293 @@ const TemplateList = ({ templates, busyId, onToggle, ...actions }) => {
|
|
|
397
399
|
] }, template.id)) })
|
|
398
400
|
] });
|
|
399
401
|
};
|
|
402
|
+
const MAX_LABEL_LENGTH = 120;
|
|
403
|
+
const TRIGGERS = {
|
|
404
|
+
manual: { key: "settings.syncedVersions.trigger.manual", text: "Saved" },
|
|
405
|
+
restore: { key: "settings.syncedVersions.trigger.restore", text: "Restored" }
|
|
406
|
+
};
|
|
407
|
+
const SyncedVersions = ({ template, current, dirty, onRestored }) => {
|
|
408
|
+
const t = useT();
|
|
409
|
+
const { formatDate } = useIntl();
|
|
410
|
+
const { get, put, post } = useFetchClient();
|
|
411
|
+
const { toggleNotification } = useNotification();
|
|
412
|
+
const [state, setState] = useState({ loading: true, error: false, items: [] });
|
|
413
|
+
const [preview, setPreview] = useState(null);
|
|
414
|
+
const [tab, setTab] = useState("preview");
|
|
415
|
+
const [renaming, setRenaming] = useState(null);
|
|
416
|
+
const [renameBusy, setRenameBusy] = useState(false);
|
|
417
|
+
const [confirm, setConfirm] = useState(null);
|
|
418
|
+
const [restoring, setRestoring] = useState(false);
|
|
419
|
+
const renameButtons = useRef(/* @__PURE__ */ new Map());
|
|
420
|
+
const fetchList = useCallback(
|
|
421
|
+
() => get(API.templateVersions(template.id)).then(
|
|
422
|
+
({ data }) => setState({ loading: false, error: false, items: data.data || [] }),
|
|
423
|
+
() => setState((value) => ({ ...value, loading: false, error: true }))
|
|
424
|
+
),
|
|
425
|
+
[get, template.id]
|
|
426
|
+
);
|
|
427
|
+
useEffect(() => {
|
|
428
|
+
fetchList();
|
|
429
|
+
}, [fetchList, template.updatedAt]);
|
|
430
|
+
const reload = () => {
|
|
431
|
+
setState((value) => ({ ...value, loading: true, error: false }));
|
|
432
|
+
return fetchList();
|
|
433
|
+
};
|
|
434
|
+
const showPreview = async (item) => {
|
|
435
|
+
if (preview && preview.item.id === item.id) {
|
|
436
|
+
setPreview(null);
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
setTab("preview");
|
|
440
|
+
setPreview({ item, loading: true });
|
|
441
|
+
try {
|
|
442
|
+
const { data } = await get(API.templateVersion(template.id, item.id));
|
|
443
|
+
setPreview({
|
|
444
|
+
item,
|
|
445
|
+
loading: false,
|
|
446
|
+
content: data.data.content,
|
|
447
|
+
lines: previewLines(data.data.content)
|
|
448
|
+
});
|
|
449
|
+
} catch {
|
|
450
|
+
setPreview({ item, loading: false, error: true });
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
const endRename = (id) => {
|
|
454
|
+
setRenaming(null);
|
|
455
|
+
window.requestAnimationFrame(() => {
|
|
456
|
+
const button = renameButtons.current.get(id);
|
|
457
|
+
if (button) button.focus();
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
const saveRename = async (event) => {
|
|
461
|
+
if (event) event.preventDefault();
|
|
462
|
+
if (!renaming || renameBusy || renaming.value.trim().length > MAX_LABEL_LENGTH) return;
|
|
463
|
+
setRenameBusy(true);
|
|
464
|
+
try {
|
|
465
|
+
await put(API.templateVersion(template.id, renaming.id), { label: renaming.value.trim() || null });
|
|
466
|
+
toggleNotification({
|
|
467
|
+
type: "success",
|
|
468
|
+
message: t("settings.syncedVersions.renamed", "Version name saved.")
|
|
469
|
+
});
|
|
470
|
+
const id = renaming.id;
|
|
471
|
+
await reload();
|
|
472
|
+
endRename(id);
|
|
473
|
+
} catch (error) {
|
|
474
|
+
toggleNotification({
|
|
475
|
+
type: "danger",
|
|
476
|
+
message: readApiError(error).message || t("settings.syncedVersions.renameFailed", "The name could not be saved.")
|
|
477
|
+
});
|
|
478
|
+
} finally {
|
|
479
|
+
setRenameBusy(false);
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
const restore = async () => {
|
|
483
|
+
const item = confirm;
|
|
484
|
+
setRestoring(true);
|
|
485
|
+
try {
|
|
486
|
+
const { data } = await post(API.templateVersionRestore(template.id, item.id), {});
|
|
487
|
+
toggleNotification({
|
|
488
|
+
type: "success",
|
|
489
|
+
message: t(
|
|
490
|
+
"settings.syncedVersions.restored",
|
|
491
|
+
"Version {version} restored. Every field that uses this synced block shows it now.",
|
|
492
|
+
{ version: item.version }
|
|
493
|
+
)
|
|
494
|
+
});
|
|
495
|
+
setConfirm(null);
|
|
496
|
+
onRestored(data.data);
|
|
497
|
+
} catch (error) {
|
|
498
|
+
const info = readApiError(error);
|
|
499
|
+
toggleNotification({
|
|
500
|
+
type: "danger",
|
|
501
|
+
message: info.status === 400 ? t(
|
|
502
|
+
"settings.syncedVersions.restoreInvalid",
|
|
503
|
+
'This version cannot be restored with the current settings (for example a field in "Where it is offered" no longer exists).'
|
|
504
|
+
) : t("settings.syncedVersions.restoreFailed", "This version could not be restored.")
|
|
505
|
+
});
|
|
506
|
+
} finally {
|
|
507
|
+
setRestoring(false);
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
return /* @__PURE__ */ jsxs(
|
|
511
|
+
SectionCard,
|
|
512
|
+
{
|
|
513
|
+
title: t("settings.syncedVersions.title", "Versions"),
|
|
514
|
+
subtitle: t(
|
|
515
|
+
"settings.syncedVersions.subtitle",
|
|
516
|
+
"Every save of this synced block is kept as a version. Restoring a version saves it again as the newest one."
|
|
517
|
+
),
|
|
518
|
+
children: [
|
|
519
|
+
state.loading ? /* @__PURE__ */ jsx(Flex, { justifyContent: "center", padding: 4, children: /* @__PURE__ */ jsx(Loader, { small: true, children: t("settings.syncedVersions.loading", "Loading versions") }) }) : null,
|
|
520
|
+
state.error ? /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 2, children: [
|
|
521
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "danger600", children: t("settings.syncedVersions.error", "Versions could not be loaded.") }),
|
|
522
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", startIcon: /* @__PURE__ */ jsx(ArrowClockwise, {}), onClick: reload, children: t("settings.retry", "Try again") })
|
|
523
|
+
] }) : null,
|
|
524
|
+
!state.loading && !state.error && state.items.length === 0 ? /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: t("settings.syncedVersions.empty", "No versions yet. They are created when you save.") }) : null,
|
|
525
|
+
!state.error && state.items.length > 0 ? /* @__PURE__ */ jsx(
|
|
526
|
+
Flex,
|
|
527
|
+
{
|
|
528
|
+
tag: "ul",
|
|
529
|
+
direction: "column",
|
|
530
|
+
alignItems: "stretch",
|
|
531
|
+
gap: 2,
|
|
532
|
+
"aria-label": t("settings.syncedVersions.listLabel", "Versions of this synced block"),
|
|
533
|
+
children: state.items.map((item, index) => {
|
|
534
|
+
const trigger = TRIGGERS[item.trigger] || TRIGGERS.manual;
|
|
535
|
+
const when = item.createdAt ? formatDate(new Date(item.createdAt), { dateStyle: "medium", timeStyle: "short" }) : "";
|
|
536
|
+
const versionText = t("settings.syncedVersions.version", "Version {version}", {
|
|
537
|
+
version: item.version
|
|
538
|
+
});
|
|
539
|
+
return /* @__PURE__ */ jsxs(
|
|
540
|
+
Box,
|
|
541
|
+
{
|
|
542
|
+
tag: "li",
|
|
543
|
+
padding: 3,
|
|
544
|
+
hasRadius: true,
|
|
545
|
+
borderColor: "neutral200",
|
|
546
|
+
background: "neutral0",
|
|
547
|
+
children: [
|
|
548
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 3, justifyContent: "space-between", wrap: "wrap", children: [
|
|
549
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, flex: "1 1 20rem", children: [
|
|
550
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", minWidth: 0, children: [
|
|
551
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", style: { overflowWrap: "anywhere" }, children: item.label || versionText }),
|
|
552
|
+
item.label ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: versionText }) : null,
|
|
553
|
+
/* @__PURE__ */ jsx(Badge, { children: t(trigger.key, trigger.text) }),
|
|
554
|
+
index === 0 ? /* @__PURE__ */ jsx(Badge, { backgroundColor: "success100", textColor: "success700", children: t("settings.syncedVersions.current", "Current") }) : null
|
|
555
|
+
] }),
|
|
556
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", style: { overflowWrap: "anywhere" }, children: item.createdBy ? t("settings.syncedVersions.byline", "{date} by {name}", {
|
|
557
|
+
date: when,
|
|
558
|
+
name: item.createdBy.name
|
|
559
|
+
}) : when }),
|
|
560
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", style: { overflowWrap: "anywhere" }, children: t(
|
|
561
|
+
"settings.syncedVersions.details",
|
|
562
|
+
"{name} · {blocks, plural, one {# block} other {# blocks}}",
|
|
563
|
+
{ name: item.name, blocks: item.blockCount }
|
|
564
|
+
) })
|
|
565
|
+
] }),
|
|
566
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", children: [
|
|
567
|
+
/* @__PURE__ */ jsx(
|
|
568
|
+
IconButton,
|
|
569
|
+
{
|
|
570
|
+
label: t("settings.syncedVersions.preview", "Preview version {version}", {
|
|
571
|
+
version: item.version
|
|
572
|
+
}),
|
|
573
|
+
variant: "tertiary",
|
|
574
|
+
"aria-expanded": Boolean(preview && preview.item.id === item.id),
|
|
575
|
+
onClick: () => showPreview(item),
|
|
576
|
+
children: /* @__PURE__ */ jsx(Eye, {})
|
|
577
|
+
}
|
|
578
|
+
),
|
|
579
|
+
/* @__PURE__ */ jsx(
|
|
580
|
+
IconButton,
|
|
581
|
+
{
|
|
582
|
+
ref: (node) => {
|
|
583
|
+
if (node) renameButtons.current.set(item.id, node);
|
|
584
|
+
else renameButtons.current.delete(item.id);
|
|
585
|
+
},
|
|
586
|
+
label: t("settings.syncedVersions.rename", "Rename version {version}", {
|
|
587
|
+
version: item.version
|
|
588
|
+
}),
|
|
589
|
+
variant: "tertiary",
|
|
590
|
+
onClick: () => setRenaming({ id: item.id, value: item.label || "" }),
|
|
591
|
+
children: /* @__PURE__ */ jsx(Pencil, {})
|
|
592
|
+
}
|
|
593
|
+
),
|
|
594
|
+
index > 0 ? /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => setConfirm(item), children: t("settings.syncedVersions.restore", "Restore") }) : null
|
|
595
|
+
] })
|
|
596
|
+
] }),
|
|
597
|
+
renaming && renaming.id === item.id ? /* @__PURE__ */ jsx(Box, { tag: "form", marginTop: 3, onSubmit: saveRename, noValidate: true, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
598
|
+
/* @__PURE__ */ jsxs(
|
|
599
|
+
Field.Root,
|
|
600
|
+
{
|
|
601
|
+
name: `mex-synced-version-label-${item.id}`,
|
|
602
|
+
hint: t("settings.syncedVersions.renameHint", "Leave empty to remove the name."),
|
|
603
|
+
error: renaming.value.trim().length > MAX_LABEL_LENGTH ? t("settings.syncedVersions.labelTooLong", "Use 120 characters or fewer.") : void 0,
|
|
604
|
+
children: [
|
|
605
|
+
/* @__PURE__ */ jsx(Field.Label, { children: t("settings.syncedVersions.renameLabel", "Version name") }),
|
|
606
|
+
/* @__PURE__ */ jsx(
|
|
607
|
+
TextInput,
|
|
608
|
+
{
|
|
609
|
+
autoFocus: true,
|
|
610
|
+
value: renaming.value,
|
|
611
|
+
onChange: (event) => setRenaming({ ...renaming, value: event.target.value }),
|
|
612
|
+
onKeyDown: (event) => {
|
|
613
|
+
if (event.key === "Escape") {
|
|
614
|
+
event.preventDefault();
|
|
615
|
+
event.stopPropagation();
|
|
616
|
+
endRename(item.id);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
),
|
|
621
|
+
/* @__PURE__ */ jsx(Field.Hint, {}),
|
|
622
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
623
|
+
]
|
|
624
|
+
}
|
|
625
|
+
),
|
|
626
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", children: [
|
|
627
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", size: "S", loading: renameBusy, children: t("settings.syncedVersions.renameSave", "Save name") }),
|
|
628
|
+
/* @__PURE__ */ jsx(Button, { type: "button", size: "S", variant: "tertiary", onClick: () => endRename(item.id), children: t("settings.syncedVersions.renameCancel", "Cancel") })
|
|
629
|
+
] })
|
|
630
|
+
] }) }) : null,
|
|
631
|
+
preview && preview.item.id === item.id ? /* @__PURE__ */ jsxs(Box, { marginTop: 3, padding: 3, background: "neutral100", hasRadius: true, minWidth: 0, children: [
|
|
632
|
+
preview.loading ? /* @__PURE__ */ jsx(Loader, { small: true, children: t("settings.syncedVersions.previewLoading", "Loading preview") }) : null,
|
|
633
|
+
preview.error ? /* @__PURE__ */ jsx(Typography, { textColor: "danger600", children: t("settings.syncedVersions.previewError", "The preview could not be loaded.") }) : null,
|
|
634
|
+
preview.content ? /* @__PURE__ */ jsxs(Tabs.Root, { value: tab, onValueChange: setTab, children: [
|
|
635
|
+
/* @__PURE__ */ jsxs(Tabs.List, { "aria-label": t("settings.syncedVersions.tabs", "Version views"), children: [
|
|
636
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { value: "preview", children: t("settings.syncedVersions.tab.preview", "Preview") }),
|
|
637
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { value: "changes", children: t("settings.syncedVersions.tab.changes", "Changes") })
|
|
638
|
+
] }),
|
|
639
|
+
/* @__PURE__ */ jsx(Tabs.Content, { value: "preview", children: /* @__PURE__ */ jsx(Box, { paddingTop: 3, children: preview.lines.map((line, lineIndex) => /* @__PURE__ */ jsx(
|
|
640
|
+
Typography,
|
|
641
|
+
{
|
|
642
|
+
tag: "p",
|
|
643
|
+
variant: "pi",
|
|
644
|
+
textColor: "neutral800",
|
|
645
|
+
style: { overflowWrap: "anywhere" },
|
|
646
|
+
children: line
|
|
647
|
+
},
|
|
648
|
+
lineIndex
|
|
649
|
+
)) }) }),
|
|
650
|
+
/* @__PURE__ */ jsx(Tabs.Content, { value: "changes", children: /* @__PURE__ */ jsx(Box, { paddingTop: 3, children: tab === "changes" ? /* @__PURE__ */ jsx(
|
|
651
|
+
VersionDiff,
|
|
652
|
+
{
|
|
653
|
+
t,
|
|
654
|
+
version: preview.content,
|
|
655
|
+
current: current || { blocks: [] },
|
|
656
|
+
versionNumber: item.version,
|
|
657
|
+
canRestore: false
|
|
658
|
+
}
|
|
659
|
+
) : null }) })
|
|
660
|
+
] }) : null
|
|
661
|
+
] }) : null
|
|
662
|
+
]
|
|
663
|
+
},
|
|
664
|
+
item.id
|
|
665
|
+
);
|
|
666
|
+
})
|
|
667
|
+
}
|
|
668
|
+
) : null,
|
|
669
|
+
/* @__PURE__ */ jsx(Dialog.Root, { open: Boolean(confirm), onOpenChange: (open) => !open && !restoring && setConfirm(null), children: confirm ? /* @__PURE__ */ jsx(
|
|
670
|
+
ConfirmDialog,
|
|
671
|
+
{
|
|
672
|
+
title: t("settings.syncedVersions.confirmTitle", "Restore version {version}?", {
|
|
673
|
+
version: confirm.version
|
|
674
|
+
}),
|
|
675
|
+
endAction: /* @__PURE__ */ jsx(Button, { variant: "danger-light", loading: restoring, onClick: restore, children: t("settings.syncedVersions.restore", "Restore") }),
|
|
676
|
+
children: dirty ? t(
|
|
677
|
+
"settings.syncedVersions.confirmBodyDirty",
|
|
678
|
+
"The synced block is saved with the content of this version, and every field that uses it shows it at once. Your unsaved changes in this form are lost."
|
|
679
|
+
) : t(
|
|
680
|
+
"settings.syncedVersions.confirmBody",
|
|
681
|
+
"The synced block is saved with the content of this version, and every field that uses it shows it at once."
|
|
682
|
+
)
|
|
683
|
+
}
|
|
684
|
+
) : null })
|
|
685
|
+
]
|
|
686
|
+
}
|
|
687
|
+
);
|
|
688
|
+
};
|
|
400
689
|
const EDITOR_TARGET = Object.freeze({
|
|
401
690
|
uid: null,
|
|
402
691
|
documentId: null,
|
|
@@ -428,7 +717,7 @@ const errorText = (t, code) => {
|
|
|
428
717
|
});
|
|
429
718
|
return code;
|
|
430
719
|
};
|
|
431
|
-
const TemplateEditor = ({ template, targets, onRetryTargets, onSubmit, onBack }) => {
|
|
720
|
+
const TemplateEditor = ({ template, targets, onRetryTargets, onSubmit, onBack, onRestored }) => {
|
|
432
721
|
const t = useT();
|
|
433
722
|
const saved = useMemo(() => template ? fromDto(template) : emptyValues(), [template]);
|
|
434
723
|
const [values, setValues] = useState(saved);
|
|
@@ -712,6 +1001,7 @@ const TemplateEditor = ({ template, targets, onRetryTargets, onSubmit, onBack })
|
|
|
712
1001
|
)
|
|
713
1002
|
}
|
|
714
1003
|
),
|
|
1004
|
+
savedSynced && onRestored ? /* @__PURE__ */ jsx(SyncedVersions, { template, current: values.blocks, dirty, onRestored }) : null,
|
|
715
1005
|
/* @__PURE__ */ jsxs(Form, { method: "PUT", initialValues: savedKey, children: [
|
|
716
1006
|
/* @__PURE__ */ jsx(DraftSync, { values: draftKey }),
|
|
717
1007
|
/* @__PURE__ */ jsx(Blocker, {})
|
|
@@ -817,6 +1107,11 @@ const TemplatesPage = () => {
|
|
|
817
1107
|
return { ok: false };
|
|
818
1108
|
}
|
|
819
1109
|
};
|
|
1110
|
+
const onRestored = async (template) => {
|
|
1111
|
+
resetEditorConfigCache();
|
|
1112
|
+
await data.reload();
|
|
1113
|
+
setEditing({ template, key: `${template.id}:${template.updatedAt || Date.now()}` });
|
|
1114
|
+
};
|
|
820
1115
|
if (editing) {
|
|
821
1116
|
return /* @__PURE__ */ jsx(
|
|
822
1117
|
TemplateEditor,
|
|
@@ -825,7 +1120,8 @@ const TemplatesPage = () => {
|
|
|
825
1120
|
targets: data.targets,
|
|
826
1121
|
onRetryTargets: data.reloadTargets,
|
|
827
1122
|
onSubmit,
|
|
828
|
-
onBack: backToList
|
|
1123
|
+
onBack: backToList,
|
|
1124
|
+
onRestored
|
|
829
1125
|
},
|
|
830
1126
|
editing.key
|
|
831
1127
|
);
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef } from "react";
|
|
3
|
-
import { Dialog, Button } from "@strapi/design-system";
|
|
4
|
-
import { ConfirmDialog } from "@strapi/strapi/admin";
|
|
5
1
|
const API = {
|
|
6
2
|
config: "/magic-editor-x/config",
|
|
7
3
|
link: "/magic-editor-x/link",
|
|
8
4
|
imageByFile: "/magic-editor-x/image/byFile",
|
|
9
5
|
imageByUrl: "/magic-editor-x/image/byUrl",
|
|
10
6
|
fileUpload: "/magic-editor-x/file/upload",
|
|
7
|
+
mediaByUrl: "/magic-editor-x/media/byUrl",
|
|
11
8
|
contentTypes: "/magic-editor-x/content-types",
|
|
12
9
|
linkTypes: "/magic-editor-x/links/types",
|
|
13
10
|
linkSearch: "/magic-editor-x/links/search",
|
|
@@ -25,18 +22,36 @@ const API = {
|
|
|
25
22
|
ai: (action) => `/magic-editor-x/ai/${encodeURIComponent(action)}`,
|
|
26
23
|
aiAltText: "/magic-editor-x/ai/image/alt-text",
|
|
27
24
|
aiField: (action) => `/magic-editor-x/ai/field/${encodeURIComponent(action)}`,
|
|
25
|
+
aiBlocks: (action) => `/magic-editor-x/ai/blocks/${encodeURIComponent(action)}`,
|
|
28
26
|
grammarCheck: "/magic-editor-x/grammar/check",
|
|
29
27
|
comments: "/magic-editor-x/comments",
|
|
30
28
|
comment: (id) => `/magic-editor-x/comments/${encodeURIComponent(id)}`,
|
|
31
29
|
commentReplies: (id) => `/magic-editor-x/comments/${encodeURIComponent(id)}/replies`,
|
|
32
30
|
commentResolve: (id) => `/magic-editor-x/comments/${encodeURIComponent(id)}/resolve`,
|
|
33
31
|
commentReopen: (id) => `/magic-editor-x/comments/${encodeURIComponent(id)}/reopen`,
|
|
32
|
+
// 2.4: @mentions and notifications.
|
|
33
|
+
commentMentionable: "/magic-editor-x/comments/mentionable",
|
|
34
|
+
notifications: "/magic-editor-x/notifications",
|
|
35
|
+
notificationsReadAll: "/magic-editor-x/notifications/read-all",
|
|
36
|
+
notificationRead: (id) => `/magic-editor-x/notifications/${encodeURIComponent(id)}/read`,
|
|
37
|
+
notificationUnread: (id) => `/magic-editor-x/notifications/${encodeURIComponent(id)}/unread`,
|
|
38
|
+
suggestions: "/magic-editor-x/suggestions",
|
|
39
|
+
suggestion: (id) => `/magic-editor-x/suggestions/${encodeURIComponent(id)}`,
|
|
40
|
+
suggestionAccept: (id) => `/magic-editor-x/suggestions/${encodeURIComponent(id)}/accept`,
|
|
41
|
+
suggestionReject: (id) => `/magic-editor-x/suggestions/${encodeURIComponent(id)}/reject`,
|
|
34
42
|
templates: "/magic-editor-x/templates",
|
|
35
43
|
templateTargets: "/magic-editor-x/templates/targets",
|
|
36
44
|
templatesOrder: "/magic-editor-x/templates/order",
|
|
37
45
|
template: (id) => `/magic-editor-x/templates/${encodeURIComponent(id)}`,
|
|
38
46
|
templateDuplicate: (id) => `/magic-editor-x/templates/${encodeURIComponent(id)}/duplicate`,
|
|
39
47
|
templateUsage: (id) => `/magic-editor-x/templates/${encodeURIComponent(id)}/usage`,
|
|
48
|
+
templateVersions: (id) => `/magic-editor-x/templates/${encodeURIComponent(id)}/versions`,
|
|
49
|
+
templateVersion: (id, versionId) => `/magic-editor-x/templates/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}`,
|
|
50
|
+
templateVersionRestore: (id, versionId) => `/magic-editor-x/templates/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}/restore`,
|
|
51
|
+
audit: "/magic-editor-x/audit",
|
|
52
|
+
auditActors: "/magic-editor-x/audit/actors",
|
|
53
|
+
linkSchedule: "/magic-editor-x/quality/link-schedule",
|
|
54
|
+
linkScheduleRun: "/magic-editor-x/quality/link-schedule/run",
|
|
40
55
|
settings: "/magic-editor-x/settings",
|
|
41
56
|
settingsAiTest: "/magic-editor-x/settings/ai/test",
|
|
42
57
|
settingsLanguageToolTest: "/magic-editor-x/settings/language-tool/test"
|
|
@@ -53,73 +68,7 @@ const readApiError = (error) => {
|
|
|
53
68
|
details: apiError && apiError.details || null
|
|
54
69
|
};
|
|
55
70
|
};
|
|
56
|
-
const canTakeFocus = (el) => Boolean(
|
|
57
|
-
el && el.isConnected && typeof el.focus === "function" && !el.disabled && (typeof el.getAttribute !== "function" || el.getAttribute("aria-disabled") !== "true")
|
|
58
|
-
);
|
|
59
|
-
const pickFocusTarget = (opener, fallback) => {
|
|
60
|
-
if (canTakeFocus(opener)) return opener;
|
|
61
|
-
if (canTakeFocus(fallback)) return fallback;
|
|
62
|
-
return null;
|
|
63
|
-
};
|
|
64
|
-
const refocusIfLost = (opener, fallback, doc = globalThis.document) => {
|
|
65
|
-
if (!doc) return;
|
|
66
|
-
const active = doc.activeElement;
|
|
67
|
-
if (active && active !== doc.body) return;
|
|
68
|
-
const target = pickFocusTarget(opener, fallback);
|
|
69
|
-
if (target) target.focus();
|
|
70
|
-
};
|
|
71
|
-
const ConfirmAction = ({
|
|
72
|
-
trigger,
|
|
73
|
-
title,
|
|
74
|
-
body,
|
|
75
|
-
confirmLabel,
|
|
76
|
-
onConfirm,
|
|
77
|
-
variant = "danger",
|
|
78
|
-
disabled = false,
|
|
79
|
-
fallbackFocusRef
|
|
80
|
-
}) => {
|
|
81
|
-
const [open, setOpen] = useState(false);
|
|
82
|
-
const [busy, setBusy] = useState(false);
|
|
83
|
-
const triggerRef = useRef(null);
|
|
84
|
-
const restoreFocus = () => requestAnimationFrame(() => {
|
|
85
|
-
const active = document.activeElement;
|
|
86
|
-
if (active && active !== document.body) return;
|
|
87
|
-
const target = pickFocusTarget(triggerRef.current, fallbackFocusRef && fallbackFocusRef.current);
|
|
88
|
-
if (target) target.focus();
|
|
89
|
-
});
|
|
90
|
-
const onOpenChange = (next) => {
|
|
91
|
-
if (busy) return;
|
|
92
|
-
setOpen(next);
|
|
93
|
-
if (!next) restoreFocus();
|
|
94
|
-
};
|
|
95
|
-
const confirm = async (event) => {
|
|
96
|
-
if (event && typeof event.preventDefault === "function") event.preventDefault();
|
|
97
|
-
setBusy(true);
|
|
98
|
-
try {
|
|
99
|
-
await onConfirm();
|
|
100
|
-
setOpen(false);
|
|
101
|
-
restoreFocus();
|
|
102
|
-
} catch {
|
|
103
|
-
} finally {
|
|
104
|
-
setBusy(false);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
return /* @__PURE__ */ jsxs(Dialog.Root, { open, onOpenChange, children: [
|
|
108
|
-
/* @__PURE__ */ jsx(Dialog.Trigger, { ref: triggerRef, disabled, children: trigger }),
|
|
109
|
-
/* @__PURE__ */ jsx(
|
|
110
|
-
ConfirmDialog,
|
|
111
|
-
{
|
|
112
|
-
title,
|
|
113
|
-
variant,
|
|
114
|
-
endAction: /* @__PURE__ */ jsx(Button, { fullWidth: true, variant, onClick: confirm, loading: busy, disabled: busy, children: confirmLabel }),
|
|
115
|
-
children: body
|
|
116
|
-
}
|
|
117
|
-
)
|
|
118
|
-
] });
|
|
119
|
-
};
|
|
120
71
|
export {
|
|
121
72
|
API as A,
|
|
122
|
-
ConfirmAction as C,
|
|
123
|
-
refocusIfLost as a,
|
|
124
73
|
readApiError as r
|
|
125
74
|
};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const ReactNamespace = require("react");
|
|
4
|
-
const designSystem = require("@strapi/design-system");
|
|
5
|
-
const admin = require("@strapi/strapi/admin");
|
|
6
2
|
const API = {
|
|
7
3
|
config: "/magic-editor-x/config",
|
|
8
4
|
link: "/magic-editor-x/link",
|
|
9
5
|
imageByFile: "/magic-editor-x/image/byFile",
|
|
10
6
|
imageByUrl: "/magic-editor-x/image/byUrl",
|
|
11
7
|
fileUpload: "/magic-editor-x/file/upload",
|
|
8
|
+
mediaByUrl: "/magic-editor-x/media/byUrl",
|
|
12
9
|
contentTypes: "/magic-editor-x/content-types",
|
|
13
10
|
linkTypes: "/magic-editor-x/links/types",
|
|
14
11
|
linkSearch: "/magic-editor-x/links/search",
|
|
@@ -26,18 +23,36 @@ const API = {
|
|
|
26
23
|
ai: (action) => `/magic-editor-x/ai/${encodeURIComponent(action)}`,
|
|
27
24
|
aiAltText: "/magic-editor-x/ai/image/alt-text",
|
|
28
25
|
aiField: (action) => `/magic-editor-x/ai/field/${encodeURIComponent(action)}`,
|
|
26
|
+
aiBlocks: (action) => `/magic-editor-x/ai/blocks/${encodeURIComponent(action)}`,
|
|
29
27
|
grammarCheck: "/magic-editor-x/grammar/check",
|
|
30
28
|
comments: "/magic-editor-x/comments",
|
|
31
29
|
comment: (id) => `/magic-editor-x/comments/${encodeURIComponent(id)}`,
|
|
32
30
|
commentReplies: (id) => `/magic-editor-x/comments/${encodeURIComponent(id)}/replies`,
|
|
33
31
|
commentResolve: (id) => `/magic-editor-x/comments/${encodeURIComponent(id)}/resolve`,
|
|
34
32
|
commentReopen: (id) => `/magic-editor-x/comments/${encodeURIComponent(id)}/reopen`,
|
|
33
|
+
// 2.4: @mentions and notifications.
|
|
34
|
+
commentMentionable: "/magic-editor-x/comments/mentionable",
|
|
35
|
+
notifications: "/magic-editor-x/notifications",
|
|
36
|
+
notificationsReadAll: "/magic-editor-x/notifications/read-all",
|
|
37
|
+
notificationRead: (id) => `/magic-editor-x/notifications/${encodeURIComponent(id)}/read`,
|
|
38
|
+
notificationUnread: (id) => `/magic-editor-x/notifications/${encodeURIComponent(id)}/unread`,
|
|
39
|
+
suggestions: "/magic-editor-x/suggestions",
|
|
40
|
+
suggestion: (id) => `/magic-editor-x/suggestions/${encodeURIComponent(id)}`,
|
|
41
|
+
suggestionAccept: (id) => `/magic-editor-x/suggestions/${encodeURIComponent(id)}/accept`,
|
|
42
|
+
suggestionReject: (id) => `/magic-editor-x/suggestions/${encodeURIComponent(id)}/reject`,
|
|
35
43
|
templates: "/magic-editor-x/templates",
|
|
36
44
|
templateTargets: "/magic-editor-x/templates/targets",
|
|
37
45
|
templatesOrder: "/magic-editor-x/templates/order",
|
|
38
46
|
template: (id) => `/magic-editor-x/templates/${encodeURIComponent(id)}`,
|
|
39
47
|
templateDuplicate: (id) => `/magic-editor-x/templates/${encodeURIComponent(id)}/duplicate`,
|
|
40
48
|
templateUsage: (id) => `/magic-editor-x/templates/${encodeURIComponent(id)}/usage`,
|
|
49
|
+
templateVersions: (id) => `/magic-editor-x/templates/${encodeURIComponent(id)}/versions`,
|
|
50
|
+
templateVersion: (id, versionId) => `/magic-editor-x/templates/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}`,
|
|
51
|
+
templateVersionRestore: (id, versionId) => `/magic-editor-x/templates/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}/restore`,
|
|
52
|
+
audit: "/magic-editor-x/audit",
|
|
53
|
+
auditActors: "/magic-editor-x/audit/actors",
|
|
54
|
+
linkSchedule: "/magic-editor-x/quality/link-schedule",
|
|
55
|
+
linkScheduleRun: "/magic-editor-x/quality/link-schedule/run",
|
|
41
56
|
settings: "/magic-editor-x/settings",
|
|
42
57
|
settingsAiTest: "/magic-editor-x/settings/ai/test",
|
|
43
58
|
settingsLanguageToolTest: "/magic-editor-x/settings/language-tool/test"
|
|
@@ -54,71 +69,5 @@ const readApiError = (error) => {
|
|
|
54
69
|
details: apiError && apiError.details || null
|
|
55
70
|
};
|
|
56
71
|
};
|
|
57
|
-
const canTakeFocus = (el) => Boolean(
|
|
58
|
-
el && el.isConnected && typeof el.focus === "function" && !el.disabled && (typeof el.getAttribute !== "function" || el.getAttribute("aria-disabled") !== "true")
|
|
59
|
-
);
|
|
60
|
-
const pickFocusTarget = (opener, fallback) => {
|
|
61
|
-
if (canTakeFocus(opener)) return opener;
|
|
62
|
-
if (canTakeFocus(fallback)) return fallback;
|
|
63
|
-
return null;
|
|
64
|
-
};
|
|
65
|
-
const refocusIfLost = (opener, fallback, doc = globalThis.document) => {
|
|
66
|
-
if (!doc) return;
|
|
67
|
-
const active = doc.activeElement;
|
|
68
|
-
if (active && active !== doc.body) return;
|
|
69
|
-
const target = pickFocusTarget(opener, fallback);
|
|
70
|
-
if (target) target.focus();
|
|
71
|
-
};
|
|
72
|
-
const ConfirmAction = ({
|
|
73
|
-
trigger,
|
|
74
|
-
title,
|
|
75
|
-
body,
|
|
76
|
-
confirmLabel,
|
|
77
|
-
onConfirm,
|
|
78
|
-
variant = "danger",
|
|
79
|
-
disabled = false,
|
|
80
|
-
fallbackFocusRef
|
|
81
|
-
}) => {
|
|
82
|
-
const [open, setOpen] = ReactNamespace.useState(false);
|
|
83
|
-
const [busy, setBusy] = ReactNamespace.useState(false);
|
|
84
|
-
const triggerRef = ReactNamespace.useRef(null);
|
|
85
|
-
const restoreFocus = () => requestAnimationFrame(() => {
|
|
86
|
-
const active = document.activeElement;
|
|
87
|
-
if (active && active !== document.body) return;
|
|
88
|
-
const target = pickFocusTarget(triggerRef.current, fallbackFocusRef && fallbackFocusRef.current);
|
|
89
|
-
if (target) target.focus();
|
|
90
|
-
});
|
|
91
|
-
const onOpenChange = (next) => {
|
|
92
|
-
if (busy) return;
|
|
93
|
-
setOpen(next);
|
|
94
|
-
if (!next) restoreFocus();
|
|
95
|
-
};
|
|
96
|
-
const confirm = async (event) => {
|
|
97
|
-
if (event && typeof event.preventDefault === "function") event.preventDefault();
|
|
98
|
-
setBusy(true);
|
|
99
|
-
try {
|
|
100
|
-
await onConfirm();
|
|
101
|
-
setOpen(false);
|
|
102
|
-
restoreFocus();
|
|
103
|
-
} catch {
|
|
104
|
-
} finally {
|
|
105
|
-
setBusy(false);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { open, onOpenChange, children: [
|
|
109
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { ref: triggerRef, disabled, children: trigger }),
|
|
110
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
111
|
-
admin.ConfirmDialog,
|
|
112
|
-
{
|
|
113
|
-
title,
|
|
114
|
-
variant,
|
|
115
|
-
endAction: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, variant, onClick: confirm, loading: busy, disabled: busy, children: confirmLabel }),
|
|
116
|
-
children: body
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
] });
|
|
120
|
-
};
|
|
121
72
|
exports.API = API;
|
|
122
|
-
exports.ConfirmAction = ConfirmAction;
|
|
123
73
|
exports.readApiError = readApiError;
|
|
124
|
-
exports.refocusIfLost = refocusIfLost;
|