@mattisvensson/strapi-plugin-webatlas 0.10.1 → 0.11.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.
- package/README.md +16 -9
- package/dist/admin/{FullLoader-CrPED_dY.mjs → FullLoader-Btjb2W2p.mjs} +5 -1
- package/dist/admin/FullLoader-Btjb2W2p.mjs.map +1 -0
- package/dist/admin/{FullLoader-Cmsf8xS6.js → FullLoader-Da2n70bJ.js} +5 -1
- package/dist/admin/FullLoader-Da2n70bJ.js.map +1 -0
- package/dist/admin/{SettingTitle-uw1S5OmC.js → SettingTitle-B0quw3f8.js} +6 -2
- package/dist/admin/SettingTitle-B0quw3f8.js.map +1 -0
- package/dist/admin/{SettingTitle-DbsxB1V9.mjs → SettingTitle-HMfQOJnK.mjs} +6 -2
- package/dist/admin/SettingTitle-HMfQOJnK.mjs.map +1 -0
- package/dist/admin/de-B5pRvs13.mjs +1 -0
- package/dist/admin/de-B5pRvs13.mjs.map +1 -0
- package/dist/admin/de-CqU1FU8C.js +1 -0
- package/dist/admin/de-CqU1FU8C.js.map +1 -0
- package/dist/admin/en-BE-zzIv8.mjs +1 -0
- package/dist/admin/en-BE-zzIv8.mjs.map +1 -0
- package/dist/admin/en-C7I90FwV.js +1 -0
- package/dist/admin/en-C7I90FwV.js.map +1 -0
- package/dist/admin/{index-BKWY9Ta-.mjs → index-9_HhKDUC.mjs} +32 -58
- package/dist/admin/index-9_HhKDUC.mjs.map +1 -0
- package/dist/admin/{index-CIr8o1RP.mjs → index-B79ELMEC.mjs} +300 -282
- package/dist/admin/index-B79ELMEC.mjs.map +1 -0
- package/dist/admin/{index-DkqiqVx2.js → index-BEVoxEAm.js} +32 -58
- package/dist/admin/index-BEVoxEAm.js.map +1 -0
- package/dist/admin/index-Bmg-ERct.mjs +244 -0
- package/dist/admin/index-Bmg-ERct.mjs.map +1 -0
- package/dist/admin/{index-BXt-QjKo.js → index-C8YjuuOx.js} +497 -353
- package/dist/admin/index-C8YjuuOx.js.map +1 -0
- package/dist/admin/{index-DC5WwNdi.js → index-Cx_mktdk.js} +300 -282
- package/dist/admin/index-Cx_mktdk.js.map +1 -0
- package/dist/admin/{index-CUaBX_v-.mjs → index-Cz_k_jjp.mjs} +42 -30
- package/dist/admin/index-Cz_k_jjp.mjs.map +1 -0
- package/dist/admin/{index-BYlmJycd.js → index-D2hB1vTw.js} +42 -30
- package/dist/admin/index-D2hB1vTw.js.map +1 -0
- package/dist/admin/index-YdWxpvOH.js +244 -0
- package/dist/admin/index-YdWxpvOH.js.map +1 -0
- package/dist/admin/{index-tPrfjOIn.mjs → index-oEJT_mvw.mjs} +497 -353
- package/dist/admin/index-oEJT_mvw.mjs.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/index.mjs +2 -1
- package/dist/admin/index.mjs.map +1 -0
- package/dist/server/index.js +578 -394
- package/dist/server/index.js.map +1 -0
- package/dist/server/index.mjs +578 -394
- package/dist/server/index.mjs.map +1 -0
- package/package.json +108 -108
- package/dist/admin/index-B07KlG03.mjs +0 -218
- package/dist/admin/index-CGsC8P9P.js +0 -218
- package/dist/admin/src/index.d.ts +0 -12
- package/dist/server/src/index.d.ts +0 -301
|
@@ -41,18 +41,25 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
|
41
41
|
);
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
-
function transformToUrl(input) {
|
|
44
|
+
function transformToUrl(input, replaceSlash = true) {
|
|
45
45
|
const specialCharMap = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
ü: "ue",
|
|
47
|
+
ä: "ae",
|
|
48
|
+
ö: "oe",
|
|
49
|
+
ß: "ss"
|
|
49
50
|
};
|
|
50
51
|
if (!input || typeof input !== "string") return "";
|
|
51
52
|
input = input.toLowerCase();
|
|
52
53
|
input = input.replace(/\/+/g, "/");
|
|
53
54
|
input = input.startsWith("/") ? input.slice(1) : input;
|
|
54
55
|
input = input.endsWith("/") ? input.slice(0, -1) : input;
|
|
55
|
-
|
|
56
|
+
if (replaceSlash) {
|
|
57
|
+
input = input.replace(/\//g, "-");
|
|
58
|
+
} else {
|
|
59
|
+
input = input.replace(/\/+/g, "/");
|
|
60
|
+
input = input.startsWith("/") ? input.slice(1) : input;
|
|
61
|
+
input = input.endsWith("/") ? input.slice(0, -1) : input;
|
|
62
|
+
}
|
|
56
63
|
for (const char in specialCharMap) {
|
|
57
64
|
const regex = new RegExp(char, "g");
|
|
58
65
|
input = input.replace(regex, specialCharMap[char]);
|
|
@@ -63,7 +70,7 @@ function transformToUrl(input) {
|
|
|
63
70
|
input = input.replace(/-+/g, "-");
|
|
64
71
|
return input;
|
|
65
72
|
}
|
|
66
|
-
const version = "0.
|
|
73
|
+
const version = "0.11.1";
|
|
67
74
|
const strapi$1 = { "name": "webatlas", "displayName": "Webatlas" };
|
|
68
75
|
const pluginPkg = {
|
|
69
76
|
version,
|
|
@@ -118,7 +125,9 @@ function useApi() {
|
|
|
118
125
|
const entityResults = await Promise.allSettled(
|
|
119
126
|
contentTypes.map(async (contentType) => {
|
|
120
127
|
try {
|
|
121
|
-
const { data: data2 } = await get(
|
|
128
|
+
const { data: data2 } = await get(
|
|
129
|
+
`/content-manager/collection-types/${contentType.uid}?pageSize=9999`
|
|
130
|
+
);
|
|
122
131
|
if (!data2 || !data2.results) {
|
|
123
132
|
return null;
|
|
124
133
|
}
|
|
@@ -152,14 +161,21 @@ function useApi() {
|
|
|
152
161
|
return data;
|
|
153
162
|
};
|
|
154
163
|
const getProhibitedRouteIds = async (documentId) => {
|
|
155
|
-
const { data } = await get(
|
|
164
|
+
const { data } = await get(
|
|
165
|
+
`/${PLUGIN_ID}/route/prohibitedIds/${documentId ? `${documentId}` : ""}`
|
|
166
|
+
);
|
|
156
167
|
return data;
|
|
157
168
|
};
|
|
158
|
-
const getNavigation = async ({
|
|
169
|
+
const getNavigation = async ({
|
|
170
|
+
documentId,
|
|
171
|
+
variant
|
|
172
|
+
} = {}) => {
|
|
159
173
|
const query = [];
|
|
160
174
|
if (documentId) query.push(`documentId=${documentId}`);
|
|
161
175
|
if (variant) query.push(`variant=${variant}`);
|
|
162
|
-
const { data } = await get(
|
|
176
|
+
const { data } = await get(
|
|
177
|
+
`/${PLUGIN_ID}/navigation${query.length > 0 ? `?${query.join("&")}` : ""}`
|
|
178
|
+
);
|
|
163
179
|
return data;
|
|
164
180
|
};
|
|
165
181
|
const createNavigation = async (body) => {
|
|
@@ -230,7 +246,9 @@ function usePluginConfig() {
|
|
|
230
246
|
setLoading(true);
|
|
231
247
|
setFetchError(null);
|
|
232
248
|
try {
|
|
233
|
-
const {
|
|
249
|
+
const {
|
|
250
|
+
data: { data: contentTypesArray }
|
|
251
|
+
} = await get("/content-manager/content-types");
|
|
234
252
|
let { data: config2 } = await get(`/${PLUGIN_ID}/config`);
|
|
235
253
|
if (!config2 || !config2.selectedContentTypes) {
|
|
236
254
|
throw new Error(`Couldn't fetch plugin config`);
|
|
@@ -239,7 +257,9 @@ function usePluginConfig() {
|
|
|
239
257
|
(type) => type.pluginOptions?.webatlas?.enabled === true
|
|
240
258
|
);
|
|
241
259
|
const contentTypeUids = new Set(allowedContentTypes.map((type) => type.uid));
|
|
242
|
-
const activeContentTypes = config2.selectedContentTypes.filter(
|
|
260
|
+
const activeContentTypes = config2.selectedContentTypes.filter(
|
|
261
|
+
(type) => contentTypeUids.has(type.uid)
|
|
262
|
+
);
|
|
243
263
|
const displayConfig = {
|
|
244
264
|
...config2,
|
|
245
265
|
selectedContentTypes: activeContentTypes
|
|
@@ -282,7 +302,9 @@ async function duplicateCheck({
|
|
|
282
302
|
if (!path) throw new Error("URL is required");
|
|
283
303
|
try {
|
|
284
304
|
const pathToCheck = withoutTransform ? path : transformToUrl(path);
|
|
285
|
-
const { data } = await fetchFunction(
|
|
305
|
+
const { data } = await fetchFunction(
|
|
306
|
+
`/${PLUGIN_ID}/checkUniquePath?path=${pathToCheck}${routeDocumentId ? `&targetRouteDocumentId=${routeDocumentId}` : ""}`
|
|
307
|
+
);
|
|
286
308
|
if (!data.uniquePath) {
|
|
287
309
|
throw new Error("Network response was not ok");
|
|
288
310
|
}
|
|
@@ -300,45 +322,42 @@ function PathInfo({ validationState, replacement }) {
|
|
|
300
322
|
if (validationState === "initial") return;
|
|
301
323
|
if (validationState === "checking") {
|
|
302
324
|
setColor("neutral800");
|
|
303
|
-
setText(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
325
|
+
setText(
|
|
326
|
+
formatMessage({
|
|
327
|
+
id: getTranslation("components.pathInfo.checking"),
|
|
328
|
+
defaultMessage: "Checking if path is available..."
|
|
329
|
+
})
|
|
330
|
+
);
|
|
307
331
|
} else if (validationState === "done") {
|
|
308
332
|
setColor(replacement ? "danger500" : "success500");
|
|
309
|
-
setText(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
333
|
+
setText(
|
|
334
|
+
replacement ? `${formatMessage({
|
|
335
|
+
id: getTranslation("components.pathInfo.notAvailable"),
|
|
336
|
+
defaultMessage: "Path is not available. Replaced with"
|
|
337
|
+
})} "${replacement}".` : formatMessage({
|
|
338
|
+
id: getTranslation("components.pathInfo.available"),
|
|
339
|
+
defaultMessage: "Path is available."
|
|
340
|
+
})
|
|
341
|
+
);
|
|
316
342
|
}
|
|
317
343
|
}, [validationState, replacement, formatMessage]);
|
|
318
344
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: color, children: text }) });
|
|
319
345
|
}
|
|
320
346
|
function OverrideCheckbox({ isOverride, setIsOverride, disabledCondition }) {
|
|
321
347
|
const { formatMessage } = reactIntl.useIntl();
|
|
322
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
323
|
-
designSystem.
|
|
348
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
349
|
+
designSystem.Checkbox,
|
|
324
350
|
{
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
disabled: disabledCondition,
|
|
334
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
|
|
335
|
-
id: getTranslation("components.CMEditViewAside.path.overrideCheckbox"),
|
|
336
|
-
defaultMessage: "Override automatic path generation"
|
|
337
|
-
}) })
|
|
338
|
-
}
|
|
339
|
-
)
|
|
351
|
+
id: "path-override-checkbox",
|
|
352
|
+
checked: isOverride,
|
|
353
|
+
onCheckedChange: () => setIsOverride(!isOverride),
|
|
354
|
+
disabled: disabledCondition,
|
|
355
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
|
|
356
|
+
id: getTranslation("components.CMEditViewAside.path.overrideCheckbox"),
|
|
357
|
+
defaultMessage: "Override automatic path generation"
|
|
358
|
+
}) })
|
|
340
359
|
}
|
|
341
|
-
);
|
|
360
|
+
) });
|
|
342
361
|
}
|
|
343
362
|
function NewPathInfo() {
|
|
344
363
|
const { formatMessage } = reactIntl.useIntl();
|
|
@@ -357,13 +376,7 @@ function UidPathDisplay({ path }) {
|
|
|
357
376
|
defaultMessage: "Permanent UID path, cannot be changed"
|
|
358
377
|
}),
|
|
359
378
|
children: [
|
|
360
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
361
|
-
designSystem.Field.Input,
|
|
362
|
-
{
|
|
363
|
-
value: path,
|
|
364
|
-
disabled: true
|
|
365
|
-
}
|
|
366
|
-
),
|
|
379
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Input, { value: path, disabled: true }),
|
|
367
380
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
368
381
|
]
|
|
369
382
|
}
|
|
@@ -3691,10 +3704,15 @@ function PathInput({ path, dispatchPath, isOverride, config }) {
|
|
|
3691
3704
|
id: getTranslation("components.CMEditViewAside.path.input.label"),
|
|
3692
3705
|
defaultMessage: "Path"
|
|
3693
3706
|
}),
|
|
3694
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3707
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3708
|
+
Tooltip,
|
|
3709
|
+
{
|
|
3710
|
+
description: formatMessage({
|
|
3711
|
+
id: getTranslation("components.CMEditViewAside.path.input.tooltip"),
|
|
3712
|
+
defaultMessage: "The following characters are valid: A-Z, a-z, 0-9, /, -, _, $, ., +, !, *, ', (, )"
|
|
3713
|
+
})
|
|
3714
|
+
}
|
|
3715
|
+
)
|
|
3698
3716
|
] }),
|
|
3699
3717
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3700
3718
|
designSystem.Field.Input,
|
|
@@ -3703,10 +3721,10 @@ function PathInput({ path, dispatchPath, isOverride, config }) {
|
|
|
3703
3721
|
value: displayedPath,
|
|
3704
3722
|
onChange: (e) => dispatchPath({ type: "SET_OVERRIDEPATH", payload: e.target.value }),
|
|
3705
3723
|
disabled: !isOverride,
|
|
3706
|
-
onBlur: (e) => {
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
},
|
|
3724
|
+
onBlur: (e) => dispatchPath({
|
|
3725
|
+
type: "SET_OVERRIDEPATH",
|
|
3726
|
+
payload: transformToUrl(e.target.value, false)
|
|
3727
|
+
}),
|
|
3710
3728
|
style: { outline: inputBorder }
|
|
3711
3729
|
}
|
|
3712
3730
|
),
|
|
@@ -3715,11 +3733,19 @@ function PathInput({ path, dispatchPath, isOverride, config }) {
|
|
|
3715
3733
|
}
|
|
3716
3734
|
);
|
|
3717
3735
|
}
|
|
3718
|
-
function RouteStructure({
|
|
3736
|
+
function RouteStructure({
|
|
3737
|
+
routes,
|
|
3738
|
+
selectedParent,
|
|
3739
|
+
setSelectedParent,
|
|
3740
|
+
canonicalPath,
|
|
3741
|
+
prohibitedRouteIds
|
|
3742
|
+
}) {
|
|
3719
3743
|
const { formatMessage } = reactIntl.useIntl();
|
|
3720
|
-
const
|
|
3721
|
-
return [...routes].sort((a, b) => a.title.localeCompare(b.title))
|
|
3722
|
-
|
|
3744
|
+
const filteredRoutes = React.useMemo(() => {
|
|
3745
|
+
return [...routes].sort((a, b) => a.title.localeCompare(b.title)).filter(
|
|
3746
|
+
(route) => !prohibitedRouteIds?.includes(route.documentId) || route.documentId === selectedParent?.documentId
|
|
3747
|
+
);
|
|
3748
|
+
}, [routes, prohibitedRouteIds, selectedParent]);
|
|
3723
3749
|
const handleSelectParent = (value) => {
|
|
3724
3750
|
const parentRoute = routes.find((route) => route.documentId === value) || null;
|
|
3725
3751
|
setSelectedParent(parentRoute);
|
|
@@ -3730,29 +3756,13 @@ function RouteStructure({ routes, selectedParent, setSelectedParent, canonicalPa
|
|
|
3730
3756
|
id: getTranslation("components.CMEditViewAside.path.input.parentSelect.label"),
|
|
3731
3757
|
defaultMessage: "Place under"
|
|
3732
3758
|
}) }),
|
|
3733
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3734
|
-
designSystem.
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
id: getTranslation("components.CMEditViewAside.path.input.parentSelect.rootPath"),
|
|
3741
|
-
defaultMessage: "None (root path)"
|
|
3742
|
-
}) }),
|
|
3743
|
-
sortedRoutes.filter((route) => !prohibitedRouteIds?.includes(route.documentId) || route.documentId === selectedParent?.documentId).map(
|
|
3744
|
-
(route) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3745
|
-
designSystem.SingleSelectOption,
|
|
3746
|
-
{
|
|
3747
|
-
value: route.documentId,
|
|
3748
|
-
children: route.title
|
|
3749
|
-
},
|
|
3750
|
-
route.documentId
|
|
3751
|
-
)
|
|
3752
|
-
)
|
|
3753
|
-
]
|
|
3754
|
-
}
|
|
3755
|
-
)
|
|
3759
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.SingleSelect, { value: selectedParent?.documentId || "", onValueChange: handleSelectParent, children: [
|
|
3760
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "", children: formatMessage({
|
|
3761
|
+
id: getTranslation("components.CMEditViewAside.path.input.parentSelect.rootPath"),
|
|
3762
|
+
defaultMessage: "None (root path)"
|
|
3763
|
+
}) }),
|
|
3764
|
+
filteredRoutes.map((route) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: route.documentId, children: route.title }, route.documentId))
|
|
3765
|
+
] })
|
|
3756
3766
|
] }),
|
|
3757
3767
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { marginTop: 4, children: [
|
|
3758
3768
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
|
|
@@ -3760,26 +3770,25 @@ function RouteStructure({ routes, selectedParent, setSelectedParent, canonicalPa
|
|
|
3760
3770
|
id: getTranslation("components.CMEditViewAside.canonicalPath.input.label"),
|
|
3761
3771
|
defaultMessage: "Canonical Path"
|
|
3762
3772
|
}),
|
|
3763
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3773
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3774
|
+
Tooltip,
|
|
3775
|
+
{
|
|
3776
|
+
description: formatMessage({
|
|
3777
|
+
id: getTranslation("components.CMEditViewAside.canonicalPath.input.tooltip"),
|
|
3778
|
+
defaultMessage: "The path determined by your content's natural hierarchy, independent of where it appears in navigation menus."
|
|
3779
|
+
})
|
|
3780
|
+
}
|
|
3781
|
+
)
|
|
3767
3782
|
] }),
|
|
3768
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3769
|
-
designSystem.Field.Input,
|
|
3770
|
-
{
|
|
3771
|
-
id: "canonicalPath-input",
|
|
3772
|
-
value: canonicalPath,
|
|
3773
|
-
disabled: true
|
|
3774
|
-
}
|
|
3775
|
-
),
|
|
3783
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Input, { id: "canonicalPath-input", value: canonicalPath, disabled: true }),
|
|
3776
3784
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
3777
3785
|
] })
|
|
3778
3786
|
] });
|
|
3779
3787
|
}
|
|
3780
|
-
function
|
|
3781
|
-
const
|
|
3782
|
-
|
|
3788
|
+
function buildPath(type, slug, parent) {
|
|
3789
|
+
const parentSlug = type === "canonical" ? parent?.canonicalPath : parent?.path;
|
|
3790
|
+
const parentPath = parentSlug ? `${parentSlug}/` : "";
|
|
3791
|
+
return `${parentPath}${transformToUrl(slug)}`;
|
|
3783
3792
|
}
|
|
3784
3793
|
function reducer(state, action) {
|
|
3785
3794
|
switch (action.type) {
|
|
@@ -3810,6 +3819,8 @@ function reducer(state, action) {
|
|
|
3810
3819
|
return { ...state, replacement: action.payload };
|
|
3811
3820
|
case "SET_UIDPATH":
|
|
3812
3821
|
return { ...state, uidPath: action.payload };
|
|
3822
|
+
case "SET_SLUG":
|
|
3823
|
+
return { ...state, slug: action.payload };
|
|
3813
3824
|
case "SET_CANONICALPATH":
|
|
3814
3825
|
return { ...state, canonicalPath: action.payload };
|
|
3815
3826
|
case "SET_OVERRIDEPATH":
|
|
@@ -3824,10 +3835,9 @@ const Panel = ({ config }) => {
|
|
|
3824
3835
|
const { getRelatedRoute, getAllRoutes, getProhibitedRouteIds } = useApi();
|
|
3825
3836
|
const { formatMessage } = reactIntl.useIntl();
|
|
3826
3837
|
const { get } = admin.useFetchClient();
|
|
3827
|
-
const {
|
|
3828
|
-
canUpdate,
|
|
3829
|
-
|
|
3830
|
-
} } = admin.useRBAC([
|
|
3838
|
+
const {
|
|
3839
|
+
allowedActions: { canUpdate, canCreate }
|
|
3840
|
+
} = admin.useRBAC([
|
|
3831
3841
|
{
|
|
3832
3842
|
action: "plugin::content-manager.explorer.update",
|
|
3833
3843
|
subject: model,
|
|
@@ -3855,66 +3865,95 @@ const Panel = ({ config }) => {
|
|
|
3855
3865
|
replacement: null,
|
|
3856
3866
|
uidPath: "",
|
|
3857
3867
|
canonicalPath: "",
|
|
3868
|
+
slug: "",
|
|
3858
3869
|
overridePath: ""
|
|
3859
3870
|
});
|
|
3860
3871
|
const hasUserChangedField = React.useRef(false);
|
|
3872
|
+
const hasUserInteracted = React.useRef(false);
|
|
3861
3873
|
const initialPath = React.useRef("");
|
|
3862
3874
|
const prevSourceValueRef = React.useRef(null);
|
|
3863
|
-
const sourceFieldValue =
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
const
|
|
3871
|
-
|
|
3875
|
+
const sourceFieldValue = values[config?.default] || "";
|
|
3876
|
+
const initialSourceFieldValue = initialValues[config?.default] || "";
|
|
3877
|
+
const latestCheckPathRef = React.useRef(checkPath);
|
|
3878
|
+
latestCheckPathRef.current = checkPath;
|
|
3879
|
+
const debouncedCheckPath = React.useRef(
|
|
3880
|
+
debounce((p, id) => latestCheckPathRef.current(p, id), 250)
|
|
3881
|
+
).current;
|
|
3882
|
+
const latestCheckCanonicalRef = React.useRef(checkCanonicalPath);
|
|
3883
|
+
latestCheckCanonicalRef.current = checkCanonicalPath;
|
|
3884
|
+
const debouncedCheckCanonicalPath = React.useRef(
|
|
3885
|
+
debounce((p, id) => latestCheckCanonicalRef.current(p, id), 250)
|
|
3886
|
+
).current;
|
|
3872
3887
|
React.useEffect(() => {
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
}, [path.value, path.overridePath, isOverride, selectedParent]);
|
|
3877
|
-
const debouncedValueEffect = React.useMemo(() => debounce((currentValues) => {
|
|
3878
|
-
const key = config?.default;
|
|
3879
|
-
if (!key) return;
|
|
3880
|
-
const currentValue = currentValues[key];
|
|
3881
|
-
if (!currentValue) {
|
|
3882
|
-
dispatchPath({ type: "NO_URL_CHECK", payload: "" });
|
|
3883
|
-
return;
|
|
3884
|
-
}
|
|
3885
|
-
if (initialLoadComplete && (hasUserChangedField.current || !route) && prevSourceValueRef.current !== currentValue && !isOverride) {
|
|
3886
|
-
const path2 = getCanonicalPath(selectedParent, currentValue);
|
|
3887
|
-
if (currentValue === initialValues[key]) {
|
|
3888
|
-
dispatchPath({ type: "NO_URL_CHECK", payload: path2 });
|
|
3889
|
-
} else {
|
|
3890
|
-
dispatchPath({ type: "DEFAULT", payload: path2 });
|
|
3891
|
-
}
|
|
3892
|
-
prevSourceValueRef.current = currentValue;
|
|
3888
|
+
async function fetchAllRoutes() {
|
|
3889
|
+
const allRoutes = await getAllRoutes();
|
|
3890
|
+
setRoutes(allRoutes);
|
|
3893
3891
|
}
|
|
3894
|
-
|
|
3892
|
+
fetchAllRoutes();
|
|
3893
|
+
}, []);
|
|
3895
3894
|
React.useEffect(() => {
|
|
3896
|
-
const
|
|
3897
|
-
|
|
3898
|
-
const
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3895
|
+
const slug = transformToUrl(sourceFieldValue);
|
|
3896
|
+
const overridePath = transformToUrl(path.overridePath || "", false);
|
|
3897
|
+
const data = {
|
|
3898
|
+
path: isOverride ? overridePath : path.value,
|
|
3899
|
+
isOverride,
|
|
3900
|
+
parentDocumentId: selectedParent?.documentId || null,
|
|
3901
|
+
slug: isOverride ? overridePath : slug
|
|
3902
|
+
};
|
|
3903
|
+
if (hasUserChangedField.current || hasUserInteracted.current) {
|
|
3904
|
+
onChange("webatlas", data);
|
|
3902
3905
|
}
|
|
3906
|
+
}, [
|
|
3907
|
+
path.value,
|
|
3908
|
+
path.overridePath,
|
|
3909
|
+
isOverride,
|
|
3910
|
+
selectedParent,
|
|
3911
|
+
sourceFieldValue,
|
|
3912
|
+
hasUserChangedField,
|
|
3913
|
+
hasUserInteracted
|
|
3914
|
+
]);
|
|
3915
|
+
React.useEffect(() => {
|
|
3903
3916
|
if (!initialLoadComplete) return;
|
|
3904
|
-
if (
|
|
3917
|
+
if (sourceFieldValue !== initialSourceFieldValue) {
|
|
3905
3918
|
hasUserChangedField.current = true;
|
|
3906
3919
|
}
|
|
3907
|
-
|
|
3908
|
-
|
|
3920
|
+
if (!sourceFieldValue) {
|
|
3921
|
+
dispatchPath({ type: "NO_URL_CHECK", payload: "" });
|
|
3922
|
+
return;
|
|
3923
|
+
}
|
|
3924
|
+
if (initialLoadComplete && (hasUserChangedField.current || !route) && prevSourceValueRef.current !== sourceFieldValue && !isOverride) {
|
|
3925
|
+
const newPath = buildPath("path", sourceFieldValue, selectedParent);
|
|
3926
|
+
const type = sourceFieldValue === initialSourceFieldValue ? "NO_URL_CHECK" : "DEFAULT";
|
|
3927
|
+
const slug = transformToUrl(sourceFieldValue);
|
|
3928
|
+
dispatchPath({ type, payload: newPath });
|
|
3929
|
+
dispatchPath({ type: "SET_SLUG", payload: slug });
|
|
3930
|
+
dispatchPath({ type: "SET_OVERRIDEPATH", payload: slug });
|
|
3931
|
+
prevSourceValueRef.current = sourceFieldValue;
|
|
3932
|
+
}
|
|
3933
|
+
const canonicalPath = buildPath("canonical", sourceFieldValue, selectedParent);
|
|
3934
|
+
dispatchPath({ type: "SET_CANONICALPATH", payload: canonicalPath });
|
|
3935
|
+
debouncedCheckCanonicalPath(canonicalPath, route?.documentId || null);
|
|
3936
|
+
}, [
|
|
3937
|
+
sourceFieldValue,
|
|
3938
|
+
initialSourceFieldValue,
|
|
3939
|
+
initialLoadComplete,
|
|
3940
|
+
selectedParent,
|
|
3941
|
+
isOverride,
|
|
3942
|
+
route
|
|
3943
|
+
]);
|
|
3909
3944
|
React.useEffect(() => {
|
|
3945
|
+
if (!initialLoadComplete) return;
|
|
3910
3946
|
if (path.needsUrlCheck && path.value) {
|
|
3911
3947
|
if (path.uidPath === path.value || initialPath.current === path.value) return;
|
|
3912
3948
|
debouncedCheckPath(path.value, route?.documentId || null);
|
|
3913
3949
|
dispatchPath({ type: "RESET_URL_CHECK_FLAG" });
|
|
3950
|
+
} else {
|
|
3951
|
+
setValidationState("idle");
|
|
3952
|
+
dispatchPath({ type: "SET_REPLACEMENT", payload: null });
|
|
3914
3953
|
}
|
|
3915
|
-
}, [path.needsUrlCheck, path.value, path.uidPath, route]);
|
|
3954
|
+
}, [path.needsUrlCheck, path.value, path.uidPath, route, initialLoadComplete]);
|
|
3916
3955
|
React.useEffect(() => {
|
|
3917
|
-
async function
|
|
3956
|
+
async function fetchRelatedRute() {
|
|
3918
3957
|
if (!initialValues.documentId) {
|
|
3919
3958
|
setInitialLoadComplete(true);
|
|
3920
3959
|
return;
|
|
@@ -3922,15 +3961,20 @@ const Panel = ({ config }) => {
|
|
|
3922
3961
|
try {
|
|
3923
3962
|
const route2 = await getRelatedRoute(initialValues.documentId);
|
|
3924
3963
|
if (!route2) return;
|
|
3925
|
-
initialPath.current = initialValues.
|
|
3964
|
+
initialPath.current = initialValues.webatlas.path || route2.uidPath;
|
|
3926
3965
|
setRoute(route2);
|
|
3927
3966
|
setIsOverride(route2.isOverride || false);
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
}
|
|
3967
|
+
dispatchPath({ type: "SET_OVERRIDEPATH", payload: route2.path || "" });
|
|
3968
|
+
dispatchPath({
|
|
3969
|
+
type: "NO_TRANSFORM_AND_CHECK",
|
|
3970
|
+
payload: route2.path || ""
|
|
3971
|
+
});
|
|
3933
3972
|
dispatchPath({ type: "SET_UIDPATH", payload: route2.uidPath || "" });
|
|
3973
|
+
dispatchPath({ type: "SET_SLUG", payload: route2.slug || "" });
|
|
3974
|
+
dispatchPath({
|
|
3975
|
+
type: "SET_CANONICALPATH",
|
|
3976
|
+
payload: route2.canonicalPath || ""
|
|
3977
|
+
});
|
|
3934
3978
|
const key = config?.default;
|
|
3935
3979
|
if (key) {
|
|
3936
3980
|
prevSourceValueRef.current = values[key];
|
|
@@ -3941,27 +3985,15 @@ const Panel = ({ config }) => {
|
|
|
3941
3985
|
}
|
|
3942
3986
|
setInitialLoadComplete(true);
|
|
3943
3987
|
}
|
|
3944
|
-
|
|
3988
|
+
fetchRelatedRute();
|
|
3945
3989
|
}, [config]);
|
|
3946
3990
|
React.useEffect(() => {
|
|
3947
|
-
if (
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
}
|
|
3954
|
-
}
|
|
3955
|
-
}, [initialValues, routes]);
|
|
3956
|
-
React.useEffect(() => {
|
|
3957
|
-
if (initialValues.webatlas_path) dispatchPath({ type: "NO_URL_CHECK", payload: initialValues.webatlas_path });
|
|
3958
|
-
if (initialValues.webatlas_override) setIsOverride(initialValues.webatlas_override);
|
|
3959
|
-
async function fetchAllRoutes() {
|
|
3960
|
-
const allRoutes = await getAllRoutes();
|
|
3961
|
-
setRoutes(allRoutes);
|
|
3962
|
-
}
|
|
3963
|
-
fetchAllRoutes();
|
|
3964
|
-
}, []);
|
|
3991
|
+
if (!route || !routes.length) return;
|
|
3992
|
+
const parentRoute = routes.find(
|
|
3993
|
+
(singleRoute) => singleRoute.documentId === route.parent?.documentId
|
|
3994
|
+
);
|
|
3995
|
+
setSelectedParent(parentRoute || null);
|
|
3996
|
+
}, [route, routes]);
|
|
3965
3997
|
React.useEffect(() => {
|
|
3966
3998
|
async function fetchProhibitedRouteIds() {
|
|
3967
3999
|
const prohibitedIds = await getProhibitedRouteIds(route?.documentId);
|
|
@@ -3970,28 +4002,36 @@ const Panel = ({ config }) => {
|
|
|
3970
4002
|
fetchProhibitedRouteIds();
|
|
3971
4003
|
}, [route]);
|
|
3972
4004
|
React.useEffect(() => {
|
|
3973
|
-
if (!sourceFieldValue)
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
dispatchPath({ type: "
|
|
3977
|
-
debouncedCheckCanonicalPath(canonicalPath, route?.documentId || null);
|
|
3978
|
-
dispatchPath({ type: "RESET_URL_CHECK_FLAG" });
|
|
4005
|
+
if (!sourceFieldValue || isOverride || !hasUserChangedField.current && !hasUserInteracted.current)
|
|
4006
|
+
return;
|
|
4007
|
+
const newPath = buildPath("path", sourceFieldValue, selectedParent);
|
|
4008
|
+
dispatchPath({ type: "DEFAULT", payload: newPath });
|
|
3979
4009
|
}, [selectedParent, sourceFieldValue, route, isOverride]);
|
|
3980
|
-
async function checkCanonicalPath(path2,
|
|
4010
|
+
async function checkCanonicalPath(path2, routeDocumentId) {
|
|
3981
4011
|
if (!path2) return;
|
|
3982
4012
|
try {
|
|
3983
|
-
const result = await duplicateCheck({
|
|
4013
|
+
const result = await duplicateCheck({
|
|
4014
|
+
fetchFunction: get,
|
|
4015
|
+
path: path2,
|
|
4016
|
+
routeDocumentId,
|
|
4017
|
+
withoutTransform: true
|
|
4018
|
+
});
|
|
3984
4019
|
dispatchPath({ type: "SET_CANONICALPATH", payload: result });
|
|
3985
4020
|
} catch (err) {
|
|
3986
4021
|
strapi.log.error(err);
|
|
3987
4022
|
}
|
|
3988
4023
|
}
|
|
3989
|
-
async function checkPath(path2,
|
|
4024
|
+
async function checkPath(path2, routeDocumentId) {
|
|
3990
4025
|
if (!path2) return;
|
|
3991
4026
|
setValidationState("checking");
|
|
3992
4027
|
dispatchPath({ type: "SET_REPLACEMENT", payload: "" });
|
|
3993
4028
|
try {
|
|
3994
|
-
const data = await duplicateCheck({
|
|
4029
|
+
const data = await duplicateCheck({
|
|
4030
|
+
fetchFunction: get,
|
|
4031
|
+
path: path2,
|
|
4032
|
+
routeDocumentId,
|
|
4033
|
+
withoutTransform: true
|
|
4034
|
+
});
|
|
3995
4035
|
if (!data || data === path2) return;
|
|
3996
4036
|
dispatchPath({ type: "NO_URL_CHECK", payload: data });
|
|
3997
4037
|
dispatchPath({ type: "SET_REPLACEMENT", payload: data });
|
|
@@ -4001,73 +4041,58 @@ const Panel = ({ config }) => {
|
|
|
4001
4041
|
setValidationState("done");
|
|
4002
4042
|
}
|
|
4003
4043
|
}
|
|
4004
|
-
if (!initialLoadComplete)
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
{
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4044
|
+
if (!initialLoadComplete)
|
|
4045
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
|
|
4046
|
+
id: getTranslation("loading"),
|
|
4047
|
+
defaultMessage: "Loading..."
|
|
4048
|
+
}) });
|
|
4049
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "aside", "aria-labelledby": "URL Route", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
4050
|
+
!route && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4051
|
+
/* @__PURE__ */ jsxRuntime.jsx(NewPathInfo, {}),
|
|
4052
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 2, marginBottom: 2 })
|
|
4053
|
+
] }),
|
|
4054
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4055
|
+
RouteStructure,
|
|
4056
|
+
{
|
|
4057
|
+
canonicalPath: path.canonicalPath,
|
|
4058
|
+
routes,
|
|
4059
|
+
selectedParent,
|
|
4060
|
+
setSelectedParent: (val) => {
|
|
4061
|
+
hasUserInteracted.current = true;
|
|
4062
|
+
setSelectedParent(val);
|
|
4063
|
+
},
|
|
4064
|
+
prohibitedRouteIds
|
|
4065
|
+
}
|
|
4066
|
+
),
|
|
4067
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 2, marginBottom: 2 }),
|
|
4068
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
4069
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4070
|
+
PathInput,
|
|
4016
4071
|
{
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
!route && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4022
|
-
/* @__PURE__ */ jsxRuntime.jsx(NewPathInfo, {}),
|
|
4023
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 2, marginBottom: 2 })
|
|
4024
|
-
] }),
|
|
4025
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4026
|
-
RouteStructure,
|
|
4027
|
-
{
|
|
4028
|
-
canonicalPath: path.canonicalPath,
|
|
4029
|
-
routes,
|
|
4030
|
-
selectedParent,
|
|
4031
|
-
setSelectedParent,
|
|
4032
|
-
prohibitedRouteIds
|
|
4033
|
-
}
|
|
4034
|
-
),
|
|
4035
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 2, marginBottom: 2 }),
|
|
4036
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
4037
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4038
|
-
PathInput,
|
|
4039
|
-
{
|
|
4040
|
-
path,
|
|
4041
|
-
dispatchPath,
|
|
4042
|
-
isOverride,
|
|
4043
|
-
config
|
|
4044
|
-
}
|
|
4045
|
-
),
|
|
4046
|
-
validationState !== "initial" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4047
|
-
PathInfo,
|
|
4048
|
-
{
|
|
4049
|
-
validationState,
|
|
4050
|
-
replacement: path.replacement
|
|
4051
|
-
}
|
|
4052
|
-
)
|
|
4053
|
-
] }),
|
|
4054
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4055
|
-
OverrideCheckbox,
|
|
4056
|
-
{
|
|
4057
|
-
isOverride,
|
|
4058
|
-
setIsOverride,
|
|
4059
|
-
disabledCondition: !canCreate && !canUpdate
|
|
4060
|
-
}
|
|
4061
|
-
),
|
|
4062
|
-
path.uidPath && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4063
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 2, marginBottom: 2 }),
|
|
4064
|
-
/* @__PURE__ */ jsxRuntime.jsx(UidPathDisplay, { path: path.uidPath })
|
|
4065
|
-
] })
|
|
4066
|
-
]
|
|
4072
|
+
path,
|
|
4073
|
+
dispatchPath,
|
|
4074
|
+
isOverride,
|
|
4075
|
+
config
|
|
4067
4076
|
}
|
|
4068
|
-
)
|
|
4069
|
-
|
|
4070
|
-
|
|
4077
|
+
),
|
|
4078
|
+
validationState !== "initial" && /* @__PURE__ */ jsxRuntime.jsx(PathInfo, { validationState, replacement: path.replacement })
|
|
4079
|
+
] }),
|
|
4080
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4081
|
+
OverrideCheckbox,
|
|
4082
|
+
{
|
|
4083
|
+
isOverride,
|
|
4084
|
+
setIsOverride: (val) => {
|
|
4085
|
+
hasUserInteracted.current = true;
|
|
4086
|
+
setIsOverride(val);
|
|
4087
|
+
},
|
|
4088
|
+
disabledCondition: !canCreate && !canUpdate
|
|
4089
|
+
}
|
|
4090
|
+
),
|
|
4091
|
+
path.uidPath && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4092
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 2, marginBottom: 2 }),
|
|
4093
|
+
/* @__PURE__ */ jsxRuntime.jsx(UidPathDisplay, { path: path.uidPath })
|
|
4094
|
+
] })
|
|
4095
|
+
] }) });
|
|
4071
4096
|
};
|
|
4072
4097
|
const pluginPermissions = {
|
|
4073
4098
|
"cm.aside": [{ action: `plugin::${PLUGIN_ID}.cm.aside`, subject: null }],
|
|
@@ -4076,7 +4101,7 @@ const pluginPermissions = {
|
|
|
4076
4101
|
"settings.general": [{ action: `plugin::${PLUGIN_ID}.settings.general`, subject: null }],
|
|
4077
4102
|
"settings.navigation": [{ action: `plugin::${PLUGIN_ID}.settings.navigation`, subject: null }]
|
|
4078
4103
|
};
|
|
4079
|
-
const CMEditViewAside = ({ documentId, model }) => {
|
|
4104
|
+
const CMEditViewAside = ({ documentId, model, activeTab }) => {
|
|
4080
4105
|
const { contentTypes } = useAllContentTypes();
|
|
4081
4106
|
const { config } = usePluginConfig();
|
|
4082
4107
|
const { formatMessage } = reactIntl.useIntl();
|
|
@@ -4090,7 +4115,7 @@ const CMEditViewAside = ({ documentId, model }) => {
|
|
|
4090
4115
|
setIsAllowedContentType(!!contentType?.pluginOptions?.webatlas?.enabled);
|
|
4091
4116
|
}, [contentTypes, model]);
|
|
4092
4117
|
React.useEffect(() => {
|
|
4093
|
-
const isWebatlasLabel = (label) => label.textContent?.startsWith("
|
|
4118
|
+
const isWebatlasLabel = (label) => label.textContent?.startsWith("webatlas");
|
|
4094
4119
|
const cleanupLabels = () => {
|
|
4095
4120
|
const labels = document.querySelectorAll("label");
|
|
4096
4121
|
labels.forEach((label) => {
|
|
@@ -4099,7 +4124,9 @@ const CMEditViewAside = ({ documentId, model }) => {
|
|
|
4099
4124
|
const parent = container?.parentElement;
|
|
4100
4125
|
const greatGrandParent = parent?.parentElement?.parentElement;
|
|
4101
4126
|
if (!container || !parent) return;
|
|
4102
|
-
const parentWebatlasCount = Array.from(parent.querySelectorAll("label")).filter(
|
|
4127
|
+
const parentWebatlasCount = Array.from(parent.querySelectorAll("label")).filter(
|
|
4128
|
+
isWebatlasLabel
|
|
4129
|
+
).length;
|
|
4103
4130
|
const childrenCount = parent.children.length;
|
|
4104
4131
|
if (greatGrandParent && greatGrandParent?.querySelectorAll("label").length === Array.from(greatGrandParent.querySelectorAll("label")).filter(isWebatlasLabel).length) {
|
|
4105
4132
|
greatGrandParent.remove();
|
|
@@ -4116,7 +4143,7 @@ const CMEditViewAside = ({ documentId, model }) => {
|
|
|
4116
4143
|
return () => clearTimeout(secondTimeoutId);
|
|
4117
4144
|
}, 100);
|
|
4118
4145
|
return () => clearTimeout(timeoutId);
|
|
4119
|
-
}, [documentId, model]);
|
|
4146
|
+
}, [documentId, model, activeTab]);
|
|
4120
4147
|
React.useEffect(() => {
|
|
4121
4148
|
if (!config) return;
|
|
4122
4149
|
setIsActiveContentType(false);
|
|
@@ -4139,13 +4166,14 @@ const CMEditViewAside = ({ documentId, model }) => {
|
|
|
4139
4166
|
strapi.log.error("CMEditViewAside: Plugin is not configured.");
|
|
4140
4167
|
return null;
|
|
4141
4168
|
}
|
|
4142
|
-
if (isLoading)
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4169
|
+
if (isLoading)
|
|
4170
|
+
return {
|
|
4171
|
+
title: panelTitle,
|
|
4172
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
|
|
4173
|
+
id: getTranslation("loading"),
|
|
4174
|
+
defaultMessage: "Loading..."
|
|
4175
|
+
}) })
|
|
4176
|
+
};
|
|
4149
4177
|
return {
|
|
4150
4178
|
title: panelTitle,
|
|
4151
4179
|
content: /* @__PURE__ */ jsxRuntime.jsx(Panel, { config: contentTypeConfig })
|
|
@@ -4160,10 +4188,8 @@ const index = {
|
|
|
4160
4188
|
id: `${PLUGIN_ID}.link.paths`,
|
|
4161
4189
|
defaultMessage: "Paths"
|
|
4162
4190
|
},
|
|
4163
|
-
Component: () => Promise.resolve().then(() => require("./index-
|
|
4164
|
-
permissions: [
|
|
4165
|
-
pluginPermissions["page.routes"][0]
|
|
4166
|
-
]
|
|
4191
|
+
Component: () => Promise.resolve().then(() => require("./index-BEVoxEAm.js")),
|
|
4192
|
+
permissions: [pluginPermissions["page.routes"][0]]
|
|
4167
4193
|
});
|
|
4168
4194
|
app.addMenuLink({
|
|
4169
4195
|
to: `plugins/${PLUGIN_ID}/navigation`,
|
|
@@ -4172,10 +4198,8 @@ const index = {
|
|
|
4172
4198
|
id: `${PLUGIN_ID}.link.navigation`,
|
|
4173
4199
|
defaultMessage: "Navigation"
|
|
4174
4200
|
},
|
|
4175
|
-
Component: () => Promise.resolve().then(() => require("./index-
|
|
4176
|
-
permissions: [
|
|
4177
|
-
pluginPermissions["page.navigation"][0]
|
|
4178
|
-
]
|
|
4201
|
+
Component: () => Promise.resolve().then(() => require("./index-C8YjuuOx.js")),
|
|
4202
|
+
permissions: [pluginPermissions["page.navigation"][0]]
|
|
4179
4203
|
});
|
|
4180
4204
|
app.addSettingsLink(
|
|
4181
4205
|
{
|
|
@@ -4192,27 +4216,20 @@ const index = {
|
|
|
4192
4216
|
},
|
|
4193
4217
|
id: `${PLUGIN_ID}-general`,
|
|
4194
4218
|
to: `${PLUGIN_ID}/general`,
|
|
4195
|
-
Component: () => Promise.resolve().then(() => require("./index-
|
|
4196
|
-
permissions: [
|
|
4197
|
-
pluginPermissions["settings.general"][0]
|
|
4198
|
-
]
|
|
4199
|
-
}
|
|
4200
|
-
);
|
|
4201
|
-
app.addSettingsLink(
|
|
4202
|
-
PLUGIN_ID,
|
|
4203
|
-
{
|
|
4204
|
-
intlLabel: {
|
|
4205
|
-
id: `${PLUGIN_ID}.settings.navigation`,
|
|
4206
|
-
defaultMessage: "Navigation"
|
|
4207
|
-
},
|
|
4208
|
-
id: `${PLUGIN_ID}-navigation`,
|
|
4209
|
-
to: `${PLUGIN_ID}/navigation`,
|
|
4210
|
-
Component: () => Promise.resolve().then(() => require("./index-BYlmJycd.js")),
|
|
4211
|
-
permissions: [
|
|
4212
|
-
pluginPermissions["settings.navigation"][0]
|
|
4213
|
-
]
|
|
4219
|
+
Component: () => Promise.resolve().then(() => require("./index-YdWxpvOH.js")),
|
|
4220
|
+
permissions: [pluginPermissions["settings.general"][0]]
|
|
4214
4221
|
}
|
|
4215
4222
|
);
|
|
4223
|
+
app.addSettingsLink(PLUGIN_ID, {
|
|
4224
|
+
intlLabel: {
|
|
4225
|
+
id: `${PLUGIN_ID}.settings.navigation`,
|
|
4226
|
+
defaultMessage: "Navigation"
|
|
4227
|
+
},
|
|
4228
|
+
id: `${PLUGIN_ID}-navigation`,
|
|
4229
|
+
to: `${PLUGIN_ID}/navigation`,
|
|
4230
|
+
Component: () => Promise.resolve().then(() => require("./index-D2hB1vTw.js")),
|
|
4231
|
+
permissions: [pluginPermissions["settings.navigation"][0]]
|
|
4232
|
+
});
|
|
4216
4233
|
app.registerPlugin({
|
|
4217
4234
|
id: PLUGIN_ID,
|
|
4218
4235
|
initializer: Initializer,
|
|
@@ -4249,3 +4266,4 @@ exports.pluginPermissions = pluginPermissions;
|
|
|
4249
4266
|
exports.useAllContentTypes = useAllContentTypes;
|
|
4250
4267
|
exports.useApi = useApi;
|
|
4251
4268
|
exports.usePluginConfig = usePluginConfig;
|
|
4269
|
+
//# sourceMappingURL=index-Cx_mktdk.js.map
|