@strapi/content-manager 0.0.0-experimental.59ce88771272039a9d868fba2f7b503edf715c6a → 0.0.0-experimental.5b211b38912691ee2eab22d47b5095ea2fcfec76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js → ComponentConfigurationPage-C-49MccQ.js} +3 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js.map → ComponentConfigurationPage-C-49MccQ.js.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-gdUj_t-O.mjs → ComponentConfigurationPage-DmwmiFQy.mjs} +3 -3
  4. package/dist/_chunks/{ComponentConfigurationPage-gdUj_t-O.mjs.map → ComponentConfigurationPage-DmwmiFQy.mjs.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js → EditConfigurationPage-DjFJw56M.js} +3 -3
  6. package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js.map → EditConfigurationPage-DjFJw56M.js.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs → EditConfigurationPage-JT3E7NZy.mjs} +3 -3
  8. package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs.map → EditConfigurationPage-JT3E7NZy.mjs.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-0MiFkXa8.mjs → EditViewPage-CPj61RMh.mjs} +3 -3
  10. package/dist/_chunks/{EditViewPage-0MiFkXa8.mjs.map → EditViewPage-CPj61RMh.mjs.map} +1 -1
  11. package/dist/_chunks/{EditViewPage-DbcGfyqK.js → EditViewPage-zT3fBr4Y.js} +3 -3
  12. package/dist/_chunks/{EditViewPage-DbcGfyqK.js.map → EditViewPage-zT3fBr4Y.js.map} +1 -1
  13. package/dist/_chunks/{Field-BG1xu38N.js → Field-Boxf9Ajp.js} +272 -5
  14. package/dist/_chunks/Field-Boxf9Ajp.js.map +1 -0
  15. package/dist/_chunks/{Field-BDMSCcy5.mjs → Field-dha5VnIQ.mjs} +273 -6
  16. package/dist/_chunks/Field-dha5VnIQ.mjs.map +1 -0
  17. package/dist/_chunks/{Form-CPVWavB8.mjs → Form-DHrru2AV.mjs} +6 -3
  18. package/dist/_chunks/Form-DHrru2AV.mjs.map +1 -0
  19. package/dist/_chunks/{Form-9BnFyUjy.js → Form-y5g1SRsh.js} +6 -3
  20. package/dist/_chunks/Form-y5g1SRsh.js.map +1 -0
  21. package/dist/_chunks/{History-BVpd8LP3.mjs → History-Bru_KoeP.mjs} +4 -4
  22. package/dist/_chunks/{History-BVpd8LP3.mjs.map → History-Bru_KoeP.mjs.map} +1 -1
  23. package/dist/_chunks/{History-BWWxLt2Z.js → History-CqN6K7SX.js} +4 -4
  24. package/dist/_chunks/{History-BWWxLt2Z.js.map → History-CqN6K7SX.js.map} +1 -1
  25. package/dist/_chunks/{ListConfigurationPage-DozVMKcR.mjs → ListConfigurationPage-D8wGABj0.mjs} +2 -2
  26. package/dist/_chunks/{ListConfigurationPage-DozVMKcR.mjs.map → ListConfigurationPage-D8wGABj0.mjs.map} +1 -1
  27. package/dist/_chunks/{ListConfigurationPage-6swzjdAZ.js → ListConfigurationPage-R_p-SbHZ.js} +2 -2
  28. package/dist/_chunks/{ListConfigurationPage-6swzjdAZ.js.map → ListConfigurationPage-R_p-SbHZ.js.map} +1 -1
  29. package/dist/_chunks/{ListViewPage-Ds0ulgfG.mjs → ListViewPage-SID6TRb9.mjs} +3 -3
  30. package/dist/_chunks/{ListViewPage-Ds0ulgfG.mjs.map → ListViewPage-SID6TRb9.mjs.map} +1 -1
  31. package/dist/_chunks/{ListViewPage-BlzfjS2Q.js → ListViewPage-pEw_zug9.js} +3 -3
  32. package/dist/_chunks/{ListViewPage-BlzfjS2Q.js.map → ListViewPage-pEw_zug9.js.map} +1 -1
  33. package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js → NoContentTypePage-C5dcQojD.js} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js.map → NoContentTypePage-C5dcQojD.js.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs → NoContentTypePage-CJ7UXwrQ.mjs} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs.map → NoContentTypePage-CJ7UXwrQ.mjs.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs → NoPermissionsPage-B7syEq5E.mjs} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs.map → NoPermissionsPage-B7syEq5E.mjs.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js → NoPermissionsPage-BtPrImPP.js} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js.map → NoPermissionsPage-BtPrImPP.js.map} +1 -1
  41. package/dist/_chunks/{Relations-Dnag3fhV.mjs → Relations-B9Crnhnn.mjs} +3 -3
  42. package/dist/_chunks/{Relations-Dnag3fhV.mjs.map → Relations-B9Crnhnn.mjs.map} +1 -1
  43. package/dist/_chunks/{Relations-CcgFTcWo.js → Relations-DjTQ5kGB.js} +3 -3
  44. package/dist/_chunks/{Relations-CcgFTcWo.js.map → Relations-DjTQ5kGB.js.map} +1 -1
  45. package/dist/_chunks/{index-JNNNKUHs.mjs → index-DJXJw9V5.mjs} +46 -25
  46. package/dist/_chunks/index-DJXJw9V5.mjs.map +1 -0
  47. package/dist/_chunks/{index-CWpLBSt0.js → index-DVPWZkbS.js} +33 -12
  48. package/dist/_chunks/index-DVPWZkbS.js.map +1 -0
  49. package/dist/_chunks/{layout-DC503LnF.mjs → layout-Bau7ZfLV.mjs} +5 -5
  50. package/dist/_chunks/{layout-DC503LnF.mjs.map → layout-Bau7ZfLV.mjs.map} +1 -1
  51. package/dist/_chunks/{layout--iHdZzRk.js → layout-Dm6fbiQj.js} +4 -4
  52. package/dist/_chunks/{layout--iHdZzRk.js.map → layout-Dm6fbiQj.js.map} +1 -1
  53. package/dist/_chunks/{relations-CTje5t-a.mjs → relations-BH_kBSJ0.mjs} +2 -2
  54. package/dist/_chunks/{relations-CTje5t-a.mjs.map → relations-BH_kBSJ0.mjs.map} +1 -1
  55. package/dist/_chunks/{relations-BbHizA5K.js → relations-CKnpRgrN.js} +2 -2
  56. package/dist/_chunks/{relations-BbHizA5K.js.map → relations-CKnpRgrN.js.map} +1 -1
  57. package/dist/admin/index.js +1 -1
  58. package/dist/admin/index.mjs +4 -4
  59. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +4 -0
  60. package/dist/server/index.js +4 -6
  61. package/dist/server/index.js.map +1 -1
  62. package/dist/server/index.mjs +4 -6
  63. package/dist/server/index.mjs.map +1 -1
  64. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  65. package/package.json +6 -6
  66. package/dist/_chunks/Field-BDMSCcy5.mjs.map +0 -1
  67. package/dist/_chunks/Field-BG1xu38N.js.map +0 -1
  68. package/dist/_chunks/Form-9BnFyUjy.js.map +0 -1
  69. package/dist/_chunks/Form-CPVWavB8.mjs.map +0 -1
  70. package/dist/_chunks/index-CWpLBSt0.js.map +0 -1
  71. package/dist/_chunks/index-JNNNKUHs.mjs.map +0 -1
@@ -2,12 +2,12 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { useState, useEffect, useCallback, memo } from "react";
4
4
  import { useStrapiApp, createContext, useField, useNotification, useForm, useAPIErrorHandler, useQueryParams, useFocusInputField, InputRenderer as InputRenderer$1 } from "@strapi/admin/strapi-admin";
5
- import { Typography, Flex, Box, BaseLink, Button, Popover, Field, Tooltip, SingleSelect, SingleSelectOption, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton, BaseButton, TextInput, IconButtonGroup, Menu, MenuItem } from "@strapi/design-system";
5
+ import { Box, SingleSelect, SingleSelectOption, Typography, Flex, BaseLink, Button, Popover, Field, Tooltip, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton, BaseButton, TextInput, IconButtonGroup, Menu, MenuItem } from "@strapi/design-system";
6
6
  import pipe$1 from "lodash/fp/pipe";
7
7
  import { useIntl } from "react-intl";
8
- import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, d as buildValidParams, f as useDocumentRBAC, n as useDocLayout } from "./index-JNNNKUHs.mjs";
8
+ import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, d as buildValidParams, f as useDocumentRBAC, n as useDocLayout } from "./index-DJXJw9V5.mjs";
9
9
  import { generateNKeysBetween } from "fractional-indexing";
10
- import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-Dnag3fhV.mjs";
10
+ import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-B9Crnhnn.mjs";
11
11
  import { Code, HeadingOne, HeadingTwo, HeadingThree, HeadingFour, HeadingFive, HeadingSix, Image as Image$1, NumberList, BulletList, Paragraph, Quotes, Link as Link$1, Drag, Collapse, Bold, Italic, Underline, StrikeThrough, Expand, PlusCircle, Plus, Trash, EyeStriked, CheckCircle, WarningCircle, Loader, ArrowClockwise, More } from "@strapi/icons";
12
12
  import { styled, css, keyframes } from "styled-components";
13
13
  import { C as ComponentIcon, a as COMPONENT_ICONS } from "./ComponentIcon-u4bIXTFY.mjs";
@@ -160,6 +160,220 @@ const useLazyComponents = (componentUids = []) => {
160
160
  }, []);
161
161
  return { isLazyLoading: loading, lazyComponentStore, cleanup };
162
162
  };
163
+ const codeLanguages = [
164
+ {
165
+ value: "asm",
166
+ label: "Assembly"
167
+ },
168
+ {
169
+ value: "bash",
170
+ label: "Bash"
171
+ },
172
+ {
173
+ value: "c",
174
+ label: "C"
175
+ },
176
+ {
177
+ value: "clojure",
178
+ label: "Clojure"
179
+ },
180
+ {
181
+ value: "cobol",
182
+ label: "COBOL"
183
+ },
184
+ {
185
+ value: "cpp",
186
+ label: "C++"
187
+ },
188
+ {
189
+ value: "csharp",
190
+ label: "C#"
191
+ },
192
+ {
193
+ value: "css",
194
+ label: "CSS"
195
+ },
196
+ {
197
+ value: "dart",
198
+ label: "Dart"
199
+ },
200
+ {
201
+ value: "dockerfile",
202
+ label: "Dockerfile"
203
+ },
204
+ {
205
+ value: "elixir",
206
+ label: "Elixir"
207
+ },
208
+ {
209
+ value: "erlang",
210
+ label: "Erlang"
211
+ },
212
+ {
213
+ value: "fortran",
214
+ label: "Fortran"
215
+ },
216
+ {
217
+ value: "fsharp",
218
+ label: "F#"
219
+ },
220
+ {
221
+ value: "go",
222
+ label: "Go"
223
+ },
224
+ {
225
+ value: "graphql",
226
+ label: "GraphQL"
227
+ },
228
+ {
229
+ value: "groovy",
230
+ label: "Groovy"
231
+ },
232
+ {
233
+ value: "haskell",
234
+ label: "Haskell"
235
+ },
236
+ {
237
+ value: "haxe",
238
+ label: "Haxe"
239
+ },
240
+ {
241
+ value: "html",
242
+ label: "HTML"
243
+ },
244
+ {
245
+ value: "ini",
246
+ label: "INI"
247
+ },
248
+ {
249
+ value: "java",
250
+ label: "Java"
251
+ },
252
+ {
253
+ value: "javascript",
254
+ label: "JavaScript"
255
+ },
256
+ {
257
+ value: "jsx",
258
+ label: "JavaScript (React)"
259
+ },
260
+ {
261
+ value: "json",
262
+ label: "JSON"
263
+ },
264
+ {
265
+ value: "julia",
266
+ label: "Julia"
267
+ },
268
+ {
269
+ value: "kotlin",
270
+ label: "Kotlin"
271
+ },
272
+ {
273
+ value: "latex",
274
+ label: "LaTeX"
275
+ },
276
+ {
277
+ value: "lua",
278
+ label: "Lua"
279
+ },
280
+ {
281
+ value: "markdown",
282
+ label: "Markdown"
283
+ },
284
+ {
285
+ value: "matlab",
286
+ label: "MATLAB"
287
+ },
288
+ {
289
+ value: "makefile",
290
+ label: "Makefile"
291
+ },
292
+ {
293
+ value: "objectivec",
294
+ label: "Objective-C"
295
+ },
296
+ {
297
+ value: "perl",
298
+ label: "Perl"
299
+ },
300
+ {
301
+ value: "php",
302
+ label: "PHP"
303
+ },
304
+ {
305
+ value: "plaintext",
306
+ label: "Plain text"
307
+ },
308
+ {
309
+ value: "powershell",
310
+ label: "PowerShell"
311
+ },
312
+ {
313
+ value: "python",
314
+ label: "Python"
315
+ },
316
+ {
317
+ value: "r",
318
+ label: "R"
319
+ },
320
+ {
321
+ value: "ruby",
322
+ label: "Ruby"
323
+ },
324
+ {
325
+ value: "rust",
326
+ label: "Rust"
327
+ },
328
+ {
329
+ value: "sas",
330
+ label: "SAS"
331
+ },
332
+ {
333
+ value: "scala",
334
+ label: "Scala"
335
+ },
336
+ {
337
+ value: "scheme",
338
+ label: "Scheme"
339
+ },
340
+ {
341
+ value: "shell",
342
+ label: "Shell"
343
+ },
344
+ {
345
+ value: "sql",
346
+ label: "SQL"
347
+ },
348
+ {
349
+ value: "stata",
350
+ label: "Stata"
351
+ },
352
+ {
353
+ value: "swift",
354
+ label: "Swift"
355
+ },
356
+ {
357
+ value: "typescript",
358
+ label: "TypeScript"
359
+ },
360
+ {
361
+ value: "tsx",
362
+ label: "TypeScript (React)"
363
+ },
364
+ {
365
+ value: "vbnet",
366
+ label: "VB.NET"
367
+ },
368
+ {
369
+ value: "xml",
370
+ label: "XML"
371
+ },
372
+ {
373
+ value: "yaml",
374
+ label: "YAML"
375
+ }
376
+ ];
163
377
  const baseHandleConvert = (editor, attributesToSet) => {
164
378
  const [_, lastNodePath] = Editor$1.last(editor, []);
165
379
  Transforms.unwrapNodes(editor, {
@@ -230,6 +444,7 @@ const CodeBlock = styled.pre`
230
444
  overflow: auto;
231
445
  padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
232
446
  flex-shrink: 1;
447
+
233
448
  & > code {
234
449
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,
235
450
  monospace;
@@ -238,9 +453,61 @@ const CodeBlock = styled.pre`
238
453
  max-width: 100%;
239
454
  }
240
455
  `;
456
+ const CodeEditor = (props) => {
457
+ const { editor } = useBlocksEditorContext("ImageDialog");
458
+ const editorIsFocused = useFocused();
459
+ const imageIsSelected = useSelected();
460
+ const { formatMessage } = useIntl();
461
+ const [isSelectOpen, setIsSelectOpen] = React.useState(false);
462
+ const shouldDisplayLanguageSelect = editorIsFocused && imageIsSelected || isSelectOpen;
463
+ return /* @__PURE__ */ jsxs(Box, { position: "relative", width: "100%", children: [
464
+ /* @__PURE__ */ jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsx("code", { children: props.children }) }),
465
+ shouldDisplayLanguageSelect && /* @__PURE__ */ jsx(
466
+ Box,
467
+ {
468
+ position: "absolute",
469
+ background: "neutral0",
470
+ borderColor: "neutral150",
471
+ borderStyle: "solid",
472
+ borderWidth: "0.5px",
473
+ shadow: "tableShadow",
474
+ top: "100%",
475
+ marginTop: 1,
476
+ right: 0,
477
+ padding: 1,
478
+ hasRadius: true,
479
+ children: /* @__PURE__ */ jsx(
480
+ SingleSelect,
481
+ {
482
+ onChange: (open) => {
483
+ Transforms.setNodes(
484
+ editor,
485
+ { language: open.toString() },
486
+ { match: (node) => !Editor$1.isEditor(node) && node.type === "code" }
487
+ );
488
+ },
489
+ value: props.element.type === "code" && props.element.language || "plaintext",
490
+ onOpenChange: (open) => {
491
+ setIsSelectOpen(open);
492
+ if (!open) {
493
+ ReactEditor.focus(editor);
494
+ }
495
+ },
496
+ onCloseAutoFocus: (e) => e.preventDefault(),
497
+ "aria-label": formatMessage({
498
+ id: "components.Blocks.blocks.code.languageLabel",
499
+ defaultMessage: "Select a language"
500
+ }),
501
+ children: codeLanguages.map(({ value, label }) => /* @__PURE__ */ jsx(SingleSelectOption, { value, children: label }, value))
502
+ }
503
+ )
504
+ }
505
+ )
506
+ ] });
507
+ };
241
508
  const codeBlocks = {
242
509
  code: {
243
- renderElement: (props) => /* @__PURE__ */ jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsx("code", { children: props.children }) }),
510
+ renderElement: (props) => /* @__PURE__ */ jsx(CodeEditor, { ...props }),
244
511
  icon: Code,
245
512
  label: {
246
513
  id: "components.Blocks.blocks.code",
@@ -249,7 +516,7 @@ const codeBlocks = {
249
516
  matchNode: (node) => node.type === "code",
250
517
  isInBlocksSelector: true,
251
518
  handleConvert(editor) {
252
- baseHandleConvert(editor, { type: "code" });
519
+ baseHandleConvert(editor, { type: "code", language: "plaintext" });
253
520
  },
254
521
  handleEnterKey(editor) {
255
522
  pressEnterTwiceToExit(editor);
@@ -5196,4 +5463,4 @@ export {
5196
5463
  transformDocument as t,
5197
5464
  useLazyComponents as u
5198
5465
  };
5199
- //# sourceMappingURL=Field-BDMSCcy5.mjs.map
5466
+ //# sourceMappingURL=Field-dha5VnIQ.mjs.map