magic-editor-x 1.6.0 → 2.1.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.
Files changed (97) hide show
  1. package/CHANGELOG.md +322 -0
  2. package/LICENSE +1 -7
  3. package/README.md +398 -969
  4. package/dist/admin/ConfigurationPage-CK2AbfGW.mjs +886 -0
  5. package/dist/admin/ConfigurationPage-CzsT_dO_.js +888 -0
  6. package/dist/admin/CustomBlocksPage-B2A8S5MV.mjs +1741 -0
  7. package/dist/admin/CustomBlocksPage-CvLrsBds.js +1743 -0
  8. package/dist/admin/EditorField-7YCdXx-v.mjs +6829 -0
  9. package/dist/admin/EditorField-BdBCW15Q.js +6864 -0
  10. package/dist/admin/api-CmccMxlN.js +36 -0
  11. package/dist/admin/api-D5CAH0nh.mjs +37 -0
  12. package/dist/admin/de-BHPyA2S-.mjs +103 -0
  13. package/dist/admin/de-Bt6pYIWi.mjs +246 -0
  14. package/dist/admin/de-CVbi685U.js +246 -0
  15. package/dist/admin/de-CkUYGb7U.js +176 -0
  16. package/dist/admin/de-DBR893G4.js +13 -0
  17. package/dist/admin/de-RMs-_SCK.js +103 -0
  18. package/dist/admin/de-fBFh09Wl.mjs +13 -0
  19. package/dist/admin/de-rRIutpYJ.mjs +176 -0
  20. package/dist/admin/en-BX362fTp.js +246 -0
  21. package/dist/admin/en-B_HltUxZ.mjs +246 -0
  22. package/dist/admin/en-BluCStLw.mjs +103 -0
  23. package/dist/admin/en-C81faOHP.js +103 -0
  24. package/dist/admin/en-D9Nfccux.mjs +13 -0
  25. package/dist/admin/en-DulOcmXb.js +176 -0
  26. package/dist/admin/en-Puup8TFi.mjs +176 -0
  27. package/dist/admin/en-gueRT44P.js +13 -0
  28. package/dist/admin/es-257SSB7f.mjs +176 -0
  29. package/dist/admin/es-B0Zy8DVg.mjs +13 -0
  30. package/dist/admin/es-BoQZC86B.js +176 -0
  31. package/dist/admin/es-CHHEZi44.js +246 -0
  32. package/dist/admin/es-CQRI2Prp.mjs +103 -0
  33. package/dist/admin/es-CrhwOq-5.mjs +246 -0
  34. package/dist/admin/es-D1QzY0JW.js +103 -0
  35. package/dist/admin/es-DRGs7meF.js +13 -0
  36. package/dist/admin/fr-5djKfQ3s.mjs +246 -0
  37. package/dist/admin/fr-B3SL0TBV.js +246 -0
  38. package/dist/admin/fr-B8rdLAIL.js +13 -0
  39. package/dist/admin/fr-C5rSdKU4.mjs +176 -0
  40. package/dist/admin/fr-Di3R6gOX.mjs +103 -0
  41. package/dist/admin/fr-HxFcPpv4.js +176 -0
  42. package/dist/admin/fr-R3_MbzT5.js +103 -0
  43. package/dist/admin/fr-oiUb2bb_.mjs +13 -0
  44. package/dist/admin/index-0_b1iroK.mjs +156 -0
  45. package/dist/admin/index-6SZLli70.js +155 -0
  46. package/dist/admin/index.js +1 -1
  47. package/dist/admin/index.mjs +2 -2
  48. package/dist/admin/pt-B3Jce6uT.mjs +13 -0
  49. package/dist/admin/pt-BCW1u_Hp.js +103 -0
  50. package/dist/admin/pt-BdnY2Cth.mjs +246 -0
  51. package/dist/admin/pt-BiWuSBcH.js +13 -0
  52. package/dist/admin/pt-Cjn2Sc9k.js +176 -0
  53. package/dist/admin/pt-Cr9AL408.mjs +103 -0
  54. package/dist/admin/pt-D6UuEtPy.mjs +176 -0
  55. package/dist/admin/pt-EVwCuBUK.js +246 -0
  56. package/dist/admin/sanitize-DP5aeU7V.js +597 -0
  57. package/dist/admin/sanitize-jjCot5PM.mjs +596 -0
  58. package/dist/admin/useT-91ruePzq.js +130 -0
  59. package/dist/admin/useT-vgY88N_H.mjs +131 -0
  60. package/dist/server/index.js +5373 -64722
  61. package/dist/server/index.mjs +5373 -64731
  62. package/package.json +90 -66
  63. package/strapi-admin.js +3 -0
  64. package/strapi-server.js +3 -0
  65. package/COPYRIGHT_NOTICE.txt +0 -20
  66. package/dist/admin/App-BwMEZnS-.mjs +0 -2144
  67. package/dist/admin/App-HNr2tizR.js +0 -2147
  68. package/dist/admin/CustomBlocksPage-BjcA7MGz.js +0 -1519
  69. package/dist/admin/CustomBlocksPage-COPOZ2-_.mjs +0 -1517
  70. package/dist/admin/LicensePage-D0DMTF41.mjs +0 -392
  71. package/dist/admin/LicensePage-D0_9yPkw.js +0 -394
  72. package/dist/admin/LiveCollaborationPanel-CZAbgAVr.js +0 -223
  73. package/dist/admin/LiveCollaborationPanel-D8z72afw.mjs +0 -221
  74. package/dist/admin/Settings-DRenvRcG.js +0 -441
  75. package/dist/admin/Settings-DjyNURlS.mjs +0 -439
  76. package/dist/admin/de-C_0Mj-Zo.mjs +0 -296
  77. package/dist/admin/de-DVNVpAt9.js +0 -296
  78. package/dist/admin/en-B7AAf1ie.mjs +0 -296
  79. package/dist/admin/en-C2hv5GsA.js +0 -296
  80. package/dist/admin/es-BzJqcIST.js +0 -274
  81. package/dist/admin/es-zdP8sd-f.mjs +0 -274
  82. package/dist/admin/fr-CtAgOgH1.mjs +0 -274
  83. package/dist/admin/fr-D3GwqAAJ.js +0 -274
  84. package/dist/admin/getTranslation-2OiEgVGt.mjs +0 -49459
  85. package/dist/admin/getTranslation-DQ_WJ-7M.js +0 -49475
  86. package/dist/admin/index-Bn2tfJrC.js +0 -2186
  87. package/dist/admin/index-DAtClhqy.js +0 -6956
  88. package/dist/admin/index-FVEbTfqO.mjs +0 -2187
  89. package/dist/admin/index-gjWl-6E2.mjs +0 -6934
  90. package/dist/admin/magic-editor-x.css +0 -1103
  91. package/dist/admin/pt-BmUw6YMP.mjs +0 -274
  92. package/dist/admin/pt-CFo0nTbj.js +0 -274
  93. package/dist/admin/tools-CzHTZaY_.mjs +0 -2268
  94. package/dist/admin/tools-DALFhvPO.js +0 -2299
  95. package/pics/collab-magiceditorX.png +0 -0
  96. package/pics/editorX.png +0 -0
  97. package/pics/liveCollabwidget1.png +0 -0
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const react = require("react");
4
+ const designSystem = require("@strapi/design-system");
5
+ const admin = require("@strapi/strapi/admin");
6
+ const reactIntl = require("react-intl");
7
+ const index = require("./index-6SZLli70.js");
8
+ const PageShell = ({
9
+ title,
10
+ subtitle,
11
+ primaryAction,
12
+ secondaryAction,
13
+ startActions,
14
+ endActions,
15
+ children
16
+ }) => {
17
+ const id = `mex-page-title-${react.useId().replace(/:/g, "")}`;
18
+ return /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Main, { "aria-labelledby": id, children: [
19
+ /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Title, { children: title }),
20
+ /* @__PURE__ */ jsxRuntime.jsx(
21
+ admin.Layouts.Header,
22
+ {
23
+ id,
24
+ title,
25
+ subtitle,
26
+ primaryAction,
27
+ secondaryAction
28
+ }
29
+ ),
30
+ startActions || endActions ? /* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Action, { startActions, endActions }) : null,
31
+ /* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, paddingBottom: 8, minWidth: 0, children }) })
32
+ ] });
33
+ };
34
+ const SectionCard = ({ title, subtitle, action, headingTag = "h2", children }) => /* @__PURE__ */ jsxRuntime.jsx(
35
+ designSystem.Box,
36
+ {
37
+ tag: "section",
38
+ background: "neutral0",
39
+ hasRadius: true,
40
+ shadow: "tableShadow",
41
+ padding: { initial: 4, medium: 6 },
42
+ minWidth: 0,
43
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
44
+ title || action ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "flex-start", gap: 4, wrap: "wrap", children: [
45
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, flex: "1 1 24rem", children: [
46
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: headingTag, textColor: "neutral800", children: title }),
47
+ subtitle ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: subtitle }) : null
48
+ ] }),
49
+ action ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, wrap: "wrap", children: action }) : null
50
+ ] }) : null,
51
+ children
52
+ ] })
53
+ }
54
+ );
55
+ const canTakeFocus = (el) => Boolean(
56
+ el && el.isConnected && typeof el.focus === "function" && !el.disabled && (typeof el.getAttribute !== "function" || el.getAttribute("aria-disabled") !== "true")
57
+ );
58
+ const pickFocusTarget = (opener, fallback) => {
59
+ if (canTakeFocus(opener)) return opener;
60
+ if (canTakeFocus(fallback)) return fallback;
61
+ return null;
62
+ };
63
+ const refocusIfLost = (opener, fallback, doc = globalThis.document) => {
64
+ if (!doc) return;
65
+ const active = doc.activeElement;
66
+ if (active && active !== doc.body) return;
67
+ const target = pickFocusTarget(opener, fallback);
68
+ if (target) target.focus();
69
+ };
70
+ const ConfirmAction = ({
71
+ trigger,
72
+ title,
73
+ body,
74
+ confirmLabel,
75
+ onConfirm,
76
+ variant = "danger",
77
+ disabled = false,
78
+ fallbackFocusRef
79
+ }) => {
80
+ const [open, setOpen] = react.useState(false);
81
+ const [busy, setBusy] = react.useState(false);
82
+ const triggerRef = react.useRef(null);
83
+ const restoreFocus = () => requestAnimationFrame(() => {
84
+ const active = document.activeElement;
85
+ if (active && active !== document.body) return;
86
+ const target = pickFocusTarget(triggerRef.current, fallbackFocusRef && fallbackFocusRef.current);
87
+ if (target) target.focus();
88
+ });
89
+ const onOpenChange = (next) => {
90
+ if (busy) return;
91
+ setOpen(next);
92
+ if (!next) restoreFocus();
93
+ };
94
+ const confirm = async (event) => {
95
+ if (event && typeof event.preventDefault === "function") event.preventDefault();
96
+ setBusy(true);
97
+ try {
98
+ await onConfirm();
99
+ setOpen(false);
100
+ restoreFocus();
101
+ } catch {
102
+ } finally {
103
+ setBusy(false);
104
+ }
105
+ };
106
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { open, onOpenChange, children: [
107
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { ref: triggerRef, disabled, children: trigger }),
108
+ /* @__PURE__ */ jsxRuntime.jsx(
109
+ admin.ConfirmDialog,
110
+ {
111
+ title,
112
+ variant,
113
+ endAction: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, variant, onClick: confirm, loading: busy, disabled: busy, children: confirmLabel }),
114
+ children: body
115
+ }
116
+ )
117
+ ] });
118
+ };
119
+ const useT = () => {
120
+ const { formatMessage } = reactIntl.useIntl();
121
+ return react.useCallback(
122
+ (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values),
123
+ [formatMessage]
124
+ );
125
+ };
126
+ exports.ConfirmAction = ConfirmAction;
127
+ exports.PageShell = PageShell;
128
+ exports.SectionCard = SectionCard;
129
+ exports.refocusIfLost = refocusIfLost;
130
+ exports.useT = useT;
@@ -0,0 +1,131 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useId, useState, useRef, useCallback } from "react";
3
+ import { Flex, Box, Typography, Dialog, Button } from "@strapi/design-system";
4
+ import { Page, Layouts, ConfirmDialog } from "@strapi/strapi/admin";
5
+ import { useIntl } from "react-intl";
6
+ import { g as getTranslation } from "./index-0_b1iroK.mjs";
7
+ const PageShell = ({
8
+ title,
9
+ subtitle,
10
+ primaryAction,
11
+ secondaryAction,
12
+ startActions,
13
+ endActions,
14
+ children
15
+ }) => {
16
+ const id = `mex-page-title-${useId().replace(/:/g, "")}`;
17
+ return /* @__PURE__ */ jsxs(Page.Main, { "aria-labelledby": id, children: [
18
+ /* @__PURE__ */ jsx(Page.Title, { children: title }),
19
+ /* @__PURE__ */ jsx(
20
+ Layouts.Header,
21
+ {
22
+ id,
23
+ title,
24
+ subtitle,
25
+ primaryAction,
26
+ secondaryAction
27
+ }
28
+ ),
29
+ startActions || endActions ? /* @__PURE__ */ jsx(Layouts.Action, { startActions, endActions }) : null,
30
+ /* @__PURE__ */ jsx(Layouts.Content, { children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, paddingBottom: 8, minWidth: 0, children }) })
31
+ ] });
32
+ };
33
+ const SectionCard = ({ title, subtitle, action, headingTag = "h2", children }) => /* @__PURE__ */ jsx(
34
+ Box,
35
+ {
36
+ tag: "section",
37
+ background: "neutral0",
38
+ hasRadius: true,
39
+ shadow: "tableShadow",
40
+ padding: { initial: 4, medium: 6 },
41
+ minWidth: 0,
42
+ children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
43
+ title || action ? /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", gap: 4, wrap: "wrap", children: [
44
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, flex: "1 1 24rem", children: [
45
+ /* @__PURE__ */ jsx(Typography, { variant: "delta", tag: headingTag, textColor: "neutral800", children: title }),
46
+ subtitle ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: subtitle }) : null
47
+ ] }),
48
+ action ? /* @__PURE__ */ jsx(Flex, { gap: 2, wrap: "wrap", children: action }) : null
49
+ ] }) : null,
50
+ children
51
+ ] })
52
+ }
53
+ );
54
+ const canTakeFocus = (el) => Boolean(
55
+ el && el.isConnected && typeof el.focus === "function" && !el.disabled && (typeof el.getAttribute !== "function" || el.getAttribute("aria-disabled") !== "true")
56
+ );
57
+ const pickFocusTarget = (opener, fallback) => {
58
+ if (canTakeFocus(opener)) return opener;
59
+ if (canTakeFocus(fallback)) return fallback;
60
+ return null;
61
+ };
62
+ const refocusIfLost = (opener, fallback, doc = globalThis.document) => {
63
+ if (!doc) return;
64
+ const active = doc.activeElement;
65
+ if (active && active !== doc.body) return;
66
+ const target = pickFocusTarget(opener, fallback);
67
+ if (target) target.focus();
68
+ };
69
+ const ConfirmAction = ({
70
+ trigger,
71
+ title,
72
+ body,
73
+ confirmLabel,
74
+ onConfirm,
75
+ variant = "danger",
76
+ disabled = false,
77
+ fallbackFocusRef
78
+ }) => {
79
+ const [open, setOpen] = useState(false);
80
+ const [busy, setBusy] = useState(false);
81
+ const triggerRef = useRef(null);
82
+ const restoreFocus = () => requestAnimationFrame(() => {
83
+ const active = document.activeElement;
84
+ if (active && active !== document.body) return;
85
+ const target = pickFocusTarget(triggerRef.current, fallbackFocusRef && fallbackFocusRef.current);
86
+ if (target) target.focus();
87
+ });
88
+ const onOpenChange = (next) => {
89
+ if (busy) return;
90
+ setOpen(next);
91
+ if (!next) restoreFocus();
92
+ };
93
+ const confirm = async (event) => {
94
+ if (event && typeof event.preventDefault === "function") event.preventDefault();
95
+ setBusy(true);
96
+ try {
97
+ await onConfirm();
98
+ setOpen(false);
99
+ restoreFocus();
100
+ } catch {
101
+ } finally {
102
+ setBusy(false);
103
+ }
104
+ };
105
+ return /* @__PURE__ */ jsxs(Dialog.Root, { open, onOpenChange, children: [
106
+ /* @__PURE__ */ jsx(Dialog.Trigger, { ref: triggerRef, disabled, children: trigger }),
107
+ /* @__PURE__ */ jsx(
108
+ ConfirmDialog,
109
+ {
110
+ title,
111
+ variant,
112
+ endAction: /* @__PURE__ */ jsx(Button, { fullWidth: true, variant, onClick: confirm, loading: busy, disabled: busy, children: confirmLabel }),
113
+ children: body
114
+ }
115
+ )
116
+ ] });
117
+ };
118
+ const useT = () => {
119
+ const { formatMessage } = useIntl();
120
+ return useCallback(
121
+ (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values),
122
+ [formatMessage]
123
+ );
124
+ };
125
+ export {
126
+ ConfirmAction as C,
127
+ PageShell as P,
128
+ SectionCard as S,
129
+ refocusIfLost as r,
130
+ useT as u
131
+ };