@strapi/content-manager 0.0.0-experimental.f75e3c6d67cc47c64ab37479efdbb7b43be50b78 → 0.0.0-next.ce84fada19d58a7dfbdd553035e6558f8befcba4
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/LICENSE +18 -3
- package/dist/_chunks/{ComponentConfigurationPage-CuWgXugY.mjs → ComponentConfigurationPage-DfFSZQxe.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-CuWgXugY.mjs.map → ComponentConfigurationPage-DfFSZQxe.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-by0e_kNd.js → ComponentConfigurationPage-FqfsxQ1j.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-by0e_kNd.js.map → ComponentConfigurationPage-FqfsxQ1j.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CqBeCPGH.js → EditConfigurationPage-Cn0e8t3I.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CqBeCPGH.js.map → EditConfigurationPage-Cn0e8t3I.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DbI4KMyz.mjs → EditConfigurationPage-DdPNAbl3.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-DbI4KMyz.mjs.map → EditConfigurationPage-DdPNAbl3.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-dFPBya9U.mjs → EditViewPage-B82x_x1b.mjs} +69 -48
- package/dist/_chunks/EditViewPage-B82x_x1b.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-ChgloMyO.js → EditViewPage-DlxEHhUt.js} +68 -47
- package/dist/_chunks/EditViewPage-DlxEHhUt.js.map +1 -0
- package/dist/_chunks/{Field-dLk-vgLL.js → Field-COL25JiC.js} +581 -229
- package/dist/_chunks/Field-COL25JiC.js.map +1 -0
- package/dist/_chunks/{Field-C1nUKcdS.mjs → Field-DufHXW17.mjs} +579 -227
- package/dist/_chunks/Field-DufHXW17.mjs.map +1 -0
- package/dist/_chunks/{Form-CbXtmHC_.js → Form-BssUwrTO.js} +52 -34
- package/dist/_chunks/Form-BssUwrTO.js.map +1 -0
- package/dist/_chunks/{Form-DOlpi7Js.mjs → Form-u_kAOhwB.mjs} +54 -36
- package/dist/_chunks/Form-u_kAOhwB.mjs.map +1 -0
- package/dist/_chunks/{History-BjDfohBr.js → History-C9t9UqpO.js} +158 -40
- package/dist/_chunks/History-C9t9UqpO.js.map +1 -0
- package/dist/_chunks/{History-BFNUAiGc.mjs → History-DRwA3oMM.mjs} +159 -41
- package/dist/_chunks/History-DRwA3oMM.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-IQBgWTaa.js → ListConfigurationPage-BXYPohh-.js} +57 -46
- package/dist/_chunks/ListConfigurationPage-BXYPohh-.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DDi0KqFm.mjs → ListConfigurationPage-BxfQJzPk.mjs} +58 -48
- package/dist/_chunks/ListConfigurationPage-BxfQJzPk.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-BPjljUsH.mjs → ListViewPage-CELx2ysp.mjs} +116 -103
- package/dist/_chunks/ListViewPage-CELx2ysp.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-CZYGqlvF.js → ListViewPage-D2VD8Szg.js} +117 -104
- package/dist/_chunks/ListViewPage-D2VD8Szg.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-BOAI6VZ1.js → NoContentTypePage-BV9IjJSM.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-BOAI6VZ1.js.map → NoContentTypePage-BV9IjJSM.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-DaWw67K-.mjs → NoContentTypePage-DtJ9jcfk.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DaWw67K-.mjs.map → NoContentTypePage-DtJ9jcfk.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CZrJH00p.mjs → NoPermissionsPage-DWleVYK7.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CZrJH00p.mjs.map → NoPermissionsPage-DWleVYK7.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-cYEtLc_e.js → NoPermissionsPage-Dp8NpF9I.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-cYEtLc_e.js.map → NoPermissionsPage-Dp8NpF9I.js.map} +1 -1
- package/dist/_chunks/{Relations-DTowyge2.mjs → Relations-BTcf5xaw.mjs} +34 -25
- package/dist/_chunks/Relations-BTcf5xaw.mjs.map +1 -0
- package/dist/_chunks/{Relations-DU6B7irU.js → Relations-DR7EUgyC.js} +34 -25
- package/dist/_chunks/Relations-DR7EUgyC.js.map +1 -0
- package/dist/_chunks/{en-DTULi5-d.js → en-Bm0D0IWz.js} +21 -15
- package/dist/_chunks/{en-DTULi5-d.js.map → en-Bm0D0IWz.js.map} +1 -1
- package/dist/_chunks/{en-GCOTL6jR.mjs → en-DKV44jRb.mjs} +21 -15
- package/dist/_chunks/{en-GCOTL6jR.mjs.map → en-DKV44jRb.mjs.map} +1 -1
- package/dist/_chunks/{index-CCJeB7Rw.js → index-BdMf2lfT.js} +1357 -747
- package/dist/_chunks/index-BdMf2lfT.js.map +1 -0
- package/dist/_chunks/{index-BaGHmIir.mjs → index-wnqzm4Q8.mjs} +1390 -780
- package/dist/_chunks/index-wnqzm4Q8.mjs.map +1 -0
- package/dist/_chunks/{layout-BinjszSQ.mjs → layout-2CfjL0T9.mjs} +41 -23
- package/dist/_chunks/layout-2CfjL0T9.mjs.map +1 -0
- package/dist/_chunks/{layout-ni_L9kT1.js → layout-B2MyZU-_.js} +39 -21
- package/dist/_chunks/layout-B2MyZU-_.js.map +1 -0
- package/dist/_chunks/{relations-CeJAJc5I.js → relations-BH7JJGGe.js} +2 -2
- package/dist/_chunks/{relations-CeJAJc5I.js.map → relations-BH7JJGGe.js.map} +1 -1
- package/dist/_chunks/{relations-c91ji5eR.mjs → relations-C0w0GcXi.mjs} +2 -2
- package/dist/_chunks/{relations-c91ji5eR.mjs.map → relations-C0w0GcXi.mjs.map} +1 -1
- package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +7 -6
- package/dist/admin/src/exports.d.ts +1 -1
- package/dist/admin/src/history/components/VersionInputRenderer.d.ts +1 -1
- package/dist/admin/src/history/index.d.ts +3 -0
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +32 -1
- package/dist/admin/src/hooks/useDocumentActions.d.ts +1 -1
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +8 -3
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +4 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +6 -58
- package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
- package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
- package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
- package/dist/admin/src/pages/ListView/components/BulkActions/PublishAction.d.ts +14 -0
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +3 -3
- package/dist/admin/src/services/documents.d.ts +19 -17
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/admin/src/utils/validation.d.ts +4 -1
- package/dist/server/index.js +218 -126
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +219 -127
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/single-types.d.ts.map +1 -1
- package/dist/server/src/controllers/uid.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
- package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +2 -1
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/permission-checker.d.ts.map +1 -1
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/dist/shared/contracts/collection-types.d.ts +3 -1
- package/dist/shared/contracts/collection-types.d.ts.map +1 -1
- package/package.json +12 -12
- package/dist/_chunks/EditViewPage-ChgloMyO.js.map +0 -1
- package/dist/_chunks/EditViewPage-dFPBya9U.mjs.map +0 -1
- package/dist/_chunks/Field-C1nUKcdS.mjs.map +0 -1
- package/dist/_chunks/Field-dLk-vgLL.js.map +0 -1
- package/dist/_chunks/Form-CbXtmHC_.js.map +0 -1
- package/dist/_chunks/Form-DOlpi7Js.mjs.map +0 -1
- package/dist/_chunks/History-BFNUAiGc.mjs.map +0 -1
- package/dist/_chunks/History-BjDfohBr.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DDi0KqFm.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-IQBgWTaa.js.map +0 -1
- package/dist/_chunks/ListViewPage-BPjljUsH.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-CZYGqlvF.js.map +0 -1
- package/dist/_chunks/Relations-DTowyge2.mjs.map +0 -1
- package/dist/_chunks/Relations-DU6B7irU.js.map +0 -1
- package/dist/_chunks/index-BaGHmIir.mjs.map +0 -1
- package/dist/_chunks/index-CCJeB7Rw.js.map +0 -1
- package/dist/_chunks/layout-BinjszSQ.mjs.map +0 -1
- package/dist/_chunks/layout-ni_L9kT1.js.map +0 -1
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
- package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
- package/strapi-server.js +0 -3
@@ -5,9 +5,9 @@ const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
5
5
|
const designSystem = require("@strapi/design-system");
|
6
6
|
const pipe$1 = require("lodash/fp/pipe");
|
7
7
|
const reactIntl = require("react-intl");
|
8
|
-
const index = require("./index-
|
8
|
+
const index = require("./index-BdMf2lfT.js");
|
9
9
|
const fractionalIndexing = require("fractional-indexing");
|
10
|
-
const Relations = require("./Relations-
|
10
|
+
const Relations = require("./Relations-DR7EUgyC.js");
|
11
11
|
const Icons = require("@strapi/icons");
|
12
12
|
const styledComponents = require("styled-components");
|
13
13
|
const ComponentIcon = require("./ComponentIcon-BXdiCGQp.js");
|
@@ -17,7 +17,7 @@ const objects = require("./objects-gigeqt7s.js");
|
|
17
17
|
const slate = require("slate");
|
18
18
|
const slateHistory = require("slate-history");
|
19
19
|
const slateReact = require("slate-react");
|
20
|
-
const
|
20
|
+
const useDebounce = require("./useDebounce-CtcjDB3L.js");
|
21
21
|
const Toolbar = require("@radix-ui/react-toolbar");
|
22
22
|
const reactRouterDom = require("react-router-dom");
|
23
23
|
const CodeMirror = require("codemirror5");
|
@@ -194,6 +194,220 @@ const useLazyComponents = (componentUids = []) => {
|
|
194
194
|
}, []);
|
195
195
|
return { isLazyLoading: loading, lazyComponentStore, cleanup };
|
196
196
|
};
|
197
|
+
const codeLanguages = [
|
198
|
+
{
|
199
|
+
value: "asm",
|
200
|
+
label: "Assembly"
|
201
|
+
},
|
202
|
+
{
|
203
|
+
value: "bash",
|
204
|
+
label: "Bash"
|
205
|
+
},
|
206
|
+
{
|
207
|
+
value: "c",
|
208
|
+
label: "C"
|
209
|
+
},
|
210
|
+
{
|
211
|
+
value: "clojure",
|
212
|
+
label: "Clojure"
|
213
|
+
},
|
214
|
+
{
|
215
|
+
value: "cobol",
|
216
|
+
label: "COBOL"
|
217
|
+
},
|
218
|
+
{
|
219
|
+
value: "cpp",
|
220
|
+
label: "C++"
|
221
|
+
},
|
222
|
+
{
|
223
|
+
value: "csharp",
|
224
|
+
label: "C#"
|
225
|
+
},
|
226
|
+
{
|
227
|
+
value: "css",
|
228
|
+
label: "CSS"
|
229
|
+
},
|
230
|
+
{
|
231
|
+
value: "dart",
|
232
|
+
label: "Dart"
|
233
|
+
},
|
234
|
+
{
|
235
|
+
value: "dockerfile",
|
236
|
+
label: "Dockerfile"
|
237
|
+
},
|
238
|
+
{
|
239
|
+
value: "elixir",
|
240
|
+
label: "Elixir"
|
241
|
+
},
|
242
|
+
{
|
243
|
+
value: "erlang",
|
244
|
+
label: "Erlang"
|
245
|
+
},
|
246
|
+
{
|
247
|
+
value: "fortran",
|
248
|
+
label: "Fortran"
|
249
|
+
},
|
250
|
+
{
|
251
|
+
value: "fsharp",
|
252
|
+
label: "F#"
|
253
|
+
},
|
254
|
+
{
|
255
|
+
value: "go",
|
256
|
+
label: "Go"
|
257
|
+
},
|
258
|
+
{
|
259
|
+
value: "graphql",
|
260
|
+
label: "GraphQL"
|
261
|
+
},
|
262
|
+
{
|
263
|
+
value: "groovy",
|
264
|
+
label: "Groovy"
|
265
|
+
},
|
266
|
+
{
|
267
|
+
value: "haskell",
|
268
|
+
label: "Haskell"
|
269
|
+
},
|
270
|
+
{
|
271
|
+
value: "haxe",
|
272
|
+
label: "Haxe"
|
273
|
+
},
|
274
|
+
{
|
275
|
+
value: "html",
|
276
|
+
label: "HTML"
|
277
|
+
},
|
278
|
+
{
|
279
|
+
value: "ini",
|
280
|
+
label: "INI"
|
281
|
+
},
|
282
|
+
{
|
283
|
+
value: "java",
|
284
|
+
label: "Java"
|
285
|
+
},
|
286
|
+
{
|
287
|
+
value: "javascript",
|
288
|
+
label: "JavaScript"
|
289
|
+
},
|
290
|
+
{
|
291
|
+
value: "jsx",
|
292
|
+
label: "JavaScript (React)"
|
293
|
+
},
|
294
|
+
{
|
295
|
+
value: "json",
|
296
|
+
label: "JSON"
|
297
|
+
},
|
298
|
+
{
|
299
|
+
value: "julia",
|
300
|
+
label: "Julia"
|
301
|
+
},
|
302
|
+
{
|
303
|
+
value: "kotlin",
|
304
|
+
label: "Kotlin"
|
305
|
+
},
|
306
|
+
{
|
307
|
+
value: "latex",
|
308
|
+
label: "LaTeX"
|
309
|
+
},
|
310
|
+
{
|
311
|
+
value: "lua",
|
312
|
+
label: "Lua"
|
313
|
+
},
|
314
|
+
{
|
315
|
+
value: "markdown",
|
316
|
+
label: "Markdown"
|
317
|
+
},
|
318
|
+
{
|
319
|
+
value: "matlab",
|
320
|
+
label: "MATLAB"
|
321
|
+
},
|
322
|
+
{
|
323
|
+
value: "makefile",
|
324
|
+
label: "Makefile"
|
325
|
+
},
|
326
|
+
{
|
327
|
+
value: "objectivec",
|
328
|
+
label: "Objective-C"
|
329
|
+
},
|
330
|
+
{
|
331
|
+
value: "perl",
|
332
|
+
label: "Perl"
|
333
|
+
},
|
334
|
+
{
|
335
|
+
value: "php",
|
336
|
+
label: "PHP"
|
337
|
+
},
|
338
|
+
{
|
339
|
+
value: "plaintext",
|
340
|
+
label: "Plain text"
|
341
|
+
},
|
342
|
+
{
|
343
|
+
value: "powershell",
|
344
|
+
label: "PowerShell"
|
345
|
+
},
|
346
|
+
{
|
347
|
+
value: "python",
|
348
|
+
label: "Python"
|
349
|
+
},
|
350
|
+
{
|
351
|
+
value: "r",
|
352
|
+
label: "R"
|
353
|
+
},
|
354
|
+
{
|
355
|
+
value: "ruby",
|
356
|
+
label: "Ruby"
|
357
|
+
},
|
358
|
+
{
|
359
|
+
value: "rust",
|
360
|
+
label: "Rust"
|
361
|
+
},
|
362
|
+
{
|
363
|
+
value: "sas",
|
364
|
+
label: "SAS"
|
365
|
+
},
|
366
|
+
{
|
367
|
+
value: "scala",
|
368
|
+
label: "Scala"
|
369
|
+
},
|
370
|
+
{
|
371
|
+
value: "scheme",
|
372
|
+
label: "Scheme"
|
373
|
+
},
|
374
|
+
{
|
375
|
+
value: "shell",
|
376
|
+
label: "Shell"
|
377
|
+
},
|
378
|
+
{
|
379
|
+
value: "sql",
|
380
|
+
label: "SQL"
|
381
|
+
},
|
382
|
+
{
|
383
|
+
value: "stata",
|
384
|
+
label: "Stata"
|
385
|
+
},
|
386
|
+
{
|
387
|
+
value: "swift",
|
388
|
+
label: "Swift"
|
389
|
+
},
|
390
|
+
{
|
391
|
+
value: "typescript",
|
392
|
+
label: "TypeScript"
|
393
|
+
},
|
394
|
+
{
|
395
|
+
value: "tsx",
|
396
|
+
label: "TypeScript (React)"
|
397
|
+
},
|
398
|
+
{
|
399
|
+
value: "vbnet",
|
400
|
+
label: "VB.NET"
|
401
|
+
},
|
402
|
+
{
|
403
|
+
value: "xml",
|
404
|
+
label: "XML"
|
405
|
+
},
|
406
|
+
{
|
407
|
+
value: "yaml",
|
408
|
+
label: "YAML"
|
409
|
+
}
|
410
|
+
];
|
197
411
|
const baseHandleConvert = (editor, attributesToSet) => {
|
198
412
|
const [_, lastNodePath] = slate.Editor.last(editor, []);
|
199
413
|
slate.Transforms.unwrapNodes(editor, {
|
@@ -264,6 +478,7 @@ const CodeBlock = styledComponents.styled.pre`
|
|
264
478
|
overflow: auto;
|
265
479
|
padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
|
266
480
|
flex-shrink: 1;
|
481
|
+
|
267
482
|
& > code {
|
268
483
|
font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,
|
269
484
|
monospace;
|
@@ -272,9 +487,61 @@ const CodeBlock = styledComponents.styled.pre`
|
|
272
487
|
max-width: 100%;
|
273
488
|
}
|
274
489
|
`;
|
490
|
+
const CodeEditor = (props) => {
|
491
|
+
const { editor } = useBlocksEditorContext("ImageDialog");
|
492
|
+
const editorIsFocused = slateReact.useFocused();
|
493
|
+
const imageIsSelected = slateReact.useSelected();
|
494
|
+
const { formatMessage } = reactIntl.useIntl();
|
495
|
+
const [isSelectOpen, setIsSelectOpen] = React__namespace.useState(false);
|
496
|
+
const shouldDisplayLanguageSelect = editorIsFocused && imageIsSelected || isSelectOpen;
|
497
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { position: "relative", width: "100%", children: [
|
498
|
+
/* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: props.children }) }),
|
499
|
+
shouldDisplayLanguageSelect && /* @__PURE__ */ jsxRuntime.jsx(
|
500
|
+
designSystem.Box,
|
501
|
+
{
|
502
|
+
position: "absolute",
|
503
|
+
background: "neutral0",
|
504
|
+
borderColor: "neutral150",
|
505
|
+
borderStyle: "solid",
|
506
|
+
borderWidth: "0.5px",
|
507
|
+
shadow: "tableShadow",
|
508
|
+
top: "100%",
|
509
|
+
marginTop: 1,
|
510
|
+
right: 0,
|
511
|
+
padding: 1,
|
512
|
+
hasRadius: true,
|
513
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
514
|
+
designSystem.SingleSelect,
|
515
|
+
{
|
516
|
+
onChange: (open) => {
|
517
|
+
slate.Transforms.setNodes(
|
518
|
+
editor,
|
519
|
+
{ language: open.toString() },
|
520
|
+
{ match: (node) => !slate.Editor.isEditor(node) && node.type === "code" }
|
521
|
+
);
|
522
|
+
},
|
523
|
+
value: props.element.type === "code" && props.element.language || "plaintext",
|
524
|
+
onOpenChange: (open) => {
|
525
|
+
setIsSelectOpen(open);
|
526
|
+
if (!open) {
|
527
|
+
slateReact.ReactEditor.focus(editor);
|
528
|
+
}
|
529
|
+
},
|
530
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
531
|
+
"aria-label": formatMessage({
|
532
|
+
id: "components.Blocks.blocks.code.languageLabel",
|
533
|
+
defaultMessage: "Select a language"
|
534
|
+
}),
|
535
|
+
children: codeLanguages.map(({ value, label }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value, children: label }, value))
|
536
|
+
}
|
537
|
+
)
|
538
|
+
}
|
539
|
+
)
|
540
|
+
] });
|
541
|
+
};
|
275
542
|
const codeBlocks = {
|
276
543
|
code: {
|
277
|
-
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
544
|
+
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(CodeEditor, { ...props }),
|
278
545
|
icon: Icons.Code,
|
279
546
|
label: {
|
280
547
|
id: "components.Blocks.blocks.code",
|
@@ -283,7 +550,7 @@ const codeBlocks = {
|
|
283
550
|
matchNode: (node) => node.type === "code",
|
284
551
|
isInBlocksSelector: true,
|
285
552
|
handleConvert(editor) {
|
286
|
-
baseHandleConvert(editor, { type: "code" });
|
553
|
+
baseHandleConvert(editor, { type: "code", language: "plaintext" });
|
287
554
|
},
|
288
555
|
handleEnterKey(editor) {
|
289
556
|
pressEnterTwiceToExit(editor);
|
@@ -501,7 +768,7 @@ const ImageDialog = () => {
|
|
501
768
|
const nodeImage = {
|
502
769
|
...expectedImage,
|
503
770
|
alternativeText: expectedImage.alternativeText || expectedImage.name,
|
504
|
-
url:
|
771
|
+
url: useDebounce.prefixFileUrlWithBackendUrl(image.url)
|
505
772
|
};
|
506
773
|
return nodeImage;
|
507
774
|
});
|
@@ -623,18 +890,12 @@ const LinkContent = React__namespace.forwardRef(
|
|
623
890
|
const [popoverOpen, setPopoverOpen] = React__namespace.useState(
|
624
891
|
editor.lastInsertedLinkPath ? slate.Path.equals(path, editor.lastInsertedLinkPath) : false
|
625
892
|
);
|
626
|
-
const linkRef = React__namespace.useRef(null);
|
627
893
|
const elementText = link.children.map((child) => child.text).join("");
|
628
894
|
const [linkText, setLinkText] = React__namespace.useState(elementText);
|
629
895
|
const [linkUrl, setLinkUrl] = React__namespace.useState(link.url);
|
630
896
|
const linkInputRef = React__namespace.useRef(null);
|
631
|
-
const
|
897
|
+
const isLastInsertedLink = editor.lastInsertedLinkPath ? !slate.Path.equals(path, editor.lastInsertedLinkPath) : true;
|
632
898
|
const [isSaveDisabled, setIsSaveDisabled] = React__namespace.useState(false);
|
633
|
-
const handleOpenEditPopover = (e) => {
|
634
|
-
e.preventDefault();
|
635
|
-
setPopoverOpen(true);
|
636
|
-
setShowRemoveButton(true);
|
637
|
-
};
|
638
899
|
const onLinkChange = (e) => {
|
639
900
|
setIsSaveDisabled(false);
|
640
901
|
setLinkUrl(e.target.value);
|
@@ -655,33 +916,33 @@ const LinkContent = React__namespace.forwardRef(
|
|
655
916
|
editLink(editor, { url: linkUrl, text: linkText });
|
656
917
|
setPopoverOpen(false);
|
657
918
|
editor.lastInsertedLinkPath = null;
|
919
|
+
slateReact.ReactEditor.focus(editor);
|
658
920
|
};
|
659
|
-
const
|
660
|
-
setPopoverOpen(false);
|
921
|
+
const handleClose = () => {
|
661
922
|
if (link.url === "") {
|
662
923
|
removeLink(editor);
|
663
924
|
}
|
925
|
+
setPopoverOpen(false);
|
664
926
|
slateReact.ReactEditor.focus(editor);
|
665
927
|
};
|
666
|
-
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
667
|
-
const composedRefs = designSystem.useComposedRefs(linkRef, forwardedRef);
|
668
928
|
React__namespace.useEffect(() => {
|
669
929
|
if (popoverOpen)
|
670
930
|
linkInputRef.current?.focus();
|
671
931
|
}, [popoverOpen]);
|
672
|
-
|
673
|
-
|
932
|
+
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
933
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { open: popoverOpen, children: [
|
934
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
674
935
|
StyledBaseLink,
|
675
936
|
{
|
676
937
|
...attributes,
|
677
|
-
ref:
|
938
|
+
ref: forwardedRef,
|
678
939
|
href: link.url,
|
679
|
-
onClick:
|
940
|
+
onClick: () => setPopoverOpen(true),
|
680
941
|
color: "primary600",
|
681
942
|
children
|
682
943
|
}
|
683
|
-
),
|
684
|
-
|
944
|
+
) }),
|
945
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Content, { onPointerDownOutside: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap: 4, children: [
|
685
946
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { width: "368px", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
686
947
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
687
948
|
id: "components.Blocks.popover.text",
|
@@ -727,7 +988,7 @@ const LinkContent = React__namespace.forwardRef(
|
|
727
988
|
{
|
728
989
|
variant: "danger-light",
|
729
990
|
onClick: () => removeLink(editor),
|
730
|
-
$visible:
|
991
|
+
$visible: isLastInsertedLink,
|
731
992
|
children: formatMessage({
|
732
993
|
id: "components.Blocks.popover.remove",
|
733
994
|
defaultMessage: "Remove"
|
@@ -735,11 +996,11 @@ const LinkContent = React__namespace.forwardRef(
|
|
735
996
|
}
|
736
997
|
),
|
737
998
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
738
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick:
|
999
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: handleClose, children: formatMessage({
|
739
1000
|
id: "components.Blocks.popover.cancel",
|
740
1001
|
defaultMessage: "Cancel"
|
741
1002
|
}) }),
|
742
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, {
|
1003
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { disabled: Boolean(inputNotDirty) || isSaveDisabled, onClick: handleSave, children: formatMessage({
|
743
1004
|
id: "components.Blocks.popover.save",
|
744
1005
|
defaultMessage: "Save"
|
745
1006
|
}) })
|
@@ -1180,7 +1441,7 @@ const ToolbarButton = ({
|
|
1180
1441
|
width: 7,
|
1181
1442
|
height: 7,
|
1182
1443
|
hasRadius: true,
|
1183
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, {
|
1444
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { fill: disabled ? "neutral300" : enabledColor })
|
1184
1445
|
}
|
1185
1446
|
)
|
1186
1447
|
}
|
@@ -1325,6 +1586,26 @@ const ListButton = ({ block, format }) => {
|
|
1325
1586
|
}
|
1326
1587
|
return false;
|
1327
1588
|
};
|
1589
|
+
const isListDisabled = () => {
|
1590
|
+
if (disabled) {
|
1591
|
+
return true;
|
1592
|
+
}
|
1593
|
+
if (!editor.selection) {
|
1594
|
+
return false;
|
1595
|
+
}
|
1596
|
+
const anchorNodeEntry = slate.Editor.above(editor, {
|
1597
|
+
at: editor.selection.anchor,
|
1598
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type !== "text"
|
1599
|
+
});
|
1600
|
+
const focusNodeEntry = slate.Editor.above(editor, {
|
1601
|
+
at: editor.selection.focus,
|
1602
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type !== "text"
|
1603
|
+
});
|
1604
|
+
if (!anchorNodeEntry || !focusNodeEntry) {
|
1605
|
+
return false;
|
1606
|
+
}
|
1607
|
+
return anchorNodeEntry[0] !== focusNodeEntry[0];
|
1608
|
+
};
|
1328
1609
|
const toggleList = (format2) => {
|
1329
1610
|
let currentListEntry;
|
1330
1611
|
if (editor.selection) {
|
@@ -1358,7 +1639,7 @@ const ListButton = ({ block, format }) => {
|
|
1358
1639
|
name: format,
|
1359
1640
|
label: block.label,
|
1360
1641
|
isActive: isListActive(),
|
1361
|
-
disabled,
|
1642
|
+
disabled: isListDisabled(),
|
1362
1643
|
handleClick: () => toggleList(format)
|
1363
1644
|
}
|
1364
1645
|
);
|
@@ -1502,6 +1783,7 @@ const DragItem = styledComponents.styled(designSystem.Flex)`
|
|
1502
1783
|
}
|
1503
1784
|
`;
|
1504
1785
|
const DragIconButton = styledComponents.styled(designSystem.IconButton)`
|
1786
|
+
user-select: none;
|
1505
1787
|
display: flex;
|
1506
1788
|
align-items: center;
|
1507
1789
|
justify-content: center;
|
@@ -1525,7 +1807,7 @@ const DragIconButton = styledComponents.styled(designSystem.IconButton)`
|
|
1525
1807
|
}
|
1526
1808
|
svg {
|
1527
1809
|
height: auto;
|
1528
|
-
width: ${({ theme }) => theme.spaces[3]};
|
1810
|
+
min-width: ${({ theme }) => theme.spaces[3]};
|
1529
1811
|
|
1530
1812
|
path {
|
1531
1813
|
fill: ${({ theme }) => theme.colors.neutral700};
|
@@ -1630,6 +1912,7 @@ const DragAndDropElement = ({
|
|
1630
1912
|
DragIconButton,
|
1631
1913
|
{
|
1632
1914
|
tag: "div",
|
1915
|
+
contentEditable: false,
|
1633
1916
|
role: "button",
|
1634
1917
|
tabIndex: 0,
|
1635
1918
|
withTooltip: false,
|
@@ -1642,7 +1925,7 @@ const DragAndDropElement = ({
|
|
1642
1925
|
disabled,
|
1643
1926
|
draggable: true,
|
1644
1927
|
$dragHandleTopMargin: dragHandleTopMargin,
|
1645
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, { color: "
|
1928
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Drag, { color: "primary500" })
|
1646
1929
|
}
|
1647
1930
|
),
|
1648
1931
|
children
|
@@ -1966,7 +2249,7 @@ const EditorLayout$1 = ({
|
|
1966
2249
|
/* @__PURE__ */ jsxRuntime.jsx(
|
1967
2250
|
CollapseIconButton,
|
1968
2251
|
{
|
1969
|
-
|
2252
|
+
label: formatMessage({
|
1970
2253
|
id: index.getTranslation("components.Blocks.collapse"),
|
1971
2254
|
defaultMessage: "Collapse"
|
1972
2255
|
}),
|
@@ -2305,7 +2588,7 @@ const BlocksEditor = React__namespace.forwardRef(
|
|
2305
2588
|
!isExpandedMode && /* @__PURE__ */ jsxRuntime.jsx(
|
2306
2589
|
ExpandIconButton,
|
2307
2590
|
{
|
2308
|
-
|
2591
|
+
label: formatMessage({
|
2309
2592
|
id: index.getTranslation("components.Blocks.expand"),
|
2310
2593
|
defaultMessage: "Expand"
|
2311
2594
|
}),
|
@@ -2371,30 +2654,27 @@ const createDefaultForm = (contentType, components = {}) => {
|
|
2371
2654
|
const Initializer = ({ disabled, name: name2, onClick }) => {
|
2372
2655
|
const { formatMessage } = reactIntl.useIntl();
|
2373
2656
|
const field = strapiAdmin.useField(name2);
|
2374
|
-
return /* @__PURE__ */ jsxRuntime.
|
2375
|
-
|
2376
|
-
|
2377
|
-
|
2378
|
-
|
2379
|
-
|
2380
|
-
|
2381
|
-
|
2382
|
-
|
2383
|
-
|
2384
|
-
|
2385
|
-
|
2386
|
-
|
2387
|
-
|
2388
|
-
|
2389
|
-
|
2390
|
-
|
2391
|
-
|
2392
|
-
|
2393
|
-
|
2394
|
-
|
2395
|
-
),
|
2396
|
-
field.error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "pi", children: field.error })
|
2397
|
-
] });
|
2657
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
2658
|
+
designSystem.Box,
|
2659
|
+
{
|
2660
|
+
tag: "button",
|
2661
|
+
background: "neutral100",
|
2662
|
+
borderColor: field.error ? "danger600" : "neutral200",
|
2663
|
+
hasRadius: true,
|
2664
|
+
disabled,
|
2665
|
+
onClick,
|
2666
|
+
paddingTop: 9,
|
2667
|
+
paddingBottom: 9,
|
2668
|
+
type: "button",
|
2669
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
|
2670
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(CircleIcon, {}) }),
|
2671
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "primary600", variant: "pi", fontWeight: "bold", children: formatMessage({
|
2672
|
+
id: index.getTranslation("components.empty-repeatable"),
|
2673
|
+
defaultMessage: "No entry yet. Click on the button below to add one."
|
2674
|
+
}) }) })
|
2675
|
+
] })
|
2676
|
+
}
|
2677
|
+
) });
|
2398
2678
|
};
|
2399
2679
|
const CircleIcon = styledComponents.styled(Icons.PlusCircle)`
|
2400
2680
|
width: 2.4rem;
|
@@ -2426,9 +2706,20 @@ const NonRepeatableComponent = ({
|
|
2426
2706
|
hasRadius: isNested,
|
2427
2707
|
borderColor: isNested ? "neutral200" : void 0,
|
2428
2708
|
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index2) => {
|
2429
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: row.map(({ size, ...field }) => {
|
2709
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2430
2710
|
const completeFieldName = `${name2}.${field.name}`;
|
2431
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
2711
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
2712
|
+
designSystem.Grid.Item,
|
2713
|
+
{
|
2714
|
+
col: size,
|
2715
|
+
s: 12,
|
2716
|
+
xs: 12,
|
2717
|
+
direction: "column",
|
2718
|
+
alignItems: "stretch",
|
2719
|
+
children: children({ ...field, name: completeFieldName })
|
2720
|
+
},
|
2721
|
+
completeFieldName
|
2722
|
+
);
|
2432
2723
|
}) }, index2);
|
2433
2724
|
}) })
|
2434
2725
|
}
|
@@ -2447,13 +2738,34 @@ const RepeatableComponent = ({
|
|
2447
2738
|
const { search: searchString } = reactRouterDom.useLocation();
|
2448
2739
|
const search = React__namespace.useMemo(() => new URLSearchParams(searchString), [searchString]);
|
2449
2740
|
const { components } = index.useDoc();
|
2450
|
-
const {
|
2741
|
+
const {
|
2742
|
+
value = [],
|
2743
|
+
error,
|
2744
|
+
rawError
|
2745
|
+
} = strapiAdmin.useField(name2);
|
2451
2746
|
const addFieldRow = strapiAdmin.useForm("RepeatableComponent", (state) => state.addFieldRow);
|
2452
2747
|
const moveFieldRow = strapiAdmin.useForm("RepeatableComponent", (state) => state.moveFieldRow);
|
2453
2748
|
const removeFieldRow = strapiAdmin.useForm("RepeatableComponent", (state) => state.removeFieldRow);
|
2454
2749
|
const { max = Infinity } = attribute;
|
2455
2750
|
const [collapseToOpen, setCollapseToOpen] = React__namespace.useState("");
|
2456
2751
|
const [liveText, setLiveText] = React__namespace.useState("");
|
2752
|
+
React__namespace.useEffect(() => {
|
2753
|
+
const hasNestedErrors = rawError && Array.isArray(rawError) && rawError.length > 0;
|
2754
|
+
const hasNestedValue = value && Array.isArray(value) && value.length > 0;
|
2755
|
+
if (hasNestedErrors && hasNestedValue) {
|
2756
|
+
const errorOpenItems = rawError.map((_, idx) => {
|
2757
|
+
return value[idx] ? value[idx].__temp_key__ : null;
|
2758
|
+
}).filter((value2) => !!value2);
|
2759
|
+
if (errorOpenItems && errorOpenItems.length > 0) {
|
2760
|
+
setCollapseToOpen((collapseToOpen2) => {
|
2761
|
+
if (!errorOpenItems.includes(collapseToOpen2)) {
|
2762
|
+
return errorOpenItems[0];
|
2763
|
+
}
|
2764
|
+
return collapseToOpen2;
|
2765
|
+
});
|
2766
|
+
}
|
2767
|
+
}
|
2768
|
+
}, [rawError, value]);
|
2457
2769
|
const componentTmpKeyWithFocussedField = React__namespace.useMemo(() => {
|
2458
2770
|
if (search.has("field")) {
|
2459
2771
|
const fieldParam = search.get("field");
|
@@ -2468,7 +2780,7 @@ const RepeatableComponent = ({
|
|
2468
2780
|
}
|
2469
2781
|
return void 0;
|
2470
2782
|
}, [search, name2, value]);
|
2471
|
-
const prevValue =
|
2783
|
+
const prevValue = useDebounce.usePrev(value);
|
2472
2784
|
React__namespace.useEffect(() => {
|
2473
2785
|
if (prevValue && prevValue.length < value.length) {
|
2474
2786
|
setCollapseToOpen(value[value.length - 1].__temp_key__);
|
@@ -2604,9 +2916,20 @@ const RepeatableComponent = ({
|
|
2604
2916
|
onGrabItem: handleGrabItem,
|
2605
2917
|
__temp_key__: key,
|
2606
2918
|
children: layout.map((row, index22) => {
|
2607
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: row.map(({ size, ...field }) => {
|
2919
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2608
2920
|
const completeFieldName = `${nameWithIndex}.${field.name}`;
|
2609
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
2921
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
2922
|
+
designSystem.Grid.Item,
|
2923
|
+
{
|
2924
|
+
col: size,
|
2925
|
+
s: 12,
|
2926
|
+
xs: 12,
|
2927
|
+
direction: "column",
|
2928
|
+
alignItems: "stretch",
|
2929
|
+
children: children({ ...field, name: completeFieldName })
|
2930
|
+
},
|
2931
|
+
completeFieldName
|
2932
|
+
);
|
2610
2933
|
}) }, index22);
|
2611
2934
|
})
|
2612
2935
|
}
|
@@ -2651,7 +2974,7 @@ const TextButtonCustom = styledComponents.styled(designSystem.TextButton)`
|
|
2651
2974
|
}
|
2652
2975
|
|
2653
2976
|
@media (prefers-reduced-motion: no-preference) {
|
2654
|
-
transition: background-color 120ms ${(props) => props.theme.easings.easeOutQuad};
|
2977
|
+
transition: background-color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
2655
2978
|
}
|
2656
2979
|
`;
|
2657
2980
|
const Component = ({
|
@@ -2701,7 +3024,7 @@ const Component = ({
|
|
2701
3024
|
/* @__PURE__ */ jsxRuntime.jsx(
|
2702
3025
|
designSystem.IconButton,
|
2703
3026
|
{
|
2704
|
-
|
3027
|
+
variant: "ghost",
|
2705
3028
|
onClick: onDeleteComponent,
|
2706
3029
|
label: formatMessage({
|
2707
3030
|
id: index.getTranslation("containers.Edit.delete"),
|
@@ -2714,7 +3037,7 @@ const Component = ({
|
|
2714
3037
|
designSystem.IconButton,
|
2715
3038
|
{
|
2716
3039
|
ref: composedAccordionRefs,
|
2717
|
-
|
3040
|
+
variant: "ghost",
|
2718
3041
|
onClick: (e) => e.stopPropagation(),
|
2719
3042
|
"data-handler-id": handlerId,
|
2720
3043
|
label: formatMessage({
|
@@ -2784,7 +3107,7 @@ const ComponentInput = ({
|
|
2784
3107
|
id: index.getTranslation("components.reset-entry"),
|
2785
3108
|
defaultMessage: "Reset Entry"
|
2786
3109
|
}),
|
2787
|
-
|
3110
|
+
variant: "ghost",
|
2788
3111
|
onClick: () => {
|
2789
3112
|
field.onChange(name2, null);
|
2790
3113
|
},
|
@@ -2813,11 +3136,8 @@ const AddComponentButton = ({
|
|
2813
3136
|
onClick,
|
2814
3137
|
disabled: isDisabled,
|
2815
3138
|
background: "neutral0",
|
2816
|
-
paddingTop: 3,
|
2817
|
-
paddingBottom: 3,
|
2818
|
-
paddingLeft: 4,
|
2819
|
-
paddingRight: 4,
|
2820
3139
|
style: { cursor: isDisabled ? "not-allowed" : "pointer" },
|
3140
|
+
variant: "tertiary",
|
2821
3141
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { tag: "span", gap: 2, children: [
|
2822
3142
|
/* @__PURE__ */ jsxRuntime.jsx(StyledAddIcon, { "aria-hidden": true, $isOpen: isOpen, $hasError: hasError && !isOpen }),
|
2823
3143
|
/* @__PURE__ */ jsxRuntime.jsx(
|
@@ -2846,10 +3166,11 @@ const StyledAddIcon = styledComponents.styled(Icons.PlusCircle)`
|
|
2846
3166
|
}
|
2847
3167
|
`;
|
2848
3168
|
const AddComponentTitle = styledComponents.styled(designSystem.Typography)``;
|
2849
|
-
const StyledButton = styledComponents.styled(designSystem.
|
3169
|
+
const StyledButton = styledComponents.styled(designSystem.Button)`
|
2850
3170
|
border-radius: 26px;
|
2851
3171
|
border-color: ${({ theme }) => theme.colors.neutral150};
|
2852
3172
|
box-shadow: ${({ theme }) => theme.shadows.filterShadow};
|
3173
|
+
height: 5rem;
|
2853
3174
|
|
2854
3175
|
&:hover {
|
2855
3176
|
${AddComponentTitle} {
|
@@ -2861,7 +3182,7 @@ const StyledButton = styledComponents.styled(designSystem.BaseButton)`
|
|
2861
3182
|
fill: ${({ theme }) => theme.colors.primary600};
|
2862
3183
|
}
|
2863
3184
|
> path {
|
2864
|
-
fill: ${({ theme }) => theme.colors.
|
3185
|
+
fill: ${({ theme }) => theme.colors.primary600};
|
2865
3186
|
}
|
2866
3187
|
}
|
2867
3188
|
}
|
@@ -2919,7 +3240,7 @@ const ComponentBox = styledComponents.styled(designSystem.Flex)`
|
|
2919
3240
|
cursor: pointer;
|
2920
3241
|
|
2921
3242
|
@media (prefers-reduced-motion: no-preference) {
|
2922
|
-
transition: color 120ms ${(props) => props.theme.easings.easeOutQuad};
|
3243
|
+
transition: color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
2923
3244
|
}
|
2924
3245
|
|
2925
3246
|
&:focus,
|
@@ -2992,18 +3313,6 @@ const NotAllowedInput = ({ hint, label, required, name: name2 }) => {
|
|
2992
3313
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
2993
3314
|
] });
|
2994
3315
|
};
|
2995
|
-
function useDebounce(value, delay) {
|
2996
|
-
const [debouncedValue, setDebouncedValue] = React.useState(value);
|
2997
|
-
React.useEffect(() => {
|
2998
|
-
const handler = setTimeout(() => {
|
2999
|
-
setDebouncedValue(value);
|
3000
|
-
}, delay);
|
3001
|
-
return () => {
|
3002
|
-
clearTimeout(handler);
|
3003
|
-
};
|
3004
|
-
}, [value, delay]);
|
3005
|
-
return debouncedValue;
|
3006
|
-
}
|
3007
3316
|
const uidApi = index.contentManagerApi.injectEndpoints({
|
3008
3317
|
endpoints: (builder) => ({
|
3009
3318
|
getDefaultUID: builder.query({
|
@@ -3038,7 +3347,10 @@ const uidApi = index.contentManagerApi.injectEndpoints({
|
|
3038
3347
|
config: {
|
3039
3348
|
params
|
3040
3349
|
}
|
3041
|
-
})
|
3350
|
+
}),
|
3351
|
+
providesTags: (_res, _error, params) => [
|
3352
|
+
{ type: "UidAvailability", id: params.contentTypeUID }
|
3353
|
+
]
|
3042
3354
|
})
|
3043
3355
|
})
|
3044
3356
|
});
|
@@ -3050,8 +3362,10 @@ const UIDInput = React__namespace.forwardRef(
|
|
3050
3362
|
const allFormValues = strapiAdmin.useForm("InputUID", (form) => form.values);
|
3051
3363
|
const [availability, setAvailability] = React__namespace.useState();
|
3052
3364
|
const [showRegenerate, setShowRegenerate] = React__namespace.useState(false);
|
3365
|
+
const isCloning = reactRouterDom.useMatch(index.CLONE_PATH) !== null;
|
3053
3366
|
const field = strapiAdmin.useField(name2);
|
3054
|
-
const debouncedValue = useDebounce(field.value, 300);
|
3367
|
+
const debouncedValue = useDebounce.useDebounce(field.value, 300);
|
3368
|
+
const hasChanged = debouncedValue !== field.initialValue;
|
3055
3369
|
const { toggleNotification } = strapiAdmin.useNotification();
|
3056
3370
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
3057
3371
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -3127,8 +3441,9 @@ const UIDInput = React__namespace.forwardRef(
|
|
3127
3441
|
params
|
3128
3442
|
},
|
3129
3443
|
{
|
3444
|
+
// Don't check availability if the value is empty or wasn't changed
|
3130
3445
|
skip: !Boolean(
|
3131
|
-
|
3446
|
+
(hasChanged || isCloning) && debouncedValue && UID_REGEX.test(debouncedValue.trim())
|
3132
3447
|
)
|
3133
3448
|
}
|
3134
3449
|
);
|
@@ -3157,6 +3472,7 @@ const UIDInput = React__namespace.forwardRef(
|
|
3157
3472
|
const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
|
3158
3473
|
const fieldRef = strapiAdmin.useFocusInputField(name2);
|
3159
3474
|
const composedRefs = designSystem.useComposedRefs(ref, fieldRef);
|
3475
|
+
const shouldShowAvailability = (hasChanged || isCloning) && debouncedValue != null && availability && !showRegenerate;
|
3160
3476
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { hint, name: name2, error: field.error, required, children: [
|
3161
3477
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
|
3162
3478
|
/* @__PURE__ */ jsxRuntime.jsx(
|
@@ -3165,7 +3481,7 @@ const UIDInput = React__namespace.forwardRef(
|
|
3165
3481
|
ref: composedRefs,
|
3166
3482
|
disabled: props.disabled,
|
3167
3483
|
endAction: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { position: "relative", gap: 1, children: [
|
3168
|
-
|
3484
|
+
shouldShowAvailability && /* @__PURE__ */ jsxRuntime.jsxs(
|
3169
3485
|
TextValidation,
|
3170
3486
|
{
|
3171
3487
|
alignItems: "center",
|
@@ -3999,7 +4315,7 @@ const EditorLayout = ({
|
|
3999
4315
|
justifyContent: "flex-end",
|
4000
4316
|
shrink: 0,
|
4001
4317
|
width: "100%",
|
4002
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton$1, { onClick: onCollapse, children: [
|
4318
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton$1, { onClick: onCollapse, variant: "tertiary", size: "M", children: [
|
4003
4319
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
4004
4320
|
id: "components.Wysiwyg.collapse",
|
4005
4321
|
defaultMessage: "Collapse"
|
@@ -4017,12 +4333,14 @@ const EditorLayout = ({
|
|
4017
4333
|
) }) });
|
4018
4334
|
}
|
4019
4335
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
4020
|
-
designSystem.
|
4336
|
+
designSystem.Flex,
|
4021
4337
|
{
|
4022
4338
|
borderColor: error ? "danger600" : "neutral200",
|
4023
4339
|
borderStyle: "solid",
|
4024
4340
|
borderWidth: "1px",
|
4025
4341
|
hasRadius: true,
|
4342
|
+
direction: "column",
|
4343
|
+
alignItems: "stretch",
|
4026
4344
|
children
|
4027
4345
|
}
|
4028
4346
|
);
|
@@ -4033,11 +4351,19 @@ const ExpandWrapper = styledComponents.styled(designSystem.Flex)`
|
|
4033
4351
|
const BoxWithBorder = styledComponents.styled(designSystem.Box)`
|
4034
4352
|
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
4035
4353
|
`;
|
4036
|
-
const ExpandButton$1 = styledComponents.styled(designSystem.
|
4354
|
+
const ExpandButton$1 = styledComponents.styled(designSystem.Button)`
|
4037
4355
|
background-color: transparent;
|
4038
4356
|
border: none;
|
4039
4357
|
align-items: center;
|
4040
4358
|
|
4359
|
+
& > span {
|
4360
|
+
display: flex;
|
4361
|
+
justify-content: space-between;
|
4362
|
+
align-items: center;
|
4363
|
+
width: 100%;
|
4364
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
4365
|
+
}
|
4366
|
+
|
4041
4367
|
svg {
|
4042
4368
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4043
4369
|
|
@@ -4304,42 +4630,28 @@ const quoteAndCodeHandler = (editor, markdownType) => {
|
|
4304
4630
|
insertWithoutTextToEdit(editor, markdownType, line, contentLength);
|
4305
4631
|
}
|
4306
4632
|
};
|
4307
|
-
const CustomIconButton = styledComponents.styled(designSystem.IconButton)`
|
4308
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
4309
|
-
/* Trick to prevent the outline from overflowing because of the general outline-offset */
|
4310
|
-
outline-offset: -2px !important;
|
4311
|
-
|
4312
|
-
svg {
|
4313
|
-
width: 1.8rem;
|
4314
|
-
height: 1.8rem;
|
4315
|
-
}
|
4316
|
-
`;
|
4317
|
-
const CustomLinkIconButton = styledComponents.styled(CustomIconButton)`
|
4318
|
-
svg {
|
4319
|
-
width: 0.8rem;
|
4320
|
-
height: 0.8rem;
|
4321
|
-
}
|
4322
|
-
`;
|
4323
4633
|
const MainButtons = styledComponents.styled(designSystem.IconButtonGroup)`
|
4324
4634
|
margin-left: ${({ theme }) => theme.spaces[4]};
|
4325
4635
|
`;
|
4326
4636
|
const MoreButton = styledComponents.styled(designSystem.IconButton)`
|
4327
4637
|
margin: ${({ theme }) => `0 ${theme.spaces[2]}`};
|
4328
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
4329
|
-
|
4330
|
-
svg {
|
4331
|
-
width: 1.8rem;
|
4332
|
-
height: 1.8rem;
|
4333
|
-
}
|
4334
4638
|
`;
|
4335
4639
|
const IconButtonGroupMargin = styledComponents.styled(designSystem.IconButtonGroup)`
|
4336
4640
|
margin-right: ${({ theme }) => `${theme.spaces[2]}`};
|
4337
4641
|
`;
|
4338
|
-
const ExpandButton = styledComponents.styled(designSystem.
|
4642
|
+
const ExpandButton = styledComponents.styled(designSystem.Button)`
|
4339
4643
|
background-color: transparent;
|
4340
4644
|
border: none;
|
4341
4645
|
align-items: center;
|
4342
4646
|
|
4647
|
+
& > span {
|
4648
|
+
display: flex;
|
4649
|
+
justify-content: space-between;
|
4650
|
+
align-items: center;
|
4651
|
+
width: 100%;
|
4652
|
+
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
4653
|
+
}
|
4654
|
+
|
4343
4655
|
svg {
|
4344
4656
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
4345
4657
|
path {
|
@@ -4351,8 +4663,8 @@ const ExpandButton = styledComponents.styled(designSystem.BaseButton)`
|
|
4351
4663
|
`;
|
4352
4664
|
const WysiwygFooter = ({ onToggleExpand }) => {
|
4353
4665
|
const { formatMessage } = reactIntl.useIntl();
|
4354
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 2, background: "neutral100", borderRadius: `0 0 0.4rem 0.4rem`, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", alignItems: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton, { id: "expand", onClick: onToggleExpand, children: [
|
4355
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
4666
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 2, background: "neutral100", borderRadius: `0 0 0.4rem 0.4rem`, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", alignItems: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandButton, { id: "expand", onClick: onToggleExpand, variant: "tertiary", size: "M", children: [
|
4667
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: formatMessage({
|
4356
4668
|
id: "components.WysiwygBottomControls.fullscreen",
|
4357
4669
|
defaultMessage: "Expand"
|
4358
4670
|
}) }),
|
@@ -4374,7 +4686,7 @@ const WysiwygNav = ({
|
|
4374
4686
|
id: "components.Wysiwyg.selectOptions.title",
|
4375
4687
|
defaultMessage: "Add a title"
|
4376
4688
|
});
|
4377
|
-
|
4689
|
+
React__namespace.useRef(null);
|
4378
4690
|
const handleTogglePopover = () => {
|
4379
4691
|
setVisiblePopover((prev) => !prev);
|
4380
4692
|
};
|
@@ -4388,18 +4700,27 @@ const WysiwygNav = ({
|
|
4388
4700
|
borderRadius: `0.4rem 0.4rem 0 0`,
|
4389
4701
|
children: [
|
4390
4702
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
|
4391
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
4392
|
-
|
4393
|
-
|
4394
|
-
|
4395
|
-
|
4396
|
-
|
4397
|
-
|
4398
|
-
|
4703
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
4704
|
+
designSystem.SingleSelect,
|
4705
|
+
{
|
4706
|
+
disabled: true,
|
4707
|
+
placeholder: selectPlaceholder,
|
4708
|
+
"aria-label": selectPlaceholder,
|
4709
|
+
size: "S",
|
4710
|
+
children: [
|
4711
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h1", children: "h1" }),
|
4712
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h2", children: "h2" }),
|
4713
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h3", children: "h3" }),
|
4714
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h4", children: "h4" }),
|
4715
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h5", children: "h5" }),
|
4716
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h6", children: "h6" })
|
4717
|
+
]
|
4718
|
+
}
|
4719
|
+
) }),
|
4399
4720
|
/* @__PURE__ */ jsxRuntime.jsxs(MainButtons, { children: [
|
4400
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
4401
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
4402
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
4721
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { disabled: true, label: "Bold", name: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Bold, {}) }),
|
4722
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { disabled: true, label: "Italic", name: "Italic", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Italic, {}) }),
|
4723
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { disabled: true, label: "Underline", name: "Underline", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Underline, {}) })
|
4403
4724
|
] }),
|
4404
4725
|
/* @__PURE__ */ jsxRuntime.jsx(MoreButton, { disabled: true, label: "More", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.More, {}) })
|
4405
4726
|
] }),
|
@@ -4426,6 +4747,7 @@ const WysiwygNav = ({
|
|
4426
4747
|
placeholder: selectPlaceholder,
|
4427
4748
|
"aria-label": selectPlaceholder,
|
4428
4749
|
onChange: (value) => onActionClick(value, editorRef),
|
4750
|
+
size: "S",
|
4429
4751
|
children: [
|
4430
4752
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h1", children: "h1" }),
|
4431
4753
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "h2", children: "h2" }),
|
@@ -4437,17 +4759,9 @@ const WysiwygNav = ({
|
|
4437
4759
|
}
|
4438
4760
|
) }),
|
4439
4761
|
/* @__PURE__ */ jsxRuntime.jsxs(MainButtons, { children: [
|
4762
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { onClick: () => onActionClick("Bold", editorRef), label: "Bold", name: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Bold, {}) }),
|
4440
4763
|
/* @__PURE__ */ jsxRuntime.jsx(
|
4441
|
-
|
4442
|
-
{
|
4443
|
-
onClick: () => onActionClick("Bold", editorRef),
|
4444
|
-
label: "Bold",
|
4445
|
-
name: "Bold",
|
4446
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Bold, {})
|
4447
|
-
}
|
4448
|
-
),
|
4449
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
4450
|
-
CustomIconButton,
|
4764
|
+
designSystem.IconButton,
|
4451
4765
|
{
|
4452
4766
|
onClick: () => onActionClick("Italic", editorRef),
|
4453
4767
|
label: "Italic",
|
@@ -4456,7 +4770,7 @@ const WysiwygNav = ({
|
|
4456
4770
|
}
|
4457
4771
|
),
|
4458
4772
|
/* @__PURE__ */ jsxRuntime.jsx(
|
4459
|
-
|
4773
|
+
designSystem.IconButton,
|
4460
4774
|
{
|
4461
4775
|
onClick: () => onActionClick("Underline", editorRef),
|
4462
4776
|
label: "Underline",
|
@@ -4465,79 +4779,81 @@ const WysiwygNav = ({
|
|
4465
4779
|
}
|
4466
4780
|
)
|
4467
4781
|
] }),
|
4468
|
-
/* @__PURE__ */ jsxRuntime.
|
4469
|
-
|
4470
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
4471
|
-
/* @__PURE__ */ jsxRuntime.
|
4472
|
-
|
4473
|
-
|
4474
|
-
|
4475
|
-
|
4476
|
-
|
4477
|
-
|
4478
|
-
|
4479
|
-
|
4480
|
-
|
4481
|
-
|
4482
|
-
|
4483
|
-
|
4484
|
-
|
4485
|
-
|
4486
|
-
|
4487
|
-
|
4488
|
-
|
4489
|
-
|
4490
|
-
|
4491
|
-
|
4492
|
-
|
4493
|
-
|
4494
|
-
|
4495
|
-
|
4496
|
-
|
4497
|
-
|
4498
|
-
|
4499
|
-
|
4500
|
-
/* @__PURE__ */ jsxRuntime.
|
4501
|
-
|
4502
|
-
|
4503
|
-
|
4504
|
-
|
4505
|
-
|
4506
|
-
|
4507
|
-
|
4508
|
-
|
4509
|
-
|
4510
|
-
|
4511
|
-
|
4512
|
-
|
4513
|
-
|
4514
|
-
|
4515
|
-
|
4516
|
-
|
4517
|
-
|
4518
|
-
|
4519
|
-
|
4520
|
-
|
4521
|
-
|
4522
|
-
|
4523
|
-
|
4524
|
-
|
4525
|
-
|
4526
|
-
|
4527
|
-
|
4528
|
-
|
4529
|
-
|
4530
|
-
|
4531
|
-
|
4532
|
-
|
4533
|
-
|
4534
|
-
|
4535
|
-
|
4536
|
-
|
4537
|
-
|
4538
|
-
|
4539
|
-
|
4540
|
-
|
4782
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { children: [
|
4783
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(MoreButton, { label: "More", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.More, {}) }) }),
|
4784
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 2, children: [
|
4785
|
+
/* @__PURE__ */ jsxRuntime.jsxs(IconButtonGroupMargin, { children: [
|
4786
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4787
|
+
designSystem.IconButton,
|
4788
|
+
{
|
4789
|
+
onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
|
4790
|
+
label: "Strikethrough",
|
4791
|
+
name: "Strikethrough",
|
4792
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.StrikeThrough, {})
|
4793
|
+
}
|
4794
|
+
),
|
4795
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4796
|
+
designSystem.IconButton,
|
4797
|
+
{
|
4798
|
+
onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
|
4799
|
+
label: "BulletList",
|
4800
|
+
name: "BulletList",
|
4801
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.BulletList, {})
|
4802
|
+
}
|
4803
|
+
),
|
4804
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4805
|
+
designSystem.IconButton,
|
4806
|
+
{
|
4807
|
+
onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
|
4808
|
+
label: "NumberList",
|
4809
|
+
name: "NumberList",
|
4810
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.NumberList, {})
|
4811
|
+
}
|
4812
|
+
)
|
4813
|
+
] }),
|
4814
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.IconButtonGroup, { children: [
|
4815
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4816
|
+
designSystem.IconButton,
|
4817
|
+
{
|
4818
|
+
onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
|
4819
|
+
label: "Code",
|
4820
|
+
name: "Code",
|
4821
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Code, {})
|
4822
|
+
}
|
4823
|
+
),
|
4824
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4825
|
+
designSystem.IconButton,
|
4826
|
+
{
|
4827
|
+
onClick: () => {
|
4828
|
+
handleTogglePopover();
|
4829
|
+
onToggleMediaLib();
|
4830
|
+
},
|
4831
|
+
label: "Image",
|
4832
|
+
name: "Image",
|
4833
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Image, {})
|
4834
|
+
}
|
4835
|
+
),
|
4836
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4837
|
+
designSystem.IconButton,
|
4838
|
+
{
|
4839
|
+
onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
|
4840
|
+
label: "Link",
|
4841
|
+
name: "Link",
|
4842
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Link, {})
|
4843
|
+
}
|
4844
|
+
),
|
4845
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
4846
|
+
designSystem.IconButton,
|
4847
|
+
{
|
4848
|
+
onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
|
4849
|
+
label: "Quote",
|
4850
|
+
name: "Quote",
|
4851
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Quotes, {})
|
4852
|
+
}
|
4853
|
+
)
|
4854
|
+
] })
|
4855
|
+
] }) })
|
4856
|
+
] })
|
4541
4857
|
] }),
|
4542
4858
|
onTogglePreviewMode && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
|
4543
4859
|
id: "components.Wysiwyg.ToggleMode.preview-mode",
|
@@ -4605,7 +4921,7 @@ const Wysiwyg = React__namespace.forwardRef(
|
|
4605
4921
|
const handleSelectAssets = (files) => {
|
4606
4922
|
const formattedFiles = files.map((f) => ({
|
4607
4923
|
alt: f.alternativeText || f.name,
|
4608
|
-
url:
|
4924
|
+
url: useDebounce.prefixFileUrlWithBackendUrl(f.url),
|
4609
4925
|
mime: f.mime
|
4610
4926
|
}));
|
4611
4927
|
insertFile(editorRef, formattedFiles);
|
@@ -4664,15 +4980,19 @@ const Wysiwyg = React__namespace.forwardRef(
|
|
4664
4980
|
);
|
4665
4981
|
const MemoizedWysiwyg = React__namespace.memo(Wysiwyg);
|
4666
4982
|
const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
4667
|
-
const { id } = index.useDoc();
|
4983
|
+
const { id, document: document2, collectionType } = index.useDoc();
|
4668
4984
|
const isFormDisabled = strapiAdmin.useForm("InputRenderer", (state) => state.disabled);
|
4669
4985
|
const isInDynamicZone = useDynamicZone("isInDynamicZone", (state) => state.isInDynamicZone);
|
4670
4986
|
const canCreateFields = index.useDocumentRBAC("InputRenderer", (rbac) => rbac.canCreateFields);
|
4671
4987
|
const canReadFields = index.useDocumentRBAC("InputRenderer", (rbac) => rbac.canReadFields);
|
4672
4988
|
const canUpdateFields = index.useDocumentRBAC("InputRenderer", (rbac) => rbac.canUpdateFields);
|
4673
4989
|
const canUserAction = index.useDocumentRBAC("InputRenderer", (rbac) => rbac.canUserAction);
|
4674
|
-
|
4675
|
-
|
4990
|
+
let idToCheck = id;
|
4991
|
+
if (collectionType === index.SINGLE_TYPES) {
|
4992
|
+
idToCheck = document2?.documentId;
|
4993
|
+
}
|
4994
|
+
const editableFields = idToCheck ? canUpdateFields : canCreateFields;
|
4995
|
+
const readableFields = idToCheck ? canReadFields : canCreateFields;
|
4676
4996
|
const canUserReadField = canUserAction(props.name, readableFields, props.type);
|
4677
4997
|
const canUserEditField = canUserAction(props.name, editableFields, props.type);
|
4678
4998
|
const fields = strapiAdmin.useStrapiApp("InputRenderer", (app) => app.fields);
|
@@ -4683,6 +5003,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4683
5003
|
const {
|
4684
5004
|
edit: { components }
|
4685
5005
|
} = index.useDocLayout();
|
5006
|
+
const field = strapiAdmin.useField(props.name);
|
4686
5007
|
if (!visible) {
|
4687
5008
|
return null;
|
4688
5009
|
}
|
@@ -4693,7 +5014,7 @@ const InputRenderer = ({ visible, hint: providedHint, ...props }) => {
|
|
4693
5014
|
if (attributeHasCustomFieldProperty(props.attribute)) {
|
4694
5015
|
const CustomInput = lazyComponentStore[props.attribute.customField];
|
4695
5016
|
if (CustomInput) {
|
4696
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CustomInput, { ...props, hint, disabled: fieldIsDisabled });
|
5017
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CustomInput, { ...props, ...field, hint, disabled: fieldIsDisabled });
|
4697
5018
|
}
|
4698
5019
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
4699
5020
|
strapiAdmin.InputRenderer,
|
@@ -4763,7 +5084,9 @@ const useFieldHint = (hint = void 0, attribute) => {
|
|
4763
5084
|
if (!maximum && !minimum) {
|
4764
5085
|
return hint;
|
4765
5086
|
}
|
4766
|
-
const units = !["biginteger", "integer", "number"].includes(
|
5087
|
+
const units = !["biginteger", "integer", "number", "dynamiczone", "component"].includes(
|
5088
|
+
attribute.type
|
5089
|
+
) ? formatMessage(
|
4767
5090
|
{
|
4768
5091
|
id: "content-manager.form.Input.hint.character.unit",
|
4769
5092
|
defaultMessage: "{maxValue, plural, one { character} other { characters}}"
|
@@ -4852,12 +5175,20 @@ const DynamicComponent = ({
|
|
4852
5175
|
React__namespace.useEffect(() => {
|
4853
5176
|
dragPreviewRef(reactDndHtml5Backend.getEmptyImage(), { captureDraggingState: false });
|
4854
5177
|
}, [dragPreviewRef, index$1]);
|
5178
|
+
const accordionValue = React__namespace.useId();
|
5179
|
+
const { value = [], rawError } = strapiAdmin.useField(`${name2}.${index$1}`);
|
5180
|
+
const [collapseToOpen, setCollapseToOpen] = React__namespace.useState("");
|
5181
|
+
React__namespace.useEffect(() => {
|
5182
|
+
if (rawError && value) {
|
5183
|
+
setCollapseToOpen(accordionValue);
|
5184
|
+
}
|
5185
|
+
}, [rawError, value, accordionValue]);
|
4855
5186
|
const composedBoxRefs = designSystem.useComposedRefs(boxRef, dropRef);
|
4856
5187
|
const accordionActions = disabled ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
4857
5188
|
/* @__PURE__ */ jsxRuntime.jsx(
|
4858
5189
|
designSystem.IconButton,
|
4859
5190
|
{
|
4860
|
-
|
5191
|
+
variant: "ghost",
|
4861
5192
|
label: formatMessage(
|
4862
5193
|
{
|
4863
5194
|
id: index.getTranslation("components.DynamicZone.delete-label"),
|
@@ -4872,7 +5203,7 @@ const DynamicComponent = ({
|
|
4872
5203
|
/* @__PURE__ */ jsxRuntime.jsx(
|
4873
5204
|
designSystem.IconButton,
|
4874
5205
|
{
|
4875
|
-
|
5206
|
+
variant: "ghost",
|
4876
5207
|
onClick: (e) => e.stopPropagation(),
|
4877
5208
|
"data-handler-id": handlerId,
|
4878
5209
|
ref: dragRef,
|
@@ -4917,10 +5248,9 @@ const DynamicComponent = ({
|
|
4917
5248
|
] })
|
4918
5249
|
] });
|
4919
5250
|
const accordionTitle = title ? `${displayName} ${title}` : displayName;
|
4920
|
-
const accordionValue = React__namespace.useId();
|
4921
5251
|
return /* @__PURE__ */ jsxRuntime.jsxs(ComponentContainer, { tag: "li", width: "100%", children: [
|
4922
5252
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Rectangle, { background: "neutral200" }) }),
|
4923
|
-
/* @__PURE__ */ jsxRuntime.jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsxRuntime.jsx(Preview, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: accordionValue, children: [
|
5253
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledBox, { ref: composedBoxRefs, hasRadius: true, children: isDragging ? /* @__PURE__ */ jsxRuntime.jsx(Preview, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Root, { value: collapseToOpen, onValueChange: setCollapseToOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: accordionValue, children: [
|
4924
5254
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Header, { children: [
|
4925
5255
|
/* @__PURE__ */ jsxRuntime.jsx(
|
4926
5256
|
designSystem.Accordion.Trigger,
|
@@ -4931,10 +5261,32 @@ const DynamicComponent = ({
|
|
4931
5261
|
),
|
4932
5262
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Actions, { children: accordionActions })
|
4933
5263
|
] }),
|
4934
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children:
|
4935
|
-
|
4936
|
-
|
4937
|
-
|
5264
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsxRuntime.jsx(
|
5265
|
+
designSystem.Grid.Item,
|
5266
|
+
{
|
5267
|
+
col: 12,
|
5268
|
+
s: 12,
|
5269
|
+
xs: 12,
|
5270
|
+
direction: "column",
|
5271
|
+
alignItems: "stretch",
|
5272
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
5273
|
+
const fieldName = `${name2}.${index$1}.${field.name}`;
|
5274
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
5275
|
+
designSystem.Grid.Item,
|
5276
|
+
{
|
5277
|
+
col: size,
|
5278
|
+
s: 12,
|
5279
|
+
xs: 12,
|
5280
|
+
direction: "column",
|
5281
|
+
alignItems: "stretch",
|
5282
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(MemoizedInputRenderer, { ...field, name: fieldName })
|
5283
|
+
},
|
5284
|
+
fieldName
|
5285
|
+
);
|
5286
|
+
}) })
|
5287
|
+
},
|
5288
|
+
rowInd
|
5289
|
+
)) }) }) }) })
|
4938
5290
|
] }) }) })
|
4939
5291
|
] });
|
4940
5292
|
};
|
@@ -5126,7 +5478,7 @@ const DynamicZone = ({
|
|
5126
5478
|
const handleRemoveComponent = (name22, currentIndex) => () => {
|
5127
5479
|
removeFieldRow(name22, currentIndex);
|
5128
5480
|
};
|
5129
|
-
const hasError = error !== void 0
|
5481
|
+
const hasError = error !== void 0;
|
5130
5482
|
const renderButtonLabel = () => {
|
5131
5483
|
if (addComponentIsOpen) {
|
5132
5484
|
return formatMessage({ id: "app.utils.close-label", defaultMessage: "Close" });
|
@@ -5240,4 +5592,4 @@ exports.transformDocument = transformDocument;
|
|
5240
5592
|
exports.useDynamicZone = useDynamicZone;
|
5241
5593
|
exports.useFieldHint = useFieldHint;
|
5242
5594
|
exports.useLazyComponents = useLazyComponents;
|
5243
|
-
//# sourceMappingURL=Field-
|
5595
|
+
//# sourceMappingURL=Field-COL25JiC.js.map
|