@aduptive/strapi-blockscene 2.0.0-alpha.11 → 2.0.0-alpha.12
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 +87 -10
- package/dist/admin.cjs +1081 -545
- package/dist/admin.mjs +1078 -542
- package/dist/server.cjs +135 -15
- package/package.json +1 -1
package/dist/admin.mjs
CHANGED
|
@@ -255,8 +255,8 @@ var require_diff = __commonJS({
|
|
|
255
255
|
}
|
|
256
256
|
function summarize(before, after, schema) {
|
|
257
257
|
const zones = Object.entries(schema?.attributes || {}).filter(([, attr]) => attr?.type === "dynamiczone").map(([name]) => name);
|
|
258
|
-
const blocks = { added: 0, removed: 0, changed: 0 };
|
|
259
|
-
if (!before) return { initial: true, fields: [], blocks };
|
|
258
|
+
const blocks = { total: zones.reduce((n, name) => n + (Array.isArray(after?.[name]) ? after[name].length : 0), 0), added: 0, removed: 0, changed: 0 };
|
|
259
|
+
if (!before) return { initial: true, fields: [], blocks: { ...blocks, added: blocks.total } };
|
|
260
260
|
const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after || {})])];
|
|
261
261
|
const fields = names.filter((name) => !zones.includes(name) && !same2(before[name], after?.[name])).sort();
|
|
262
262
|
for (const name of zones) for (const { op } of diffRows2(before[name], after?.[name])) if (op !== "same") blocks[op]++;
|
|
@@ -267,23 +267,23 @@ var require_diff = __commonJS({
|
|
|
267
267
|
});
|
|
268
268
|
|
|
269
269
|
// admin/strapi5.tsx
|
|
270
|
-
import * as
|
|
270
|
+
import * as React18 from "react";
|
|
271
271
|
import {
|
|
272
|
-
Box as
|
|
272
|
+
Box as Box10,
|
|
273
273
|
Modal as Dialog2,
|
|
274
274
|
MenuItem as MenuItem2,
|
|
275
275
|
SimpleMenu as SimpleMenu2,
|
|
276
276
|
Switch as Switch2,
|
|
277
|
-
Flex as
|
|
278
|
-
Typography as
|
|
277
|
+
Flex as Flex12,
|
|
278
|
+
Typography as Typography12,
|
|
279
279
|
Field as Field3,
|
|
280
|
-
SingleSelect as
|
|
281
|
-
SingleSelectOption as
|
|
280
|
+
SingleSelect as SingleSelect3,
|
|
281
|
+
SingleSelectOption as SingleSelectOption3,
|
|
282
282
|
TextInput as TextInput2
|
|
283
283
|
} from "@strapi/design-system";
|
|
284
284
|
import {
|
|
285
285
|
useFetchClient as useFetchClient3,
|
|
286
|
-
useRBAC as
|
|
286
|
+
useRBAC as useRBAC4,
|
|
287
287
|
useStrapiApp as useStrapiApp2,
|
|
288
288
|
useAuth,
|
|
289
289
|
useForm as useForm3,
|
|
@@ -349,6 +349,26 @@ function variantRow(schema, components, values, keys = fractional) {
|
|
|
349
349
|
}
|
|
350
350
|
return row;
|
|
351
351
|
}
|
|
352
|
+
function starterKitRows(kit, zones, components, form) {
|
|
353
|
+
const out = {};
|
|
354
|
+
for (const [name, items2] of Object.entries(kit?.zones || {})) {
|
|
355
|
+
const zone = zones.find((entry) => entry.name === name);
|
|
356
|
+
const current = form.rows(name);
|
|
357
|
+
if (!zone || current.length || current.length + items2.length > (zone.max ?? Infinity) || items2.some((item) => !zone.components.includes(item.__component) || !components[item.__component])) return null;
|
|
358
|
+
const keys = form.keys(current, current.length, items2.length);
|
|
359
|
+
out[name] = items2.map((item, index) => ({ ...variantRow(components[item.__component], components, item.values), __component: item.__component, __temp_key__: keys[index] }));
|
|
360
|
+
}
|
|
361
|
+
return out;
|
|
362
|
+
}
|
|
363
|
+
function starterKitsForLocale(kits, locale) {
|
|
364
|
+
if (!Array.isArray(kits)) return [];
|
|
365
|
+
const current = String(locale || "").toLowerCase();
|
|
366
|
+
const language = current.split("-")[0];
|
|
367
|
+
return kits.filter((kit) => !Array.isArray(kit.locales) || kit.locales.some((entry) => {
|
|
368
|
+
const wanted = String(entry).toLowerCase();
|
|
369
|
+
return wanted === current || !wanted.includes("-") && wanted === language;
|
|
370
|
+
}));
|
|
371
|
+
}
|
|
352
372
|
function editableZones(schema, values, canEdit, disabled = false) {
|
|
353
373
|
if (disabled) return [];
|
|
354
374
|
return Object.entries(schema?.attributes || {}).filter(
|
|
@@ -664,6 +684,7 @@ var hoverKey = (key, rows) => key === null ? null : typeof key === "string" && k
|
|
|
664
684
|
function isPreviewMessage(event, origin, source, channel, type) {
|
|
665
685
|
return event.origin === origin && event.source === source && event.data?.protocol === PROTOCOL && event.data?.channel === channel && event.data?.type === type;
|
|
666
686
|
}
|
|
687
|
+
var previewMessageAllowed = (event, origin, source, channel, readOnly) => isPreviewMessage(event, origin, source, channel, event.data?.type) && (!readOnly || event.data?.type === "ready");
|
|
667
688
|
function insertIndex(rows, after) {
|
|
668
689
|
if (after === null || after === void 0) return 0;
|
|
669
690
|
const index = (Array.isArray(rows) ? rows : []).findIndex((row) => blockKey(row) === String(after));
|
|
@@ -918,10 +939,10 @@ var en_default = {
|
|
|
918
939
|
rememberHelp: "Only the explicit open all / close all buttons update the memory, per user and browser. Opening one block does not.",
|
|
919
940
|
previewUrl: "Preview route base URL",
|
|
920
941
|
previewUrlHelp: "Full URL of your frontend page-preview route, e.g. https://site.test/block-preview/page. Leave empty to reuse the origin of Strapi's native Preview (when configured for the content type) with /block-preview/page. The route must implement the bridge (see README).",
|
|
921
|
-
previewUrlEmpty: "No preview URL is set: editors get the Fields +
|
|
942
|
+
previewUrlEmpty: "No preview URL is set: editors get the Fields + preview and Visual editor modes only on content types where Strapi's native Preview is configured. Elsewhere the mode menu is not shown.",
|
|
922
943
|
previewMode: "Initial preview mode",
|
|
923
|
-
"modes.form": "Fields",
|
|
924
|
-
"modes.split": "Fields +
|
|
944
|
+
"modes.form": "Fields only",
|
|
945
|
+
"modes.split": "Fields + preview",
|
|
925
946
|
"modes.preview": "Visual editor",
|
|
926
947
|
previewModeHelp: "Every edit view opens in this mode, unless its content type sets its own below. Editors can switch while they edit; the switch is not remembered.",
|
|
927
948
|
lazyEdit: "Click to edit",
|
|
@@ -929,8 +950,8 @@ var en_default = {
|
|
|
929
950
|
lazyFields: "Custom fields loaded on demand",
|
|
930
951
|
lazyEditorsHelp: "Listed custom fields show a read-only preview until clicked or focused, so opening large pages stays fast. Separate uids with commas.",
|
|
931
952
|
lazyFieldsInvalid: "Use up to {max} custom field uids such as plugin::ckeditor5.CKEditor or global::my-field.",
|
|
932
|
-
modeForm: "Fields",
|
|
933
|
-
modeSplit: "Fields +
|
|
953
|
+
modeForm: "Fields only",
|
|
954
|
+
modeSplit: "Fields + preview",
|
|
934
955
|
modePreview: "Visual editor",
|
|
935
956
|
previewPane: "Page preview",
|
|
936
957
|
resize: "Resize preview pane",
|
|
@@ -1025,6 +1046,9 @@ var en_default = {
|
|
|
1025
1046
|
unstar: "Remove star",
|
|
1026
1047
|
quickInsert: "Insert {label}",
|
|
1027
1048
|
insert: "Insert",
|
|
1049
|
+
starterKits: "Start with a kit",
|
|
1050
|
+
starterKitsHelp: "Choose a starting structure. Everything is inserted as an unsaved, editable draft.",
|
|
1051
|
+
startBlank: "Start blank",
|
|
1028
1052
|
closeDetail: "Close details",
|
|
1029
1053
|
typology: "Typology",
|
|
1030
1054
|
typologyAuto: "Automatic ({name})",
|
|
@@ -1281,7 +1305,23 @@ var en_default = {
|
|
|
1281
1305
|
layoutOff: "No grid",
|
|
1282
1306
|
layoutNoMobile: "None",
|
|
1283
1307
|
layoutHelp: "The group's blocks show as a grid in the form, with the column count this block holds.",
|
|
1284
|
-
layoutNoFields: "This block has no field that can hold a column count."
|
|
1308
|
+
layoutNoFields: "This block has no field that can hold a column count.",
|
|
1309
|
+
"toolbar.versions": "Version history",
|
|
1310
|
+
versionsDenied: "Ask an administrator to grant the Blockscene Read version history permission.",
|
|
1311
|
+
versionsDisabled: "History is not enabled for this content type. Ask an administrator to enable it in Settings > Blockscene (settings.history.enabled).",
|
|
1312
|
+
versionsNew: "Save this entry first to start its history.",
|
|
1313
|
+
versionsPerson: "Filter by person",
|
|
1314
|
+
versionsEveryone: "Everyone",
|
|
1315
|
+
versionsCounts: "{total} blocks",
|
|
1316
|
+
versionsCountsMissing: "Block counts unavailable (older or unrecorded event).",
|
|
1317
|
+
versionsPage: "Page {page} of {count}",
|
|
1318
|
+
versionsPrevious: "Previous",
|
|
1319
|
+
versionsNext: "Next",
|
|
1320
|
+
versionsViewing: "Viewing version of {date} by {person} (read-only).",
|
|
1321
|
+
versionsCurrent: "Back to current draft",
|
|
1322
|
+
versionsMissing: "Some blocks, fields, media or relations are no longer available in this preview.",
|
|
1323
|
+
versionsBridgeLegacy: "This preview bridge does not support read-only browsing. Interaction is disabled; update the bridge to support readOnly.",
|
|
1324
|
+
historyExpired: "Snapshot no longer available"
|
|
1285
1325
|
};
|
|
1286
1326
|
|
|
1287
1327
|
// admin/translations/pt-BR.json
|
|
@@ -1339,10 +1379,10 @@ var pt_BR_default = {
|
|
|
1339
1379
|
rememberHelp: "Somente os bot\xF5es de abrir/fechar todos atualizam a mem\xF3ria, por usu\xE1rio e navegador. Abrir um bloco isolado n\xE3o muda.",
|
|
1340
1380
|
previewUrl: "URL base da rota de preview",
|
|
1341
1381
|
previewUrlHelp: "URL completa da rota de preview de p\xE1gina do seu frontend, por exemplo https://site.test/block-preview/page. Vazio reutiliza a origem da Preview nativa do Strapi (quando configurada para o tipo de conte\xFAdo) com /block-preview/page. A rota precisa implementar a bridge (ver README).",
|
|
1342
|
-
previewUrlEmpty: "Nenhuma URL de preview definida: os editores s\xF3 t\xEAm os modos Campos +
|
|
1382
|
+
previewUrlEmpty: "Nenhuma URL de preview definida: os editores s\xF3 t\xEAm os modos Campos + preview e Editor visual nos tipos de conte\xFAdo com o Preview nativo do Strapi configurado. Nos demais, o menu de modos n\xE3o aparece.",
|
|
1343
1383
|
previewMode: "Modo inicial da preview",
|
|
1344
|
-
"modes.form": "
|
|
1345
|
-
"modes.split": "Campos +
|
|
1384
|
+
"modes.form": "Somente campos",
|
|
1385
|
+
"modes.split": "Campos + preview",
|
|
1346
1386
|
"modes.preview": "Editor visual",
|
|
1347
1387
|
previewModeHelp: "Toda tela de edi\xE7\xE3o abre neste modo, a menos que o tipo de conte\xFAdo defina o seu abaixo. Quem edita pode trocar durante a edi\xE7\xE3o; a troca n\xE3o fica gravada.",
|
|
1348
1388
|
lazyEdit: "Clique para editar",
|
|
@@ -1350,8 +1390,8 @@ var pt_BR_default = {
|
|
|
1350
1390
|
lazyFields: "Campos personalizados carregados sob demanda",
|
|
1351
1391
|
lazyEditorsHelp: "Os campos personalizados listados mostram uma pr\xE9via somente leitura at\xE9 receberem clique ou foco, para que p\xE1ginas grandes abram r\xE1pido. Separe os uids com v\xEDrgulas.",
|
|
1352
1392
|
lazyFieldsInvalid: "Use at\xE9 {max} uids de campos personalizados, como plugin::ckeditor5.CKEditor ou global::meu-campo.",
|
|
1353
|
-
modeForm: "
|
|
1354
|
-
modeSplit: "Campos +
|
|
1393
|
+
modeForm: "Somente campos",
|
|
1394
|
+
modeSplit: "Campos + preview",
|
|
1355
1395
|
modePreview: "Editor visual",
|
|
1356
1396
|
previewPane: "Preview da p\xE1gina",
|
|
1357
1397
|
resize: "Redimensionar painel de preview",
|
|
@@ -1446,6 +1486,9 @@ var pt_BR_default = {
|
|
|
1446
1486
|
unstar: "Remover dos favoritos",
|
|
1447
1487
|
quickInsert: "Inserir {label}",
|
|
1448
1488
|
insert: "Inserir",
|
|
1489
|
+
starterKits: "Come\xE7ar com um kit",
|
|
1490
|
+
starterKitsHelp: "Escolha uma estrutura inicial. Tudo \xE9 inserido como rascunho edit\xE1vel e ainda n\xE3o salvo.",
|
|
1491
|
+
startBlank: "Come\xE7ar em branco",
|
|
1449
1492
|
closeDetail: "Fechar detalhes",
|
|
1450
1493
|
typology: "Tipologia",
|
|
1451
1494
|
typologyAuto: "Autom\xE1tica ({name})",
|
|
@@ -1702,7 +1745,23 @@ var pt_BR_default = {
|
|
|
1702
1745
|
layoutOff: "Sem grade",
|
|
1703
1746
|
layoutNoMobile: "Nenhum",
|
|
1704
1747
|
layoutHelp: "Os blocos do grupo aparecem em grade no formul\xE1rio, com o n\xFAmero de colunas deste bloco.",
|
|
1705
|
-
layoutNoFields: "Este bloco n\xE3o tem campo que guarde um n\xFAmero de colunas."
|
|
1748
|
+
layoutNoFields: "Este bloco n\xE3o tem campo que guarde um n\xFAmero de colunas.",
|
|
1749
|
+
"toolbar.versions": "Hist\xF3rico de vers\xF5es",
|
|
1750
|
+
versionsDenied: "Pe\xE7a a um administrador a permiss\xE3o Ler hist\xF3rico de vers\xF5es do Blockscene.",
|
|
1751
|
+
versionsDisabled: "O hist\xF3rico n\xE3o est\xE1 ativo para este tipo de conte\xFAdo. Pe\xE7a a um administrador para ativ\xE1-lo em Settings > Blockscene (settings.history.enabled).",
|
|
1752
|
+
versionsNew: "Salve este conte\xFAdo primeiro para iniciar seu hist\xF3rico.",
|
|
1753
|
+
versionsPerson: "Filtrar por pessoa",
|
|
1754
|
+
versionsEveryone: "Todas as pessoas",
|
|
1755
|
+
versionsCounts: "{total} blocos",
|
|
1756
|
+
versionsCountsMissing: "Contagem de blocos indispon\xEDvel (evento antigo ou n\xE3o registrado).",
|
|
1757
|
+
versionsPage: "P\xE1gina {page} de {count}",
|
|
1758
|
+
versionsPrevious: "Anterior",
|
|
1759
|
+
versionsNext: "Pr\xF3xima",
|
|
1760
|
+
versionsViewing: "Vendo vers\xE3o de {date} por {person} (somente leitura).",
|
|
1761
|
+
versionsCurrent: "Voltar ao rascunho atual",
|
|
1762
|
+
versionsMissing: "Alguns blocos, campos, m\xEDdias ou rela\xE7\xF5es n\xE3o est\xE3o mais dispon\xEDveis nesta preview.",
|
|
1763
|
+
versionsBridgeLegacy: "Esta bridge n\xE3o suporta navega\xE7\xE3o somente leitura. A intera\xE7\xE3o est\xE1 desativada; atualize a bridge para suportar readOnly.",
|
|
1764
|
+
historyExpired: "Snapshot n\xE3o est\xE1 mais dispon\xEDvel"
|
|
1706
1765
|
};
|
|
1707
1766
|
|
|
1708
1767
|
// admin/translations/pt.json
|
|
@@ -1760,10 +1819,10 @@ var pt_default = {
|
|
|
1760
1819
|
rememberHelp: "Somente os bot\xF5es de abrir/fechar todos atualizam a mem\xF3ria, por usu\xE1rio e navegador. Abrir um bloco isolado n\xE3o muda.",
|
|
1761
1820
|
previewUrl: "URL base da rota de pr\xE9-visualiza\xE7\xE3o",
|
|
1762
1821
|
previewUrlHelp: "URL completa da rota de preview de p\xE1gina do seu frontend, por exemplo https://site.test/block-preview/page. Vazio reutiliza a origem da Preview nativa do Strapi (quando configurada para o tipo de conte\xFAdo) com /block-preview/page. A rota precisa implementar a bridge (ver README).",
|
|
1763
|
-
previewUrlEmpty: "Nenhum URL de pr\xE9-visualiza\xE7\xE3o definido: os editores s\xF3 t\xEAm os modos Campos +
|
|
1822
|
+
previewUrlEmpty: "Nenhum URL de pr\xE9-visualiza\xE7\xE3o definido: os editores s\xF3 t\xEAm os modos Campos + pr\xE9-visualiza\xE7\xE3o e Editor visual nos tipos de conte\xFAdo com a Preview nativa do Strapi configurada. Nos restantes, o menu de modos n\xE3o aparece.",
|
|
1764
1823
|
previewMode: "Modo inicial da pr\xE9-visualiza\xE7\xE3o",
|
|
1765
|
-
"modes.form": "
|
|
1766
|
-
"modes.split": "Campos +
|
|
1824
|
+
"modes.form": "Apenas campos",
|
|
1825
|
+
"modes.split": "Campos + pr\xE9-visualiza\xE7\xE3o",
|
|
1767
1826
|
"modes.preview": "Editor visual",
|
|
1768
1827
|
previewModeHelp: "Cada ecr\xE3 de edi\xE7\xE3o abre neste modo, salvo se o tipo de conte\xFAdo definir o seu abaixo. Quem edita pode mudar durante a edi\xE7\xE3o; a mudan\xE7a n\xE3o fica guardada.",
|
|
1769
1828
|
lazyEdit: "Clique para editar",
|
|
@@ -1771,8 +1830,8 @@ var pt_default = {
|
|
|
1771
1830
|
lazyFields: "Campos personalizados carregados a pedido",
|
|
1772
1831
|
lazyEditorsHelp: "Os campos personalizados indicados mostram uma pr\xE9-visualiza\xE7\xE3o s\xF3 de leitura at\xE9 receberem clique ou foco, para que p\xE1ginas grandes abram depressa. Separe os uids com v\xEDrgulas.",
|
|
1773
1832
|
lazyFieldsInvalid: "Use at\xE9 {max} uids de campos personalizados, como plugin::ckeditor5.CKEditor ou global::meu-campo.",
|
|
1774
|
-
modeForm: "
|
|
1775
|
-
modeSplit: "Campos +
|
|
1833
|
+
modeForm: "Apenas campos",
|
|
1834
|
+
modeSplit: "Campos + pr\xE9-visualiza\xE7\xE3o",
|
|
1776
1835
|
modePreview: "Editor visual",
|
|
1777
1836
|
previewPane: "Pr\xE9-visualiza\xE7\xE3o da p\xE1gina",
|
|
1778
1837
|
resize: "Redimensionar painel de pr\xE9-visualiza\xE7\xE3o",
|
|
@@ -1867,6 +1926,9 @@ var pt_default = {
|
|
|
1867
1926
|
unstar: "Remover dos favoritos",
|
|
1868
1927
|
quickInsert: "Inserir {label}",
|
|
1869
1928
|
insert: "Inserir",
|
|
1929
|
+
starterKits: "Come\xE7ar com um kit",
|
|
1930
|
+
starterKitsHelp: "Escolha uma estrutura inicial. Tudo \xE9 inserido como um rascunho edit\xE1vel e ainda n\xE3o guardado.",
|
|
1931
|
+
startBlank: "Come\xE7ar em branco",
|
|
1870
1932
|
closeDetail: "Fechar detalhes",
|
|
1871
1933
|
typology: "Tipologia",
|
|
1872
1934
|
typologyAuto: "Autom\xE1tica ({name})",
|
|
@@ -2123,7 +2185,23 @@ var pt_default = {
|
|
|
2123
2185
|
layoutOff: "Sem grelha",
|
|
2124
2186
|
layoutNoMobile: "Nenhum",
|
|
2125
2187
|
layoutHelp: "Os blocos do grupo aparecem em grelha no formul\xE1rio, com o n\xFAmero de colunas deste bloco.",
|
|
2126
|
-
layoutNoFields: "Este bloco n\xE3o tem campo que guarde um n\xFAmero de colunas."
|
|
2188
|
+
layoutNoFields: "Este bloco n\xE3o tem campo que guarde um n\xFAmero de colunas.",
|
|
2189
|
+
"toolbar.versions": "Hist\xF3rico de vers\xF5es",
|
|
2190
|
+
versionsDenied: "Pe\xE7a a um administrador a permiss\xE3o Ler hist\xF3rico de vers\xF5es do Blockscene.",
|
|
2191
|
+
versionsDisabled: "O hist\xF3rico n\xE3o est\xE1 ativo para este tipo de conte\xFAdo. Pe\xE7a a um administrador para o ativar em Settings > Blockscene (settings.history.enabled).",
|
|
2192
|
+
versionsNew: "Guarde este conte\xFAdo primeiro para iniciar o hist\xF3rico.",
|
|
2193
|
+
versionsPerson: "Filtrar por pessoa",
|
|
2194
|
+
versionsEveryone: "Todas as pessoas",
|
|
2195
|
+
versionsCounts: "{total} blocos",
|
|
2196
|
+
versionsCountsMissing: "Contagem de blocos indispon\xEDvel (evento antigo ou n\xE3o registado).",
|
|
2197
|
+
versionsPage: "P\xE1gina {page} de {count}",
|
|
2198
|
+
versionsPrevious: "Anterior",
|
|
2199
|
+
versionsNext: "Seguinte",
|
|
2200
|
+
versionsViewing: "A ver a vers\xE3o de {date} por {person} (s\xF3 de leitura).",
|
|
2201
|
+
versionsCurrent: "Voltar ao rascunho atual",
|
|
2202
|
+
versionsMissing: "Alguns blocos, campos, ficheiros ou rela\xE7\xF5es j\xE1 n\xE3o est\xE3o dispon\xEDveis nesta pr\xE9via.",
|
|
2203
|
+
versionsBridgeLegacy: "Esta bridge n\xE3o suporta navega\xE7\xE3o s\xF3 de leitura. A intera\xE7\xE3o est\xE1 desativada; atualize a bridge para suportar readOnly.",
|
|
2204
|
+
historyExpired: "Snapshot j\xE1 n\xE3o est\xE1 dispon\xEDvel"
|
|
2127
2205
|
};
|
|
2128
2206
|
|
|
2129
2207
|
// admin/translations/fr.json
|
|
@@ -2181,10 +2259,10 @@ var fr_default = {
|
|
|
2181
2259
|
rememberHelp: "Seuls les boutons explicites tout ouvrir / tout fermer mettent la m\xE9moire \xE0 jour, par utilisateur et navigateur. Ouvrir un seul bloc ne change rien.",
|
|
2182
2260
|
previewUrl: "URL de base de la route d'aper\xE7u",
|
|
2183
2261
|
previewUrlHelp: "URL compl\xE8te de la route d'aper\xE7u de page de votre frontend, par ex. https://site.test/block-preview/page. Laissez vide pour r\xE9utiliser l'origine de l'aper\xE7u natif de Strapi (s'il est configur\xE9 pour le type de contenu) avec /block-preview/page. La route doit impl\xE9menter le pont (voir README).",
|
|
2184
|
-
previewUrlEmpty: "Aucune URL d'aper\xE7u : les \xE9diteurs n'ont les modes Champs +
|
|
2262
|
+
previewUrlEmpty: "Aucune URL d'aper\xE7u : les \xE9diteurs n'ont les modes Champs + aper\xE7u et \xC9diteur visuel que sur les types de contenu o\xF9 l'aper\xE7u natif de Strapi est configur\xE9. Ailleurs, le menu des modes n'appara\xEEt pas.",
|
|
2185
2263
|
previewMode: "Mode d'aper\xE7u initial",
|
|
2186
|
-
"modes.form": "Champs",
|
|
2187
|
-
"modes.split": "Champs +
|
|
2264
|
+
"modes.form": "Champs uniquement",
|
|
2265
|
+
"modes.split": "Champs + aper\xE7u",
|
|
2188
2266
|
"modes.preview": "\xC9diteur visuel",
|
|
2189
2267
|
previewModeHelp: "Chaque vue d'\xE9dition s'ouvre dans ce mode, sauf si son type de contenu d\xE9finit le sien ci-dessous. L'\xE9diteur peut changer pendant l'\xE9dition ; ce choix n'est pas m\xE9moris\xE9.",
|
|
2190
2268
|
lazyEdit: "Cliquer pour modifier",
|
|
@@ -2192,8 +2270,8 @@ var fr_default = {
|
|
|
2192
2270
|
lazyFields: "Champs personnalis\xE9s charg\xE9s \xE0 la demande",
|
|
2193
2271
|
lazyEditorsHelp: "Les champs personnalis\xE9s list\xE9s affichent un aper\xE7u en lecture seule jusqu'au clic ou au focus, pour que les grandes pages s'ouvrent vite. S\xE9parez les uids par des virgules.",
|
|
2194
2272
|
lazyFieldsInvalid: "Utilisez jusqu'\xE0 {max} uids de champs personnalis\xE9s, comme plugin::ckeditor5.CKEditor ou global::mon-champ.",
|
|
2195
|
-
modeForm: "Champs",
|
|
2196
|
-
modeSplit: "Champs +
|
|
2273
|
+
modeForm: "Champs uniquement",
|
|
2274
|
+
modeSplit: "Champs + aper\xE7u",
|
|
2197
2275
|
modePreview: "\xC9diteur visuel",
|
|
2198
2276
|
previewPane: "Aper\xE7u de la page",
|
|
2199
2277
|
resize: "Redimensionner le panneau d'aper\xE7u",
|
|
@@ -2288,6 +2366,9 @@ var fr_default = {
|
|
|
2288
2366
|
unstar: "Retirer des favoris",
|
|
2289
2367
|
quickInsert: "Ins\xE9rer {label}",
|
|
2290
2368
|
insert: "Ins\xE9rer",
|
|
2369
|
+
starterKits: "D\xE9marrer avec un kit",
|
|
2370
|
+
starterKitsHelp: "Choisissez une structure de d\xE9part. Tout est ins\xE9r\xE9 comme brouillon modifiable et non enregistr\xE9.",
|
|
2371
|
+
startBlank: "Commencer vide",
|
|
2291
2372
|
closeDetail: "Fermer les d\xE9tails",
|
|
2292
2373
|
typology: "Typologie",
|
|
2293
2374
|
typologyAuto: "Automatique ({name})",
|
|
@@ -2544,7 +2625,23 @@ var fr_default = {
|
|
|
2544
2625
|
layoutOff: "Pas de grille",
|
|
2545
2626
|
layoutNoMobile: "Aucun",
|
|
2546
2627
|
layoutHelp: "Les blocs du groupe s'affichent en grille dans le formulaire, avec le nombre de colonnes de ce bloc.",
|
|
2547
|
-
layoutNoFields: "Ce bloc n'a aucun champ pouvant contenir un nombre de colonnes."
|
|
2628
|
+
layoutNoFields: "Ce bloc n'a aucun champ pouvant contenir un nombre de colonnes.",
|
|
2629
|
+
"toolbar.versions": "Historique des versions",
|
|
2630
|
+
versionsDenied: "Demandez \xE0 un administrateur la permission Lire l\u2019historique des versions de Blockscene.",
|
|
2631
|
+
versionsDisabled: "L\u2019historique n\u2019est pas activ\xE9 pour ce type de contenu. Demandez \xE0 un administrateur de l\u2019activer dans Settings > Blockscene (settings.history.enabled).",
|
|
2632
|
+
versionsNew: "Enregistrez d\u2019abord ce contenu pour commencer son historique.",
|
|
2633
|
+
versionsPerson: "Filtrer par personne",
|
|
2634
|
+
versionsEveryone: "Tout le monde",
|
|
2635
|
+
versionsCounts: "{total} blocs",
|
|
2636
|
+
versionsCountsMissing: "Nombre de blocs indisponible (\xE9v\xE9nement ancien ou non enregistr\xE9).",
|
|
2637
|
+
versionsPage: "Page {page} sur {count}",
|
|
2638
|
+
versionsPrevious: "Pr\xE9c\xE9dente",
|
|
2639
|
+
versionsNext: "Suivante",
|
|
2640
|
+
versionsViewing: "Version du {date} par {person} (lecture seule).",
|
|
2641
|
+
versionsCurrent: "Revenir au brouillon actuel",
|
|
2642
|
+
versionsMissing: "Certains blocs, champs, m\xE9dias ou relations ne sont plus disponibles dans cet aper\xE7u.",
|
|
2643
|
+
versionsBridgeLegacy: "Cette bridge ne prend pas en charge la navigation en lecture seule. L\u2019interaction est d\xE9sactiv\xE9e ; mettez la bridge \xE0 jour pour prendre en charge readOnly.",
|
|
2644
|
+
historyExpired: "Snapshot indisponible"
|
|
2548
2645
|
};
|
|
2549
2646
|
|
|
2550
2647
|
// admin/translations/es.json
|
|
@@ -2602,10 +2699,10 @@ var es_default = {
|
|
|
2602
2699
|
rememberHelp: "Solo los botones expl\xEDcitos de abrir/cerrar todos actualizan la memoria, por usuario y navegador. Abrir un solo bloque no la cambia.",
|
|
2603
2700
|
previewUrl: "URL base de la ruta de vista previa",
|
|
2604
2701
|
previewUrlHelp: "URL completa de la ruta de vista previa de p\xE1gina de su frontend, p. ej. https://site.test/block-preview/page. D\xE9jela vac\xEDa para reutilizar el origen de la Vista previa nativa de Strapi (si est\xE1 configurada para el tipo de contenido) con /block-preview/page. La ruta debe implementar el puente (ver README).",
|
|
2605
|
-
previewUrlEmpty: "No hay URL de vista previa: los editores solo tienen los modos Campos +
|
|
2702
|
+
previewUrlEmpty: "No hay URL de vista previa: los editores solo tienen los modos Campos + vista previa y Editor visual en los tipos de contenido con la vista previa nativa de Strapi configurada. En los dem\xE1s no aparece el men\xFA de modos.",
|
|
2606
2703
|
previewMode: "Modo inicial de la vista previa",
|
|
2607
|
-
"modes.form": "
|
|
2608
|
-
"modes.split": "Campos +
|
|
2704
|
+
"modes.form": "Solo campos",
|
|
2705
|
+
"modes.split": "Campos + vista previa",
|
|
2609
2706
|
"modes.preview": "Editor visual",
|
|
2610
2707
|
previewModeHelp: "Cada vista de edici\xF3n se abre en este modo, salvo que su tipo de contenido defina el suyo abajo. Quien edita puede cambiarlo mientras edita; el cambio no se recuerda.",
|
|
2611
2708
|
lazyEdit: "Haz clic para editar",
|
|
@@ -2613,8 +2710,8 @@ var es_default = {
|
|
|
2613
2710
|
lazyFields: "Campos personalizados cargados bajo demanda",
|
|
2614
2711
|
lazyEditorsHelp: "Los campos personalizados de la lista muestran una vista previa de solo lectura hasta recibir un clic o el foco, para que las p\xE1ginas grandes abran r\xE1pido. Separa los uids con comas.",
|
|
2615
2712
|
lazyFieldsInvalid: "Usa hasta {max} uids de campos personalizados, como plugin::ckeditor5.CKEditor o global::mi-campo.",
|
|
2616
|
-
modeForm: "
|
|
2617
|
-
modeSplit: "Campos +
|
|
2713
|
+
modeForm: "Solo campos",
|
|
2714
|
+
modeSplit: "Campos + vista previa",
|
|
2618
2715
|
modePreview: "Editor visual",
|
|
2619
2716
|
previewPane: "Vista previa de la p\xE1gina",
|
|
2620
2717
|
resize: "Redimensionar el panel de vista previa",
|
|
@@ -2709,6 +2806,9 @@ var es_default = {
|
|
|
2709
2806
|
unstar: "Quitar de favoritos",
|
|
2710
2807
|
quickInsert: "Insertar {label}",
|
|
2711
2808
|
insert: "Insertar",
|
|
2809
|
+
starterKits: "Comenzar con un kit",
|
|
2810
|
+
starterKitsHelp: "Elige una estructura inicial. Todo se inserta como un borrador editable y sin guardar.",
|
|
2811
|
+
startBlank: "Comenzar en blanco",
|
|
2712
2812
|
closeDetail: "Cerrar detalles",
|
|
2713
2813
|
typology: "Tipolog\xEDa",
|
|
2714
2814
|
typologyAuto: "Autom\xE1tica ({name})",
|
|
@@ -2965,7 +3065,23 @@ var es_default = {
|
|
|
2965
3065
|
layoutOff: "Sin cuadr\xEDcula",
|
|
2966
3066
|
layoutNoMobile: "Ninguno",
|
|
2967
3067
|
layoutHelp: "Los bloques del grupo se muestran en cuadr\xEDcula en el formulario, con el n\xFAmero de columnas de este bloque.",
|
|
2968
|
-
layoutNoFields: "Este bloque no tiene ning\xFAn campo que pueda guardar un n\xFAmero de columnas."
|
|
3068
|
+
layoutNoFields: "Este bloque no tiene ning\xFAn campo que pueda guardar un n\xFAmero de columnas.",
|
|
3069
|
+
"toolbar.versions": "Historial de versiones",
|
|
3070
|
+
versionsDenied: "Pide a un administrador el permiso Leer historial de versiones de Blockscene.",
|
|
3071
|
+
versionsDisabled: "El historial no est\xE1 activo para este tipo de contenido. Pide a un administrador que lo active en Settings > Blockscene (settings.history.enabled).",
|
|
3072
|
+
versionsNew: "Guarda primero este contenido para iniciar su historial.",
|
|
3073
|
+
versionsPerson: "Filtrar por persona",
|
|
3074
|
+
versionsEveryone: "Todas las personas",
|
|
3075
|
+
versionsCounts: "{total} bloques",
|
|
3076
|
+
versionsCountsMissing: "Recuento de bloques no disponible (evento antiguo o no registrado).",
|
|
3077
|
+
versionsPage: "P\xE1gina {page} de {count}",
|
|
3078
|
+
versionsPrevious: "Anterior",
|
|
3079
|
+
versionsNext: "Siguiente",
|
|
3080
|
+
versionsViewing: "Viendo la versi\xF3n del {date} por {person} (solo lectura).",
|
|
3081
|
+
versionsCurrent: "Volver al borrador actual",
|
|
3082
|
+
versionsMissing: "Algunos bloques, campos, archivos o relaciones ya no est\xE1n disponibles en esta vista previa.",
|
|
3083
|
+
versionsBridgeLegacy: "Esta bridge no admite navegaci\xF3n de solo lectura. La interacci\xF3n est\xE1 desactivada; actualiza la bridge para admitir readOnly.",
|
|
3084
|
+
historyExpired: "Snapshot ya no disponible"
|
|
2969
3085
|
};
|
|
2970
3086
|
|
|
2971
3087
|
// admin/translations/de.json
|
|
@@ -3023,10 +3139,10 @@ var de_default = {
|
|
|
3023
3139
|
rememberHelp: "Nur die expliziten Schaltfl\xE4chen \u201Ealle \xF6ffnen/schlie\xDFen\u201C aktualisieren die Erinnerung, pro Benutzer und Browser. Das \xD6ffnen eines einzelnen Blocks \xE4ndert nichts.",
|
|
3024
3140
|
previewUrl: "Basis-URL der Vorschauroute",
|
|
3025
3141
|
previewUrlHelp: "Vollst\xE4ndige URL der Seitenvorschau-Route Ihres Frontends, z. B. https://site.test/block-preview/page. Leer lassen, um den Ursprung der nativen Strapi-Vorschau (wenn f\xFCr den Inhaltstyp konfiguriert) mit /block-preview/page zu verwenden. Die Route muss die Bridge implementieren (siehe README).",
|
|
3026
|
-
previewUrlEmpty: "Keine Vorschau-URL gesetzt: Redakteure erhalten die Modi Felder +
|
|
3142
|
+
previewUrlEmpty: "Keine Vorschau-URL gesetzt: Redakteure erhalten die Modi Felder + Vorschau und Visueller Editor nur bei Inhaltstypen, f\xFCr die Strapis native Vorschau konfiguriert ist. Sonst wird das Modusmen\xFC nicht angezeigt.",
|
|
3027
3143
|
previewMode: "Anf\xE4nglicher Vorschaumodus",
|
|
3028
|
-
"modes.form": "Felder",
|
|
3029
|
-
"modes.split": "Felder +
|
|
3144
|
+
"modes.form": "Nur Felder",
|
|
3145
|
+
"modes.split": "Felder + Vorschau",
|
|
3030
3146
|
"modes.preview": "Visueller Editor",
|
|
3031
3147
|
previewModeHelp: "Jede Bearbeitungsansicht \xF6ffnet in diesem Modus, au\xDFer ihr Inhaltstyp legt unten einen eigenen fest. Beim Bearbeiten l\xE4sst sich wechseln; der Wechsel wird nicht gespeichert.",
|
|
3032
3148
|
lazyEdit: "Zum Bearbeiten klicken",
|
|
@@ -3034,8 +3150,8 @@ var de_default = {
|
|
|
3034
3150
|
lazyFields: "Bei Bedarf geladene benutzerdefinierte Felder",
|
|
3035
3151
|
lazyEditorsHelp: "Die aufgef\xFChrten benutzerdefinierten Felder zeigen eine schreibgesch\xFCtzte Vorschau, bis sie angeklickt oder fokussiert werden, damit gro\xDFe Seiten schnell \xF6ffnen. Uids durch Kommas trennen.",
|
|
3036
3152
|
lazyFieldsInvalid: "Bis zu {max} Uids benutzerdefinierter Felder verwenden, z. B. plugin::ckeditor5.CKEditor oder global::mein-feld.",
|
|
3037
|
-
modeForm: "Felder",
|
|
3038
|
-
modeSplit: "Felder +
|
|
3153
|
+
modeForm: "Nur Felder",
|
|
3154
|
+
modeSplit: "Felder + Vorschau",
|
|
3039
3155
|
modePreview: "Visueller Editor",
|
|
3040
3156
|
previewPane: "Seitenvorschau",
|
|
3041
3157
|
resize: "Vorschaubereich anpassen",
|
|
@@ -3130,6 +3246,9 @@ var de_default = {
|
|
|
3130
3246
|
unstar: "Aus Favoriten entfernen",
|
|
3131
3247
|
quickInsert: "{label} einf\xFCgen",
|
|
3132
3248
|
insert: "Einf\xFCgen",
|
|
3249
|
+
starterKits: "Mit einem Kit starten",
|
|
3250
|
+
starterKitsHelp: "W\xE4hlen Sie eine Ausgangsstruktur. Alles wird als ungespeicherter, bearbeitbarer Entwurf eingef\xFCgt.",
|
|
3251
|
+
startBlank: "Leer beginnen",
|
|
3133
3252
|
closeDetail: "Details schlie\xDFen",
|
|
3134
3253
|
typology: "Typologie",
|
|
3135
3254
|
typologyAuto: "Automatisch ({name})",
|
|
@@ -3386,7 +3505,23 @@ var de_default = {
|
|
|
3386
3505
|
layoutOff: "Kein Raster",
|
|
3387
3506
|
layoutNoMobile: "Keines",
|
|
3388
3507
|
layoutHelp: "Die Bl\xF6cke der Gruppe erscheinen im Formular als Raster, mit der Spaltenzahl dieses Blocks.",
|
|
3389
|
-
layoutNoFields: "Dieser Block hat kein Feld, das eine Spaltenzahl enthalten kann."
|
|
3508
|
+
layoutNoFields: "Dieser Block hat kein Feld, das eine Spaltenzahl enthalten kann.",
|
|
3509
|
+
"toolbar.versions": "Versionsverlauf",
|
|
3510
|
+
versionsDenied: "Bitte einen Administrator um die Blockscene-Berechtigung zum Lesen des Versionsverlaufs.",
|
|
3511
|
+
versionsDisabled: "Der Verlauf ist f\xFCr diesen Inhaltstyp nicht aktiviert. Bitte einen Administrator, ihn unter Settings > Blockscene zu aktivieren (settings.history.enabled).",
|
|
3512
|
+
versionsNew: "Speichere diesen Eintrag zuerst, um seinen Verlauf zu beginnen.",
|
|
3513
|
+
versionsPerson: "Nach Person filtern",
|
|
3514
|
+
versionsEveryone: "Alle Personen",
|
|
3515
|
+
versionsCounts: "{total} Bl\xF6cke",
|
|
3516
|
+
versionsCountsMissing: "Blockanzahl nicht verf\xFCgbar (\xE4lteres oder nicht aufgezeichnetes Ereignis).",
|
|
3517
|
+
versionsPage: "Seite {page} von {count}",
|
|
3518
|
+
versionsPrevious: "Zur\xFCck",
|
|
3519
|
+
versionsNext: "Weiter",
|
|
3520
|
+
versionsViewing: "Version vom {date} von {person} (schreibgesch\xFCtzt).",
|
|
3521
|
+
versionsCurrent: "Zur\xFCck zum aktuellen Entwurf",
|
|
3522
|
+
versionsMissing: "Einige Bl\xF6cke, Felder, Medien oder Beziehungen sind in dieser Vorschau nicht mehr verf\xFCgbar.",
|
|
3523
|
+
versionsBridgeLegacy: "Diese Bridge unterst\xFCtzt keine schreibgesch\xFCtzte Navigation. Interaktion ist deaktiviert; aktualisiere die Bridge f\xFCr readOnly.",
|
|
3524
|
+
historyExpired: "Snapshot nicht mehr verf\xFCgbar"
|
|
3390
3525
|
};
|
|
3391
3526
|
|
|
3392
3527
|
// admin/translations/it.json
|
|
@@ -3444,10 +3579,10 @@ var it_default = {
|
|
|
3444
3579
|
rememberHelp: "Solo i pulsanti espliciti apri tutti / chiudi tutti aggiornano la memoria, per utente e browser. Aprire un singolo blocco non la cambia.",
|
|
3445
3580
|
previewUrl: "URL di base della route di anteprima",
|
|
3446
3581
|
previewUrlHelp: "URL completo della route di anteprima pagina del tuo frontend, ad es. https://site.test/block-preview/page. Lascia vuoto per riutilizzare l'origine dell'Anteprima nativa di Strapi (se configurata per il tipo di contenuto) con /block-preview/page. La route deve implementare il bridge (vedi README).",
|
|
3447
|
-
previewUrlEmpty: "Nessun URL di anteprima impostato: gli editor hanno le modalit\xE0 Campi +
|
|
3582
|
+
previewUrlEmpty: "Nessun URL di anteprima impostato: gli editor hanno le modalit\xE0 Campi + anteprima ed Editor visivo solo sui tipi di contenuto con l'anteprima nativa di Strapi configurata. Altrove il menu delle modalit\xE0 non compare.",
|
|
3448
3583
|
previewMode: "Modalit\xE0 iniziale dell'anteprima",
|
|
3449
|
-
"modes.form": "
|
|
3450
|
-
"modes.split": "Campi +
|
|
3584
|
+
"modes.form": "Solo campi",
|
|
3585
|
+
"modes.split": "Campi + anteprima",
|
|
3451
3586
|
"modes.preview": "Editor visivo",
|
|
3452
3587
|
previewModeHelp: "Ogni vista di modifica si apre in questo modo, a meno che il suo tipo di contenuto ne imposti uno proprio qui sotto. Durante la modifica si pu\xF2 cambiare; la scelta non viene ricordata.",
|
|
3453
3588
|
lazyEdit: "Fai clic per modificare",
|
|
@@ -3455,8 +3590,8 @@ var it_default = {
|
|
|
3455
3590
|
lazyFields: "Campi personalizzati caricati su richiesta",
|
|
3456
3591
|
lazyEditorsHelp: "I campi personalizzati elencati mostrano un'anteprima di sola lettura finch\xE9 non ricevono un clic o il focus, cos\xEC le pagine grandi si aprono in fretta. Separa gli uid con virgole.",
|
|
3457
3592
|
lazyFieldsInvalid: "Usa fino a {max} uid di campi personalizzati, come plugin::ckeditor5.CKEditor o global::mio-campo.",
|
|
3458
|
-
modeForm: "
|
|
3459
|
-
modeSplit: "Campi +
|
|
3593
|
+
modeForm: "Solo campi",
|
|
3594
|
+
modeSplit: "Campi + anteprima",
|
|
3460
3595
|
modePreview: "Editor visivo",
|
|
3461
3596
|
previewPane: "Anteprima della pagina",
|
|
3462
3597
|
resize: "Ridimensiona il pannello di anteprima",
|
|
@@ -3551,6 +3686,9 @@ var it_default = {
|
|
|
3551
3686
|
unstar: "Rimuovi dai preferiti",
|
|
3552
3687
|
quickInsert: "Inserisci {label}",
|
|
3553
3688
|
insert: "Inserisci",
|
|
3689
|
+
starterKits: "Inizia con un kit",
|
|
3690
|
+
starterKitsHelp: "Scegli una struttura iniziale. Tutto viene inserito come bozza modificabile e non salvata.",
|
|
3691
|
+
startBlank: "Inizia da zero",
|
|
3554
3692
|
closeDetail: "Chiudi dettagli",
|
|
3555
3693
|
typology: "Tipologia",
|
|
3556
3694
|
typologyAuto: "Automatica ({name})",
|
|
@@ -3807,7 +3945,23 @@ var it_default = {
|
|
|
3807
3945
|
layoutOff: "Nessuna griglia",
|
|
3808
3946
|
layoutNoMobile: "Nessuno",
|
|
3809
3947
|
layoutHelp: "I blocchi del gruppo appaiono in griglia nel modulo, con il numero di colonne di questo blocco.",
|
|
3810
|
-
layoutNoFields: "Questo blocco non ha un campo che possa contenere un numero di colonne."
|
|
3948
|
+
layoutNoFields: "Questo blocco non ha un campo che possa contenere un numero di colonne.",
|
|
3949
|
+
"toolbar.versions": "Cronologia delle versioni",
|
|
3950
|
+
versionsDenied: "Chiedi a un amministratore il permesso Leggere la cronologia delle versioni di Blockscene.",
|
|
3951
|
+
versionsDisabled: "La cronologia non \xE8 attiva per questo tipo di contenuto. Chiedi a un amministratore di attivarla in Settings > Blockscene (settings.history.enabled).",
|
|
3952
|
+
versionsNew: "Salva prima questo contenuto per avviare la cronologia.",
|
|
3953
|
+
versionsPerson: "Filtra per persona",
|
|
3954
|
+
versionsEveryone: "Tutte le persone",
|
|
3955
|
+
versionsCounts: "{total} blocchi",
|
|
3956
|
+
versionsCountsMissing: "Conteggio dei blocchi non disponibile (evento vecchio o non registrato).",
|
|
3957
|
+
versionsPage: "Pagina {page} di {count}",
|
|
3958
|
+
versionsPrevious: "Precedente",
|
|
3959
|
+
versionsNext: "Successiva",
|
|
3960
|
+
versionsViewing: "Versione del {date} di {person} (sola lettura).",
|
|
3961
|
+
versionsCurrent: "Torna alla bozza attuale",
|
|
3962
|
+
versionsMissing: "Alcuni blocchi, campi, media o relazioni non sono pi\xF9 disponibili in questa anteprima.",
|
|
3963
|
+
versionsBridgeLegacy: "Questa bridge non supporta la navigazione in sola lettura. Interazione disattivata; aggiorna la bridge per supportare readOnly.",
|
|
3964
|
+
historyExpired: "Snapshot non pi\xF9 disponibile"
|
|
3811
3965
|
};
|
|
3812
3966
|
|
|
3813
3967
|
// admin/translations/nl.json
|
|
@@ -3865,10 +4019,10 @@ var nl_default = {
|
|
|
3865
4019
|
rememberHelp: "Alleen de expliciete knoppen alles openen / alles sluiten werken het geheugen bij, per gebruiker en browser. E\xE9n blok openen verandert niets.",
|
|
3866
4020
|
previewUrl: "Basis-URL van de voorbeeldroute",
|
|
3867
4021
|
previewUrlHelp: "Volledige URL van de paginavoorbeeldroute van uw frontend, bijv. https://site.test/block-preview/page. Laat leeg om de oorsprong van Strapi's native Preview (indien geconfigureerd voor het contenttype) met /block-preview/page te hergebruiken. De route moet de bridge implementeren (zie README).",
|
|
3868
|
-
previewUrlEmpty: "Geen preview-URL ingesteld: redacteuren krijgen de modi Velden +
|
|
4022
|
+
previewUrlEmpty: "Geen preview-URL ingesteld: redacteuren krijgen de modi Velden + voorbeeld en Visuele editor alleen bij inhoudstypes waarvoor de native Preview van Strapi is ingesteld. Elders verschijnt het modusmenu niet.",
|
|
3869
4023
|
previewMode: "Beginmodus van het voorbeeld",
|
|
3870
|
-
"modes.form": "
|
|
3871
|
-
"modes.split": "Velden +
|
|
4024
|
+
"modes.form": "Alleen velden",
|
|
4025
|
+
"modes.split": "Velden + voorbeeld",
|
|
3872
4026
|
"modes.preview": "Visuele editor",
|
|
3873
4027
|
previewModeHelp: "Elke bewerkweergave opent in deze modus, tenzij het contenttype hieronder een eigen modus instelt. Tijdens het bewerken kan je wisselen; die keuze wordt niet onthouden.",
|
|
3874
4028
|
lazyEdit: "Klik om te bewerken",
|
|
@@ -3876,8 +4030,8 @@ var nl_default = {
|
|
|
3876
4030
|
lazyFields: "Aangepaste velden die op aanvraag laden",
|
|
3877
4031
|
lazyEditorsHelp: "De vermelde aangepaste velden tonen een alleen-lezen voorbeeld tot ze worden aangeklikt of focus krijgen, zodat grote pagina's snel openen. Scheid uids met komma's.",
|
|
3878
4032
|
lazyFieldsInvalid: "Gebruik maximaal {max} uids van aangepaste velden, zoals plugin::ckeditor5.CKEditor of global::mijn-veld.",
|
|
3879
|
-
modeForm: "
|
|
3880
|
-
modeSplit: "Velden +
|
|
4033
|
+
modeForm: "Alleen velden",
|
|
4034
|
+
modeSplit: "Velden + voorbeeld",
|
|
3881
4035
|
modePreview: "Visuele editor",
|
|
3882
4036
|
previewPane: "Paginavoorbeeld",
|
|
3883
4037
|
resize: "Voorbeeldpaneel aanpassen",
|
|
@@ -3972,6 +4126,9 @@ var nl_default = {
|
|
|
3972
4126
|
unstar: "Uit favorieten verwijderen",
|
|
3973
4127
|
quickInsert: "{label} invoegen",
|
|
3974
4128
|
insert: "Invoegen",
|
|
4129
|
+
starterKits: "Start met een kit",
|
|
4130
|
+
starterKitsHelp: "Kies een beginstructuur. Alles wordt ingevoegd als een onopgeslagen, bewerkbaar concept.",
|
|
4131
|
+
startBlank: "Leeg beginnen",
|
|
3975
4132
|
closeDetail: "Details sluiten",
|
|
3976
4133
|
typology: "Typologie",
|
|
3977
4134
|
typologyAuto: "Automatisch ({name})",
|
|
@@ -4228,7 +4385,23 @@ var nl_default = {
|
|
|
4228
4385
|
layoutOff: "Geen raster",
|
|
4229
4386
|
layoutNoMobile: "Geen",
|
|
4230
4387
|
layoutHelp: "De blokken van de groep verschijnen als raster in het formulier, met het aantal kolommen van dit blok.",
|
|
4231
|
-
layoutNoFields: "Dit blok heeft geen veld dat een aantal kolommen kan bevatten."
|
|
4388
|
+
layoutNoFields: "Dit blok heeft geen veld dat een aantal kolommen kan bevatten.",
|
|
4389
|
+
"toolbar.versions": "Versiegeschiedenis",
|
|
4390
|
+
versionsDenied: "Vraag een beheerder om de Blockscene-machtiging Versiegeschiedenis lezen.",
|
|
4391
|
+
versionsDisabled: "Geschiedenis is niet ingeschakeld voor dit inhoudstype. Vraag een beheerder dit in Settings > Blockscene in te schakelen (settings.history.enabled).",
|
|
4392
|
+
versionsNew: "Sla dit item eerst op om de geschiedenis te starten.",
|
|
4393
|
+
versionsPerson: "Filter op persoon",
|
|
4394
|
+
versionsEveryone: "Iedereen",
|
|
4395
|
+
versionsCounts: "{total} blokken",
|
|
4396
|
+
versionsCountsMissing: "Aantal blokken niet beschikbaar (oudere of niet vastgelegde gebeurtenis).",
|
|
4397
|
+
versionsPage: "Pagina {page} van {count}",
|
|
4398
|
+
versionsPrevious: "Vorige",
|
|
4399
|
+
versionsNext: "Volgende",
|
|
4400
|
+
versionsViewing: "Versie van {date} door {person} bekijken (alleen-lezen).",
|
|
4401
|
+
versionsCurrent: "Terug naar huidig concept",
|
|
4402
|
+
versionsMissing: "Sommige blokken, velden, media of relaties zijn niet meer beschikbaar in dit voorbeeld.",
|
|
4403
|
+
versionsBridgeLegacy: "Deze bridge ondersteunt geen alleen-lezen navigatie. Interactie is uitgeschakeld; werk de bridge bij voor readOnly.",
|
|
4404
|
+
historyExpired: "Snapshot niet meer beschikbaar"
|
|
4232
4405
|
};
|
|
4233
4406
|
|
|
4234
4407
|
// admin/messages.ts
|
|
@@ -5885,6 +6058,10 @@ var Round = styled5.button`
|
|
|
5885
6058
|
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
5886
6059
|
color: ${({ theme, $on }) => $on ? theme.colors.warning500 : theme.colors.neutral600};
|
|
5887
6060
|
background: ${({ theme }) => theme.colors.neutral0};
|
|
6061
|
+
transition: transform 120ms ease-out;
|
|
6062
|
+
&:active {
|
|
6063
|
+
transform: scale(0.97);
|
|
6064
|
+
}
|
|
5888
6065
|
&:focus-visible {
|
|
5889
6066
|
outline: 2px solid ${({ theme }) => theme.colors.primary600};
|
|
5890
6067
|
outline-offset: 1px;
|
|
@@ -6578,7 +6755,7 @@ function ZoneGallery({
|
|
|
6578
6755
|
gap: 4,
|
|
6579
6756
|
style: { overflowY: "auto", flex: 1, minHeight: 0, padding: "4px" },
|
|
6580
6757
|
children: (view === "recent" ? [{ typology: "recent", entries }] : groupEntries(entries)).map(
|
|
6581
|
-
({ typology, entries: items2 }) => /* @__PURE__ */ jsxs5(Flex2, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
6758
|
+
({ typology, entries: items2 }) => /* @__PURE__ */ jsxs5(Flex2, { direction: "column", alignItems: "stretch", gap: 2, flex: "0 0 auto", children: [
|
|
6582
6759
|
/* @__PURE__ */ jsx7(Typography2, { variant: "sigma", textColor: "neutral600", "data-testid": `block-group-${typology}`, children: `${typology === "recent" ? t.nav.recent : t.typologies[typology] || typology} (${items2.length})` }),
|
|
6583
6760
|
/* @__PURE__ */ jsx7(Columns, { $columns: columns, children: items2.map((entry) => /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(
|
|
6584
6761
|
Card,
|
|
@@ -6864,7 +7041,7 @@ import styled6, { useTheme as useTheme2 } from "styled-components";
|
|
|
6864
7041
|
import { Box as Box4, Button as Button3, Flex as Flex3, MenuItem, SimpleMenu, Typography as Typography4 } from "@strapi/design-system";
|
|
6865
7042
|
|
|
6866
7043
|
// admin/pane.mjs
|
|
6867
|
-
var TOOLBAR = ["modes", "history", "devices", "status", "actions"];
|
|
7044
|
+
var TOOLBAR = ["modes", "history", "versions", "devices", "status", "actions"];
|
|
6868
7045
|
var RIGHT = ["status", "actions"];
|
|
6869
7046
|
function toolbarLayout(list2) {
|
|
6870
7047
|
const ids = Array.isArray(list2) ? list2.filter((id, i) => TOOLBAR.includes(id) && list2.indexOf(id) === i) : TOOLBAR;
|
|
@@ -7315,7 +7492,8 @@ function PagePreview({
|
|
|
7315
7492
|
hiddenAttribute = null,
|
|
7316
7493
|
form = null,
|
|
7317
7494
|
Modal: Modal3,
|
|
7318
|
-
Toggle
|
|
7495
|
+
Toggle,
|
|
7496
|
+
versions
|
|
7319
7497
|
}) {
|
|
7320
7498
|
const t = useMessages();
|
|
7321
7499
|
const { values, zone, zoneLabel, canEdit, latest, insertRows: insertRows2 } = usePreviewZone(host);
|
|
@@ -7338,6 +7516,7 @@ function PagePreview({
|
|
|
7338
7516
|
const vw = main.width;
|
|
7339
7517
|
const [dragging, setDragging] = React8.useState(false);
|
|
7340
7518
|
const [ready, setReady] = React8.useState(false);
|
|
7519
|
+
const [readOnlyBridge, setReadOnlyBridge] = React8.useState(false);
|
|
7341
7520
|
const [failed, setFailed] = React8.useState(false);
|
|
7342
7521
|
const [attempt, retry] = React8.useReducer((n) => n + 1, 0);
|
|
7343
7522
|
const [picking, setPicking] = React8.useState(null);
|
|
@@ -7382,7 +7561,11 @@ function PagePreview({
|
|
|
7382
7561
|
const iframe = React8.useRef(null);
|
|
7383
7562
|
const loaded = React8.useRef(false);
|
|
7384
7563
|
const anchor = React8.useRef(null);
|
|
7385
|
-
const
|
|
7564
|
+
const version = versions?.view;
|
|
7565
|
+
const readOnly = Boolean(version);
|
|
7566
|
+
const viewRows = React8.useRef([]);
|
|
7567
|
+
viewRows.current = version ? version.values?.[zone] || [] : latest.current;
|
|
7568
|
+
const channel = React8.useMemo(() => crypto.randomUUID(), [host.model, host.documentId, host.locale, version?.scope, version?.event.id]);
|
|
7386
7569
|
const { base, source } = state.preview;
|
|
7387
7570
|
const url = base ? new URL(base) : null;
|
|
7388
7571
|
url?.searchParams.set("channel", channel);
|
|
@@ -7401,7 +7584,8 @@ function PagePreview({
|
|
|
7401
7584
|
setMode,
|
|
7402
7585
|
onChange,
|
|
7403
7586
|
clip,
|
|
7404
|
-
clipCount
|
|
7587
|
+
clipCount,
|
|
7588
|
+
readOnly
|
|
7405
7589
|
});
|
|
7406
7590
|
live.current = {
|
|
7407
7591
|
mode,
|
|
@@ -7411,7 +7595,8 @@ function PagePreview({
|
|
|
7411
7595
|
setMode,
|
|
7412
7596
|
onChange,
|
|
7413
7597
|
clip,
|
|
7414
|
-
clipCount
|
|
7598
|
+
clipCount,
|
|
7599
|
+
readOnly
|
|
7415
7600
|
};
|
|
7416
7601
|
const send = React8.useCallback(() => {
|
|
7417
7602
|
iframe.current?.contentWindow?.postMessage(
|
|
@@ -7420,19 +7605,29 @@ function PagePreview({
|
|
|
7420
7605
|
channel,
|
|
7421
7606
|
type: "update-page",
|
|
7422
7607
|
blocks: projectPage(
|
|
7423
|
-
|
|
7608
|
+
viewRows.current,
|
|
7424
7609
|
live.current.components,
|
|
7425
7610
|
window.location.origin,
|
|
7426
7611
|
hiddenAttribute
|
|
7427
|
-
),
|
|
7612
|
+
).map((block) => live.current.readOnly ? { ...block, fields: [], media: {} } : block),
|
|
7428
7613
|
groups,
|
|
7429
7614
|
locale: t.locale,
|
|
7430
7615
|
mode: live.current.mode,
|
|
7431
|
-
clipboard: live.current.clipCount
|
|
7616
|
+
clipboard: live.current.readOnly ? 0 : live.current.clipCount,
|
|
7617
|
+
readOnly: live.current.readOnly
|
|
7432
7618
|
},
|
|
7433
7619
|
origin
|
|
7434
7620
|
);
|
|
7435
|
-
}, [channel, origin, hiddenAttribute]);
|
|
7621
|
+
}, [channel, origin, hiddenAttribute, groups]);
|
|
7622
|
+
React8.useEffect(() => {
|
|
7623
|
+
if (readOnly) {
|
|
7624
|
+
setInserting(null);
|
|
7625
|
+
setBlockModal(null);
|
|
7626
|
+
setPicking(null);
|
|
7627
|
+
setFieldsPanel(null);
|
|
7628
|
+
setHovered(null);
|
|
7629
|
+
}
|
|
7630
|
+
}, [readOnly]);
|
|
7436
7631
|
const indexOf = (key) => latest.current.findIndex((row) => blockKey(row) === key);
|
|
7437
7632
|
const path = (key, field) => `${zone}.${indexOf(key)}.${field}`;
|
|
7438
7633
|
React8.useEffect(() => {
|
|
@@ -7589,9 +7784,11 @@ function PagePreview({
|
|
|
7589
7784
|
React8.useEffect(() => {
|
|
7590
7785
|
if (!active) return;
|
|
7591
7786
|
setReady(false);
|
|
7787
|
+
setReadOnlyBridge(false);
|
|
7592
7788
|
setFailed(false);
|
|
7593
7789
|
const timeout = setTimeout(() => setFailed(true), 15e3);
|
|
7594
7790
|
const receive = (event) => {
|
|
7791
|
+
if (!previewMessageAllowed(event, origin, iframe.current?.contentWindow, channel, live.current.readOnly)) return;
|
|
7595
7792
|
const is = (type) => isPreviewMessage(
|
|
7596
7793
|
event,
|
|
7597
7794
|
origin,
|
|
@@ -7604,6 +7801,7 @@ function PagePreview({
|
|
|
7604
7801
|
clearTimeout(timeout);
|
|
7605
7802
|
setReady(true);
|
|
7606
7803
|
setFailed(false);
|
|
7804
|
+
setReadOnlyBridge(Array.isArray(event.data.capabilities) && event.data.capabilities.includes("readOnly"));
|
|
7607
7805
|
send();
|
|
7608
7806
|
return;
|
|
7609
7807
|
}
|
|
@@ -7731,9 +7929,9 @@ function PagePreview({
|
|
|
7731
7929
|
if (!ready || !active) return;
|
|
7732
7930
|
const timer = setTimeout(send, 120);
|
|
7733
7931
|
return () => clearTimeout(timer);
|
|
7734
|
-
}, [values, host.components, ready, active, send, mode, clipCount]);
|
|
7932
|
+
}, [values, version, host.components, ready, active, send, mode, clipCount]);
|
|
7735
7933
|
React8.useEffect(() => {
|
|
7736
|
-
if (!active || !ready) return;
|
|
7934
|
+
if (!active || !ready || readOnly) return;
|
|
7737
7935
|
let last = null;
|
|
7738
7936
|
const post = (key) => {
|
|
7739
7937
|
if (key === last) return;
|
|
@@ -7756,7 +7954,7 @@ function PagePreview({
|
|
|
7756
7954
|
document.removeEventListener("pointerout", onOut);
|
|
7757
7955
|
post(null);
|
|
7758
7956
|
};
|
|
7759
|
-
}, [active, ready, channel, origin]);
|
|
7957
|
+
}, [active, ready, channel, origin, readOnly]);
|
|
7760
7958
|
React8.useEffect(() => {
|
|
7761
7959
|
const item = hovered && active ? findZoneList(live.current.zoneLabel)?.querySelectorAll(":scope > li")[indexOf(hovered)] : void 0;
|
|
7762
7960
|
hoverRow.current = item || null;
|
|
@@ -7810,7 +8008,7 @@ function PagePreview({
|
|
|
7810
8008
|
}
|
|
7811
8009
|
) });
|
|
7812
8010
|
const layout = toolbarLayout(editor?.previewToolbar);
|
|
7813
|
-
const tools = { modes: switcher, history: historyTools, devices };
|
|
8011
|
+
const tools = { modes: switcher, history: !readOnly && historyTools, versions: versions?.button, devices };
|
|
7814
8012
|
const toolbarShown = !ready || layout.before.length + layout.right.length + layout.after.length > 0;
|
|
7815
8013
|
const onKey = (event) => {
|
|
7816
8014
|
const map = {
|
|
@@ -7919,7 +8117,7 @@ ${/* Strapi 4's scrolled header is fixed to the viewport's right edge: beside th
|
|
|
7919
8117
|
children: [
|
|
7920
8118
|
!ready && /* @__PURE__ */ jsx9(Typography4, { variant: "pi", role: "status", textColor: "neutral600", children: failed ? t.previewFailed : t.previewLoading }),
|
|
7921
8119
|
failed && /* @__PURE__ */ jsx9(Button3, { size: "S", variant: "secondary", onClick: retry, children: t.retry }),
|
|
7922
|
-
layout.right.length > 0 && /* @__PURE__ */ jsx9(Actions2, { parts: layout.right })
|
|
8120
|
+
!readOnly && layout.right.length > 0 && /* @__PURE__ */ jsx9(Actions2, { parts: layout.right })
|
|
7923
8121
|
]
|
|
7924
8122
|
}
|
|
7925
8123
|
),
|
|
@@ -7927,62 +8125,68 @@ ${/* Strapi 4's scrolled header is fixed to the viewport's right edge: beside th
|
|
|
7927
8125
|
]
|
|
7928
8126
|
}
|
|
7929
8127
|
),
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
{
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
}
|
|
7961
|
-
) }),
|
|
7962
|
-
/* @__PURE__ */ jsx9(
|
|
7963
|
-
"div",
|
|
7964
|
-
{
|
|
7965
|
-
ref: setStage,
|
|
7966
|
-
"data-testid": "page-preview-stage",
|
|
7967
|
-
"data-device": device.id,
|
|
7968
|
-
style: { position: "relative", flex: 1, overflow: "hidden", ...stageBackground(theme) },
|
|
7969
|
-
children: /* @__PURE__ */ jsx9(
|
|
7970
|
-
Frame2,
|
|
7971
|
-
{
|
|
7972
|
-
ref: iframe,
|
|
7973
|
-
title: t.previewPane,
|
|
7974
|
-
src: url.href,
|
|
7975
|
-
sandbox: "allow-scripts allow-same-origin",
|
|
7976
|
-
referrerPolicy: "no-referrer",
|
|
7977
|
-
onLoad: () => {
|
|
7978
|
-
loaded.current = true;
|
|
8128
|
+
versions?.banner,
|
|
8129
|
+
readOnly && ready && !readOnlyBridge && /* @__PURE__ */ jsx9(Box4, { padding: 2, background: "neutral100", children: /* @__PURE__ */ jsx9(Typography4, { variant: "pi", role: "status", children: t.versionsBridgeLegacy }) }),
|
|
8130
|
+
/* @__PURE__ */ jsxs6("div", { style: { flex: 1, minHeight: 0, display: "flex" }, children: [
|
|
8131
|
+
/* @__PURE__ */ jsxs6("div", { style: { flex: 1, minWidth: 0, minHeight: 0, display: "flex", flexDirection: sidebarPosition === "bottom" ? "column-reverse" : sidebarPosition === "right" ? "row-reverse" : "row" }, children: [
|
|
8132
|
+
!readOnly && mode === "preview" && sidebar.length > 0 && /* @__PURE__ */ jsx9("div", { ref: setRailEl, style: { display: "flex" }, children: /* @__PURE__ */ jsx9(
|
|
8133
|
+
Flex3,
|
|
8134
|
+
{
|
|
8135
|
+
"data-testid": "page-preview-sidebar",
|
|
8136
|
+
"data-position": sidebarPosition,
|
|
8137
|
+
role: "toolbar",
|
|
8138
|
+
"aria-label": t.sidebarLabel,
|
|
8139
|
+
direction: sidebarPosition === "bottom" ? "row" : "column",
|
|
8140
|
+
gap: 1,
|
|
8141
|
+
padding: 1,
|
|
8142
|
+
background: "neutral100",
|
|
8143
|
+
justifyContent: sidebarPosition === "bottom" ? "center" : "flex-start",
|
|
8144
|
+
style: { [sidebarPosition === "bottom" ? "borderTop" : sidebarPosition === "right" ? "borderLeft" : "borderRight"]: `1px solid ${theme?.colors?.neutral200 || "#dcdce4"}`, overflow: "auto" },
|
|
8145
|
+
children: sidebar.map((item, i) => /* @__PURE__ */ jsxs6(
|
|
8146
|
+
RailButton,
|
|
8147
|
+
{
|
|
8148
|
+
type: "button",
|
|
8149
|
+
$active: fieldsPanel === item,
|
|
8150
|
+
"aria-pressed": fieldsPanel === item,
|
|
8151
|
+
title: item.label,
|
|
8152
|
+
"data-testid": item.custom ? `sidebar-panel-${item.id}` : `sidebar-item-${i}`,
|
|
8153
|
+
onClick: () => setFieldsPanel(fieldsPanel === item ? null : item),
|
|
8154
|
+
children: [
|
|
8155
|
+
typeof item.icon === "string" ? item.icon && /* @__PURE__ */ jsx9(Icon, { name: item.icon }) : item.icon,
|
|
8156
|
+
/* @__PURE__ */ jsx9("span", { children: item.label })
|
|
8157
|
+
]
|
|
7979
8158
|
},
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
8159
|
+
`${item.label}-${i}`
|
|
8160
|
+
))
|
|
8161
|
+
}
|
|
8162
|
+
) }),
|
|
8163
|
+
/* @__PURE__ */ jsx9(
|
|
8164
|
+
"div",
|
|
8165
|
+
{
|
|
8166
|
+
ref: setStage,
|
|
8167
|
+
"data-testid": "page-preview-stage",
|
|
8168
|
+
"data-device": device.id,
|
|
8169
|
+
style: { position: "relative", flex: 1, overflow: "hidden", ...stageBackground(theme) },
|
|
8170
|
+
children: /* @__PURE__ */ jsx9(
|
|
8171
|
+
Frame2,
|
|
8172
|
+
{
|
|
8173
|
+
ref: iframe,
|
|
8174
|
+
title: t.previewPane,
|
|
8175
|
+
src: url.href,
|
|
8176
|
+
sandbox: "allow-scripts allow-same-origin",
|
|
8177
|
+
referrerPolicy: "no-referrer",
|
|
8178
|
+
...readOnly && !readOnlyBridge ? { inert: "", tabIndex: -1 } : {},
|
|
8179
|
+
onLoad: () => {
|
|
8180
|
+
loaded.current = true;
|
|
8181
|
+
},
|
|
8182
|
+
style: { ...frameStyle(device.width, stageSize), ...dragging || readOnly && !readOnlyBridge ? { pointerEvents: "none" } : {} }
|
|
8183
|
+
},
|
|
8184
|
+
attempt
|
|
8185
|
+
)
|
|
8186
|
+
}
|
|
8187
|
+
)
|
|
8188
|
+
] }),
|
|
8189
|
+
versions?.drawer
|
|
7986
8190
|
] })
|
|
7987
8191
|
]
|
|
7988
8192
|
}
|
|
@@ -8009,6 +8213,7 @@ ${/* Strapi 4's scrolled header is fixed to the viewport's right edge: beside th
|
|
|
8009
8213
|
if (!open) setInserting(null);
|
|
8010
8214
|
},
|
|
8011
8215
|
onSelect: (uid, values2) => {
|
|
8216
|
+
if (live.current.readOnly) return;
|
|
8012
8217
|
const rows = inserting.zone === zone ? latest.current : Array.isArray(host.values?.[inserting.zone]) ? host.values[inserting.zone] : [];
|
|
8013
8218
|
const index = insertIndex(rows, inserting.after);
|
|
8014
8219
|
setInserting(null);
|
|
@@ -8133,6 +8338,7 @@ ${/* Strapi 4's scrolled header is fixed to the viewport's right edge: beside th
|
|
|
8133
8338
|
multiple: picking.attr.multiple === true,
|
|
8134
8339
|
onClose: () => setPicking(null),
|
|
8135
8340
|
onSelectAssets: (assets) => {
|
|
8341
|
+
if (live.current.readOnly) return;
|
|
8136
8342
|
const index = indexOf(picking.key);
|
|
8137
8343
|
setPicking(null);
|
|
8138
8344
|
if (index < 0 || !assets?.length) return;
|
|
@@ -8468,6 +8674,8 @@ function History({ model, documentId, schema, components, editable, disabled, ge
|
|
|
8468
8674
|
const initialValues = useForm2("BlocksceneVersions", (state) => state.initialValues);
|
|
8469
8675
|
const setValues = useForm2("BlocksceneVersions", (state) => state.setValues);
|
|
8470
8676
|
const [events, setEvents] = React10.useState(null);
|
|
8677
|
+
const [pagination, setPagination] = React10.useState(null);
|
|
8678
|
+
const [moreLoading, setMoreLoading] = React10.useState(false);
|
|
8471
8679
|
const [failed, setFailed] = React10.useState(false);
|
|
8472
8680
|
const [shown, setShown] = React10.useState(PAGE);
|
|
8473
8681
|
const [open, setOpen] = React10.useState(null);
|
|
@@ -8475,11 +8683,19 @@ function History({ model, documentId, schema, components, editable, disabled, ge
|
|
|
8475
8683
|
const [loading, setLoading] = React10.useState(false);
|
|
8476
8684
|
const [refresh, reload] = React10.useReducer((n) => n + 1, 0);
|
|
8477
8685
|
const allowed = Boolean(allowedActions?.canRead);
|
|
8686
|
+
const scope = `${model}:${documentId}:${locale}:${allowed}`;
|
|
8687
|
+
const latestScope = React10.useRef(scope);
|
|
8688
|
+
latestScope.current = scope;
|
|
8478
8689
|
React10.useEffect(() => {
|
|
8479
8690
|
if (!allowed || !documentId) return;
|
|
8480
8691
|
let active = true;
|
|
8481
8692
|
setFailed(false);
|
|
8482
|
-
get(`/blockscene/history/${encodeURIComponent(model)}/${encodeURIComponent(documentId)}${locale ? `?locale=${encodeURIComponent(locale)}` : ""}`).then(({ data }) =>
|
|
8693
|
+
get(`/blockscene/history/${encodeURIComponent(model)}/${encodeURIComponent(documentId)}${locale ? `?locale=${encodeURIComponent(locale)}` : ""}`).then(({ data }) => {
|
|
8694
|
+
if (active) {
|
|
8695
|
+
setEvents(Array.isArray(data?.results) ? data.results : []);
|
|
8696
|
+
setPagination(data?.pagination);
|
|
8697
|
+
}
|
|
8698
|
+
}).catch(() => active && setFailed(true));
|
|
8483
8699
|
return () => {
|
|
8484
8700
|
active = false;
|
|
8485
8701
|
};
|
|
@@ -8488,7 +8704,26 @@ function History({ model, documentId, schema, components, editable, disabled, ge
|
|
|
8488
8704
|
setOpen(null);
|
|
8489
8705
|
setReport(null);
|
|
8490
8706
|
setShown(PAGE);
|
|
8707
|
+
setEvents(null);
|
|
8708
|
+
setPagination(null);
|
|
8709
|
+
setMoreLoading(false);
|
|
8491
8710
|
}, [model, documentId, locale]);
|
|
8711
|
+
const more = async () => {
|
|
8712
|
+
if (shown < (events?.length || 0)) return setShown(shown + PAGE);
|
|
8713
|
+
setMoreLoading(true);
|
|
8714
|
+
try {
|
|
8715
|
+
const params = new URLSearchParams({ page: String((pagination?.page || 1) + 1), ...locale && { locale } });
|
|
8716
|
+
const { data } = await get(`/blockscene/history/${encodeURIComponent(model)}/${encodeURIComponent(documentId)}?${params}`);
|
|
8717
|
+
if (latestScope.current !== scope) return;
|
|
8718
|
+
setEvents((previous) => [...previous || [], ...data?.results || []]);
|
|
8719
|
+
setPagination(data?.pagination);
|
|
8720
|
+
setShown(shown + PAGE);
|
|
8721
|
+
} catch {
|
|
8722
|
+
if (latestScope.current === scope) setFailed(true);
|
|
8723
|
+
} finally {
|
|
8724
|
+
if (latestScope.current === scope) setMoreLoading(false);
|
|
8725
|
+
}
|
|
8726
|
+
};
|
|
8492
8727
|
if (isLoading || !allowed || !documentId) return null;
|
|
8493
8728
|
const name = (uid) => components?.[uid]?.info?.displayName || uid;
|
|
8494
8729
|
const when2 = (at) => {
|
|
@@ -8584,30 +8819,270 @@ function History({ model, documentId, schema, components, editable, disabled, ge
|
|
|
8584
8819
|
] }) })
|
|
8585
8820
|
] }, event.id);
|
|
8586
8821
|
}),
|
|
8587
|
-
events.length > shown && /* @__PURE__ */ jsx11(Flex5, { children: /* @__PURE__ */ jsx11(Button5, { variant: "tertiary", size: "S", onClick:
|
|
8822
|
+
(events.length > shown || pagination?.page < pagination?.pageCount) && /* @__PURE__ */ jsx11(Flex5, { children: /* @__PURE__ */ jsx11(Button5, { variant: "tertiary", size: "S", onClick: more, loading: moreLoading, disabled: moreLoading, children: t.historyShowMore }) })
|
|
8588
8823
|
] })
|
|
8589
8824
|
] });
|
|
8590
8825
|
}
|
|
8591
8826
|
|
|
8592
|
-
// admin/
|
|
8827
|
+
// admin/Versions.tsx
|
|
8593
8828
|
import * as React11 from "react";
|
|
8594
|
-
import { Box as Box6, Button as Button6, Flex as Flex6, Searchbar as Searchbar2, Typography as Typography7 } from "@strapi/design-system";
|
|
8595
8829
|
import styled7 from "styled-components";
|
|
8596
|
-
import {
|
|
8830
|
+
import { Box as Box6, Button as Button6, Flex as Flex6, SingleSelect, SingleSelectOption, Typography as Typography7 } from "@strapi/design-system";
|
|
8831
|
+
import { useQueryParams as useQueryParams3, useRBAC as useRBAC2 } from "@strapi/strapi/admin";
|
|
8832
|
+
import { Fragment as Fragment10, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
8833
|
+
var Drawer = styled7.aside`
|
|
8834
|
+
width: min(36rem, 55%); flex: 0 0 auto; overflow: auto;
|
|
8835
|
+
border-left: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
8836
|
+
background: ${({ theme }) => theme.colors.neutral0};
|
|
8837
|
+
`;
|
|
8838
|
+
var Entry = styled7.button`
|
|
8839
|
+
display: block; width: 100%; text-align: left; padding: 12px; margin: 4px 0;
|
|
8840
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral200}; border-radius: 4px;
|
|
8841
|
+
background: ${({ theme }) => theme.colors.neutral0}; cursor: pointer;
|
|
8842
|
+
&[aria-pressed="true"] { background: ${({ theme }) => theme.colors.primary100}; border-color: ${({ theme }) => theme.colors.primary600}; }
|
|
8843
|
+
&:focus-visible { outline: 2px solid ${({ theme }) => theme.colors.primary600}; outline-offset: 2px; }
|
|
8844
|
+
&:disabled { cursor: default; opacity: .65; }
|
|
8845
|
+
overflow-wrap: anywhere;
|
|
8846
|
+
`;
|
|
8847
|
+
var PAGE_SIZE = 25;
|
|
8848
|
+
function useVersions(host, config2) {
|
|
8849
|
+
const t = useMessages();
|
|
8850
|
+
const [{ query: query2 }] = useQueryParams3();
|
|
8851
|
+
const locale = typeof query2?.plugins?.i18n?.locale === "string" ? query2.plugins.i18n.locale : host.locale || "";
|
|
8852
|
+
const rbac = useRBAC2(HISTORY_READ);
|
|
8853
|
+
const allowed = !rbac.isLoading && Boolean(rbac.allowedActions?.canRead);
|
|
8854
|
+
const enabled = Boolean(config2?.contentTypes?.includes(host.model));
|
|
8855
|
+
const scope = `${host.model}:${host.documentId || ""}:${locale}:${allowed}:${enabled}`;
|
|
8856
|
+
const currentScope = React11.useRef(scope);
|
|
8857
|
+
currentScope.current = scope;
|
|
8858
|
+
const requests = React11.useRef(0);
|
|
8859
|
+
const [open, setOpen] = React11.useState(false);
|
|
8860
|
+
const [actor, setActor] = React11.useState("");
|
|
8861
|
+
const [page, setPage] = React11.useState(1);
|
|
8862
|
+
const [list2, setList] = React11.useState(null);
|
|
8863
|
+
const [people, setPeople] = React11.useState(null);
|
|
8864
|
+
const [selection, setSelection] = React11.useState(null);
|
|
8865
|
+
const [failed, setFailed] = React11.useState(false);
|
|
8866
|
+
const [refresh, retry] = React11.useReducer((n) => n + 1, 0);
|
|
8867
|
+
const trigger = React11.useRef(null);
|
|
8868
|
+
const closeButton = React11.useRef(null);
|
|
8869
|
+
const titleId = React11.useId(), drawerId = React11.useId();
|
|
8870
|
+
const available = allowed && enabled && Boolean(host.documentId) && !host.creating;
|
|
8871
|
+
const reason = rbac.isLoading ? t.historyLoading : !allowed ? t.versionsDenied : !enabled ? t.versionsDisabled : !host.documentId || host.creating ? t.versionsNew : "";
|
|
8872
|
+
const view = selection?.scope === scope ? selection : null;
|
|
8873
|
+
const close = () => {
|
|
8874
|
+
setOpen(false);
|
|
8875
|
+
trigger.current?.focus();
|
|
8876
|
+
};
|
|
8877
|
+
const back = () => {
|
|
8878
|
+
requests.current++;
|
|
8879
|
+
setSelection(null);
|
|
8880
|
+
setFailed(false);
|
|
8881
|
+
trigger.current?.focus();
|
|
8882
|
+
};
|
|
8883
|
+
React11.useEffect(() => {
|
|
8884
|
+
requests.current++;
|
|
8885
|
+
setSelection(null);
|
|
8886
|
+
setList(null);
|
|
8887
|
+
setPeople(null);
|
|
8888
|
+
setActor("");
|
|
8889
|
+
setPage(1);
|
|
8890
|
+
setFailed(false);
|
|
8891
|
+
return () => {
|
|
8892
|
+
requests.current++;
|
|
8893
|
+
};
|
|
8894
|
+
}, [scope]);
|
|
8895
|
+
React11.useEffect(() => {
|
|
8896
|
+
if (open) closeButton.current?.focus();
|
|
8897
|
+
}, [open]);
|
|
8898
|
+
React11.useEffect(() => {
|
|
8899
|
+
if (!open || !available) return;
|
|
8900
|
+
let active = true;
|
|
8901
|
+
setList(null);
|
|
8902
|
+
setFailed(false);
|
|
8903
|
+
const params = new URLSearchParams({ page: String(page), pageSize: String(PAGE_SIZE), ...locale && { locale }, ...actor && { actor } });
|
|
8904
|
+
host.get(`/blockscene/history/${encodeURIComponent(host.model)}/${encodeURIComponent(String(host.documentId))}?${params}`).then(({ data }) => {
|
|
8905
|
+
if (active && currentScope.current === scope) {
|
|
8906
|
+
setList({ ...data, scope });
|
|
8907
|
+
setPeople({ scope, actors: data.actors || [] });
|
|
8908
|
+
}
|
|
8909
|
+
}).catch(() => {
|
|
8910
|
+
if (active && currentScope.current === scope) setFailed(true);
|
|
8911
|
+
});
|
|
8912
|
+
return () => {
|
|
8913
|
+
active = false;
|
|
8914
|
+
};
|
|
8915
|
+
}, [scope, open, page, actor, refresh, host.get, host.history?.epoch]);
|
|
8916
|
+
const select = async (event) => {
|
|
8917
|
+
if (!available || !event.stored) return;
|
|
8918
|
+
const request = ++requests.current;
|
|
8919
|
+
setSelection({ scope, event, pending: true, values: view?.values });
|
|
8920
|
+
setFailed(false);
|
|
8921
|
+
try {
|
|
8922
|
+
const { data } = await host.get(`/blockscene/history-events/${event.id}`);
|
|
8923
|
+
if (requests.current !== request || currentScope.current !== scope) return;
|
|
8924
|
+
const localized2 = host.contentType?.pluginOptions?.i18n?.localized;
|
|
8925
|
+
if (!data?.snapshot || data.event?.contentType !== host.model || data.event?.relatedDocumentId !== String(host.documentId) || localized2 && (data.event?.locale || "") !== (locale || list2?.locale || "")) throw new Error("Unavailable version");
|
|
8926
|
+
const loaded = loadVersion(data.snapshot, {
|
|
8927
|
+
schema: host.contentType,
|
|
8928
|
+
components: host.components,
|
|
8929
|
+
media: data.media,
|
|
8930
|
+
relations: data.relations,
|
|
8931
|
+
editable: host.readable
|
|
8932
|
+
});
|
|
8933
|
+
for (const [name, attr] of Object.entries(host.contentType?.attributes || {}))
|
|
8934
|
+
if (attr.type === "dynamiczone") loaded.values[name]?.forEach((row, i) => {
|
|
8935
|
+
row.__temp_key__ = `version:${event.id}:${i}`;
|
|
8936
|
+
});
|
|
8937
|
+
setSelection({ scope, event, values: loaded.values, report: loaded.report, pending: false });
|
|
8938
|
+
} catch {
|
|
8939
|
+
if (requests.current === request && currentScope.current === scope) {
|
|
8940
|
+
setFailed(true);
|
|
8941
|
+
setSelection(null);
|
|
8942
|
+
}
|
|
8943
|
+
}
|
|
8944
|
+
};
|
|
8945
|
+
const when2 = (at, day = false) => new Date(at).toLocaleString(t.locale, { dateStyle: "medium", ...!day && { timeStyle: "short" } });
|
|
8946
|
+
const events = list2?.scope === scope ? list2.results || [] : [];
|
|
8947
|
+
let previousDay = "";
|
|
8948
|
+
const drawer = open && /* @__PURE__ */ jsx12(
|
|
8949
|
+
Drawer,
|
|
8950
|
+
{
|
|
8951
|
+
id: drawerId,
|
|
8952
|
+
role: "region",
|
|
8953
|
+
"aria-labelledby": titleId,
|
|
8954
|
+
"data-testid": "versions-drawer",
|
|
8955
|
+
onKeyDown: (event) => {
|
|
8956
|
+
if (event.key === "Escape") {
|
|
8957
|
+
event.preventDefault();
|
|
8958
|
+
event.stopPropagation();
|
|
8959
|
+
close();
|
|
8960
|
+
}
|
|
8961
|
+
},
|
|
8962
|
+
children: /* @__PURE__ */ jsxs9(Box6, { padding: 4, children: [
|
|
8963
|
+
/* @__PURE__ */ jsxs9(Flex6, { gap: 2, justifyContent: "space-between", children: [
|
|
8964
|
+
/* @__PURE__ */ jsx12(Typography7, { id: titleId, tag: "h2", variant: "delta", children: t.historyTitle }),
|
|
8965
|
+
/* @__PURE__ */ jsx12(Button6, { ref: closeButton, size: "S", variant: "tertiary", "aria-label": t.close, onClick: close, children: /* @__PURE__ */ jsx12(Icon, { name: "close" }) })
|
|
8966
|
+
] }),
|
|
8967
|
+
reason ? /* @__PURE__ */ jsx12(Typography7, { tag: "p", textColor: "neutral600", children: reason }) : /* @__PURE__ */ jsxs9(Fragment10, { children: [
|
|
8968
|
+
/* @__PURE__ */ jsx12(Box6, { paddingTop: 3, paddingBottom: 3, children: /* @__PURE__ */ jsxs9(SingleSelect, { "aria-label": t.versionsPerson, value: actor, onChange: (value) => {
|
|
8969
|
+
setActor(value);
|
|
8970
|
+
setPage(1);
|
|
8971
|
+
}, children: [
|
|
8972
|
+
/* @__PURE__ */ jsx12(SingleSelectOption, { value: "", children: t.versionsEveryone }),
|
|
8973
|
+
(people?.scope === scope ? people.actors : []).map((person) => /* @__PURE__ */ jsx12(SingleSelectOption, { value: person.actor, children: person.actorName || person.actor }, person.actor))
|
|
8974
|
+
] }) }),
|
|
8975
|
+
!list2 && !failed && /* @__PURE__ */ jsx12(Typography7, { role: "status", children: t.historyLoading }),
|
|
8976
|
+
list2 && !events.length && /* @__PURE__ */ jsx12(Typography7, { children: t.historyEmpty }),
|
|
8977
|
+
events.map((event) => {
|
|
8978
|
+
const day = when2(event.at, true), heading = day !== previousDay;
|
|
8979
|
+
previousDay = day;
|
|
8980
|
+
const blocks = event.summary?.blocks;
|
|
8981
|
+
const counted = ["total", "added", "removed", "changed"].every((key) => Number.isInteger(blocks?.[key]));
|
|
8982
|
+
return /* @__PURE__ */ jsxs9(React11.Fragment, { children: [
|
|
8983
|
+
heading && /* @__PURE__ */ jsx12(Typography7, { tag: "h3", variant: "omega", fontWeight: "bold", style: { marginTop: 12 }, children: day }),
|
|
8984
|
+
/* @__PURE__ */ jsxs9(
|
|
8985
|
+
Entry,
|
|
8986
|
+
{
|
|
8987
|
+
"aria-pressed": view?.event.id === event.id,
|
|
8988
|
+
disabled: !event.stored,
|
|
8989
|
+
title: !event.stored ? t.historyExpired : void 0,
|
|
8990
|
+
"data-testid": `version-${event.id}`,
|
|
8991
|
+
onClick: () => select(event),
|
|
8992
|
+
children: [
|
|
8993
|
+
/* @__PURE__ */ jsx12(Typography7, { tag: "span", fontWeight: "bold", children: event.actorName || event.actor }),
|
|
8994
|
+
/* @__PURE__ */ jsxs9(Typography7, { tag: "p", variant: "pi", children: [
|
|
8995
|
+
when2(event.at),
|
|
8996
|
+
" \xB7 ",
|
|
8997
|
+
t.historyActions[event.action] || event.action
|
|
8998
|
+
] }),
|
|
8999
|
+
counted ? /* @__PURE__ */ jsxs9(Fragment10, { children: [
|
|
9000
|
+
/* @__PURE__ */ jsx12(Typography7, { tag: "p", variant: "pi", textColor: "neutral600", children: t.f("versionsCounts", blocks) }),
|
|
9001
|
+
/* @__PURE__ */ jsxs9(Flex6, { gap: 2, wrap: "wrap", children: [
|
|
9002
|
+
/* @__PURE__ */ jsxs9(Typography7, { variant: "pi", textColor: "success700", children: [
|
|
9003
|
+
"+",
|
|
9004
|
+
blocks.added,
|
|
9005
|
+
" ",
|
|
9006
|
+
t.diffOps.added
|
|
9007
|
+
] }),
|
|
9008
|
+
/* @__PURE__ */ jsxs9(Typography7, { variant: "pi", textColor: "danger700", children: [
|
|
9009
|
+
"\u2212",
|
|
9010
|
+
blocks.removed,
|
|
9011
|
+
" ",
|
|
9012
|
+
t.diffOps.removed
|
|
9013
|
+
] }),
|
|
9014
|
+
/* @__PURE__ */ jsxs9(Typography7, { variant: "pi", textColor: "warning700", children: [
|
|
9015
|
+
"~",
|
|
9016
|
+
blocks.changed,
|
|
9017
|
+
" ",
|
|
9018
|
+
t.diffOps.changed
|
|
9019
|
+
] })
|
|
9020
|
+
] })
|
|
9021
|
+
] }) : /* @__PURE__ */ jsx12(Typography7, { tag: "p", variant: "pi", textColor: "neutral600", children: t.versionsCountsMissing }),
|
|
9022
|
+
!event.stored && /* @__PURE__ */ jsx12(Typography7, { tag: "p", variant: "pi", children: t.historyExpired })
|
|
9023
|
+
]
|
|
9024
|
+
}
|
|
9025
|
+
)
|
|
9026
|
+
] }, event.id);
|
|
9027
|
+
}),
|
|
9028
|
+
list2 && /* @__PURE__ */ jsxs9(Flex6, { gap: 2, paddingTop: 3, justifyContent: "space-between", children: [
|
|
9029
|
+
/* @__PURE__ */ jsx12(Button6, { size: "S", variant: "tertiary", disabled: page <= 1, onClick: () => setPage(page - 1), children: t.versionsPrevious }),
|
|
9030
|
+
/* @__PURE__ */ jsx12(Typography7, { variant: "pi", children: t.f("versionsPage", { page, count: Math.max(1, list2.pagination?.pageCount || 0) }) }),
|
|
9031
|
+
/* @__PURE__ */ jsx12(Button6, { size: "S", variant: "tertiary", disabled: page >= (list2.pagination?.pageCount || 0), onClick: () => setPage(page + 1), children: t.versionsNext })
|
|
9032
|
+
] })
|
|
9033
|
+
] }),
|
|
9034
|
+
failed && /* @__PURE__ */ jsxs9(Box6, { paddingTop: 3, children: [
|
|
9035
|
+
/* @__PURE__ */ jsx12(Typography7, { role: "alert", textColor: "danger600", children: t.historyFailed }),
|
|
9036
|
+
/* @__PURE__ */ jsx12(Button6, { size: "S", variant: "tertiary", onClick: retry, children: t.retry })
|
|
9037
|
+
] })
|
|
9038
|
+
] })
|
|
9039
|
+
}
|
|
9040
|
+
);
|
|
9041
|
+
return {
|
|
9042
|
+
view,
|
|
9043
|
+
drawer,
|
|
9044
|
+
button: /* @__PURE__ */ jsx12(
|
|
9045
|
+
Button6,
|
|
9046
|
+
{
|
|
9047
|
+
ref: trigger,
|
|
9048
|
+
size: "S",
|
|
9049
|
+
variant: "tertiary",
|
|
9050
|
+
startIcon: /* @__PURE__ */ jsx12(Icon, { name: "clock" }),
|
|
9051
|
+
"data-testid": "versions-toggle",
|
|
9052
|
+
"aria-expanded": open,
|
|
9053
|
+
"aria-controls": open ? drawerId : void 0,
|
|
9054
|
+
title: reason || t.historyTitle,
|
|
9055
|
+
onClick: () => setOpen(!open),
|
|
9056
|
+
children: t.historyTitle
|
|
9057
|
+
}
|
|
9058
|
+
),
|
|
9059
|
+
banner: view && /* @__PURE__ */ jsxs9(Flex6, { padding: 3, gap: 3, wrap: "wrap", background: "primary100", "data-testid": "versions-banner", children: [
|
|
9060
|
+
/* @__PURE__ */ jsx12(Typography7, { role: "status", children: view.pending ? t.historyLoading : t.f("versionsViewing", { date: when2(view.event.at), person: view.event.actorName || view.event.actor }) }),
|
|
9061
|
+
/* @__PURE__ */ jsx12(Button6, { size: "S", variant: "secondary", onClick: back, children: t.versionsCurrent }),
|
|
9062
|
+
!view.pending && (view.report?.blocks || view.report?.media || view.report?.relations || view.report?.removed.length) > 0 && /* @__PURE__ */ jsx12(Typography7, { variant: "pi", children: t.versionsMissing })
|
|
9063
|
+
] })
|
|
9064
|
+
};
|
|
9065
|
+
}
|
|
9066
|
+
|
|
9067
|
+
// admin/Settings.tsx
|
|
9068
|
+
import * as React12 from "react";
|
|
9069
|
+
import { Box as Box7, Button as Button7, Flex as Flex7, Searchbar as Searchbar2, Typography as Typography8 } from "@strapi/design-system";
|
|
9070
|
+
import styled8 from "styled-components";
|
|
9071
|
+
import { Fragment as Fragment11, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
8597
9072
|
var COLOR2 = /^#[0-9A-Fa-f]{6}$/;
|
|
8598
|
-
var Grid2 =
|
|
8599
|
-
var Card2 =
|
|
9073
|
+
var Grid2 = styled8.div` display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; `;
|
|
9074
|
+
var Card2 = styled8.div`
|
|
8600
9075
|
display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 4px;
|
|
8601
9076
|
border: 1px solid ${({ theme }) => theme.colors.neutral200}; background: ${({ theme }) => theme.colors.neutral0};
|
|
8602
9077
|
`;
|
|
8603
|
-
var Bar =
|
|
9078
|
+
var Bar = styled8.div`
|
|
8604
9079
|
position: fixed; top: 0; z-index: 4; padding: 12px 32px;
|
|
8605
9080
|
background: ${({ theme }) => theme.colors.neutral100}; border-bottom: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
8606
9081
|
box-shadow: 0 1px 4px rgba(33, 33, 52, 0.1);
|
|
8607
9082
|
`;
|
|
8608
9083
|
function useMainRect2(anchor) {
|
|
8609
|
-
const [rect, setRect] =
|
|
8610
|
-
|
|
9084
|
+
const [rect, setRect] = React12.useState({ left: 0, width: 0 });
|
|
9085
|
+
React12.useEffect(() => {
|
|
8611
9086
|
const read3 = () => {
|
|
8612
9087
|
let host = document.getElementById("main-content");
|
|
8613
9088
|
for (let el = anchor.current?.parentElement; !host && el; el = el.parentElement) if (["auto", "scroll"].includes(getComputedStyle(el).overflowY) && el.scrollHeight > el.clientHeight) host = el;
|
|
@@ -8620,15 +9095,15 @@ function useMainRect2(anchor) {
|
|
|
8620
9095
|
});
|
|
8621
9096
|
return rect;
|
|
8622
9097
|
}
|
|
8623
|
-
var Swatches =
|
|
8624
|
-
var Label =
|
|
9098
|
+
var Swatches = styled8.div` display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; `;
|
|
9099
|
+
var Label = styled8.label` display: flex; flex-direction: column; gap: 4px; font-size: 12px; `;
|
|
8625
9100
|
function ColorField({ name, label, value, onChange, disabled }) {
|
|
8626
9101
|
const valid = COLOR2.test(value);
|
|
8627
|
-
return /* @__PURE__ */
|
|
8628
|
-
/* @__PURE__ */
|
|
8629
|
-
/* @__PURE__ */
|
|
8630
|
-
/* @__PURE__ */
|
|
8631
|
-
/* @__PURE__ */
|
|
9102
|
+
return /* @__PURE__ */ jsxs10(Label, { children: [
|
|
9103
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", fontWeight: "bold", textColor: "neutral800", children: label }),
|
|
9104
|
+
/* @__PURE__ */ jsxs10(Flex7, { gap: 2, children: [
|
|
9105
|
+
/* @__PURE__ */ jsx13("input", { type: "color", "aria-label": label, value: valid ? value : "#000000", disabled, onChange: (e) => onChange(e.target.value.toUpperCase()), style: { width: 40, height: 32, padding: 0, border: 0, background: "none" } }),
|
|
9106
|
+
/* @__PURE__ */ jsx13(
|
|
8632
9107
|
"input",
|
|
8633
9108
|
{
|
|
8634
9109
|
name,
|
|
@@ -8644,14 +9119,14 @@ function ColorField({ name, label, value, onChange, disabled }) {
|
|
|
8644
9119
|
] });
|
|
8645
9120
|
}
|
|
8646
9121
|
function TagsField({ name, label, hint, value, onChange, disabled }) {
|
|
8647
|
-
const [text, setText] =
|
|
8648
|
-
return /* @__PURE__ */
|
|
8649
|
-
/* @__PURE__ */
|
|
8650
|
-
/* @__PURE__ */
|
|
9122
|
+
const [text, setText] = React12.useState(value.join(", "));
|
|
9123
|
+
return /* @__PURE__ */ jsxs10(Label, { children: [
|
|
9124
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", fontWeight: "bold", textColor: "neutral800", children: label }),
|
|
9125
|
+
/* @__PURE__ */ jsx13("input", { name, value: text, disabled, onChange: (e) => {
|
|
8651
9126
|
setText(e.target.value);
|
|
8652
9127
|
onChange([...new Set(e.target.value.split(",").map((tag) => tag.replace(/[<>]/g, "").trim().slice(0, 24)).filter(Boolean))].slice(0, 10));
|
|
8653
9128
|
}, style: { padding: "6px 8px", border: "1px solid #dcdce4", borderRadius: 4, fontSize: 13 } }),
|
|
8654
|
-
/* @__PURE__ */
|
|
9129
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: hint })
|
|
8655
9130
|
] });
|
|
8656
9131
|
}
|
|
8657
9132
|
var FIELD_UID = /^(plugin|global)::[\w.-]+$/;
|
|
@@ -8659,11 +9134,11 @@ var LAZY_MAX = 20;
|
|
|
8659
9134
|
var parseUids = (text) => [...new Set(text.split(/[\s,]+/).filter(Boolean))];
|
|
8660
9135
|
var badUids = (uids = []) => uids.length > LAZY_MAX || uids.some((uid) => !FIELD_UID.test(uid));
|
|
8661
9136
|
function UidListField({ TextField: TextField2, value, onChange, ...props }) {
|
|
8662
|
-
const [text, setText] =
|
|
8663
|
-
|
|
9137
|
+
const [text, setText] = React12.useState(value.join(", "));
|
|
9138
|
+
React12.useEffect(() => {
|
|
8664
9139
|
if (parseUids(text).join() !== value.join()) setText(value.join(", "));
|
|
8665
9140
|
}, [value.join()]);
|
|
8666
|
-
return /* @__PURE__ */
|
|
9141
|
+
return /* @__PURE__ */ jsx13(TextField2, { ...props, value: text, onChange: (v) => {
|
|
8667
9142
|
setText(v);
|
|
8668
9143
|
onChange(parseUids(v));
|
|
8669
9144
|
} });
|
|
@@ -8673,31 +9148,31 @@ var SIDEBAR_MAX = 12;
|
|
|
8673
9148
|
var ITEM_LABEL = /^[^<>]{1,40}$/;
|
|
8674
9149
|
var badItem = (item) => !ITEM_LABEL.test(String(item.label || "").trim()) || !item.fields?.length;
|
|
8675
9150
|
var SYSTEM_FIELDS2 = ["createdAt", "updatedAt", "publishedAt", "createdBy", "updatedBy", "locale", "localizations"];
|
|
8676
|
-
var Item =
|
|
9151
|
+
var Item = styled8.div`
|
|
8677
9152
|
display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 4px;
|
|
8678
9153
|
border: 1px solid ${({ theme }) => theme.colors.neutral200}; background: ${({ theme }) => theme.colors.neutral100};
|
|
8679
9154
|
`;
|
|
8680
|
-
var Checks =
|
|
9155
|
+
var Checks = styled8.fieldset`
|
|
8681
9156
|
display: flex; flex-wrap: wrap; gap: 4px 16px; border: 0; padding: 0; margin: 0; font-size: 13px; color: ${({ theme }) => theme.colors.neutral800};
|
|
8682
9157
|
legend { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
|
|
8683
9158
|
label { display: inline-flex; align-items: center; gap: 6px; }
|
|
8684
9159
|
`;
|
|
8685
|
-
var TOOLBAR2 = ["modes", "history", "devices", "status", "actions"];
|
|
9160
|
+
var TOOLBAR2 = ["modes", "history", "versions", "devices", "status", "actions"];
|
|
8686
9161
|
var DEVICE_NAMES = ["fit", "mobile", "tablet", "desktop"];
|
|
8687
9162
|
var DEVICE_LABEL = /^[^<>]{1,24}$/;
|
|
8688
9163
|
var badDevices = (list2 = []) => list2.length < 1 || list2.length > 8 || list2.some((item) => typeof item !== "string" && (!DEVICE_LABEL.test(String(item.label || "").trim()) || !(Number.isInteger(item.width) && item.width >= 240 && item.width <= 3840))) || new Set(list2.map((item) => typeof item === "string" ? item : item.width)).size !== list2.length;
|
|
8689
|
-
var Row =
|
|
8690
|
-
function PaneEditor({ id, toolbar, devices, set: set2, t, disabled, TextField: TextField2 }) {
|
|
9164
|
+
var Row = styled8.div` display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 13px; color: ${({ theme }) => theme.colors.neutral800}; `;
|
|
9165
|
+
function PaneEditor({ id, toolbar, devices, set: set2, t, disabled, TextField: TextField2, versions }) {
|
|
8691
9166
|
const move = (list2, index, by) => {
|
|
8692
9167
|
const next = [...list2];
|
|
8693
9168
|
[next[index], next[index + by]] = [next[index + by], next[index]];
|
|
8694
9169
|
return next;
|
|
8695
9170
|
};
|
|
8696
|
-
const arrows = (list2, index, key) => /* @__PURE__ */
|
|
8697
|
-
/* @__PURE__ */
|
|
8698
|
-
/* @__PURE__ */
|
|
9171
|
+
const arrows = (list2, index, key) => /* @__PURE__ */ jsxs10(Fragment11, { children: [
|
|
9172
|
+
/* @__PURE__ */ jsx13(Tool, { icon: "up", label: t.moveUp, disabled: disabled || index < 0 || index === 0, onClick: () => set2(key, move(list2, index, -1)) }),
|
|
9173
|
+
/* @__PURE__ */ jsx13(Tool, { icon: "down", label: t.moveDown, disabled: disabled || index < 0 || index === list2.length - 1, onClick: () => set2(key, move(list2, index, 1)) })
|
|
8699
9174
|
] });
|
|
8700
|
-
const check = (list2, item, key) => /* @__PURE__ */
|
|
9175
|
+
const check = (list2, item, key) => /* @__PURE__ */ jsx13(
|
|
8701
9176
|
"input",
|
|
8702
9177
|
{
|
|
8703
9178
|
type: "checkbox",
|
|
@@ -8708,27 +9183,27 @@ function PaneEditor({ id, toolbar, devices, set: set2, t, disabled, TextField: T
|
|
|
8708
9183
|
}
|
|
8709
9184
|
);
|
|
8710
9185
|
const width = (index, patch) => set2("previewDevices", devices.map((item, i) => i === index ? { ...item, ...patch } : item));
|
|
8711
|
-
return /* @__PURE__ */
|
|
8712
|
-
/* @__PURE__ */
|
|
8713
|
-
/* @__PURE__ */
|
|
9186
|
+
return /* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "stretch", gap: 3, "data-testid": `pane-editor-${id}`, children: [
|
|
9187
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.paneHelp }),
|
|
9188
|
+
/* @__PURE__ */ jsx13(Box7, { children: [...toolbar, ...TOOLBAR2.filter((item) => !toolbar.includes(item))].filter((item) => item !== "versions" || versions).map((item) => /* @__PURE__ */ jsxs10(Row, { "data-testid": `${id}-toolbar-${item}`, children: [
|
|
8714
9189
|
arrows(toolbar, toolbar.indexOf(item), "previewToolbar"),
|
|
8715
|
-
/* @__PURE__ */
|
|
9190
|
+
/* @__PURE__ */ jsxs10("label", { style: { display: "inline-flex", gap: 6, alignItems: "center" }, children: [
|
|
8716
9191
|
check(toolbar, item, "previewToolbar"),
|
|
8717
9192
|
t.toolbar[item]
|
|
8718
9193
|
] })
|
|
8719
9194
|
] }, item)) }),
|
|
8720
|
-
/* @__PURE__ */
|
|
8721
|
-
/* @__PURE__ */
|
|
8722
|
-
/* @__PURE__ */
|
|
9195
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "delta", tag: "h3", children: t.paneDevices }),
|
|
9196
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.paneDevicesHelp }),
|
|
9197
|
+
/* @__PURE__ */ jsx13(Box7, { children: [...devices, ...DEVICE_NAMES.filter((item) => !devices.includes(item))].map((item) => {
|
|
8723
9198
|
const index = devices.indexOf(item);
|
|
8724
|
-
return /* @__PURE__ */
|
|
9199
|
+
return /* @__PURE__ */ jsxs10(Row, { "data-testid": `${id}-device-${typeof item === "string" ? item : index}`, children: [
|
|
8725
9200
|
arrows(devices, index, "previewDevices"),
|
|
8726
|
-
typeof item === "string" ? /* @__PURE__ */
|
|
9201
|
+
typeof item === "string" ? /* @__PURE__ */ jsxs10("label", { style: { display: "inline-flex", gap: 6, alignItems: "center" }, children: [
|
|
8727
9202
|
check(devices, item, "previewDevices"),
|
|
8728
9203
|
t.device[item]
|
|
8729
|
-
] }) : /* @__PURE__ */
|
|
8730
|
-
/* @__PURE__ */
|
|
8731
|
-
/* @__PURE__ */
|
|
9204
|
+
] }) : /* @__PURE__ */ jsxs10(Fragment11, { children: [
|
|
9205
|
+
/* @__PURE__ */ jsx13(Box7, { style: { flex: "1 1 160px" }, children: /* @__PURE__ */ jsx13(TextField2, { name: `${id}-device-label-${index}`, label: t.paneWidthLabel, value: item.label, disabled, onChange: (v) => width(index, { label: v }) }) }),
|
|
9206
|
+
/* @__PURE__ */ jsx13(Box7, { style: { width: 140 }, children: /* @__PURE__ */ jsx13(
|
|
8732
9207
|
TextField2,
|
|
8733
9208
|
{
|
|
8734
9209
|
name: `${id}-device-width-${index}`,
|
|
@@ -8738,12 +9213,12 @@ function PaneEditor({ id, toolbar, devices, set: set2, t, disabled, TextField: T
|
|
|
8738
9213
|
onChange: (v) => width(index, { width: /^\d{1,4}$/.test(v.trim()) ? Number(v.trim()) : NaN })
|
|
8739
9214
|
}
|
|
8740
9215
|
) }),
|
|
8741
|
-
/* @__PURE__ */
|
|
9216
|
+
/* @__PURE__ */ jsx13(Tool, { icon: "close", label: t.paneRemoveWidth, disabled, onClick: () => set2("previewDevices", devices.filter((_, i) => i !== index)) })
|
|
8742
9217
|
] })
|
|
8743
9218
|
] }, typeof item === "string" ? item : `px-${index}`);
|
|
8744
9219
|
}) }),
|
|
8745
|
-
/* @__PURE__ */
|
|
8746
|
-
|
|
9220
|
+
/* @__PURE__ */ jsx13(Flex7, { children: /* @__PURE__ */ jsx13(
|
|
9221
|
+
Button7,
|
|
8747
9222
|
{
|
|
8748
9223
|
variant: "secondary",
|
|
8749
9224
|
size: "S",
|
|
@@ -8753,7 +9228,7 @@ function PaneEditor({ id, toolbar, devices, set: set2, t, disabled, TextField: T
|
|
|
8753
9228
|
children: t.paneAddWidth
|
|
8754
9229
|
}
|
|
8755
9230
|
) }),
|
|
8756
|
-
badDevices(devices) && /* @__PURE__ */
|
|
9231
|
+
badDevices(devices) && /* @__PURE__ */ jsx13(Typography8, { role: "alert", variant: "pi", textColor: "danger600", children: t.paneInvalid })
|
|
8757
9232
|
] });
|
|
8758
9233
|
}
|
|
8759
9234
|
var DAYS = (n) => Number.isInteger(n) && n >= 1 && n <= 3650;
|
|
@@ -8761,7 +9236,7 @@ var badRetention = (h) => !h || !DAYS(h.retentionDays) || !DAYS(h.eventDays) ||
|
|
|
8761
9236
|
function HistorySettings({ types, history, set: set2, t, disabled, ToggleField: ToggleField2, TextField: TextField2 }) {
|
|
8762
9237
|
const all = history.contentTypes === "all";
|
|
8763
9238
|
const list2 = all ? [] : history.contentTypes;
|
|
8764
|
-
const number = (key) => /* @__PURE__ */
|
|
9239
|
+
const number = (key) => /* @__PURE__ */ jsx13(Box7, { style: { minWidth: 200 }, children: /* @__PURE__ */ jsx13(
|
|
8765
9240
|
TextField2,
|
|
8766
9241
|
{
|
|
8767
9242
|
name: `history-${key}`,
|
|
@@ -8771,15 +9246,15 @@ function HistorySettings({ types, history, set: set2, t, disabled, ToggleField:
|
|
|
8771
9246
|
onChange: (v) => set2(key, /^\d{1,5}$/.test(v.trim()) ? Number(v.trim()) : NaN)
|
|
8772
9247
|
}
|
|
8773
9248
|
) });
|
|
8774
|
-
return /* @__PURE__ */
|
|
8775
|
-
/* @__PURE__ */
|
|
8776
|
-
/* @__PURE__ */
|
|
8777
|
-
/* @__PURE__ */
|
|
8778
|
-
/* @__PURE__ */
|
|
8779
|
-
!all && /* @__PURE__ */
|
|
8780
|
-
/* @__PURE__ */
|
|
8781
|
-
types.map((type) => /* @__PURE__ */
|
|
8782
|
-
/* @__PURE__ */
|
|
9249
|
+
return /* @__PURE__ */ jsx13(Box7, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "stretch", gap: 4, "data-testid": "history-settings", children: [
|
|
9250
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "beta", tag: "h2", children: t.historySettings }),
|
|
9251
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.historySettingsHelp }),
|
|
9252
|
+
/* @__PURE__ */ jsx13(ToggleField2, { name: "history-enabled", label: t.historyEnabled, value: history.enabled, disabled, onChange: (v) => set2("enabled", v) }),
|
|
9253
|
+
/* @__PURE__ */ jsx13(ToggleField2, { name: "history-all", label: t.historyAll, value: all, disabled: disabled || !history.enabled, onChange: (v) => set2("contentTypes", v ? "all" : types.map((type) => type.uid)) }),
|
|
9254
|
+
!all && /* @__PURE__ */ jsxs10(Checks, { disabled: disabled || !history.enabled, children: [
|
|
9255
|
+
/* @__PURE__ */ jsx13("legend", { children: t.historyTypes }),
|
|
9256
|
+
types.map((type) => /* @__PURE__ */ jsxs10("label", { children: [
|
|
9257
|
+
/* @__PURE__ */ jsx13(
|
|
8783
9258
|
"input",
|
|
8784
9259
|
{
|
|
8785
9260
|
type: "checkbox",
|
|
@@ -8791,13 +9266,13 @@ function HistorySettings({ types, history, set: set2, t, disabled, ToggleField:
|
|
|
8791
9266
|
type.displayName
|
|
8792
9267
|
] }, type.uid))
|
|
8793
9268
|
] }),
|
|
8794
|
-
/* @__PURE__ */
|
|
9269
|
+
/* @__PURE__ */ jsxs10(Flex7, { gap: 4, wrap: "wrap", alignItems: "flex-end", children: [
|
|
8795
9270
|
number("retentionDays"),
|
|
8796
9271
|
number("maxSnapshots"),
|
|
8797
9272
|
number("eventDays"),
|
|
8798
9273
|
number("trashDays")
|
|
8799
9274
|
] }),
|
|
8800
|
-
/* @__PURE__ */
|
|
9275
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: badRetention(history) ? "danger600" : "neutral600", role: badRetention(history) ? "alert" : void 0, children: badRetention(history) ? t.historyInvalid : `${t.historyRetentionHelp} ${t.trashDaysHelp}` })
|
|
8801
9276
|
] }) });
|
|
8802
9277
|
}
|
|
8803
9278
|
function SidebarEditor({ type, entry, set: set2, t, disabled, SelectField: SelectField2, TextField: TextField2 }) {
|
|
@@ -8811,10 +9286,10 @@ function SidebarEditor({ type, entry, set: set2, t, disabled, SelectField: Selec
|
|
|
8811
9286
|
};
|
|
8812
9287
|
const fields = (type.attributes || []).filter((attr) => !SYSTEM_FIELDS2.includes(attr.name));
|
|
8813
9288
|
const id = (name, index) => `sidebar-${name}-${type.uid}${index === void 0 ? "" : `-${index}`}`;
|
|
8814
|
-
return /* @__PURE__ */
|
|
8815
|
-
/* @__PURE__ */
|
|
8816
|
-
/* @__PURE__ */
|
|
8817
|
-
/* @__PURE__ */
|
|
9289
|
+
return /* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "stretch", gap: 3, paddingLeft: 4, "data-testid": `sidebar-editor-${type.uid}`, children: [
|
|
9290
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "delta", tag: "h3", children: t.f("sidebarTitle", { name: type.displayName }) }),
|
|
9291
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.sidebarHelp }),
|
|
9292
|
+
/* @__PURE__ */ jsx13(Box7, { style: { maxWidth: 240 }, children: /* @__PURE__ */ jsx13(
|
|
8818
9293
|
SelectField2,
|
|
8819
9294
|
{
|
|
8820
9295
|
name: id("position"),
|
|
@@ -8825,21 +9300,21 @@ function SidebarEditor({ type, entry, set: set2, t, disabled, SelectField: Selec
|
|
|
8825
9300
|
onChange: (v) => set2("sidebarPosition", v, "left")
|
|
8826
9301
|
}
|
|
8827
9302
|
) }),
|
|
8828
|
-
items2.map((item, index) => /* @__PURE__ */
|
|
8829
|
-
/* @__PURE__ */
|
|
8830
|
-
/* @__PURE__ */
|
|
8831
|
-
/* @__PURE__ */
|
|
9303
|
+
items2.map((item, index) => /* @__PURE__ */ jsxs10(Item, { "data-testid": id("item", index), children: [
|
|
9304
|
+
/* @__PURE__ */ jsxs10(Flex7, { gap: 4, alignItems: "flex-end", wrap: "wrap", children: [
|
|
9305
|
+
/* @__PURE__ */ jsx13(Box7, { style: { flex: "1 1 200px" }, children: /* @__PURE__ */ jsx13(TextField2, { name: id("label", index), label: t.sidebarItemLabel, value: item.label, disabled, onChange: (v) => edit(index, { label: v }) }) }),
|
|
9306
|
+
/* @__PURE__ */ jsx13(Box7, { style: { minWidth: 180 }, children: /* @__PURE__ */ jsx13(
|
|
8832
9307
|
SelectField2,
|
|
8833
9308
|
{
|
|
8834
9309
|
name: id("icon", index),
|
|
8835
9310
|
label: t.sidebarIcon,
|
|
8836
9311
|
value: item.icon || "none",
|
|
8837
9312
|
disabled,
|
|
8838
|
-
options: [{ value: "none", label: t.noIcon }, ...SIDEBAR_ICONS.map((value) => ({ value, label: t.icons[value], icon: /* @__PURE__ */
|
|
9313
|
+
options: [{ value: "none", label: t.noIcon }, ...SIDEBAR_ICONS.map((value) => ({ value, label: t.icons[value], icon: /* @__PURE__ */ jsx13(Icon, { name: value, size: 16 }) }))],
|
|
8839
9314
|
onChange: (v) => edit(index, { icon: v === "none" ? void 0 : v })
|
|
8840
9315
|
}
|
|
8841
9316
|
) }),
|
|
8842
|
-
/* @__PURE__ */
|
|
9317
|
+
/* @__PURE__ */ jsx13(Box7, { style: { minWidth: 160 }, children: /* @__PURE__ */ jsx13(
|
|
8843
9318
|
SelectField2,
|
|
8844
9319
|
{
|
|
8845
9320
|
name: id("open", index),
|
|
@@ -8850,16 +9325,16 @@ function SidebarEditor({ type, entry, set: set2, t, disabled, SelectField: Selec
|
|
|
8850
9325
|
onChange: (v) => edit(index, { open: v })
|
|
8851
9326
|
}
|
|
8852
9327
|
) }),
|
|
8853
|
-
/* @__PURE__ */
|
|
8854
|
-
/* @__PURE__ */
|
|
8855
|
-
/* @__PURE__ */
|
|
8856
|
-
/* @__PURE__ */
|
|
9328
|
+
/* @__PURE__ */ jsxs10(Flex7, { gap: 1, paddingBottom: 1, children: [
|
|
9329
|
+
/* @__PURE__ */ jsx13(Tool, { icon: "up", label: t.moveUp, disabled: disabled || index === 0, onClick: () => move(index, -1) }),
|
|
9330
|
+
/* @__PURE__ */ jsx13(Tool, { icon: "down", label: t.moveDown, disabled: disabled || index === items2.length - 1, onClick: () => move(index, 1) }),
|
|
9331
|
+
/* @__PURE__ */ jsx13(Tool, { icon: "close", label: t.sidebarRemove, disabled, onClick: () => save(items2.filter((_, i) => i !== index)) })
|
|
8857
9332
|
] })
|
|
8858
9333
|
] }),
|
|
8859
|
-
/* @__PURE__ */
|
|
8860
|
-
/* @__PURE__ */
|
|
8861
|
-
fields.map((attr) => /* @__PURE__ */
|
|
8862
|
-
/* @__PURE__ */
|
|
9334
|
+
/* @__PURE__ */ jsxs10(Checks, { disabled, children: [
|
|
9335
|
+
/* @__PURE__ */ jsx13("legend", { children: t.sidebarFields }),
|
|
9336
|
+
fields.map((attr) => /* @__PURE__ */ jsxs10("label", { children: [
|
|
9337
|
+
/* @__PURE__ */ jsx13(
|
|
8863
9338
|
"input",
|
|
8864
9339
|
{
|
|
8865
9340
|
type: "checkbox",
|
|
@@ -8871,11 +9346,11 @@ function SidebarEditor({ type, entry, set: set2, t, disabled, SelectField: Selec
|
|
|
8871
9346
|
attr.name
|
|
8872
9347
|
] }, attr.name))
|
|
8873
9348
|
] }),
|
|
8874
|
-
badItem(item) && /* @__PURE__ */
|
|
9349
|
+
badItem(item) && /* @__PURE__ */ jsx13(Typography8, { role: "alert", variant: "pi", textColor: "danger600", children: t.sidebarInvalid })
|
|
8875
9350
|
] }, index)),
|
|
8876
|
-
/* @__PURE__ */
|
|
8877
|
-
/* @__PURE__ */
|
|
8878
|
-
|
|
9351
|
+
/* @__PURE__ */ jsxs10(Flex7, { gap: 2, alignItems: "center", children: [
|
|
9352
|
+
/* @__PURE__ */ jsx13(
|
|
9353
|
+
Button7,
|
|
8879
9354
|
{
|
|
8880
9355
|
variant: "secondary",
|
|
8881
9356
|
size: "S",
|
|
@@ -8885,7 +9360,7 @@ function SidebarEditor({ type, entry, set: set2, t, disabled, SelectField: Selec
|
|
|
8885
9360
|
children: t.sidebarAdd
|
|
8886
9361
|
}
|
|
8887
9362
|
),
|
|
8888
|
-
items2.length >= SIDEBAR_MAX && /* @__PURE__ */
|
|
9363
|
+
items2.length >= SIDEBAR_MAX && /* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.f("sidebarLimit", { max: SIDEBAR_MAX }) })
|
|
8889
9364
|
] })
|
|
8890
9365
|
] });
|
|
8891
9366
|
}
|
|
@@ -8894,18 +9369,18 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
8894
9369
|
const t = useMessages();
|
|
8895
9370
|
const { get, put, del } = useClient();
|
|
8896
9371
|
const { canRead, canUpdate, isLoading } = usePermissions2();
|
|
8897
|
-
const [data, setData] =
|
|
8898
|
-
const [catalog, setCatalog] =
|
|
8899
|
-
const [settings, setSettings] =
|
|
8900
|
-
const [media, setMedia] =
|
|
8901
|
-
const [sources, setSources] =
|
|
8902
|
-
const [dirty, setDirty] =
|
|
8903
|
-
const [saving, setSaving] =
|
|
8904
|
-
const [status, setStatus] =
|
|
8905
|
-
const [failed, setFailed] =
|
|
8906
|
-
const [filter, setFilter] =
|
|
8907
|
-
const [picking, setPicking] =
|
|
8908
|
-
|
|
9372
|
+
const [data, setData] = React12.useState(null);
|
|
9373
|
+
const [catalog, setCatalog] = React12.useState(null);
|
|
9374
|
+
const [settings, setSettings] = React12.useState(null);
|
|
9375
|
+
const [media, setMedia] = React12.useState({});
|
|
9376
|
+
const [sources, setSources] = React12.useState({});
|
|
9377
|
+
const [dirty, setDirty] = React12.useState(false);
|
|
9378
|
+
const [saving, setSaving] = React12.useState(false);
|
|
9379
|
+
const [status, setStatus] = React12.useState("");
|
|
9380
|
+
const [failed, setFailed] = React12.useState(false);
|
|
9381
|
+
const [filter, setFilter] = React12.useState("");
|
|
9382
|
+
const [picking, setPicking] = React12.useState(null);
|
|
9383
|
+
React12.useEffect(() => {
|
|
8909
9384
|
if (!canRead || isLoading) return;
|
|
8910
9385
|
let active = true;
|
|
8911
9386
|
Promise.all([get("/blockscene/settings"), get("/blockscene/catalog")]).then(([s, c]) => {
|
|
@@ -8983,36 +9458,36 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
8983
9458
|
return index === 0 && manual ? t.manual : t.automatic;
|
|
8984
9459
|
};
|
|
8985
9460
|
const ready = !isLoading && canRead && !failed && settings && catalog;
|
|
8986
|
-
const header =
|
|
8987
|
-
const [floating, setFloating] =
|
|
9461
|
+
const header = React12.useRef(null);
|
|
9462
|
+
const [floating, setFloating] = React12.useState(false);
|
|
8988
9463
|
const main = useMainRect2(header);
|
|
8989
|
-
|
|
9464
|
+
React12.useEffect(() => {
|
|
8990
9465
|
const el = header.current;
|
|
8991
9466
|
if (!el || typeof IntersectionObserver === "undefined") return;
|
|
8992
9467
|
const observer = new IntersectionObserver(([entry]) => setFloating(!entry.isIntersecting && entry.boundingClientRect.top < 0));
|
|
8993
9468
|
observer.observe(el);
|
|
8994
9469
|
return () => observer.disconnect();
|
|
8995
9470
|
}, [ready]);
|
|
8996
|
-
const controls = (suffix) => ready && /* @__PURE__ */
|
|
8997
|
-
/* @__PURE__ */
|
|
8998
|
-
!suffix && /* @__PURE__ */
|
|
8999
|
-
/* @__PURE__ */
|
|
9471
|
+
const controls = (suffix) => ready && /* @__PURE__ */ jsxs10(Flex7, { gap: 3, alignItems: "center", wrap: "wrap", children: [
|
|
9472
|
+
/* @__PURE__ */ jsx13(Typography8, { role: "status", "aria-live": "polite", textColor: dirty ? "warning700" : "neutral600", "data-testid": `${dirty ? "unsaved-indicator" : "save-status"}${suffix}`, children: dirty ? t.unsaved : status || t.noChanges }),
|
|
9473
|
+
!suffix && /* @__PURE__ */ jsx13(Button7, { variant: "tertiary", onClick: restore, disabled: !canUpdate || saving, "data-testid": "restore-blockscene-settings", children: data.projectDefaults ? t.restoreProject : t.resetAll }),
|
|
9474
|
+
/* @__PURE__ */ jsx13(Button7, { onClick: save, disabled: !canUpdate || invalid || !dirty, loading: saving, "data-testid": `save-blockscene-settings${suffix}`, children: t.save })
|
|
9000
9475
|
] });
|
|
9001
|
-
return /* @__PURE__ */
|
|
9002
|
-
/* @__PURE__ */
|
|
9003
|
-
/* @__PURE__ */
|
|
9476
|
+
return /* @__PURE__ */ jsx13(Box7, { padding: 8, background: "neutral100", children: /* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "stretch", gap: 5, children: [
|
|
9477
|
+
/* @__PURE__ */ jsx13("div", { ref: header, children: /* @__PURE__ */ jsxs10(Flex7, { gap: 4, alignItems: "center", justifyContent: "space-between", wrap: "wrap", children: [
|
|
9478
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "alpha", tag: "h1", children: t.settingsTitle }),
|
|
9004
9479
|
controls("")
|
|
9005
9480
|
] }) }),
|
|
9006
|
-
floating && main.width > 0 && /* @__PURE__ */
|
|
9007
|
-
/* @__PURE__ */
|
|
9481
|
+
floating && main.width > 0 && /* @__PURE__ */ jsx13(Bar, { style: { left: main.left, width: main.width }, "data-testid": "settings-floating-bar", children: /* @__PURE__ */ jsxs10(Flex7, { gap: 4, alignItems: "center", justifyContent: "space-between", wrap: "wrap", children: [
|
|
9482
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "beta", tag: "p", children: t.settingsTitle }),
|
|
9008
9483
|
controls("-floating")
|
|
9009
9484
|
] }) }),
|
|
9010
|
-
/* @__PURE__ */
|
|
9011
|
-
isLoading ? /* @__PURE__ */
|
|
9012
|
-
data.disabled && /* @__PURE__ */
|
|
9013
|
-
/* @__PURE__ */
|
|
9014
|
-
/* @__PURE__ */
|
|
9015
|
-
/* @__PURE__ */
|
|
9485
|
+
/* @__PURE__ */ jsx13(Typography8, { textColor: "neutral600", children: t.settingsIntro }),
|
|
9486
|
+
isLoading ? /* @__PURE__ */ jsx13(Typography8, { children: "\u2026" }) : !canRead ? /* @__PURE__ */ jsx13(Typography8, { role: "alert", children: t.denied }) : failed ? /* @__PURE__ */ jsx13(Typography8, { role: "alert", children: t.loadFailed }) : !settings || !catalog ? /* @__PURE__ */ jsx13(Typography8, { children: t.loading }) : /* @__PURE__ */ jsxs10(Fragment11, { children: [
|
|
9487
|
+
data.disabled && /* @__PURE__ */ jsx13(Box7, { padding: 4, background: "warning100", hasRadius: true, children: /* @__PURE__ */ jsx13(Typography8, { role: "alert", textColor: "warning700", children: t.disabledByServer }) }),
|
|
9488
|
+
/* @__PURE__ */ jsx13(Box7, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
9489
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "beta", tag: "h2", children: t.palette }),
|
|
9490
|
+
/* @__PURE__ */ jsx13(Swatches, { children: Object.keys(DEFAULT_PALETTE).map((key) => /* @__PURE__ */ jsx13(
|
|
9016
9491
|
ColorField,
|
|
9017
9492
|
{
|
|
9018
9493
|
name: `palette-${key}`,
|
|
@@ -9026,43 +9501,43 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9026
9501
|
},
|
|
9027
9502
|
key
|
|
9028
9503
|
)) }),
|
|
9029
|
-
badColor && /* @__PURE__ */
|
|
9030
|
-
/* @__PURE__ */
|
|
9031
|
-
/* @__PURE__ */
|
|
9032
|
-
/* @__PURE__ */
|
|
9033
|
-
/* @__PURE__ */
|
|
9504
|
+
badColor && /* @__PURE__ */ jsx13(Typography8, { role: "alert", textColor: "danger600", children: t.invalidColor }),
|
|
9505
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.previewLabel }),
|
|
9506
|
+
/* @__PURE__ */ jsx13(Swatches, { "data-testid": "palette-preview", children: TEMPLATES.map((template) => /* @__PURE__ */ jsxs10(Flex7, { direction: "column", gap: 1, children: [
|
|
9507
|
+
/* @__PURE__ */ jsx13(Box7, { style: { aspectRatio: "16 / 9", overflow: "hidden" }, hasRadius: true, children: /* @__PURE__ */ jsx13(Wireframe, { template, palette: settings.palette }) }),
|
|
9508
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.templates[template] })
|
|
9034
9509
|
] }, template)) }),
|
|
9035
|
-
/* @__PURE__ */
|
|
9510
|
+
/* @__PURE__ */ jsx13(Flex7, { children: /* @__PURE__ */ jsx13(Button7, { variant: "tertiary", size: "S", disabled: !canUpdate, onClick: () => update((s) => {
|
|
9036
9511
|
s.palette = { ...DEFAULT_PALETTE };
|
|
9037
9512
|
return s;
|
|
9038
9513
|
}), children: t.resetPalette }) })
|
|
9039
9514
|
] }) }),
|
|
9040
|
-
/* @__PURE__ */
|
|
9041
|
-
/* @__PURE__ */
|
|
9042
|
-
/* @__PURE__ */
|
|
9515
|
+
/* @__PURE__ */ jsx13(Box7, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
9516
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "beta", tag: "h2", children: t.editor }),
|
|
9517
|
+
/* @__PURE__ */ jsx13(ToggleField2, { name: "editor-enabled", label: t.enabled, value: editor.enabled, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
|
|
9043
9518
|
s.editor.enabled = v;
|
|
9044
9519
|
return s;
|
|
9045
9520
|
}) }),
|
|
9046
|
-
/* @__PURE__ */
|
|
9047
|
-
/* @__PURE__ */
|
|
9521
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.enabledHelp }),
|
|
9522
|
+
/* @__PURE__ */ jsx13(ToggleField2, { name: "editor-showOpenAll", label: t.showOpenAll, value: editor.showOpenAll, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
|
|
9048
9523
|
s.editor.showOpenAll = v;
|
|
9049
9524
|
return s;
|
|
9050
9525
|
}) }),
|
|
9051
|
-
/* @__PURE__ */
|
|
9526
|
+
/* @__PURE__ */ jsx13(ToggleField2, { name: "editor-showCloseAll", label: t.showCloseAll, value: editor.showCloseAll, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
|
|
9052
9527
|
s.editor.showCloseAll = v;
|
|
9053
9528
|
return s;
|
|
9054
9529
|
}) }),
|
|
9055
|
-
/* @__PURE__ */
|
|
9056
|
-
/* @__PURE__ */
|
|
9530
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.toggleHelp }),
|
|
9531
|
+
/* @__PURE__ */ jsx13(ToggleField2, { name: "editor-showRowThumbnails", label: t.showRowThumbnails, value: editor.showRowThumbnails !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
|
|
9057
9532
|
s.editor.showRowThumbnails = v;
|
|
9058
9533
|
return s;
|
|
9059
9534
|
}) }),
|
|
9060
|
-
/* @__PURE__ */
|
|
9535
|
+
/* @__PURE__ */ jsx13(ToggleField2, { name: "editor-friendlyLabels", label: t.friendlyLabels, value: editor.friendlyLabels !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
|
|
9061
9536
|
s.editor.friendlyLabels = v;
|
|
9062
9537
|
return s;
|
|
9063
9538
|
}) }),
|
|
9064
|
-
/* @__PURE__ */
|
|
9065
|
-
/* @__PURE__ */
|
|
9539
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.friendlyLabelsHelp }),
|
|
9540
|
+
/* @__PURE__ */ jsx13(
|
|
9066
9541
|
SelectField2,
|
|
9067
9542
|
{
|
|
9068
9543
|
name: "editor-initialState",
|
|
@@ -9076,8 +9551,8 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9076
9551
|
})
|
|
9077
9552
|
}
|
|
9078
9553
|
),
|
|
9079
|
-
/* @__PURE__ */
|
|
9080
|
-
/* @__PURE__ */
|
|
9554
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.rememberHelp }),
|
|
9555
|
+
/* @__PURE__ */ jsx13(
|
|
9081
9556
|
TextField2,
|
|
9082
9557
|
{
|
|
9083
9558
|
name: "editor-blockPreviewUrl",
|
|
@@ -9091,8 +9566,8 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9091
9566
|
})
|
|
9092
9567
|
}
|
|
9093
9568
|
),
|
|
9094
|
-
/* @__PURE__ */
|
|
9095
|
-
/* @__PURE__ */
|
|
9569
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.blockPreviewUrlHelp }),
|
|
9570
|
+
/* @__PURE__ */ jsx13(
|
|
9096
9571
|
TextField2,
|
|
9097
9572
|
{
|
|
9098
9573
|
name: "editor-previewUrl",
|
|
@@ -9106,9 +9581,9 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9106
9581
|
})
|
|
9107
9582
|
}
|
|
9108
9583
|
),
|
|
9109
|
-
/* @__PURE__ */
|
|
9110
|
-
!editor.previewUrl && /* @__PURE__ */
|
|
9111
|
-
/* @__PURE__ */
|
|
9584
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.previewUrlHelp }),
|
|
9585
|
+
!editor.previewUrl && /* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "warning700", "data-testid": "preview-url-empty", children: t.previewUrlEmpty }),
|
|
9586
|
+
/* @__PURE__ */ jsx13(
|
|
9112
9587
|
SelectField2,
|
|
9113
9588
|
{
|
|
9114
9589
|
name: "editor-previewMode",
|
|
@@ -9122,12 +9597,13 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9122
9597
|
})
|
|
9123
9598
|
}
|
|
9124
9599
|
),
|
|
9125
|
-
/* @__PURE__ */
|
|
9126
|
-
/* @__PURE__ */
|
|
9127
|
-
/* @__PURE__ */
|
|
9600
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.previewModeHelp }),
|
|
9601
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "delta", tag: "h3", children: t.paneTitle }),
|
|
9602
|
+
/* @__PURE__ */ jsx13(
|
|
9128
9603
|
PaneEditor,
|
|
9129
9604
|
{
|
|
9130
9605
|
id: "editor",
|
|
9606
|
+
versions: Boolean(data.historyTypes),
|
|
9131
9607
|
toolbar: editor.previewToolbar || TOOLBAR2,
|
|
9132
9608
|
devices: editor.previewDevices || DEVICE_NAMES,
|
|
9133
9609
|
t,
|
|
@@ -9139,12 +9615,12 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9139
9615
|
})
|
|
9140
9616
|
}
|
|
9141
9617
|
),
|
|
9142
|
-
lazyEditors && /* @__PURE__ */
|
|
9143
|
-
/* @__PURE__ */
|
|
9618
|
+
lazyEditors && /* @__PURE__ */ jsxs10(Fragment11, { children: [
|
|
9619
|
+
/* @__PURE__ */ jsx13(ToggleField2, { name: "editor-lazyEditors", label: t.lazyEditors, value: editor.lazyEditors !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
|
|
9144
9620
|
s.editor.lazyEditors = v;
|
|
9145
9621
|
return s;
|
|
9146
9622
|
}) }),
|
|
9147
|
-
/* @__PURE__ */
|
|
9623
|
+
/* @__PURE__ */ jsx13(
|
|
9148
9624
|
UidListField,
|
|
9149
9625
|
{
|
|
9150
9626
|
TextField: TextField2,
|
|
@@ -9159,31 +9635,31 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9159
9635
|
})
|
|
9160
9636
|
}
|
|
9161
9637
|
),
|
|
9162
|
-
/* @__PURE__ */
|
|
9163
|
-
data.blockPreviewAvailable && /* @__PURE__ */
|
|
9164
|
-
/* @__PURE__ */
|
|
9638
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: badLazy ? "danger600" : "neutral600", role: badLazy ? "alert" : void 0, children: badLazy ? t.f("lazyFieldsInvalid", { max: LAZY_MAX }) : t.lazyEditorsHelp }),
|
|
9639
|
+
data.blockPreviewAvailable && /* @__PURE__ */ jsxs10(Fragment11, { children: [
|
|
9640
|
+
/* @__PURE__ */ jsx13(ToggleField2, { name: "editor-blockPreviewInForm", label: t.blockPreviewInForm, value: editor.blockPreviewInForm, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
|
|
9165
9641
|
s.editor.blockPreviewInForm = v;
|
|
9166
9642
|
return s;
|
|
9167
9643
|
}) }),
|
|
9168
|
-
/* @__PURE__ */
|
|
9644
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.blockPreviewInFormHelp })
|
|
9169
9645
|
] })
|
|
9170
9646
|
] })
|
|
9171
9647
|
] }) }),
|
|
9172
|
-
/* @__PURE__ */
|
|
9173
|
-
/* @__PURE__ */
|
|
9174
|
-
/* @__PURE__ */
|
|
9648
|
+
/* @__PURE__ */ jsx13(Box7, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "stretch", gap: 4, "data-testid": "row-actions-settings", children: [
|
|
9649
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "beta", tag: "h2", children: t.rowActionsTitle }),
|
|
9650
|
+
/* @__PURE__ */ jsx13(ToggleField2, { name: "editor-confirmDelete", label: t.confirmDeleteOption, value: editor.confirmDelete !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
|
|
9175
9651
|
s.editor.confirmDelete = v;
|
|
9176
9652
|
return s;
|
|
9177
9653
|
}) }),
|
|
9178
|
-
/* @__PURE__ */
|
|
9654
|
+
/* @__PURE__ */ jsx13(ToggleField2, { name: "editor-duplicate", label: t.duplicateOption, value: editor.duplicate !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
|
|
9179
9655
|
s.editor.duplicate = v;
|
|
9180
9656
|
return s;
|
|
9181
9657
|
}) }),
|
|
9182
|
-
/* @__PURE__ */
|
|
9658
|
+
/* @__PURE__ */ jsx13(ToggleField2, { name: "editor-clipboard", label: t.clipboardOption, value: editor.clipboard !== false, disabled: !canUpdate || saving, onChange: (v) => update((s) => {
|
|
9183
9659
|
s.editor.clipboard = v;
|
|
9184
9660
|
return s;
|
|
9185
9661
|
}) }),
|
|
9186
|
-
/* @__PURE__ */
|
|
9662
|
+
/* @__PURE__ */ jsx13(
|
|
9187
9663
|
SelectField2,
|
|
9188
9664
|
{
|
|
9189
9665
|
name: "editor-hiddenBlocks",
|
|
@@ -9197,9 +9673,9 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9197
9673
|
})
|
|
9198
9674
|
}
|
|
9199
9675
|
),
|
|
9200
|
-
/* @__PURE__ */
|
|
9676
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: data.hiddenAttribute ? t.hiddenBlocksHelp : t.hiddenAttributeOff })
|
|
9201
9677
|
] }) }),
|
|
9202
|
-
data.historyTypes && settings.history && /* @__PURE__ */
|
|
9678
|
+
data.historyTypes && settings.history && /* @__PURE__ */ jsx13(
|
|
9203
9679
|
HistorySettings,
|
|
9204
9680
|
{
|
|
9205
9681
|
types: data.historyTypes,
|
|
@@ -9214,9 +9690,9 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9214
9690
|
})
|
|
9215
9691
|
}
|
|
9216
9692
|
),
|
|
9217
|
-
(data.contentTypes || []).length > 0 && /* @__PURE__ */
|
|
9218
|
-
/* @__PURE__ */
|
|
9219
|
-
/* @__PURE__ */
|
|
9693
|
+
(data.contentTypes || []).length > 0 && /* @__PURE__ */ jsx13(Box7, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "stretch", gap: 4, "data-testid": "content-types", children: [
|
|
9694
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "beta", tag: "h2", children: t.contentTypes }),
|
|
9695
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: t.contentTypesHelp }),
|
|
9220
9696
|
data.contentTypes.map((type) => {
|
|
9221
9697
|
const entry = settings.contentTypes?.[type.uid] || {};
|
|
9222
9698
|
const set2 = (key, value, fallback) => update((s) => {
|
|
@@ -9228,9 +9704,9 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9228
9704
|
else delete s.contentTypes[type.uid];
|
|
9229
9705
|
return s;
|
|
9230
9706
|
});
|
|
9231
|
-
return /* @__PURE__ */
|
|
9232
|
-
/* @__PURE__ */
|
|
9233
|
-
/* @__PURE__ */
|
|
9707
|
+
return /* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
9708
|
+
/* @__PURE__ */ jsxs10(Flex7, { gap: 6, alignItems: "flex-end", wrap: "wrap", "data-testid": `content-type-${type.uid}`, children: [
|
|
9709
|
+
/* @__PURE__ */ jsx13(Box7, { style: { minWidth: 220 }, children: /* @__PURE__ */ jsx13(
|
|
9234
9710
|
ToggleField2,
|
|
9235
9711
|
{
|
|
9236
9712
|
name: `type-enabled-${type.uid}`,
|
|
@@ -9240,7 +9716,7 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9240
9716
|
onChange: (v) => set2("enabled", v, true)
|
|
9241
9717
|
}
|
|
9242
9718
|
) }),
|
|
9243
|
-
/* @__PURE__ */
|
|
9719
|
+
/* @__PURE__ */ jsx13(Box7, { style: { minWidth: 240 }, children: /* @__PURE__ */ jsx13(
|
|
9244
9720
|
SelectField2,
|
|
9245
9721
|
{
|
|
9246
9722
|
name: `type-mode-${type.uid}`,
|
|
@@ -9252,9 +9728,9 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9252
9728
|
}
|
|
9253
9729
|
) })
|
|
9254
9730
|
] }),
|
|
9255
|
-
entry.enabled !== false && /* @__PURE__ */
|
|
9256
|
-
entry.enabled !== false && /* @__PURE__ */
|
|
9257
|
-
/* @__PURE__ */
|
|
9731
|
+
entry.enabled !== false && /* @__PURE__ */ jsx13(SidebarEditor, { type, entry, set: set2, t, disabled: !canUpdate || saving, SelectField: SelectField2, TextField: TextField2 }),
|
|
9732
|
+
entry.enabled !== false && /* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "stretch", gap: 3, paddingLeft: 4, children: [
|
|
9733
|
+
/* @__PURE__ */ jsx13(
|
|
9258
9734
|
ToggleField2,
|
|
9259
9735
|
{
|
|
9260
9736
|
name: `type-pane-${type.uid}`,
|
|
@@ -9267,10 +9743,11 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9267
9743
|
}
|
|
9268
9744
|
}
|
|
9269
9745
|
),
|
|
9270
|
-
(entry.previewToolbar || entry.previewDevices) && /* @__PURE__ */
|
|
9746
|
+
(entry.previewToolbar || entry.previewDevices) && /* @__PURE__ */ jsx13(
|
|
9271
9747
|
PaneEditor,
|
|
9272
9748
|
{
|
|
9273
9749
|
id: `type-${type.uid}`,
|
|
9750
|
+
versions: Boolean(data.historyTypes),
|
|
9274
9751
|
toolbar: entry.previewToolbar || editor.previewToolbar || TOOLBAR2,
|
|
9275
9752
|
devices: entry.previewDevices || editor.previewDevices || DEVICE_NAMES,
|
|
9276
9753
|
t,
|
|
@@ -9282,18 +9759,18 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9282
9759
|
] })
|
|
9283
9760
|
] }, type.uid);
|
|
9284
9761
|
}),
|
|
9285
|
-
badSidebar && /* @__PURE__ */
|
|
9762
|
+
badSidebar && /* @__PURE__ */ jsx13(Typography8, { role: "alert", textColor: "danger600", children: t.sidebarInvalidSave })
|
|
9286
9763
|
] }) }),
|
|
9287
|
-
/* @__PURE__ */
|
|
9288
|
-
/* @__PURE__ */
|
|
9289
|
-
/* @__PURE__ */
|
|
9290
|
-
/* @__PURE__ */
|
|
9291
|
-
/* @__PURE__ */
|
|
9764
|
+
/* @__PURE__ */ jsx13(Box7, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
9765
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "beta", tag: "h2", children: t.components }),
|
|
9766
|
+
/* @__PURE__ */ jsx13(Searchbar2, { name: "component-filter", value: filter, placeholder: t.filter, clearLabel: t.clear, onClear: () => setFilter(""), onChange: (e) => setFilter(e.target.value), children: t.filter }),
|
|
9767
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", "data-testid": "components-count", children: t.f("countAll", { count: components.length }) }),
|
|
9768
|
+
/* @__PURE__ */ jsx13(Grid2, { "data-testid": "components-grid", children: components.map((component) => {
|
|
9292
9769
|
const entry = settings.components[component.uid] || {};
|
|
9293
9770
|
const meta = { ...catalog.components?.[component.uid] || {}, ...media[component.uid] || {} };
|
|
9294
9771
|
const candidates = candidatesFor(component.uid, meta, catalog);
|
|
9295
|
-
return /* @__PURE__ */
|
|
9296
|
-
/* @__PURE__ */
|
|
9772
|
+
return /* @__PURE__ */ jsxs10(Card2, { "data-testid": `settings-${component.uid}`, children: [
|
|
9773
|
+
/* @__PURE__ */ jsx13(
|
|
9297
9774
|
Thumb,
|
|
9298
9775
|
{
|
|
9299
9776
|
candidates,
|
|
@@ -9304,23 +9781,23 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9304
9781
|
onResolved: (index) => setSources((current) => current[component.uid] === index ? current : { ...current, [component.uid]: index })
|
|
9305
9782
|
}
|
|
9306
9783
|
),
|
|
9307
|
-
/* @__PURE__ */
|
|
9308
|
-
/* @__PURE__ */
|
|
9309
|
-
/* @__PURE__ */
|
|
9784
|
+
/* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "flex-start", gap: 2, children: [
|
|
9785
|
+
/* @__PURE__ */ jsx13(Typography8, { fontWeight: "bold", textColor: "neutral800", children: component.displayName }),
|
|
9786
|
+
/* @__PURE__ */ jsxs10(Typography8, { variant: "pi", textColor: "neutral600", children: [
|
|
9310
9787
|
component.uid,
|
|
9311
9788
|
" \xB7 ",
|
|
9312
9789
|
component.category
|
|
9313
9790
|
] }),
|
|
9314
|
-
/* @__PURE__ */
|
|
9791
|
+
/* @__PURE__ */ jsxs10(Typography8, { variant: "pi", "data-testid": `source-${component.uid}`, children: [
|
|
9315
9792
|
t.source,
|
|
9316
9793
|
": ",
|
|
9317
9794
|
sourceOf(component.uid, Boolean(meta.manualImage)),
|
|
9318
9795
|
meta.manualName ? ` (${meta.manualName})` : ""
|
|
9319
9796
|
] }),
|
|
9320
|
-
meta.manualMissing && /* @__PURE__ */
|
|
9321
|
-
/* @__PURE__ */
|
|
9322
|
-
/* @__PURE__ */
|
|
9323
|
-
entry.mediaId && /* @__PURE__ */
|
|
9797
|
+
meta.manualMissing && /* @__PURE__ */ jsx13(Typography8, { variant: "pi", role: "alert", textColor: "danger600", children: t.brokenMedia }),
|
|
9798
|
+
/* @__PURE__ */ jsxs10(Flex7, { gap: 2, wrap: "wrap", children: [
|
|
9799
|
+
/* @__PURE__ */ jsx13(Button7, { variant: "secondary", size: "S", disabled: !canUpdate || saving, onClick: () => setPicking(component.uid), children: entry.mediaId ? t.replace : t.choose }),
|
|
9800
|
+
entry.mediaId && /* @__PURE__ */ jsx13(Button7, { variant: "tertiary", size: "S", disabled: !canUpdate || saving, onClick: () => {
|
|
9324
9801
|
update((s) => {
|
|
9325
9802
|
delete s.components[component.uid]?.mediaId;
|
|
9326
9803
|
if (!Object.keys(s.components[component.uid] || {}).length) delete s.components[component.uid];
|
|
@@ -9333,7 +9810,7 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9333
9810
|
});
|
|
9334
9811
|
}, children: t.useAutomatic })
|
|
9335
9812
|
] }),
|
|
9336
|
-
/* @__PURE__ */
|
|
9813
|
+
/* @__PURE__ */ jsx13(
|
|
9337
9814
|
SelectField2,
|
|
9338
9815
|
{
|
|
9339
9816
|
name: `template-${component.uid}`,
|
|
@@ -9347,7 +9824,7 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9347
9824
|
})
|
|
9348
9825
|
}
|
|
9349
9826
|
),
|
|
9350
|
-
/* @__PURE__ */
|
|
9827
|
+
/* @__PURE__ */ jsx13(
|
|
9351
9828
|
SelectField2,
|
|
9352
9829
|
{
|
|
9353
9830
|
name: `typology-${component.uid}`,
|
|
@@ -9358,7 +9835,7 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9358
9835
|
onChange: (v) => setComponent(component.uid, "typology", v === "auto" ? void 0 : v)
|
|
9359
9836
|
}
|
|
9360
9837
|
),
|
|
9361
|
-
/* @__PURE__ */
|
|
9838
|
+
/* @__PURE__ */ jsx13(
|
|
9362
9839
|
TagsField,
|
|
9363
9840
|
{
|
|
9364
9841
|
name: `tags-${component.uid}`,
|
|
@@ -9369,12 +9846,12 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9369
9846
|
onChange: (tags) => setComponent(component.uid, "tags", tags.length ? tags : void 0)
|
|
9370
9847
|
}
|
|
9371
9848
|
),
|
|
9372
|
-
meta.variants?.length > 0 && /* @__PURE__ */
|
|
9849
|
+
meta.variants?.length > 0 && /* @__PURE__ */ jsxs10(Typography8, { variant: "pi", textColor: "neutral600", "data-testid": `variants-${component.uid}`, children: [
|
|
9373
9850
|
t.variantsFromCode,
|
|
9374
9851
|
": ",
|
|
9375
9852
|
meta.variants.map((item) => localized(item.label, t.locale) || item.id).join(", ")
|
|
9376
9853
|
] }),
|
|
9377
|
-
catalog.groups?.[component.uid] && /* @__PURE__ */
|
|
9854
|
+
catalog.groups?.[component.uid] && /* @__PURE__ */ jsx13(
|
|
9378
9855
|
LayoutFields,
|
|
9379
9856
|
{
|
|
9380
9857
|
component,
|
|
@@ -9389,7 +9866,7 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9389
9866
|
] }, component.uid);
|
|
9390
9867
|
}) })
|
|
9391
9868
|
] }) }),
|
|
9392
|
-
picking && /* @__PURE__ */
|
|
9869
|
+
picking && /* @__PURE__ */ jsx13(MediaPicker2, { onClose: () => setPicking(null), onSelect: (asset) => {
|
|
9393
9870
|
const uid = picking;
|
|
9394
9871
|
setPicking(null);
|
|
9395
9872
|
if (!asset?.id) return;
|
|
@@ -9405,8 +9882,8 @@ function Settings({ useClient, usePermissions: usePermissions2, MediaPicker: Med
|
|
|
9405
9882
|
function LayoutFields({ component, layout, set: set2, t, disabled, SelectField: SelectField2 }) {
|
|
9406
9883
|
const fields = (component.layoutFields || []).map((name) => ({ value: name, label: name }));
|
|
9407
9884
|
const change = (key, value) => set2(key === "columnsField" && value === "none" ? void 0 : Object.fromEntries(Object.entries({ ...layout, [key]: value }).filter(([, v]) => v !== "none" && v !== void 0)));
|
|
9408
|
-
return /* @__PURE__ */
|
|
9409
|
-
/* @__PURE__ */
|
|
9885
|
+
return /* @__PURE__ */ jsxs10(Flex7, { direction: "column", alignItems: "stretch", gap: 2, "data-testid": `layout-${component.uid}`, style: { width: "100%" }, children: [
|
|
9886
|
+
/* @__PURE__ */ jsx13(
|
|
9410
9887
|
SelectField2,
|
|
9411
9888
|
{
|
|
9412
9889
|
name: `layout-columns-${component.uid}`,
|
|
@@ -9417,8 +9894,8 @@ function LayoutFields({ component, layout, set: set2, t, disabled, SelectField:
|
|
|
9417
9894
|
onChange: (v) => change("columnsField", v)
|
|
9418
9895
|
}
|
|
9419
9896
|
),
|
|
9420
|
-
layout?.columnsField && /* @__PURE__ */
|
|
9421
|
-
/* @__PURE__ */
|
|
9897
|
+
layout?.columnsField && /* @__PURE__ */ jsxs10(Fragment11, { children: [
|
|
9898
|
+
/* @__PURE__ */ jsx13(
|
|
9422
9899
|
SelectField2,
|
|
9423
9900
|
{
|
|
9424
9901
|
name: `layout-mobile-${component.uid}`,
|
|
@@ -9429,7 +9906,7 @@ function LayoutFields({ component, layout, set: set2, t, disabled, SelectField:
|
|
|
9429
9906
|
onChange: (v) => change("mobileColumnsField", v)
|
|
9430
9907
|
}
|
|
9431
9908
|
),
|
|
9432
|
-
/* @__PURE__ */
|
|
9909
|
+
/* @__PURE__ */ jsx13(
|
|
9433
9910
|
SelectField2,
|
|
9434
9911
|
{
|
|
9435
9912
|
name: `layout-max-${component.uid}`,
|
|
@@ -9441,7 +9918,7 @@ function LayoutFields({ component, layout, set: set2, t, disabled, SelectField:
|
|
|
9441
9918
|
}
|
|
9442
9919
|
)
|
|
9443
9920
|
] }),
|
|
9444
|
-
/* @__PURE__ */
|
|
9921
|
+
/* @__PURE__ */ jsx13(Typography8, { variant: "pi", textColor: "neutral600", children: fields.length ? t.layoutHelp : t.layoutNoFields })
|
|
9445
9922
|
] });
|
|
9446
9923
|
}
|
|
9447
9924
|
function register(app, Component2, to) {
|
|
@@ -9460,27 +9937,27 @@ function register(app, Component2, to) {
|
|
|
9460
9937
|
}
|
|
9461
9938
|
|
|
9462
9939
|
// admin/catalog.ts
|
|
9463
|
-
import * as
|
|
9940
|
+
import * as React14 from "react";
|
|
9464
9941
|
|
|
9465
9942
|
// admin/FieldHelp.tsx
|
|
9466
|
-
import * as
|
|
9467
|
-
import
|
|
9468
|
-
import { Flex as
|
|
9469
|
-
import { jsx as
|
|
9470
|
-
var HelpButton =
|
|
9943
|
+
import * as React13 from "react";
|
|
9944
|
+
import styled9 from "styled-components";
|
|
9945
|
+
import { Flex as Flex8, Tooltip } from "@strapi/design-system";
|
|
9946
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
9947
|
+
var HelpButton = styled9.button`
|
|
9471
9948
|
display: inline-flex; padding: 0; border: 0; border-radius: 50%; background: none; cursor: help; color: inherit;
|
|
9472
9949
|
&:hover, &:focus-visible { color: ${({ theme }) => theme.colors.primary600}; }
|
|
9473
9950
|
&:focus-visible { outline: 2px solid ${({ theme }) => theme.colors.primary600}; outline-offset: 2px; }
|
|
9474
9951
|
`;
|
|
9475
9952
|
function FieldHelp({ text, previous, title }) {
|
|
9476
9953
|
const m = useMessages();
|
|
9477
|
-
const kept2 =
|
|
9478
|
-
return /* @__PURE__ */
|
|
9954
|
+
const kept2 = React13.isValidElement(previous) && previous.props.title ? React13.cloneElement(previous, { title }) : previous;
|
|
9955
|
+
return /* @__PURE__ */ jsxs11(Flex8, { gap: 1, alignItems: "center", children: [
|
|
9479
9956
|
kept2,
|
|
9480
|
-
/* @__PURE__ */
|
|
9957
|
+
/* @__PURE__ */ jsx14(Tooltip, { label: text, style: { maxWidth: 320 }, children: /* @__PURE__ */ jsx14(HelpButton, { type: "button", "aria-label": m.fieldHelp, children: /* @__PURE__ */ jsx14(Icon, { name: "info", size: 14 }) }) })
|
|
9481
9958
|
] });
|
|
9482
9959
|
}
|
|
9483
|
-
var helpAction = (text, previous) => /* @__PURE__ */
|
|
9960
|
+
var helpAction = (text, previous) => /* @__PURE__ */ jsx14(FieldHelp, { text, previous, title: React13.isValidElement(previous) && previous.props.title || { id: "blockscene.fieldHelp" } });
|
|
9484
9961
|
|
|
9485
9962
|
// admin/catalog.ts
|
|
9486
9963
|
var cached = null;
|
|
@@ -9493,8 +9970,8 @@ var load = (get) => flight || (flight = get("/blockscene/catalog").then(({ data
|
|
|
9493
9970
|
flight = null;
|
|
9494
9971
|
}));
|
|
9495
9972
|
function useCatalog(get) {
|
|
9496
|
-
const [catalog, setCatalog] =
|
|
9497
|
-
|
|
9973
|
+
const [catalog, setCatalog] = React14.useState(null);
|
|
9974
|
+
React14.useEffect(() => {
|
|
9498
9975
|
let active = true;
|
|
9499
9976
|
load(get).then((data) => {
|
|
9500
9977
|
if (active) setCatalog(data);
|
|
@@ -9530,9 +10007,9 @@ var labelsHook = (get, relabel, drop) => (args) => {
|
|
|
9530
10007
|
};
|
|
9531
10008
|
|
|
9532
10009
|
// admin/LazyInput.tsx
|
|
9533
|
-
import * as
|
|
9534
|
-
import { Field, Flex as
|
|
9535
|
-
import
|
|
10010
|
+
import * as React15 from "react";
|
|
10011
|
+
import { Field, Flex as Flex9, Typography as Typography9 } from "@strapi/design-system";
|
|
10012
|
+
import styled10 from "styled-components";
|
|
9536
10013
|
|
|
9537
10014
|
// admin/sanitize.mjs
|
|
9538
10015
|
var DROP = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "IFRAME", "FRAME", "OBJECT", "EMBED", "LINK", "META", "BASE", "FORM", "TEMPLATE", "NOSCRIPT"]);
|
|
@@ -9586,7 +10063,7 @@ function sanitizeHtml(html) {
|
|
|
9586
10063
|
}
|
|
9587
10064
|
|
|
9588
10065
|
// admin/LazyInput.tsx
|
|
9589
|
-
import { jsx as
|
|
10066
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
9590
10067
|
var config = { on: false, fields: [] };
|
|
9591
10068
|
var listeners = /* @__PURE__ */ new Set();
|
|
9592
10069
|
function setLazyConfig(next) {
|
|
@@ -9602,7 +10079,7 @@ var subscribe = (run) => {
|
|
|
9602
10079
|
};
|
|
9603
10080
|
var read2 = () => config;
|
|
9604
10081
|
var lazyFor = (uid) => config.on && config.fields.includes(uid);
|
|
9605
|
-
var Preview =
|
|
10082
|
+
var Preview = styled10.div`
|
|
9606
10083
|
min-height: 240px; border: 1px solid ${({ theme }) => theme.colors.neutral200}; border-radius: 4px; overflow: hidden;
|
|
9607
10084
|
background: ${({ theme, $disabled }) => $disabled ? theme.colors.neutral150 : theme.colors.neutral0};
|
|
9608
10085
|
color: ${({ theme }) => theme.colors.neutral800}; font-size: 1.4rem; line-height: 1.5;
|
|
@@ -9621,14 +10098,14 @@ var Preview = styled9.div`
|
|
|
9621
10098
|
`;
|
|
9622
10099
|
function Placeholder({ name, label, hint, error, required, labelAction, placeholder, value, disabled, onActivate }) {
|
|
9623
10100
|
const t = useMessages();
|
|
9624
|
-
const html =
|
|
10101
|
+
const html = React15.useMemo(() => typeof value === "string" ? sanitizeHtml(value) : value == null ? "" : null, [value]);
|
|
9625
10102
|
const activate = disabled ? void 0 : (event) => {
|
|
9626
10103
|
event.preventDefault();
|
|
9627
10104
|
onActivate();
|
|
9628
10105
|
};
|
|
9629
|
-
return /* @__PURE__ */
|
|
9630
|
-
/* @__PURE__ */
|
|
9631
|
-
/* @__PURE__ */
|
|
10106
|
+
return /* @__PURE__ */ jsx15(Field.Root, { id: name, name, error, hint, required, children: /* @__PURE__ */ jsxs12(Flex9, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
10107
|
+
/* @__PURE__ */ jsx15(Field.Label, { action: labelAction, children: label }),
|
|
10108
|
+
/* @__PURE__ */ jsxs12(
|
|
9632
10109
|
Preview,
|
|
9633
10110
|
{
|
|
9634
10111
|
id: name,
|
|
@@ -9644,22 +10121,22 @@ function Placeholder({ name, label, hint, error, required, labelAction, placehol
|
|
|
9644
10121
|
if (e.key === "Enter" || e.key === " ") activate?.(e);
|
|
9645
10122
|
},
|
|
9646
10123
|
children: [
|
|
9647
|
-
/* @__PURE__ */
|
|
9648
|
-
html === null ? /* @__PURE__ */
|
|
10124
|
+
/* @__PURE__ */ jsx15("div", { "data-bar": true, children: /* @__PURE__ */ jsx15(Typography9, { variant: "pi", textColor: "neutral500", children: disabled ? "" : t.lazyEdit }) }),
|
|
10125
|
+
html === null ? /* @__PURE__ */ jsx15("div", { "data-body": true, children: JSON.stringify(value) }) : html ? /* @__PURE__ */ jsx15("div", { "data-body": true, dangerouslySetInnerHTML: { __html: html } }) : /* @__PURE__ */ jsx15("div", { "data-body": true, children: /* @__PURE__ */ jsx15(Typography9, { textColor: "neutral500", children: placeholder || "" }) })
|
|
9649
10126
|
]
|
|
9650
10127
|
}
|
|
9651
10128
|
),
|
|
9652
|
-
/* @__PURE__ */
|
|
9653
|
-
/* @__PURE__ */
|
|
10129
|
+
/* @__PURE__ */ jsx15(Field.Hint, {}),
|
|
10130
|
+
/* @__PURE__ */ jsx15(Field.Error, {})
|
|
9654
10131
|
] }) });
|
|
9655
10132
|
}
|
|
9656
10133
|
function lazyInput(uid, Real) {
|
|
9657
|
-
const Lazy =
|
|
9658
|
-
|
|
9659
|
-
const [active, setActive] =
|
|
9660
|
-
const box =
|
|
9661
|
-
const focus =
|
|
9662
|
-
|
|
10134
|
+
const Lazy = React15.forwardRef((props, ref) => {
|
|
10135
|
+
React15.useSyncExternalStore(subscribe, read2);
|
|
10136
|
+
const [active, setActive] = React15.useState(() => !lazyFor(uid));
|
|
10137
|
+
const box = React15.useRef(null);
|
|
10138
|
+
const focus = React15.useRef(false);
|
|
10139
|
+
React15.useEffect(() => {
|
|
9663
10140
|
if (!active || !focus.current) return;
|
|
9664
10141
|
focus.current = false;
|
|
9665
10142
|
let frame2 = 0;
|
|
@@ -9672,7 +10149,7 @@ function lazyInput(uid, Real) {
|
|
|
9672
10149
|
poll();
|
|
9673
10150
|
return () => cancelAnimationFrame(frame2);
|
|
9674
10151
|
}, [active]);
|
|
9675
|
-
return /* @__PURE__ */
|
|
10152
|
+
return /* @__PURE__ */ jsx15("div", { ref: box, style: { display: "contents" }, children: active || !lazyFor(uid) ? /* @__PURE__ */ jsx15(Real, { ...props, ref }) : /* @__PURE__ */ jsx15(Placeholder, { ...props, onActivate: () => {
|
|
9676
10153
|
focus.current = true;
|
|
9677
10154
|
setActive(true);
|
|
9678
10155
|
} }) });
|
|
@@ -9692,17 +10169,17 @@ function wrapCustomFields(app) {
|
|
|
9692
10169
|
}
|
|
9693
10170
|
|
|
9694
10171
|
// admin/Activity.tsx
|
|
9695
|
-
import * as
|
|
10172
|
+
import * as React16 from "react";
|
|
9696
10173
|
import {
|
|
9697
|
-
Box as
|
|
9698
|
-
Button as
|
|
10174
|
+
Box as Box8,
|
|
10175
|
+
Button as Button8,
|
|
9699
10176
|
Dialog,
|
|
9700
10177
|
Field as Field2,
|
|
9701
|
-
Flex as
|
|
10178
|
+
Flex as Flex10,
|
|
9702
10179
|
Link,
|
|
9703
10180
|
Modal,
|
|
9704
|
-
SingleSelect,
|
|
9705
|
-
SingleSelectOption,
|
|
10181
|
+
SingleSelect as SingleSelect2,
|
|
10182
|
+
SingleSelectOption as SingleSelectOption2,
|
|
9706
10183
|
Switch,
|
|
9707
10184
|
Table,
|
|
9708
10185
|
Tabs,
|
|
@@ -9712,17 +10189,17 @@ import {
|
|
|
9712
10189
|
Th,
|
|
9713
10190
|
Thead,
|
|
9714
10191
|
Tr,
|
|
9715
|
-
Typography as
|
|
10192
|
+
Typography as Typography10
|
|
9716
10193
|
} from "@strapi/design-system";
|
|
9717
|
-
import { Layouts, Page, useFetchClient as useFetchClient2, useNotification as useNotification2, useRBAC as
|
|
9718
|
-
import { Fragment as
|
|
10194
|
+
import { Layouts, Page, useFetchClient as useFetchClient2, useNotification as useNotification2, useRBAC as useRBAC3 } from "@strapi/strapi/admin";
|
|
10195
|
+
import { Fragment as Fragment13, jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
9719
10196
|
var ACTIVITY = [{ action: "plugin::blockscene.activity.read", subject: null }];
|
|
9720
10197
|
var TRASH = ["read", "restore", "purge"].map((name) => ({ action: `plugin::blockscene.trash.${name}`, subject: null }));
|
|
9721
10198
|
var ACTIONS = ["create", "update", "publish", "unpublish", "discard", "delete", "restore", "purge"];
|
|
9722
10199
|
var DAY = 24 * 60 * 60 * 1e3;
|
|
9723
10200
|
var contentMenuLink = (Component2) => ({
|
|
9724
10201
|
to: "plugins/blockscene",
|
|
9725
|
-
icon: () => /* @__PURE__ */
|
|
10202
|
+
icon: () => /* @__PURE__ */ jsx16(Icon, { name: "clock", size: 20 }),
|
|
9726
10203
|
intlLabel: { id: "blockscene.contentMenu", defaultMessage: "Activity and trash" },
|
|
9727
10204
|
permissions: [...ACTIVITY, TRASH[0]],
|
|
9728
10205
|
// Not an `async` function: Strapi 5 warns on AsyncFunction loaders.
|
|
@@ -9741,29 +10218,29 @@ var editUrl = (type, documentId, locale) => {
|
|
|
9741
10218
|
return `${base}/content-manager/${kind}/${type.uid}${kind === "single-types" ? "" : `/${encodeURIComponent(documentId)}`}${locale ? `?plugins[i18n][locale]=${encodeURIComponent(locale)}` : ""}`;
|
|
9742
10219
|
};
|
|
9743
10220
|
var query = (params) => new URLSearchParams(Object.entries(params).filter(([, v]) => v !== "" && v != null).map(([k, v]) => [k, String(v)])).toString();
|
|
9744
|
-
var Select = ({ label, value, onChange, options, name }) => /* @__PURE__ */
|
|
9745
|
-
/* @__PURE__ */
|
|
9746
|
-
/* @__PURE__ */
|
|
10221
|
+
var Select = ({ label, value, onChange, options, name }) => /* @__PURE__ */ jsx16(Box8, { style: { minWidth: 180 }, children: /* @__PURE__ */ jsxs13(Field2.Root, { name, children: [
|
|
10222
|
+
/* @__PURE__ */ jsx16(Field2.Label, { children: label }),
|
|
10223
|
+
/* @__PURE__ */ jsx16(SingleSelect2, { value, onChange: (v) => onChange(String(v)), children: options.map((o) => /* @__PURE__ */ jsx16(SingleSelectOption2, { value: o.value, children: o.label }, o.value)) })
|
|
9747
10224
|
] }) });
|
|
9748
|
-
var Input = ({ label, value, onChange, name, type = "text" }) => /* @__PURE__ */
|
|
9749
|
-
/* @__PURE__ */
|
|
9750
|
-
/* @__PURE__ */
|
|
10225
|
+
var Input = ({ label, value, onChange, name, type = "text" }) => /* @__PURE__ */ jsx16(Box8, { style: { minWidth: 160 }, children: /* @__PURE__ */ jsxs13(Field2.Root, { name, children: [
|
|
10226
|
+
/* @__PURE__ */ jsx16(Field2.Label, { children: label }),
|
|
10227
|
+
/* @__PURE__ */ jsx16(TextInput, { name, type, value, onChange: (e) => onChange(e.target.value) })
|
|
9751
10228
|
] }) });
|
|
9752
10229
|
function Pager({ t, pagination, setPage }) {
|
|
9753
10230
|
if (!pagination?.total) return null;
|
|
9754
10231
|
const { page, pageCount, total } = pagination;
|
|
9755
|
-
return /* @__PURE__ */
|
|
9756
|
-
/* @__PURE__ */
|
|
9757
|
-
/* @__PURE__ */
|
|
9758
|
-
/* @__PURE__ */
|
|
9759
|
-
/* @__PURE__ */
|
|
10232
|
+
return /* @__PURE__ */ jsxs13(Flex10, { justifyContent: "space-between", alignItems: "center", paddingTop: 4, children: [
|
|
10233
|
+
/* @__PURE__ */ jsx16(Typography10, { variant: "pi", textColor: "neutral600", children: t.f("contentPage", { page, pages: Math.max(pageCount, 1), total }) }),
|
|
10234
|
+
/* @__PURE__ */ jsxs13(Flex10, { gap: 2, children: [
|
|
10235
|
+
/* @__PURE__ */ jsx16(Button8, { variant: "tertiary", size: "S", disabled: page <= 1, onClick: () => setPage(page - 1), children: t.contentPrevious }),
|
|
10236
|
+
/* @__PURE__ */ jsx16(Button8, { variant: "tertiary", size: "S", disabled: page >= pageCount, onClick: () => setPage(page + 1), children: t.contentNext })
|
|
9760
10237
|
] })
|
|
9761
10238
|
] });
|
|
9762
10239
|
}
|
|
9763
10240
|
function useList(get, path, params, refresh = 0) {
|
|
9764
|
-
const [state, setState] =
|
|
10241
|
+
const [state, setState] = React16.useState({ data: null, failed: false });
|
|
9765
10242
|
const key = `${path}?${query(params)}`;
|
|
9766
|
-
|
|
10243
|
+
React16.useEffect(() => {
|
|
9767
10244
|
let active = true;
|
|
9768
10245
|
setState((s) => ({ data: s.data, failed: false, loading: true }));
|
|
9769
10246
|
get(`/blockscene${key}`).then(({ data }) => active && setState({ data, failed: false })).catch(() => active && setState({ data: null, failed: true }));
|
|
@@ -9775,9 +10252,9 @@ function useList(get, path, params, refresh = 0) {
|
|
|
9775
10252
|
}
|
|
9776
10253
|
var Doc = ({ t, type, row, documentId, locale }) => {
|
|
9777
10254
|
const title = row.title || t.contentUntitled;
|
|
9778
|
-
return /* @__PURE__ */
|
|
9779
|
-
row.exists && type ? /* @__PURE__ */
|
|
9780
|
-
/* @__PURE__ */
|
|
10255
|
+
return /* @__PURE__ */ jsxs13(Flex10, { direction: "column", alignItems: "flex-start", gap: 1, children: [
|
|
10256
|
+
row.exists && type ? /* @__PURE__ */ jsx16(Link, { href: editUrl(type, documentId, locale), children: title }) : /* @__PURE__ */ jsx16(Typography10, { fontWeight: "bold", children: title }),
|
|
10257
|
+
/* @__PURE__ */ jsxs13(Typography10, { variant: "pi", textColor: "neutral600", children: [
|
|
9781
10258
|
type?.displayName || row.contentType,
|
|
9782
10259
|
locale ? ` \xB7 ${locale}` : "",
|
|
9783
10260
|
row.exists === false ? ` \xB7 ${t.contentGone}` : ""
|
|
@@ -9785,9 +10262,9 @@ var Doc = ({ t, type, row, documentId, locale }) => {
|
|
|
9785
10262
|
] });
|
|
9786
10263
|
};
|
|
9787
10264
|
function ActivityTab({ t, get }) {
|
|
9788
|
-
const [filters, setFilters] =
|
|
9789
|
-
const [search, setSearch] =
|
|
9790
|
-
const [page, setPage] =
|
|
10265
|
+
const [filters, setFilters] = React16.useState({ actor: "", contentType: "", action: "", from: "", to: "", q: "" });
|
|
10266
|
+
const [search, setSearch] = React16.useState("");
|
|
10267
|
+
const [page, setPage] = React16.useState(1);
|
|
9791
10268
|
const set2 = (key, value) => {
|
|
9792
10269
|
setFilters((f) => ({ ...f, [key]: value }));
|
|
9793
10270
|
setPage(1);
|
|
@@ -9799,13 +10276,13 @@ function ActivityTab({ t, get }) {
|
|
|
9799
10276
|
};
|
|
9800
10277
|
const { data, failed } = useList(get, "/activity", { ...filters, from: day(filters.from, false), to: day(filters.to, true), page, pageSize: 25 });
|
|
9801
10278
|
const types = new Map((data?.types || []).map((type) => [type.uid, type]));
|
|
9802
|
-
return /* @__PURE__ */
|
|
9803
|
-
data && !data.enabled && /* @__PURE__ */
|
|
9804
|
-
/* @__PURE__ */
|
|
10279
|
+
return /* @__PURE__ */ jsxs13(Flex10, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
10280
|
+
data && !data.enabled && /* @__PURE__ */ jsx16(Box8, { padding: 3, background: "warning100", hasRadius: true, children: /* @__PURE__ */ jsx16(Typography10, { variant: "pi", textColor: "warning700", children: t.contentOff }) }),
|
|
10281
|
+
/* @__PURE__ */ jsxs13(Flex10, { tag: "form", gap: 3, wrap: "wrap", alignItems: "flex-end", onSubmit: (e) => {
|
|
9805
10282
|
e.preventDefault();
|
|
9806
10283
|
set2("q", search.trim());
|
|
9807
10284
|
}, children: [
|
|
9808
|
-
/* @__PURE__ */
|
|
10285
|
+
/* @__PURE__ */ jsx16(
|
|
9809
10286
|
Select,
|
|
9810
10287
|
{
|
|
9811
10288
|
name: "actor",
|
|
@@ -9815,7 +10292,7 @@ function ActivityTab({ t, get }) {
|
|
|
9815
10292
|
options: [{ value: "", label: t.activityAnyone }, ...(data?.actors || []).map((a) => ({ value: a.actor, label: a.actorName || (a.actor === "system" ? t.historySystem : a.actor) }))]
|
|
9816
10293
|
}
|
|
9817
10294
|
),
|
|
9818
|
-
/* @__PURE__ */
|
|
10295
|
+
/* @__PURE__ */ jsx16(
|
|
9819
10296
|
Select,
|
|
9820
10297
|
{
|
|
9821
10298
|
name: "contentType",
|
|
@@ -9825,7 +10302,7 @@ function ActivityTab({ t, get }) {
|
|
|
9825
10302
|
options: [{ value: "", label: t.activityAnyType }, ...(data?.types || []).map((type) => ({ value: type.uid, label: type.displayName }))]
|
|
9826
10303
|
}
|
|
9827
10304
|
),
|
|
9828
|
-
/* @__PURE__ */
|
|
10305
|
+
/* @__PURE__ */ jsx16(
|
|
9829
10306
|
Select,
|
|
9830
10307
|
{
|
|
9831
10308
|
name: "action",
|
|
@@ -9835,35 +10312,35 @@ function ActivityTab({ t, get }) {
|
|
|
9835
10312
|
options: [{ value: "", label: t.activityAnyAction }, ...ACTIONS.map((a) => ({ value: a, label: t.historyActions[a] || a }))]
|
|
9836
10313
|
}
|
|
9837
10314
|
),
|
|
9838
|
-
/* @__PURE__ */
|
|
9839
|
-
/* @__PURE__ */
|
|
9840
|
-
/* @__PURE__ */
|
|
9841
|
-
/* @__PURE__ */
|
|
9842
|
-
/* @__PURE__ */
|
|
10315
|
+
/* @__PURE__ */ jsx16(Input, { name: "from", type: "date", label: t.activityFrom, value: filters.from, onChange: (v) => set2("from", v) }),
|
|
10316
|
+
/* @__PURE__ */ jsx16(Input, { name: "to", type: "date", label: t.activityTo, value: filters.to, onChange: (v) => set2("to", v) }),
|
|
10317
|
+
/* @__PURE__ */ jsx16(Input, { name: "q", label: t.activitySearch, value: search, onChange: setSearch }),
|
|
10318
|
+
/* @__PURE__ */ jsx16(Button8, { type: "submit", variant: "secondary", children: t.activitySearchButton }),
|
|
10319
|
+
/* @__PURE__ */ jsx16(Button8, { type: "button", variant: "tertiary", onClick: () => {
|
|
9843
10320
|
setSearch("");
|
|
9844
10321
|
setFilters({ actor: "", contentType: "", action: "", from: "", to: "", q: "" });
|
|
9845
10322
|
setPage(1);
|
|
9846
10323
|
}, children: t.contentClear })
|
|
9847
10324
|
] }),
|
|
9848
|
-
failed ? /* @__PURE__ */
|
|
9849
|
-
/* @__PURE__ */
|
|
9850
|
-
/* @__PURE__ */
|
|
9851
|
-
/* @__PURE__ */
|
|
9852
|
-
/* @__PURE__ */
|
|
9853
|
-
/* @__PURE__ */
|
|
9854
|
-
/* @__PURE__ */
|
|
10325
|
+
failed ? /* @__PURE__ */ jsx16(Typography10, { role: "alert", textColor: "danger600", children: t.activityFailed }) : !data ? /* @__PURE__ */ jsx16(Typography10, { textColor: "neutral600", children: t.contentLoading }) : !data.results.length ? /* @__PURE__ */ jsx16(Typography10, { textColor: "neutral600", children: t.activityEmpty }) : /* @__PURE__ */ jsxs13(Box8, { children: [
|
|
10326
|
+
/* @__PURE__ */ jsxs13(Table, { colCount: 4, rowCount: data.results.length + 1, "data-testid": "blockscene-activity", children: [
|
|
10327
|
+
/* @__PURE__ */ jsx16(Thead, { children: /* @__PURE__ */ jsxs13(Tr, { children: [
|
|
10328
|
+
/* @__PURE__ */ jsx16(Th, { children: /* @__PURE__ */ jsx16(Typography10, { variant: "sigma", children: t.activityWhen }) }),
|
|
10329
|
+
/* @__PURE__ */ jsx16(Th, { children: /* @__PURE__ */ jsx16(Typography10, { variant: "sigma", children: t.activityDocument }) }),
|
|
10330
|
+
/* @__PURE__ */ jsx16(Th, { children: /* @__PURE__ */ jsx16(Typography10, { variant: "sigma", children: t.activityWho }) }),
|
|
10331
|
+
/* @__PURE__ */ jsx16(Th, { children: /* @__PURE__ */ jsx16(Typography10, { variant: "sigma", children: t.activityWhat }) })
|
|
9855
10332
|
] }) }),
|
|
9856
|
-
/* @__PURE__ */
|
|
9857
|
-
/* @__PURE__ */
|
|
9858
|
-
/* @__PURE__ */
|
|
9859
|
-
/* @__PURE__ */
|
|
9860
|
-
/* @__PURE__ */
|
|
9861
|
-
/* @__PURE__ */
|
|
9862
|
-
/* @__PURE__ */
|
|
10333
|
+
/* @__PURE__ */ jsx16(Tbody, { children: data.results.map((event) => /* @__PURE__ */ jsxs13(Tr, { "data-testid": `activity-${event.id}`, children: [
|
|
10334
|
+
/* @__PURE__ */ jsx16(Td, { children: /* @__PURE__ */ jsx16(Typography10, { variant: "pi", children: when(t, event.at) }) }),
|
|
10335
|
+
/* @__PURE__ */ jsx16(Td, { children: /* @__PURE__ */ jsx16(Doc, { t, type: types.get(event.contentType), row: event, documentId: event.relatedDocumentId, locale: event.locale }) }),
|
|
10336
|
+
/* @__PURE__ */ jsx16(Td, { children: /* @__PURE__ */ jsx16(Typography10, { variant: "pi", children: event.actorName || (event.actor === "system" ? t.historySystem : event.actor) }) }),
|
|
10337
|
+
/* @__PURE__ */ jsx16(Td, { children: /* @__PURE__ */ jsxs13(Flex10, { direction: "column", alignItems: "flex-start", gap: 1, children: [
|
|
10338
|
+
/* @__PURE__ */ jsx16(Typography10, { variant: "omega", fontWeight: "bold", children: t.historyActions[event.action] || event.action }),
|
|
10339
|
+
/* @__PURE__ */ jsx16(Typography10, { variant: "pi", textColor: event.summary?.missing ? "warning700" : "neutral700", children: ["delete", "purge"].includes(event.action) ? "" : [event.summary?.restoredFrom ? t.activityRestoredFrom : "", summaryText(t, event.summary)].filter(Boolean).join(" \xB7 ") })
|
|
9863
10340
|
] }) })
|
|
9864
10341
|
] }, event.id)) })
|
|
9865
10342
|
] }),
|
|
9866
|
-
/* @__PURE__ */
|
|
10343
|
+
/* @__PURE__ */ jsx16(Pager, { t, pagination: data.pagination, setPage })
|
|
9867
10344
|
] })
|
|
9868
10345
|
] });
|
|
9869
10346
|
}
|
|
@@ -9872,57 +10349,57 @@ function Report({ t, report }) {
|
|
|
9872
10349
|
const line = (item) => item.code === "incoming" ? t.f("report.incoming", item) : t.f(`report.${item.code}`, { ...item, locale: locale(item.locale), locales: (item.locales || []).map(locale).join(", "), fields: (item.fields || []).join(", ") });
|
|
9873
10350
|
const incoming = report.incoming && (report.incoming.reconnect || report.incoming.gone || report.incoming.replaced || report.incoming.published) ? [{ code: "incoming", ...report.incoming }] : [];
|
|
9874
10351
|
const warnings = [...report.warnings || [], ...incoming];
|
|
9875
|
-
return /* @__PURE__ */
|
|
9876
|
-
report.blocking?.length > 0 && /* @__PURE__ */
|
|
9877
|
-
/* @__PURE__ */
|
|
9878
|
-
/* @__PURE__ */
|
|
10352
|
+
return /* @__PURE__ */ jsxs13(Flex10, { direction: "column", alignItems: "stretch", gap: 2, "data-testid": "restore-report", children: [
|
|
10353
|
+
report.blocking?.length > 0 && /* @__PURE__ */ jsxs13(Box8, { padding: 3, background: "danger100", hasRadius: true, children: [
|
|
10354
|
+
/* @__PURE__ */ jsx16(Typography10, { variant: "pi", fontWeight: "bold", textColor: "danger700", children: t.restoreBlocked }),
|
|
10355
|
+
/* @__PURE__ */ jsx16("ul", { style: { margin: "4px 0 0", paddingLeft: 16 }, children: report.blocking.map((item, i) => /* @__PURE__ */ jsx16("li", { children: /* @__PURE__ */ jsx16(Typography10, { variant: "pi", textColor: "danger700", children: line(item) }) }, i)) })
|
|
9879
10356
|
] }),
|
|
9880
|
-
warnings.length > 0 && /* @__PURE__ */
|
|
9881
|
-
/* @__PURE__ */
|
|
9882
|
-
/* @__PURE__ */
|
|
10357
|
+
warnings.length > 0 && /* @__PURE__ */ jsxs13(Box8, { padding: 3, background: "warning100", hasRadius: true, children: [
|
|
10358
|
+
/* @__PURE__ */ jsx16(Typography10, { variant: "pi", fontWeight: "bold", textColor: "warning700", children: t.restoreWarnings }),
|
|
10359
|
+
/* @__PURE__ */ jsx16("ul", { style: { margin: "4px 0 0", paddingLeft: 16 }, children: warnings.map((item, i) => /* @__PURE__ */ jsx16("li", { children: /* @__PURE__ */ jsx16(Typography10, { variant: "pi", textColor: "warning700", children: line(item) }) }, i)) })
|
|
9883
10360
|
] })
|
|
9884
10361
|
] });
|
|
9885
10362
|
}
|
|
9886
10363
|
function Preview2({ t, id, get, onClose }) {
|
|
9887
|
-
const [row, setRow] =
|
|
9888
|
-
const [failed, setFailed] =
|
|
9889
|
-
|
|
10364
|
+
const [row, setRow] = React16.useState(null);
|
|
10365
|
+
const [failed, setFailed] = React16.useState(false);
|
|
10366
|
+
React16.useEffect(() => {
|
|
9890
10367
|
get(`/blockscene/trash/${id}`).then(({ data }) => setRow(data)).catch(() => setFailed(true));
|
|
9891
10368
|
}, [get, id]);
|
|
9892
|
-
return /* @__PURE__ */
|
|
9893
|
-
/* @__PURE__ */
|
|
9894
|
-
/* @__PURE__ */
|
|
9895
|
-
row.incoming > 0 && /* @__PURE__ */
|
|
9896
|
-
row.entries.map((entry, i) => /* @__PURE__ */
|
|
9897
|
-
/* @__PURE__ */
|
|
10369
|
+
return /* @__PURE__ */ jsx16(Modal.Root, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs13(Modal.Content, { style: { width: "min(900px, 92vw)" }, children: [
|
|
10370
|
+
/* @__PURE__ */ jsx16(Modal.Header, { children: /* @__PURE__ */ jsx16(Modal.Title, { children: row?.title || t.trashPreview }) }),
|
|
10371
|
+
/* @__PURE__ */ jsx16(Modal.Body, { children: failed ? /* @__PURE__ */ jsx16(Typography10, { role: "alert", textColor: "danger600", children: t.trashFailed }) : !row ? /* @__PURE__ */ jsx16(Typography10, { children: t.contentLoading }) : /* @__PURE__ */ jsxs13(Flex10, { direction: "column", alignItems: "stretch", gap: 5, "data-testid": "trash-preview", children: [
|
|
10372
|
+
row.incoming > 0 && /* @__PURE__ */ jsx16(Typography10, { variant: "pi", textColor: "neutral600", children: t.f("trashIncoming", { count: row.incoming }) }),
|
|
10373
|
+
row.entries.map((entry, i) => /* @__PURE__ */ jsxs13(Flex10, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
10374
|
+
/* @__PURE__ */ jsxs13(Typography10, { variant: "delta", tag: "h3", children: [
|
|
9898
10375
|
entry.locale || t.contentNone,
|
|
9899
10376
|
entry.status ? ` \xB7 ${entry.status === "published" ? t.trashPublished : t.trashDraft}` : ""
|
|
9900
10377
|
] }),
|
|
9901
|
-
/* @__PURE__ */
|
|
9902
|
-
/* @__PURE__ */
|
|
9903
|
-
/* @__PURE__ */
|
|
9904
|
-
/* @__PURE__ */
|
|
10378
|
+
/* @__PURE__ */ jsx16(Typography10, { variant: "sigma", textColor: "neutral600", children: t.trashFields }),
|
|
10379
|
+
/* @__PURE__ */ jsx16("dl", { style: { display: "grid", gridTemplateColumns: "minmax(120px, max-content) 1fr", gap: "4px 16px", margin: 0 }, children: entry.fields.map((field) => /* @__PURE__ */ jsxs13(React16.Fragment, { children: [
|
|
10380
|
+
/* @__PURE__ */ jsx16("dt", { children: /* @__PURE__ */ jsx16(Typography10, { variant: "pi", fontWeight: "bold", children: field.name }) }),
|
|
10381
|
+
/* @__PURE__ */ jsx16("dd", { style: { margin: 0, wordBreak: "break-word" }, children: /* @__PURE__ */ jsx16(Typography10, { variant: "pi", children: field.count !== void 0 ? t.f("trashItems", { count: field.count }) : field.value }) })
|
|
9905
10382
|
] }, field.name)) }),
|
|
9906
|
-
entry.blocks.length > 0 && /* @__PURE__ */
|
|
9907
|
-
/* @__PURE__ */
|
|
9908
|
-
/* @__PURE__ */
|
|
10383
|
+
entry.blocks.length > 0 && /* @__PURE__ */ jsxs13(Fragment13, { children: [
|
|
10384
|
+
/* @__PURE__ */ jsx16(Typography10, { variant: "sigma", textColor: "neutral600", children: t.trashBlocks }),
|
|
10385
|
+
/* @__PURE__ */ jsx16("ol", { style: { margin: 0, paddingLeft: 20 }, children: entry.blocks.map((block, j) => /* @__PURE__ */ jsx16("li", { children: /* @__PURE__ */ jsx16(Typography10, { variant: "pi", children: block.name }) }, j)) })
|
|
9909
10386
|
] })
|
|
9910
10387
|
] }, i))
|
|
9911
10388
|
] }) }),
|
|
9912
|
-
/* @__PURE__ */
|
|
10389
|
+
/* @__PURE__ */ jsx16(Modal.Footer, { children: /* @__PURE__ */ jsx16(Modal.Close, { children: /* @__PURE__ */ jsx16(Button8, { variant: "tertiary", children: t.trashClose }) }) })
|
|
9913
10390
|
] }) });
|
|
9914
10391
|
}
|
|
9915
10392
|
function TrashTab({ t, get, post, del, can }) {
|
|
9916
10393
|
const { toggleNotification } = useNotification2();
|
|
9917
|
-
const [contentType, setType] =
|
|
9918
|
-
const [restored, setRestored] =
|
|
9919
|
-
const [page, setPage] =
|
|
9920
|
-
const [refresh, reload] =
|
|
10394
|
+
const [contentType, setType] = React16.useState("");
|
|
10395
|
+
const [restored, setRestored] = React16.useState(false);
|
|
10396
|
+
const [page, setPage] = React16.useState(1);
|
|
10397
|
+
const [refresh, reload] = React16.useReducer((n) => n + 1, 0);
|
|
9921
10398
|
const { data, failed } = useList(get, "/trash", { contentType, status: restored ? "restored" : "trashed", page, pageSize: 20 }, refresh);
|
|
9922
|
-
const [preview, setPreview] =
|
|
9923
|
-
const [restore, setRestore] =
|
|
9924
|
-
const [remove, setRemove] =
|
|
9925
|
-
const [busy, setBusy] =
|
|
10399
|
+
const [preview, setPreview] = React16.useState(null);
|
|
10400
|
+
const [restore, setRestore] = React16.useState(null);
|
|
10401
|
+
const [remove, setRemove] = React16.useState(null);
|
|
10402
|
+
const [busy, setBusy] = React16.useState(false);
|
|
9926
10403
|
const types = new Map((data?.types || []).map((type) => [type.uid, type]));
|
|
9927
10404
|
const title = (row) => row.title || t.contentUntitled;
|
|
9928
10405
|
const check = async (row) => {
|
|
@@ -9968,9 +10445,9 @@ function TrashTab({ t, get, post, del, can }) {
|
|
|
9968
10445
|
const days = Math.floor((new Date(at).getTime() - Date.now()) / DAY);
|
|
9969
10446
|
return days < 1 ? t.trashExpiresToday : t.f("trashExpiresIn", { days });
|
|
9970
10447
|
};
|
|
9971
|
-
return /* @__PURE__ */
|
|
9972
|
-
/* @__PURE__ */
|
|
9973
|
-
/* @__PURE__ */
|
|
10448
|
+
return /* @__PURE__ */ jsxs13(Flex10, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
10449
|
+
/* @__PURE__ */ jsxs13(Flex10, { gap: 4, wrap: "wrap", alignItems: "flex-end", children: [
|
|
10450
|
+
/* @__PURE__ */ jsx16(
|
|
9974
10451
|
Select,
|
|
9975
10452
|
{
|
|
9976
10453
|
name: "trash-type",
|
|
@@ -9983,70 +10460,70 @@ function TrashTab({ t, get, post, del, can }) {
|
|
|
9983
10460
|
options: [{ value: "", label: t.activityAnyType }, ...(data?.types || []).map((type) => ({ value: type.uid, label: type.displayName }))]
|
|
9984
10461
|
}
|
|
9985
10462
|
),
|
|
9986
|
-
/* @__PURE__ */
|
|
9987
|
-
/* @__PURE__ */
|
|
10463
|
+
/* @__PURE__ */ jsxs13(Flex10, { gap: 2, paddingBottom: 2, children: [
|
|
10464
|
+
/* @__PURE__ */ jsx16(Switch, { "aria-label": t.trashShowRestored, checked: restored, onCheckedChange: (v) => {
|
|
9988
10465
|
setRestored(v);
|
|
9989
10466
|
setPage(1);
|
|
9990
10467
|
} }),
|
|
9991
|
-
/* @__PURE__ */
|
|
10468
|
+
/* @__PURE__ */ jsx16(Typography10, { variant: "pi", children: t.trashShowRestored })
|
|
9992
10469
|
] })
|
|
9993
10470
|
] }),
|
|
9994
|
-
failed ? /* @__PURE__ */
|
|
9995
|
-
/* @__PURE__ */
|
|
9996
|
-
/* @__PURE__ */
|
|
9997
|
-
/* @__PURE__ */
|
|
9998
|
-
/* @__PURE__ */
|
|
9999
|
-
/* @__PURE__ */
|
|
10000
|
-
/* @__PURE__ */
|
|
10001
|
-
/* @__PURE__ */
|
|
10471
|
+
failed ? /* @__PURE__ */ jsx16(Typography10, { role: "alert", textColor: "danger600", children: t.trashFailed }) : !data ? /* @__PURE__ */ jsx16(Typography10, { textColor: "neutral600", children: t.contentLoading }) : !data.results.length ? /* @__PURE__ */ jsx16(Typography10, { textColor: "neutral600", children: t.trashEmpty }) : /* @__PURE__ */ jsxs13(Box8, { children: [
|
|
10472
|
+
/* @__PURE__ */ jsxs13(Table, { colCount: 5, rowCount: data.results.length + 1, "data-testid": "blockscene-trash", children: [
|
|
10473
|
+
/* @__PURE__ */ jsx16(Thead, { children: /* @__PURE__ */ jsxs13(Tr, { children: [
|
|
10474
|
+
/* @__PURE__ */ jsx16(Th, { children: /* @__PURE__ */ jsx16(Typography10, { variant: "sigma", children: t.activityDocument }) }),
|
|
10475
|
+
/* @__PURE__ */ jsx16(Th, { children: /* @__PURE__ */ jsx16(Typography10, { variant: "sigma", children: t.trashLocales }) }),
|
|
10476
|
+
/* @__PURE__ */ jsx16(Th, { children: /* @__PURE__ */ jsx16(Typography10, { variant: "sigma", children: t.trashDeletedBy }) }),
|
|
10477
|
+
/* @__PURE__ */ jsx16(Th, { children: /* @__PURE__ */ jsx16(Typography10, { variant: "sigma", children: restored ? t.trashRestoredAs : t.trashExpires }) }),
|
|
10478
|
+
/* @__PURE__ */ jsx16(Th, { children: /* @__PURE__ */ jsx16(Typography10, { variant: "sigma", children: " " }) })
|
|
10002
10479
|
] }) }),
|
|
10003
|
-
/* @__PURE__ */
|
|
10004
|
-
/* @__PURE__ */
|
|
10005
|
-
/* @__PURE__ */
|
|
10006
|
-
/* @__PURE__ */
|
|
10007
|
-
/* @__PURE__ */
|
|
10008
|
-
/* @__PURE__ */
|
|
10480
|
+
/* @__PURE__ */ jsx16(Tbody, { children: data.results.map((row) => /* @__PURE__ */ jsxs13(Tr, { "data-testid": `trash-${row.id}`, children: [
|
|
10481
|
+
/* @__PURE__ */ jsx16(Td, { children: /* @__PURE__ */ jsx16(Doc, { t, type: types.get(row.contentType), row: { ...row, exists: void 0 }, documentId: row.relatedDocumentId, locale: null }) }),
|
|
10482
|
+
/* @__PURE__ */ jsx16(Td, { children: /* @__PURE__ */ jsx16(Typography10, { variant: "pi", children: (row.locales || []).map((l) => l ?? t.contentNone).join(", ") }) }),
|
|
10483
|
+
/* @__PURE__ */ jsx16(Td, { children: /* @__PURE__ */ jsxs13(Flex10, { direction: "column", alignItems: "flex-start", children: [
|
|
10484
|
+
/* @__PURE__ */ jsx16(Typography10, { variant: "pi", children: row.actorName || (row.actor === "system" ? t.historySystem : row.actor) }),
|
|
10485
|
+
/* @__PURE__ */ jsx16(Typography10, { variant: "pi", textColor: "neutral600", children: when(t, row.deletedAt) })
|
|
10009
10486
|
] }) }),
|
|
10010
|
-
/* @__PURE__ */
|
|
10011
|
-
/* @__PURE__ */
|
|
10012
|
-
restored && row.restoredAs && types.get(row.contentType) && /* @__PURE__ */
|
|
10487
|
+
/* @__PURE__ */ jsxs13(Td, { children: [
|
|
10488
|
+
/* @__PURE__ */ jsx16(Typography10, { variant: "pi", children: restored ? row.restoredAt ? when(t, row.restoredAt) : "" : expires(row.expiresAt) }),
|
|
10489
|
+
restored && row.restoredAs && types.get(row.contentType) && /* @__PURE__ */ jsx16(Box8, { children: /* @__PURE__ */ jsx16(Link, { href: editUrl(types.get(row.contentType), row.restoredAs, null), children: t.contentOpen }) })
|
|
10013
10490
|
] }),
|
|
10014
|
-
/* @__PURE__ */
|
|
10015
|
-
/* @__PURE__ */
|
|
10016
|
-
!restored && can.canRestore && /* @__PURE__ */
|
|
10017
|
-
can.canPurge && /* @__PURE__ */
|
|
10491
|
+
/* @__PURE__ */ jsx16(Td, { children: /* @__PURE__ */ jsxs13(Flex10, { gap: 2, justifyContent: "flex-end", children: [
|
|
10492
|
+
/* @__PURE__ */ jsx16(Button8, { variant: "tertiary", size: "S", onClick: () => setPreview(row.id), children: t.trashPreview }),
|
|
10493
|
+
!restored && can.canRestore && /* @__PURE__ */ jsx16(Button8, { variant: "secondary", size: "S", onClick: () => check(row), "data-testid": `trash-restore-${row.id}`, children: t.trashRestore }),
|
|
10494
|
+
can.canPurge && /* @__PURE__ */ jsx16(Button8, { variant: "danger-light", size: "S", onClick: () => setRemove(row), "data-testid": `trash-delete-${row.id}`, children: t.trashDelete })
|
|
10018
10495
|
] }) })
|
|
10019
10496
|
] }, row.id)) })
|
|
10020
10497
|
] }),
|
|
10021
|
-
/* @__PURE__ */
|
|
10498
|
+
/* @__PURE__ */ jsx16(Pager, { t, pagination: data.pagination, setPage })
|
|
10022
10499
|
] }),
|
|
10023
|
-
preview !== null && /* @__PURE__ */
|
|
10024
|
-
restore && /* @__PURE__ */
|
|
10025
|
-
/* @__PURE__ */
|
|
10026
|
-
/* @__PURE__ */
|
|
10027
|
-
/* @__PURE__ */
|
|
10028
|
-
restore.done.documentId && types.get(restore.row.contentType) && /* @__PURE__ */
|
|
10029
|
-
!restore.done.already && /* @__PURE__ */
|
|
10030
|
-
] }) : !restore.report ? /* @__PURE__ */
|
|
10031
|
-
/* @__PURE__ */
|
|
10500
|
+
preview !== null && /* @__PURE__ */ jsx16(Preview2, { t, id: preview, get, onClose: () => setPreview(null) }),
|
|
10501
|
+
restore && /* @__PURE__ */ jsx16(Dialog.Root, { open: true, onOpenChange: (open) => !open && !busy && setRestore(null), children: /* @__PURE__ */ jsxs13(Dialog.Content, { children: [
|
|
10502
|
+
/* @__PURE__ */ jsx16(Dialog.Header, { children: t.f("restoreTitle", { title: title(restore.row) }) }),
|
|
10503
|
+
/* @__PURE__ */ jsx16(Dialog.Body, { children: /* @__PURE__ */ jsx16(Flex10, { direction: "column", alignItems: "stretch", gap: 3, width: "100%", children: restore.done ? /* @__PURE__ */ jsxs13(Flex10, { direction: "column", alignItems: "flex-start", gap: 2, role: "status", "data-testid": "restore-done", children: [
|
|
10504
|
+
/* @__PURE__ */ jsx16(Typography10, { textColor: "success700", children: restore.done.already ? t.restoreAlready : t.restoreDone }),
|
|
10505
|
+
restore.done.documentId && types.get(restore.row.contentType) && /* @__PURE__ */ jsx16(Link, { href: editUrl(types.get(restore.row.contentType), restore.done.documentId, restore.done.locales?.[0] ?? null), children: t.restoreOpen }),
|
|
10506
|
+
!restore.done.already && /* @__PURE__ */ jsx16(Report, { t, report: { warnings: restore.done.warnings, incoming: restore.done.incoming && { ...restore.done.incoming, reconnect: restore.done.incoming.reconnected } } })
|
|
10507
|
+
] }) : !restore.report ? /* @__PURE__ */ jsx16(Typography10, { children: t.restoreChecking }) : restore.failed ? /* @__PURE__ */ jsx16(Typography10, { role: "alert", textColor: "danger600", children: t.restoreFailed }) : /* @__PURE__ */ jsxs13(Fragment13, { children: [
|
|
10508
|
+
/* @__PURE__ */ jsxs13(Typography10, { variant: "pi", children: [
|
|
10032
10509
|
t.restoreIntro,
|
|
10033
10510
|
" ",
|
|
10034
10511
|
restore.report.documentId ? t.restoreInto : t.restoreNew
|
|
10035
10512
|
] }),
|
|
10036
|
-
restore.report.locales?.length > 0 && restore.report.locales[0] !== null && /* @__PURE__ */
|
|
10037
|
-
/* @__PURE__ */
|
|
10513
|
+
restore.report.locales?.length > 0 && restore.report.locales[0] !== null && /* @__PURE__ */ jsx16(Typography10, { variant: "pi", children: t.f("restoreLocales", { locales: restore.report.locales.join(", ") }) }),
|
|
10514
|
+
/* @__PURE__ */ jsx16(Report, { t, report: restore.report })
|
|
10038
10515
|
] }) }) }),
|
|
10039
|
-
/* @__PURE__ */
|
|
10040
|
-
/* @__PURE__ */
|
|
10041
|
-
!restore.done && /* @__PURE__ */
|
|
10516
|
+
/* @__PURE__ */ jsxs13(Dialog.Footer, { children: [
|
|
10517
|
+
/* @__PURE__ */ jsx16(Dialog.Cancel, { children: /* @__PURE__ */ jsx16(Button8, { variant: "tertiary", disabled: busy, children: restore.done ? t.trashClose : t.restoreCancel }) }),
|
|
10518
|
+
!restore.done && /* @__PURE__ */ jsx16(Button8, { onClick: confirmRestore, loading: busy, disabled: busy || !restore.report || restore.failed || restore.report.blocking?.length > 0, "data-testid": "restore-confirm", children: t.restoreConfirm })
|
|
10042
10519
|
] })
|
|
10043
10520
|
] }) }),
|
|
10044
|
-
remove && /* @__PURE__ */
|
|
10045
|
-
/* @__PURE__ */
|
|
10046
|
-
/* @__PURE__ */
|
|
10047
|
-
/* @__PURE__ */
|
|
10048
|
-
/* @__PURE__ */
|
|
10049
|
-
/* @__PURE__ */
|
|
10521
|
+
remove && /* @__PURE__ */ jsx16(Dialog.Root, { open: true, onOpenChange: (open) => !open && !busy && setRemove(null), children: /* @__PURE__ */ jsxs13(Dialog.Content, { children: [
|
|
10522
|
+
/* @__PURE__ */ jsx16(Dialog.Header, { children: t.trashDeleteTitle }),
|
|
10523
|
+
/* @__PURE__ */ jsx16(Dialog.Body, { children: /* @__PURE__ */ jsx16(Typography10, { children: t.f("trashDeleteConfirm", { title: title(remove) }) }) }),
|
|
10524
|
+
/* @__PURE__ */ jsxs13(Dialog.Footer, { children: [
|
|
10525
|
+
/* @__PURE__ */ jsx16(Dialog.Cancel, { children: /* @__PURE__ */ jsx16(Button8, { variant: "tertiary", disabled: busy, children: t.restoreCancel }) }),
|
|
10526
|
+
/* @__PURE__ */ jsx16(Button8, { variant: "danger", onClick: confirmRemove, loading: busy, disabled: busy, "data-testid": "delete-confirm", children: t.trashDelete })
|
|
10050
10527
|
] })
|
|
10051
10528
|
] }) })
|
|
10052
10529
|
] });
|
|
@@ -10054,37 +10531,92 @@ function TrashTab({ t, get, post, del, can }) {
|
|
|
10054
10531
|
function ContentPage() {
|
|
10055
10532
|
const t = useMessages();
|
|
10056
10533
|
const { get, post, del } = useFetchClient2();
|
|
10057
|
-
const activity =
|
|
10058
|
-
const trash =
|
|
10059
|
-
const [tab, setTab] =
|
|
10060
|
-
if (activity.isLoading || trash.isLoading) return /* @__PURE__ */
|
|
10534
|
+
const activity = useRBAC3(ACTIVITY);
|
|
10535
|
+
const trash = useRBAC3(TRASH);
|
|
10536
|
+
const [tab, setTab] = React16.useState(null);
|
|
10537
|
+
if (activity.isLoading || trash.isLoading) return /* @__PURE__ */ jsx16(Page.Loading, {});
|
|
10061
10538
|
const canActivity = Boolean(activity.allowedActions?.canRead), canTrash = Boolean(trash.allowedActions?.canRead);
|
|
10062
|
-
if (!canActivity && !canTrash) return /* @__PURE__ */
|
|
10539
|
+
if (!canActivity && !canTrash) return /* @__PURE__ */ jsx16(Page.NoPermissions, {});
|
|
10063
10540
|
const current = tab || (canActivity ? "activity" : "trash");
|
|
10064
|
-
return /* @__PURE__ */
|
|
10065
|
-
/* @__PURE__ */
|
|
10066
|
-
/* @__PURE__ */
|
|
10067
|
-
/* @__PURE__ */
|
|
10068
|
-
/* @__PURE__ */
|
|
10069
|
-
canActivity && /* @__PURE__ */
|
|
10070
|
-
canTrash && /* @__PURE__ */
|
|
10541
|
+
return /* @__PURE__ */ jsxs13(Page.Main, { children: [
|
|
10542
|
+
/* @__PURE__ */ jsx16(Page.Title, { children: t.contentTitle }),
|
|
10543
|
+
/* @__PURE__ */ jsx16(Layouts.Header, { title: t.contentTitle, subtitle: t.contentSubtitle }),
|
|
10544
|
+
/* @__PURE__ */ jsx16(Layouts.Content, { children: /* @__PURE__ */ jsxs13(Tabs.Root, { value: current, onValueChange: setTab, children: [
|
|
10545
|
+
/* @__PURE__ */ jsxs13(Tabs.List, { "aria-label": t.contentTitle, children: [
|
|
10546
|
+
canActivity && /* @__PURE__ */ jsx16(Tabs.Trigger, { value: "activity", children: t.activityTab }),
|
|
10547
|
+
canTrash && /* @__PURE__ */ jsx16(Tabs.Trigger, { value: "trash", children: t.trashTab })
|
|
10071
10548
|
] }),
|
|
10072
|
-
/* @__PURE__ */
|
|
10073
|
-
canActivity && /* @__PURE__ */
|
|
10074
|
-
canTrash && /* @__PURE__ */
|
|
10549
|
+
/* @__PURE__ */ jsxs13(Box8, { paddingTop: 6, paddingBottom: 6, background: "neutral0", hasRadius: true, paddingLeft: 6, paddingRight: 6, marginTop: 4, children: [
|
|
10550
|
+
canActivity && /* @__PURE__ */ jsx16(Tabs.Content, { value: "activity", children: /* @__PURE__ */ jsx16(ActivityTab, { t, get }) }),
|
|
10551
|
+
canTrash && /* @__PURE__ */ jsx16(Tabs.Content, { value: "trash", children: /* @__PURE__ */ jsx16(TrashTab, { t, get, post, del, can: trash.allowedActions }) })
|
|
10075
10552
|
] })
|
|
10076
10553
|
] }) })
|
|
10077
10554
|
] });
|
|
10078
10555
|
}
|
|
10079
10556
|
|
|
10557
|
+
// admin/StarterKits.tsx
|
|
10558
|
+
import * as React17 from "react";
|
|
10559
|
+
import { Box as Box9, Button as Button9, Flex as Flex11, Typography as Typography11 } from "@strapi/design-system";
|
|
10560
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
10561
|
+
var marker = (docKey) => {
|
|
10562
|
+
try {
|
|
10563
|
+
const entry = window.history.state?.key ?? window.history.state?.idx ?? "route";
|
|
10564
|
+
return `blockscene:starter-kit:${entry}:${docKey}`;
|
|
10565
|
+
} catch {
|
|
10566
|
+
return `blockscene:starter-kit:${docKey}`;
|
|
10567
|
+
}
|
|
10568
|
+
};
|
|
10569
|
+
var wasHandled = (key) => {
|
|
10570
|
+
try {
|
|
10571
|
+
return window.sessionStorage.getItem(key) === "handled";
|
|
10572
|
+
} catch {
|
|
10573
|
+
return false;
|
|
10574
|
+
}
|
|
10575
|
+
};
|
|
10576
|
+
var remember2 = (key) => {
|
|
10577
|
+
try {
|
|
10578
|
+
window.sessionStorage.setItem(key, "handled");
|
|
10579
|
+
} catch {
|
|
10580
|
+
}
|
|
10581
|
+
};
|
|
10582
|
+
function StarterKits({ creating, kits, zones, components, form, Modal: Modal3, docKey }) {
|
|
10583
|
+
const t = useMessages();
|
|
10584
|
+
const key = marker(docKey);
|
|
10585
|
+
const handled = React17.useRef({ key, value: wasHandled(key) });
|
|
10586
|
+
if (handled.current.key !== key) handled.current = { key, value: wasHandled(key) };
|
|
10587
|
+
const usable = starterKitsForLocale(kits, form?.locale).filter((kit) => Object.keys(kit.zones || {}).every((name) => zones.some((zone) => zone.name === name)));
|
|
10588
|
+
const available = creating && form && !handled.current.value && usable.length > 0 && zones.length > 0 && zones.every((zone) => form.rows(zone.name).length === 0);
|
|
10589
|
+
const [open, setOpen] = React17.useState(available);
|
|
10590
|
+
React17.useEffect(() => {
|
|
10591
|
+
if (available) setOpen(true);
|
|
10592
|
+
}, [available, key]);
|
|
10593
|
+
if (!available) return null;
|
|
10594
|
+
const finish = () => {
|
|
10595
|
+
handled.current.value = true;
|
|
10596
|
+
remember2(key);
|
|
10597
|
+
setOpen(false);
|
|
10598
|
+
};
|
|
10599
|
+
const apply = (kit) => {
|
|
10600
|
+
const rows = starterKitRows(kit, zones, components, form);
|
|
10601
|
+
if (!rows) return;
|
|
10602
|
+
for (const [zone, value] of Object.entries(rows)) form.setRows(zone, value);
|
|
10603
|
+
finish();
|
|
10604
|
+
};
|
|
10605
|
+
return /* @__PURE__ */ jsx17(Modal3, { open, onOpenChange: (next) => next ? setOpen(true) : finish(), title: t.starterKits, width: "560px", children: /* @__PURE__ */ jsxs14(Flex11, { direction: "column", alignItems: "stretch", gap: 3, children: [
|
|
10606
|
+
/* @__PURE__ */ jsx17(Typography11, { textColor: "neutral600", children: t.starterKitsHelp }),
|
|
10607
|
+
usable.map((kit) => /* @__PURE__ */ jsx17(Button9, { variant: "secondary", fullWidth: true, onClick: () => apply(kit), "data-testid": `starter-kit-${kit.id}`, children: localized(kit.label, t.locale) }, kit.id)),
|
|
10608
|
+
/* @__PURE__ */ jsx17(Box9, { paddingTop: 1, children: /* @__PURE__ */ jsx17(Button9, { variant: "tertiary", onClick: finish, children: t.startBlank }) })
|
|
10609
|
+
] }) });
|
|
10610
|
+
}
|
|
10611
|
+
|
|
10080
10612
|
// admin/strapi5.tsx
|
|
10081
|
-
import { Fragment as
|
|
10613
|
+
import { Fragment as Fragment14, jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
10082
10614
|
function Modal2({ open, onOpenChange, trigger, title, children, width = "80vw" }) {
|
|
10083
|
-
return /* @__PURE__ */
|
|
10084
|
-
trigger && /* @__PURE__ */
|
|
10085
|
-
/* @__PURE__ */
|
|
10086
|
-
/* @__PURE__ */
|
|
10087
|
-
/* @__PURE__ */
|
|
10615
|
+
return /* @__PURE__ */ jsxs15(Dialog2.Root, { open, onOpenChange, children: [
|
|
10616
|
+
trigger && /* @__PURE__ */ jsx18(Dialog2.Trigger, { children: trigger }),
|
|
10617
|
+
/* @__PURE__ */ jsxs15(Dialog2.Content, { style: { width, maxWidth: "92vw" }, children: [
|
|
10618
|
+
/* @__PURE__ */ jsx18(Dialog2.Header, { children: /* @__PURE__ */ jsx18(Dialog2.Title, { children: title }) }),
|
|
10619
|
+
/* @__PURE__ */ jsx18(Dialog2.Body, { children })
|
|
10088
10620
|
] })
|
|
10089
10621
|
] });
|
|
10090
10622
|
}
|
|
@@ -10102,7 +10634,7 @@ function useRowForm(c, values, get) {
|
|
|
10102
10634
|
const onChange = useForm3("Blockscene", (state) => state.onChange);
|
|
10103
10635
|
const errors = useForm3("Blockscene", (state) => state.errors);
|
|
10104
10636
|
const { toggleNotification } = useNotification3();
|
|
10105
|
-
const latest =
|
|
10637
|
+
const latest = React18.useRef(values);
|
|
10106
10638
|
latest.current = values;
|
|
10107
10639
|
const locale = c.form?.initialValues?.locale || void 0;
|
|
10108
10640
|
if (typeof onChange !== "function") return null;
|
|
@@ -10146,8 +10678,8 @@ function useScope() {
|
|
|
10146
10678
|
const history = !creating && Boolean(c.id) && Boolean(catalog?.history?.contentTypes?.includes(c.model));
|
|
10147
10679
|
return { c, rbac, get, put, formValues, catalog, creating, zones, typeSettings, gallery, history };
|
|
10148
10680
|
}
|
|
10149
|
-
var Menu2 = ({ label, testid, items: items2 }) => /* @__PURE__ */
|
|
10150
|
-
/* @__PURE__ */
|
|
10681
|
+
var Menu2 = ({ label, testid, items: items2 }) => /* @__PURE__ */ jsx18(Box10, { "data-testid": testid, children: /* @__PURE__ */ jsx18(SimpleMenu2, { variant: "tertiary", size: "S", "aria-label": label, title: label, endIcon: null, label: /* @__PURE__ */ jsx18(Icon, { name: "more", size: 16 }), children: items2.map((item) => /* @__PURE__ */ jsx18(MenuItem2, { onSelect: item.onSelect, "data-testid": item.testid, children: /* @__PURE__ */ jsxs15(Flex12, { gap: 2, alignItems: "center", children: [
|
|
10682
|
+
/* @__PURE__ */ jsx18(Icon, { name: item.icon, size: 16 }),
|
|
10151
10683
|
item.label
|
|
10152
10684
|
] }) }, item.testid)) }) });
|
|
10153
10685
|
function Editor() {
|
|
@@ -10155,13 +10687,13 @@ function Editor() {
|
|
|
10155
10687
|
const { catalog, typeSettings, gallery } = scope;
|
|
10156
10688
|
const lazy = Boolean(catalog?.editor?.enabled && catalog.editor.lazyEditors !== false && typeSettings.enabled !== false);
|
|
10157
10689
|
const lazyFields = (catalog?.editor?.lazyFields || []).join(",");
|
|
10158
|
-
|
|
10690
|
+
React18.useEffect(() => {
|
|
10159
10691
|
if (catalog) setLazyConfig({ on: lazy, fields: lazyFields ? lazyFields.split(",") : [] });
|
|
10160
10692
|
}, [catalog, lazy, lazyFields]);
|
|
10161
|
-
const kept2 =
|
|
10693
|
+
const kept2 = React18.useRef(false);
|
|
10162
10694
|
if (!scope.c.isLoading) kept2.current = gallery;
|
|
10163
10695
|
if (!kept2.current) return null;
|
|
10164
|
-
return /* @__PURE__ */
|
|
10696
|
+
return /* @__PURE__ */ jsx18(Guard, { children: /* @__PURE__ */ jsx18("div", { hidden: true, "data-blockscene-editor": "", children: /* @__PURE__ */ jsx18(Workspace, { scope }) }) });
|
|
10165
10697
|
}
|
|
10166
10698
|
function Workspace({ scope }) {
|
|
10167
10699
|
const { c, get, put, formValues, catalog, creating, zones, typeSettings } = scope;
|
|
@@ -10177,6 +10709,8 @@ function Workspace({ scope }) {
|
|
|
10177
10709
|
};
|
|
10178
10710
|
const host = usePreviewHost5();
|
|
10179
10711
|
const state = useEditorState(editor, host);
|
|
10712
|
+
const versions = useVersions(host, catalog?.history);
|
|
10713
|
+
const docKey = `${c.model}:${creating ? "new" : c.id}:${c.form?.initialValues?.locale || ""}`;
|
|
10180
10714
|
const add = (zone, uid, preset) => {
|
|
10181
10715
|
const values = formValues ?? c.form.values;
|
|
10182
10716
|
const close = catalog?.groups?.[uid];
|
|
@@ -10194,8 +10728,9 @@ function Workspace({ scope }) {
|
|
|
10194
10728
|
if (close) c.form.addFieldRow(zone.name, { __component: close }, at + 1);
|
|
10195
10729
|
return true;
|
|
10196
10730
|
};
|
|
10197
|
-
return /* @__PURE__ */
|
|
10198
|
-
/* @__PURE__ */
|
|
10731
|
+
return /* @__PURE__ */ jsxs15(Fragment14, { children: [
|
|
10732
|
+
/* @__PURE__ */ jsx18(StarterKits, { creating, kits: catalog.kits?.[c.model], zones, components: c.components, form, Modal: Modal2, docKey }),
|
|
10733
|
+
/* @__PURE__ */ jsx18(
|
|
10199
10734
|
Gallery,
|
|
10200
10735
|
{
|
|
10201
10736
|
zones,
|
|
@@ -10208,18 +10743,19 @@ function Workspace({ scope }) {
|
|
|
10208
10743
|
put,
|
|
10209
10744
|
editor: catalog.editor,
|
|
10210
10745
|
catalog,
|
|
10211
|
-
docKey
|
|
10746
|
+
docKey,
|
|
10212
10747
|
contentType: c.model,
|
|
10213
10748
|
userId: user?.id,
|
|
10214
10749
|
form,
|
|
10215
|
-
zoneTools: /* @__PURE__ */
|
|
10750
|
+
zoneTools: /* @__PURE__ */ jsx18(ZoneBarTools, { state }),
|
|
10216
10751
|
openBlock: state.openBlock,
|
|
10217
10752
|
openInsert: state.openInsert
|
|
10218
10753
|
}
|
|
10219
10754
|
),
|
|
10220
|
-
/* @__PURE__ */
|
|
10755
|
+
/* @__PURE__ */ jsx18(
|
|
10221
10756
|
PagePreview,
|
|
10222
10757
|
{
|
|
10758
|
+
versions,
|
|
10223
10759
|
editor,
|
|
10224
10760
|
state,
|
|
10225
10761
|
host,
|
|
@@ -10234,7 +10770,7 @@ function Workspace({ scope }) {
|
|
|
10234
10770
|
}
|
|
10235
10771
|
function Panel2() {
|
|
10236
10772
|
const { c, rbac, get, catalog, gallery, history } = useScope();
|
|
10237
|
-
const canReadHistory = Boolean(
|
|
10773
|
+
const canReadHistory = Boolean(useRBAC4(HISTORY_READ).allowedActions?.canRead);
|
|
10238
10774
|
const preview = usePreviewZone(usePreviewHost5());
|
|
10239
10775
|
const groups = gallery ? catalog?.groups : null;
|
|
10240
10776
|
const problems = groups && preview.zone ? (0, import_groups.validateGroups)(preview.rows, groups) : [];
|
|
@@ -10242,9 +10778,9 @@ function Panel2() {
|
|
|
10242
10778
|
if (!versions && !problems.length) return null;
|
|
10243
10779
|
return {
|
|
10244
10780
|
title: "Blockscene",
|
|
10245
|
-
content: /* @__PURE__ */
|
|
10246
|
-
problems.length > 0 && /* @__PURE__ */
|
|
10247
|
-
versions && /* @__PURE__ */
|
|
10781
|
+
content: /* @__PURE__ */ jsx18(Guard, { children: /* @__PURE__ */ jsxs15(Flex12, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
10782
|
+
problems.length > 0 && /* @__PURE__ */ jsx18(GroupDiagnostics, { scope: preview, groups, problems }),
|
|
10783
|
+
versions && /* @__PURE__ */ jsx18(
|
|
10248
10784
|
History,
|
|
10249
10785
|
{
|
|
10250
10786
|
model: c.model,
|
|
@@ -10260,8 +10796,8 @@ function Panel2() {
|
|
|
10260
10796
|
] }) })
|
|
10261
10797
|
};
|
|
10262
10798
|
}
|
|
10263
|
-
var ToggleField = ({ name, label, value, onChange, disabled }) => /* @__PURE__ */
|
|
10264
|
-
/* @__PURE__ */
|
|
10799
|
+
var ToggleField = ({ name, label, value, onChange, disabled }) => /* @__PURE__ */ jsxs15(Flex12, { gap: 3, children: [
|
|
10800
|
+
/* @__PURE__ */ jsx18(
|
|
10265
10801
|
Switch2,
|
|
10266
10802
|
{
|
|
10267
10803
|
name,
|
|
@@ -10271,7 +10807,7 @@ var ToggleField = ({ name, label, value, onChange, disabled }) => /* @__PURE__ *
|
|
|
10271
10807
|
onCheckedChange: onChange
|
|
10272
10808
|
}
|
|
10273
10809
|
),
|
|
10274
|
-
/* @__PURE__ */
|
|
10810
|
+
/* @__PURE__ */ jsx18(Typography12, { children: label })
|
|
10275
10811
|
] });
|
|
10276
10812
|
var TextField = ({
|
|
10277
10813
|
name,
|
|
@@ -10280,9 +10816,9 @@ var TextField = ({
|
|
|
10280
10816
|
onChange,
|
|
10281
10817
|
disabled,
|
|
10282
10818
|
placeholder
|
|
10283
|
-
}) => /* @__PURE__ */
|
|
10284
|
-
/* @__PURE__ */
|
|
10285
|
-
/* @__PURE__ */
|
|
10819
|
+
}) => /* @__PURE__ */ jsxs15(Field3.Root, { name, children: [
|
|
10820
|
+
/* @__PURE__ */ jsx18(Field3.Label, { children: label }),
|
|
10821
|
+
/* @__PURE__ */ jsx18(
|
|
10286
10822
|
TextInput2,
|
|
10287
10823
|
{
|
|
10288
10824
|
name,
|
|
@@ -10300,16 +10836,16 @@ var SelectField = ({
|
|
|
10300
10836
|
onChange,
|
|
10301
10837
|
disabled,
|
|
10302
10838
|
options
|
|
10303
|
-
}) => /* @__PURE__ */
|
|
10304
|
-
/* @__PURE__ */
|
|
10305
|
-
/* @__PURE__ */
|
|
10306
|
-
|
|
10839
|
+
}) => /* @__PURE__ */ jsxs15(Field3.Root, { name, children: [
|
|
10840
|
+
/* @__PURE__ */ jsx18(Field3.Label, { children: label }),
|
|
10841
|
+
/* @__PURE__ */ jsx18(
|
|
10842
|
+
SingleSelect3,
|
|
10307
10843
|
{
|
|
10308
10844
|
value,
|
|
10309
10845
|
disabled,
|
|
10310
10846
|
startIcon: options.find((o) => o.value === value)?.icon,
|
|
10311
10847
|
onChange: (v) => onChange(String(v)),
|
|
10312
|
-
children: options.map((o) => /* @__PURE__ */
|
|
10848
|
+
children: options.map((o) => /* @__PURE__ */ jsx18(SingleSelectOption3, { value: o.value, startIcon: o.icon, children: o.label }, o.value))
|
|
10313
10849
|
}
|
|
10314
10850
|
)
|
|
10315
10851
|
] });
|
|
@@ -10319,11 +10855,11 @@ function MediaPicker({ onClose, onSelect }) {
|
|
|
10319
10855
|
(state) => state.components
|
|
10320
10856
|
);
|
|
10321
10857
|
const Dialog3 = components?.["media-library"];
|
|
10322
|
-
|
|
10858
|
+
React18.useEffect(() => {
|
|
10323
10859
|
if (!Dialog3) onClose();
|
|
10324
10860
|
}, [Dialog3, onClose]);
|
|
10325
10861
|
if (!Dialog3) return null;
|
|
10326
|
-
return /* @__PURE__ */
|
|
10862
|
+
return /* @__PURE__ */ jsx18(
|
|
10327
10863
|
Dialog3,
|
|
10328
10864
|
{
|
|
10329
10865
|
onClose,
|
|
@@ -10334,7 +10870,7 @@ function MediaPicker({ onClose, onSelect }) {
|
|
|
10334
10870
|
);
|
|
10335
10871
|
}
|
|
10336
10872
|
function usePermissions() {
|
|
10337
|
-
const { allowedActions, isLoading } =
|
|
10873
|
+
const { allowedActions, isLoading } = useRBAC4(
|
|
10338
10874
|
Object.values(permissions).flat()
|
|
10339
10875
|
);
|
|
10340
10876
|
return {
|
|
@@ -10343,7 +10879,7 @@ function usePermissions() {
|
|
|
10343
10879
|
isLoading
|
|
10344
10880
|
};
|
|
10345
10881
|
}
|
|
10346
|
-
var SettingsPage = () => /* @__PURE__ */
|
|
10882
|
+
var SettingsPage = () => /* @__PURE__ */ jsx18(Guard, { children: /* @__PURE__ */ jsx18(
|
|
10347
10883
|
Settings,
|
|
10348
10884
|
{
|
|
10349
10885
|
useClient: useFetchClient3,
|
|
@@ -10361,7 +10897,7 @@ var strapi5_default = {
|
|
|
10361
10897
|
strapiApp = app;
|
|
10362
10898
|
register(app, SettingsPage, "blockscene");
|
|
10363
10899
|
app.registerPlugin({ id: "blockscene", name: "Blockscene", apis: { registerPanel: (panel) => registerPanel(panel, ICON_NAMES) } });
|
|
10364
|
-
app.addMenuLink(contentMenuLink(() => /* @__PURE__ */
|
|
10900
|
+
app.addMenuLink(contentMenuLink(() => /* @__PURE__ */ jsx18(Guard, { children: /* @__PURE__ */ jsx18(ContentPage, {}) })));
|
|
10365
10901
|
},
|
|
10366
10902
|
registerTrads,
|
|
10367
10903
|
bootstrap(app) {
|