@strapi/content-manager 5.34.0 → 5.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/admin/components/ActionsDrawer.js +208 -0
  2. package/dist/admin/components/ActionsDrawer.js.map +1 -0
  3. package/dist/admin/components/ActionsDrawer.mjs +186 -0
  4. package/dist/admin/components/ActionsDrawer.mjs.map +1 -0
  5. package/dist/admin/components/LeftMenu.js +1 -28
  6. package/dist/admin/components/LeftMenu.js.map +1 -1
  7. package/dist/admin/components/LeftMenu.mjs +2 -29
  8. package/dist/admin/components/LeftMenu.mjs.map +1 -1
  9. package/dist/admin/history/components/VersionContent.js +96 -68
  10. package/dist/admin/history/components/VersionContent.js.map +1 -1
  11. package/dist/admin/history/components/VersionContent.mjs +98 -70
  12. package/dist/admin/history/components/VersionContent.mjs.map +1 -1
  13. package/dist/admin/history/components/VersionsList.js +139 -54
  14. package/dist/admin/history/components/VersionsList.js.map +1 -1
  15. package/dist/admin/history/components/VersionsList.mjs +141 -56
  16. package/dist/admin/history/components/VersionsList.mjs.map +1 -1
  17. package/dist/admin/history/pages/History.js +27 -9
  18. package/dist/admin/history/pages/History.js.map +1 -1
  19. package/dist/admin/history/pages/History.mjs +28 -10
  20. package/dist/admin/history/pages/History.mjs.map +1 -1
  21. package/dist/admin/hooks/useDocument.js +1 -1
  22. package/dist/admin/hooks/useDocument.js.map +1 -1
  23. package/dist/admin/hooks/useDocument.mjs +1 -1
  24. package/dist/admin/hooks/useDocument.mjs.map +1 -1
  25. package/dist/admin/hooks/usePersistentQueryParams.js +56 -0
  26. package/dist/admin/hooks/usePersistentQueryParams.js.map +1 -0
  27. package/dist/admin/hooks/usePersistentQueryParams.mjs +54 -0
  28. package/dist/admin/hooks/usePersistentQueryParams.mjs.map +1 -0
  29. package/dist/admin/pages/EditView/EditViewPage.js +107 -71
  30. package/dist/admin/pages/EditView/EditViewPage.js.map +1 -1
  31. package/dist/admin/pages/EditView/EditViewPage.mjs +109 -73
  32. package/dist/admin/pages/EditView/EditViewPage.mjs.map +1 -1
  33. package/dist/admin/pages/EditView/components/DocumentActions.js +48 -40
  34. package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
  35. package/dist/admin/pages/EditView/components/DocumentActions.mjs +50 -42
  36. package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
  37. package/dist/admin/pages/EditView/components/EditorToolbarObserver.js +63 -31
  38. package/dist/admin/pages/EditView/components/EditorToolbarObserver.js.map +1 -1
  39. package/dist/admin/pages/EditView/components/EditorToolbarObserver.mjs +64 -32
  40. package/dist/admin/pages/EditView/components/EditorToolbarObserver.mjs.map +1 -1
  41. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.js +20 -5
  42. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.js.map +1 -1
  43. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs +20 -5
  44. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs.map +1 -1
  45. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js +22 -12
  46. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js.map +1 -1
  47. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs +22 -12
  48. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs.map +1 -1
  49. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js +6 -1
  50. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js.map +1 -1
  51. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs +7 -2
  52. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs.map +1 -1
  53. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js +151 -10
  54. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js.map +1 -1
  55. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs +152 -11
  56. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs.map +1 -1
  57. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.js +52 -5
  58. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.js.map +1 -1
  59. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.mjs +53 -6
  60. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.mjs.map +1 -1
  61. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.js +10 -6
  62. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.js.map +1 -1
  63. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.mjs +11 -7
  64. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.mjs.map +1 -1
  65. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js +8 -2
  66. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js.map +1 -1
  67. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs +8 -2
  68. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs.map +1 -1
  69. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/AddComponentButton.js +9 -1
  70. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/AddComponentButton.js.map +1 -1
  71. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/AddComponentButton.mjs +9 -1
  72. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/AddComponentButton.mjs.map +1 -1
  73. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.js +7 -2
  74. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.js.map +1 -1
  75. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.mjs +7 -2
  76. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.mjs.map +1 -1
  77. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentPicker.js +30 -11
  78. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentPicker.js.map +1 -1
  79. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentPicker.mjs +31 -12
  80. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentPicker.mjs.map +1 -1
  81. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js +4 -4
  82. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js.map +1 -1
  83. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs +4 -4
  84. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs.map +1 -1
  85. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js +4 -1
  86. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js.map +1 -1
  87. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs +4 -1
  88. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs.map +1 -1
  89. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.js +6 -1
  90. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.js.map +1 -1
  91. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.mjs +6 -1
  92. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.mjs.map +1 -1
  93. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.js +1 -0
  94. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.js.map +1 -1
  95. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.mjs +1 -0
  96. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.mjs.map +1 -1
  97. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Field.js +21 -1
  98. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Field.js.map +1 -1
  99. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Field.mjs +24 -4
  100. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Field.mjs.map +1 -1
  101. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.js +2 -2
  102. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.js.map +1 -1
  103. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.mjs +2 -2
  104. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.mjs.map +1 -1
  105. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.js +4 -0
  106. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.js.map +1 -1
  107. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.mjs +4 -0
  108. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.mjs.map +1 -1
  109. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.js +30 -13
  110. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.js.map +1 -1
  111. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.mjs +32 -16
  112. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.mjs.map +1 -1
  113. package/dist/admin/pages/EditView/components/FormLayout.js +6 -9
  114. package/dist/admin/pages/EditView/components/FormLayout.js.map +1 -1
  115. package/dist/admin/pages/EditView/components/FormLayout.mjs +6 -9
  116. package/dist/admin/pages/EditView/components/FormLayout.mjs.map +1 -1
  117. package/dist/admin/pages/EditView/components/Header.js +2 -0
  118. package/dist/admin/pages/EditView/components/Header.js.map +1 -1
  119. package/dist/admin/pages/EditView/components/Header.mjs +2 -0
  120. package/dist/admin/pages/EditView/components/Header.mjs.map +1 -1
  121. package/dist/admin/pages/EditView/components/Panels.js +67 -15
  122. package/dist/admin/pages/EditView/components/Panels.js.map +1 -1
  123. package/dist/admin/pages/EditView/components/Panels.mjs +67 -18
  124. package/dist/admin/pages/EditView/components/Panels.mjs.map +1 -1
  125. package/dist/admin/pages/ListView/ListViewPage.js +52 -20
  126. package/dist/admin/pages/ListView/ListViewPage.js.map +1 -1
  127. package/dist/admin/pages/ListView/ListViewPage.mjs +53 -21
  128. package/dist/admin/pages/ListView/ListViewPage.mjs.map +1 -1
  129. package/dist/admin/preview/index.js +9 -3
  130. package/dist/admin/preview/index.js.map +1 -1
  131. package/dist/admin/preview/index.mjs +9 -3
  132. package/dist/admin/preview/index.mjs.map +1 -1
  133. package/dist/admin/src/components/ActionsDrawer.d.ts +35 -0
  134. package/dist/admin/src/hooks/usePersistentQueryParams.d.ts +5 -0
  135. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.d.ts +7 -2
  136. package/dist/admin/src/pages/EditView/components/Panels.d.ts +14 -2
  137. package/dist/admin/translations/en.json.js +5 -1
  138. package/dist/admin/translations/en.json.js.map +1 -1
  139. package/dist/admin/translations/en.json.mjs +5 -1
  140. package/dist/admin/translations/en.json.mjs.map +1 -1
  141. package/dist/admin/translations/es.json.js +3 -1
  142. package/dist/admin/translations/es.json.js.map +1 -1
  143. package/dist/admin/translations/es.json.mjs +3 -1
  144. package/dist/admin/translations/es.json.mjs.map +1 -1
  145. package/dist/admin/translations/fr.json.js +3 -1
  146. package/dist/admin/translations/fr.json.js.map +1 -1
  147. package/dist/admin/translations/fr.json.mjs +3 -1
  148. package/dist/admin/translations/fr.json.mjs.map +1 -1
  149. package/dist/server/preview/services/preview.js +1 -1
  150. package/dist/server/preview/services/preview.js.map +1 -1
  151. package/dist/server/preview/services/preview.mjs +1 -1
  152. package/dist/server/preview/services/preview.mjs.map +1 -1
  153. package/dist/server/src/preview/services/index.d.ts +1 -1
  154. package/dist/server/src/preview/utils.d.ts +1 -1
  155. package/package.json +5 -5
@@ -3,12 +3,14 @@
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var React = require('react');
5
5
  var Toolbar = require('@radix-ui/react-toolbar');
6
+ var strapiAdmin = require('@strapi/admin/strapi-admin');
6
7
  var designSystem = require('@strapi/design-system');
7
8
  var Icons = require('@strapi/icons');
8
9
  var reactIntl = require('react-intl');
9
10
  var slate = require('slate');
10
11
  var slateReact = require('slate-react');
11
12
  var styledComponents = require('styled-components');
13
+ var translations = require('../../../../../utils/translations.js');
12
14
  var EditorToolbarObserver = require('../../EditorToolbarObserver.js');
13
15
  var Link = require('./Blocks/Link.js');
14
16
  var BlocksEditor = require('./BlocksEditor.js');
@@ -44,8 +46,13 @@ const ToolbarSeparator = styledComponents.styled(Toolbar__namespace.Separator)`
44
46
  background: ${({ theme })=>theme.colors.neutral150};
45
47
  width: 1px;
46
48
  height: 2.4rem;
47
- margin-left: 0.8rem;
48
- margin-right: 0.8rem;
49
+ margin-left: ${({ theme })=>theme.spaces[1]};
50
+ margin-right: ${({ theme })=>theme.spaces[1]};
51
+
52
+ ${({ theme })=>theme.breakpoints.medium} {
53
+ margin-left: ${({ theme })=>theme.spaces[2]};
54
+ margin-right: ${({ theme })=>theme.spaces[2]};
55
+ }
49
56
  `;
50
57
  const FlexButton = styledComponents.styled(designSystem.Flex)`
51
58
  // Inherit the not-allowed cursor from ToolbarWrapper when disabled
@@ -56,9 +63,11 @@ const FlexButton = styledComponents.styled(designSystem.Flex)`
56
63
  &[aria-disabled='false'] {
57
64
  cursor: pointer;
58
65
 
59
- // Only apply hover styles if the button is enabled
60
- &:hover {
61
- background: ${({ theme })=>theme.colors.primary100};
66
+ // Only apply hover styles if the button is enabled on desktop
67
+ ${({ theme })=>theme.breakpoints.medium} {
68
+ &:hover {
69
+ background: ${({ theme })=>theme.colors.primary100};
70
+ }
62
71
  }
63
72
  }
64
73
  `;
@@ -68,8 +77,17 @@ const SelectWrapper = styledComponents.styled(designSystem.Box)`
68
77
  border: none;
69
78
  cursor: pointer;
70
79
  min-height: unset;
71
- padding-top: 6px;
72
- padding-bottom: 6px;
80
+ padding-top: ${({ theme })=>theme.spaces[2]};
81
+ padding-bottom: ${({ theme })=>theme.spaces[2]};
82
+ padding-left: ${({ theme })=>theme.spaces[4]};
83
+ padding-right: ${({ theme })=>theme.spaces[4]};
84
+ gap: ${({ theme })=>theme.spaces[2]};
85
+
86
+ ${({ theme })=>theme.breakpoints.medium} {
87
+ padding-top: ${({ theme })=>theme.spaces[1]};
88
+ padding-bottom: ${({ theme })=>theme.spaces[1]};
89
+ gap: ${({ theme })=>theme.spaces[4]};
90
+ }
73
91
 
74
92
  &[aria-disabled='false']:hover {
75
93
  cursor: pointer;
@@ -85,6 +103,13 @@ const SelectWrapper = styledComponents.styled(designSystem.Box)`
85
103
  color: ${({ theme })=>theme.colors.neutral600};
86
104
  }
87
105
  }
106
+
107
+ & > span:first-child {
108
+ gap: ${({ theme })=>theme.spaces[0]};
109
+
110
+ ${({ theme })=>theme.breakpoints.medium} {
111
+ gap: ${({ theme })=>theme.spaces[3]};
112
+ }
88
113
  }
89
114
  `;
90
115
  /**
@@ -116,7 +141,7 @@ const ToolbarButton = ({ icon: Icon, name, label, isActive, disabled, handleClic
116
141
  children: /*#__PURE__*/ jsxRuntime.jsx(Toolbar__namespace.ToggleItem, {
117
142
  value: name,
118
143
  "data-state": isActive ? 'on' : 'off',
119
- onMouseDown: (e)=>{
144
+ onPointerDown: (e)=>{
120
145
  e.preventDefault();
121
146
  handleClick();
122
147
  slateReact.ReactEditor.focus(editor);
@@ -145,6 +170,7 @@ const BlocksDropdown = ()=>{
145
170
  const { editor, blocks, disabled } = BlocksEditor.useBlocksEditorContext('BlocksDropdown');
146
171
  const { formatMessage } = reactIntl.useIntl();
147
172
  const { modalElement, handleConversionResult } = useConversionModal();
173
+ const isMobile = strapiAdmin.useIsMobile();
148
174
  const blockKeysToInclude = types.getEntries(blocks).reduce((currentKeys, entry)=>{
149
175
  const [key, block] = entry;
150
176
  return block.isInBlocksSelector ? [
@@ -271,7 +297,7 @@ const BlocksDropdown = ()=>{
271
297
  children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelect, {
272
298
  startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icon, {}),
273
299
  onChange: handleSelect,
274
- placeholder: formatMessage(blocks[blockSelected].label),
300
+ customizeContent: ()=>isMobile ? '' : formatMessage(blocks[blockSelected].label),
275
301
  value: blockSelected,
276
302
  onCloseAutoFocus: preventSelectFocus,
277
303
  "aria-label": formatMessage({
@@ -477,9 +503,115 @@ const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
477
503
  fill: ${({ theme, isActive })=>isActive ? theme.colors.primary600 : theme.colors.neutral500};
478
504
  }
479
505
  `;
506
+ const ReorderToolbarButtons = ()=>{
507
+ const { editor, disabled, blocks, name, setLiveText } = BlocksEditor.useBlocksEditorContext('ReorderToolbarButtons');
508
+ const { formatMessage } = reactIntl.useIntl();
509
+ const selection = editor.selection;
510
+ const totalBlocks = editor.children.length;
511
+ const anchorIndex = selection ? selection.anchor.path[0] : null;
512
+ const focusIndex = selection ? selection.focus.path[0] : null;
513
+ const isSingleBlockSelection = anchorIndex !== null && focusIndex !== null && anchorIndex === focusIndex;
514
+ const selectedTopLevelNode = isSingleBlockSelection && anchorIndex !== null ? editor.children[anchorIndex] : null;
515
+ const selectedBlock = selectedTopLevelNode && Object.values(blocks).find((block)=>block.matchNode(selectedTopLevelNode));
516
+ const isSelectedBlockDraggable = selectedTopLevelNode && selectedBlock ? selectedBlock.isDraggable?.(selectedTopLevelNode) ?? true : false;
517
+ const canMoveUp = !disabled && isSingleBlockSelection && isSelectedBlockDraggable && anchorIndex !== null && anchorIndex > 0;
518
+ const canMoveDown = !disabled && isSingleBlockSelection && isSelectedBlockDraggable && anchorIndex !== null && anchorIndex < totalBlocks - 1;
519
+ const moveBlock = (direction)=>{
520
+ if (!selection || anchorIndex === null) return;
521
+ const currentIndex = [
522
+ anchorIndex
523
+ ];
524
+ const newIndex = [
525
+ direction === 'up' ? anchorIndex - 1 : anchorIndex + 1
526
+ ];
527
+ slate.Transforms.moveNodes(editor, {
528
+ at: currentIndex,
529
+ to: newIndex
530
+ });
531
+ // Keep the moved block focused so disabled states update immediately.
532
+ slate.Transforms.select(editor, slate.Editor.start(editor, newIndex));
533
+ slateReact.ReactEditor.focus(editor);
534
+ setLiveText(formatMessage({
535
+ id: translations.getTranslation('components.Blocks.dnd.reorder'),
536
+ defaultMessage: '{item}, moved. New position in the editor: {position}.'
537
+ }, {
538
+ item: `${name}.${currentIndex[0] + 1}`,
539
+ position: `${newIndex[0] + 1} of ${editor.children.length}`
540
+ }));
541
+ };
542
+ return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
543
+ direction: "row",
544
+ gap: 1,
545
+ children: [
546
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tooltip, {
547
+ label: formatMessage({
548
+ id: translations.getTranslation('components.DynamicZone.move-up'),
549
+ defaultMessage: 'Move up'
550
+ }),
551
+ children: /*#__PURE__*/ jsxRuntime.jsx(Toolbar__namespace.Button, {
552
+ onPointerDown: (e)=>{
553
+ e.preventDefault();
554
+ if (canMoveUp) moveBlock('up');
555
+ },
556
+ "aria-disabled": !canMoveUp,
557
+ disabled: !canMoveUp,
558
+ "aria-label": formatMessage({
559
+ id: translations.getTranslation('components.DynamicZone.move-up'),
560
+ defaultMessage: 'Move up'
561
+ }),
562
+ asChild: true,
563
+ children: /*#__PURE__*/ jsxRuntime.jsx(FlexButton, {
564
+ tag: "button",
565
+ alignItems: "center",
566
+ justifyContent: "center",
567
+ width: 7,
568
+ height: 7,
569
+ hasRadius: true,
570
+ type: "button",
571
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.ArrowUp, {
572
+ fill: !canMoveUp ? 'neutral300' : 'neutral600'
573
+ })
574
+ })
575
+ })
576
+ }),
577
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tooltip, {
578
+ label: formatMessage({
579
+ id: translations.getTranslation('components.DynamicZone.move-down'),
580
+ defaultMessage: 'Move down'
581
+ }),
582
+ children: /*#__PURE__*/ jsxRuntime.jsx(Toolbar__namespace.Button, {
583
+ onPointerDown: (e)=>{
584
+ e.preventDefault();
585
+ if (canMoveDown) moveBlock('down');
586
+ },
587
+ "aria-disabled": !canMoveDown,
588
+ disabled: !canMoveDown,
589
+ "aria-label": formatMessage({
590
+ id: translations.getTranslation('components.DynamicZone.move-down'),
591
+ defaultMessage: 'Move down'
592
+ }),
593
+ asChild: true,
594
+ children: /*#__PURE__*/ jsxRuntime.jsx(FlexButton, {
595
+ tag: "button",
596
+ alignItems: "center",
597
+ justifyContent: "center",
598
+ width: 7,
599
+ height: 7,
600
+ hasRadius: true,
601
+ type: "button",
602
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.ArrowDown, {
603
+ fill: !canMoveDown ? 'neutral300' : 'neutral600'
604
+ })
605
+ })
606
+ })
607
+ })
608
+ ]
609
+ });
610
+ };
480
611
  const BlocksToolbar = ()=>{
481
612
  const { editor, blocks, modifiers, disabled } = BlocksEditor.useBlocksEditorContext('BlocksToolbar');
482
613
  const { formatMessage } = reactIntl.useIntl();
614
+ const isMobile = strapiAdmin.useIsMobile();
483
615
  /**
484
616
  * The modifier buttons are disabled when an image is selected.
485
617
  */ const checkButtonDisabled = ()=>{
@@ -594,10 +726,19 @@ const BlocksToolbar = ()=>{
594
726
  "aria-disabled": disabled,
595
727
  asChild: true,
596
728
  children: /*#__PURE__*/ jsxRuntime.jsxs(ToolbarWrapper, {
597
- padding: 2,
729
+ padding: {
730
+ initial: 1,
731
+ medium: 2
732
+ },
598
733
  width: "100%",
599
734
  children: [
600
735
  /*#__PURE__*/ jsxRuntime.jsx(BlocksDropdown, {}),
736
+ isMobile && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
737
+ children: [
738
+ /*#__PURE__*/ jsxRuntime.jsx(ToolbarSeparator, {}),
739
+ /*#__PURE__*/ jsxRuntime.jsx(ReorderToolbarButtons, {})
740
+ ]
741
+ }),
601
742
  /*#__PURE__*/ jsxRuntime.jsx(ToolbarSeparator, {}),
602
743
  /*#__PURE__*/ jsxRuntime.jsx(Toolbar__namespace.ToggleGroup, {
603
744
  type: "multiple",
@@ -1 +1 @@
1
- {"version":3,"file":"BlocksToolbar.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport * as Toolbar from '@radix-ui/react-toolbar';\nimport {\n Flex,\n Tooltip,\n SingleSelect,\n SingleSelectOption,\n Box,\n FlexComponent,\n BoxComponent,\n Menu,\n} from '@strapi/design-system';\nimport { Link } from '@strapi/icons';\nimport { MessageDescriptor, useIntl } from 'react-intl';\nimport { Editor, Transforms, Element as SlateElement, Node, type Ancestor } from 'slate';\nimport { ReactEditor } from 'slate-react';\nimport { css, styled } from 'styled-components';\n\nimport { EditorToolbarObserver, type ObservedComponent } from '../../EditorToolbarObserver';\n\nimport { insertLink } from './Blocks/Link';\nimport {\n type BlocksStore,\n type SelectorBlockKey,\n isSelectorBlockKey,\n useBlocksEditorContext,\n} from './BlocksEditor';\nimport { type Block, getEntries, getKeys } from './utils/types';\n\nconst ToolbarWrapper = styled<FlexComponent>(Flex)`\n &[aria-disabled='true'] {\n cursor: not-allowed;\n background: ${({ theme }) => theme.colors.neutral150};\n }\n`;\n\nconst ToolbarSeparator = styled(Toolbar.Separator)`\n background: ${({ theme }) => theme.colors.neutral150};\n width: 1px;\n height: 2.4rem;\n margin-left: 0.8rem;\n margin-right: 0.8rem;\n`;\n\nconst FlexButton = styled<FlexComponent<'button'>>(Flex)`\n // Inherit the not-allowed cursor from ToolbarWrapper when disabled\n &[aria-disabled] {\n cursor: not-allowed;\n }\n\n &[aria-disabled='false'] {\n cursor: pointer;\n\n // Only apply hover styles if the button is enabled\n &:hover {\n background: ${({ theme }) => theme.colors.primary100};\n }\n }\n`;\n\nconst SelectWrapper = styled<BoxComponent>(Box)`\n // Styling changes to SingleSelect component don't work, so adding wrapper to target SingleSelect\n div[role='combobox'] {\n border: none;\n cursor: pointer;\n min-height: unset;\n padding-top: 6px;\n padding-bottom: 6px;\n\n &[aria-disabled='false']:hover {\n cursor: pointer;\n background: ${({ theme }) => theme.colors.primary100};\n }\n\n &[aria-disabled] {\n background: transparent;\n cursor: inherit;\n\n // Select text and icons should also have disabled color\n span {\n color: ${({ theme }) => theme.colors.neutral600};\n }\n }\n }\n`;\n\n/**\n * Handles the modal component that may be returned by a block when converting it\n */\nfunction useConversionModal() {\n const [modalElement, setModalComponent] = React.useState<React.JSX.Element | null>(null);\n\n const handleConversionResult = (renderModal: void | (() => React.JSX.Element) | undefined) => {\n // Not all blocks return a modal\n if (renderModal) {\n // Use cloneElement to apply a key because to create a new instance of the component\n // Without the new key, the state is kept from previous times that option was picked\n setModalComponent(React.cloneElement(renderModal(), { key: Date.now() }));\n }\n };\n\n return { modalElement, handleConversionResult };\n}\n\ninterface ToolbarButtonProps {\n icon: React.ComponentType<React.SVGProps<SVGSVGElement>>;\n name: string;\n label: MessageDescriptor;\n isActive: boolean;\n disabled: boolean;\n handleClick: () => void;\n}\n\nconst ToolbarButton = ({\n icon: Icon,\n name,\n label,\n isActive,\n disabled,\n handleClick,\n}: ToolbarButtonProps) => {\n const { editor } = useBlocksEditorContext('ToolbarButton');\n const { formatMessage } = useIntl();\n const labelMessage = formatMessage(label);\n\n const enabledColor = isActive ? 'primary600' : 'neutral600';\n\n return (\n <Tooltip label={labelMessage}>\n <Toolbar.ToggleItem\n value={name}\n data-state={isActive ? 'on' : 'off'}\n onMouseDown={(e) => {\n e.preventDefault();\n handleClick();\n ReactEditor.focus(editor);\n }}\n aria-disabled={disabled}\n disabled={disabled}\n aria-label={labelMessage}\n asChild\n >\n <FlexButton\n tag=\"button\"\n background={isActive ? 'primary100' : ''}\n alignItems=\"center\"\n justifyContent=\"center\"\n width={7}\n height={7}\n hasRadius\n type=\"button\"\n >\n <Icon fill={disabled ? 'neutral300' : enabledColor} />\n </FlexButton>\n </Toolbar.ToggleItem>\n </Tooltip>\n );\n};\n\nconst BlocksDropdown = () => {\n const { editor, blocks, disabled } = useBlocksEditorContext('BlocksDropdown');\n const { formatMessage } = useIntl();\n const { modalElement, handleConversionResult } = useConversionModal();\n\n const blockKeysToInclude: SelectorBlockKey[] = getEntries(blocks).reduce<\n ReturnType<typeof getEntries>\n >((currentKeys, entry) => {\n const [key, block] = entry;\n\n return block.isInBlocksSelector ? [...currentKeys, key] : currentKeys;\n }, []);\n\n const [blockSelected, setBlockSelected] = React.useState<SelectorBlockKey>('paragraph');\n\n const handleSelect = (optionKey: unknown) => {\n if (!isSelectorBlockKey(optionKey)) {\n return;\n }\n\n const editorIsEmpty =\n editor.children.length === 1 && Editor.isEmpty(editor, editor.children[0]);\n\n if (!editor.selection && !editorIsEmpty) {\n // When there is no selection, create an empty block at the end of the editor\n // so that it can be converted to the selected block\n Transforms.insertNodes(\n editor,\n {\n type: 'quote',\n children: [{ type: 'text', text: '' }],\n },\n {\n select: true,\n // Since there's no selection, Slate will automatically insert the node at the end\n }\n );\n } else if (!editor.selection && editorIsEmpty) {\n // When there is no selection and the editor is empty,\n // select the empty paragraph from Slate's initialValue so it gets converted\n Transforms.select(editor, Editor.start(editor, [0, 0]));\n }\n\n // If selection is already a list block, toggle its format\n const currentListEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n });\n\n if (currentListEntry && ['list-ordered', 'list-unordered'].includes(optionKey)) {\n const [currentList, currentListPath] = currentListEntry;\n const format = optionKey === 'list-ordered' ? 'ordered' : 'unordered';\n\n if (!Editor.isEditor(currentList) && isListNode(currentList)) {\n // Format is different, toggle list format\n if (currentList.format !== format) {\n Transforms.setNodes(editor, { format }, { at: currentListPath });\n }\n }\n return;\n }\n\n // Let the block handle the Slate conversion logic\n const maybeRenderModal = blocks[optionKey].handleConvert?.(editor);\n handleConversionResult(maybeRenderModal);\n\n setBlockSelected(optionKey);\n\n ReactEditor.focus(editor);\n };\n\n /**\n * Prevent the select from focusing itself so ReactEditor.focus(editor) can focus the editor instead.\n *\n * The editor first loses focus to a blur event when clicking the select button. However,\n * refocusing the editor is not enough since the select's default behavior is to refocus itself\n * after an option is selected.\n *\n */\n const preventSelectFocus = (e: Event) => e.preventDefault();\n\n // Listen to the selection change and update the selected block in the dropdown\n React.useEffect(() => {\n if (editor.selection) {\n let selectedNode: Ancestor;\n\n // If selection anchor is a list-item, get its parent\n const currentListEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n at: editor.selection.anchor,\n });\n\n if (currentListEntry) {\n const [currentList] = currentListEntry;\n selectedNode = currentList;\n } else {\n // Get the parent node of the anchor other than list-item\n const [anchorNode] = Editor.parent(editor, editor.selection.anchor, {\n edge: 'start',\n depth: 2,\n });\n\n // @ts-expect-error slate's delete behaviour creates an exceptional type\n if (anchorNode.type === 'list-item') {\n // When the last node in the selection is a list item,\n // slate's default delete operation leaves an empty list-item instead of converting it into a paragraph.\n // Issue: https://github.com/ianstormtaylor/slate/issues/2500\n\n Transforms.setNodes(editor, { type: 'paragraph' });\n // @ts-expect-error convert explicitly type to paragraph\n selectedNode = { ...anchorNode, type: 'paragraph' };\n } else {\n selectedNode = anchorNode;\n }\n }\n\n // Find the block key that matches the anchor node\n const anchorBlockKey = getKeys(blocks).find(\n (blockKey) => !Editor.isEditor(selectedNode) && blocks[blockKey].matchNode(selectedNode)\n );\n\n // Change the value selected in the dropdown if it doesn't match the anchor block key\n if (anchorBlockKey && anchorBlockKey !== blockSelected) {\n setBlockSelected(anchorBlockKey as SelectorBlockKey);\n }\n }\n }, [editor.selection, editor, blocks, blockSelected]);\n\n const Icon = blocks[blockSelected].icon;\n\n return (\n <>\n <SelectWrapper>\n <SingleSelect\n startIcon={<Icon />}\n onChange={handleSelect}\n placeholder={formatMessage(blocks[blockSelected].label)}\n value={blockSelected}\n onCloseAutoFocus={preventSelectFocus}\n aria-label={formatMessage({\n id: 'components.Blocks.blocks.selectBlock',\n defaultMessage: 'Select a block',\n })}\n disabled={disabled}\n >\n {blockKeysToInclude.map((key) => (\n <BlockOption\n key={key}\n value={key}\n label={blocks[key].label}\n icon={blocks[key].icon}\n blockSelected={blockSelected}\n />\n ))}\n </SingleSelect>\n </SelectWrapper>\n {modalElement}\n </>\n );\n};\n\ninterface BlockOptionProps {\n value: string;\n icon: React.ComponentType<React.SVGProps<SVGElement>>;\n label: MessageDescriptor;\n blockSelected: string;\n}\n\nconst BlockOption = ({ value, icon: Icon, label, blockSelected }: BlockOptionProps) => {\n const { formatMessage } = useIntl();\n\n const isSelected = value === blockSelected;\n\n return (\n <SingleSelectOption\n startIcon={<Icon fill={isSelected ? 'primary600' : 'neutral500'} />}\n value={value}\n >\n {formatMessage(label)}\n </SingleSelectOption>\n );\n};\n\nconst isListNode = (node: unknown): node is Block<'list'> => {\n return Node.isNode(node) && !Editor.isEditor(node) && node.type === 'list';\n};\n\ninterface ListButtonProps {\n block: BlocksStore['list-ordered'] | BlocksStore['list-unordered'];\n format: Block<'list'>['format'];\n location?: 'toolbar' | 'menu';\n}\n\nconst ListButton = ({ block, format, location = 'toolbar' }: ListButtonProps) => {\n const { formatMessage } = useIntl();\n const { editor, disabled, blocks } = useBlocksEditorContext('ListButton');\n\n const isListActive = () => {\n if (!editor.selection) return false;\n\n // Get the parent list at selection anchor node\n const currentListEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n at: editor.selection.anchor,\n });\n\n if (currentListEntry) {\n const [currentList] = currentListEntry;\n if (!Editor.isEditor(currentList) && isListNode(currentList) && currentList.format === format)\n return true;\n }\n\n return false;\n };\n\n /**\n * @TODO: Currently, applying list while multiple blocks are selected is not supported.\n * We should implement this feature in the future.\n */\n const isListDisabled = () => {\n // Always disabled when the whole editor is disabled\n if (disabled) {\n return true;\n }\n\n // Always enabled when there's no selection\n if (!editor.selection) {\n return false;\n }\n\n // Get the block node closest to the anchor and focus\n const anchorNodeEntry = Editor.above(editor, {\n at: editor.selection.anchor,\n match: (node) => !Editor.isEditor(node) && node.type !== 'text',\n });\n const focusNodeEntry = Editor.above(editor, {\n at: editor.selection.focus,\n match: (node) => !Editor.isEditor(node) && node.type !== 'text',\n });\n\n if (!anchorNodeEntry || !focusNodeEntry) {\n return false;\n }\n\n // Disabled if the anchor and focus are not in the same block\n return anchorNodeEntry[0] !== focusNodeEntry[0];\n };\n\n const toggleList = (format: Block<'list'>['format']) => {\n let currentListEntry;\n if (editor.selection) {\n currentListEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n });\n } else {\n // If no selection, toggle last inserted node\n const [_, lastNodePath] = Editor.last(editor, []);\n currentListEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n at: lastNodePath,\n });\n }\n\n if (!currentListEntry) {\n // If selection is not a list then convert it to list\n blocks[`list-${format}`].handleConvert!(editor);\n return;\n }\n\n // If selection is already a list then toggle format\n const [currentList, currentListPath] = currentListEntry;\n\n if (!Editor.isEditor(currentList) && isListNode(currentList)) {\n if (currentList.format !== format) {\n // Format is different, toggle list format\n Transforms.setNodes(editor, { format }, { at: currentListPath });\n } else {\n // Format is same, convert selected list-item to paragraph\n blocks['paragraph'].handleConvert!(editor);\n }\n }\n };\n\n if (location === 'menu') {\n const Icon = block.icon;\n\n return (\n <StyledMenuItem\n startIcon={<Icon />}\n onSelect={() => toggleList(format)}\n isActive={isListActive()}\n disabled={isListDisabled()}\n >\n {formatMessage(block.label)}\n </StyledMenuItem>\n );\n }\n\n return (\n <ToolbarButton\n icon={block.icon}\n name={format}\n label={block.label}\n isActive={isListActive()}\n disabled={isListDisabled()}\n handleClick={() => toggleList(format)}\n />\n );\n};\n\nconst LinkButton = ({\n disabled,\n location = 'toolbar',\n}: {\n disabled: boolean;\n location?: 'toolbar' | 'menu';\n}) => {\n const { editor } = useBlocksEditorContext('LinkButton');\n const { formatMessage } = useIntl();\n\n const isLinkActive = () => {\n const { selection } = editor;\n\n if (!selection) return false;\n\n const [match] = Array.from(\n Editor.nodes(editor, {\n at: Editor.unhangRange(editor, selection),\n match: (node) => SlateElement.isElement(node) && node.type === 'link',\n })\n );\n\n return Boolean(match);\n };\n\n const isLinkDisabled = () => {\n // Always disabled when the whole editor is disabled\n if (disabled) {\n return true;\n }\n\n // Always enabled when there's no selection\n if (!editor.selection) {\n return false;\n }\n\n // Get the block node closest to the anchor and focus\n const anchorNodeEntry = Editor.above(editor, {\n at: editor.selection.anchor,\n match: (node) => !Editor.isEditor(node) && node.type !== 'text',\n });\n const focusNodeEntry = Editor.above(editor, {\n at: editor.selection.focus,\n match: (node) => !Editor.isEditor(node) && node.type !== 'text',\n });\n\n if (!anchorNodeEntry || !focusNodeEntry) {\n return false;\n }\n\n // Disabled if the anchor and focus are not in the same block\n return anchorNodeEntry[0] !== focusNodeEntry[0];\n };\n\n const addLink = () => {\n editor.shouldSaveLinkPath = true;\n // We insert an empty anchor, so we split the DOM to have a element we can use as reference for the popover\n insertLink(editor, { url: '' });\n };\n\n const label = {\n id: 'components.Blocks.link',\n defaultMessage: 'Link',\n } as MessageDescriptor;\n\n if (location === 'menu') {\n return (\n <StyledMenuItem\n startIcon={<Link />}\n onSelect={addLink}\n isActive={isLinkActive()}\n disabled={isLinkDisabled()}\n >\n {formatMessage(label)}\n </StyledMenuItem>\n );\n }\n\n return (\n <ToolbarButton\n icon={Link}\n name=\"link\"\n label={label}\n isActive={isLinkActive()}\n handleClick={addLink}\n disabled={isLinkDisabled()}\n />\n );\n};\n\nconst StyledMenuItem = styled(Menu.Item)<{ isActive: boolean }>`\n ${(props) =>\n props.isActive &&\n css`\n color: ${({ theme }) => theme.colors.primary600};\n font-weight: 600;\n `}\n\n svg {\n fill: ${({ theme, isActive }) =>\n isActive ? theme.colors.primary600 : theme.colors.neutral500};\n }\n`;\n\nconst BlocksToolbar = () => {\n const { editor, blocks, modifiers, disabled } = useBlocksEditorContext('BlocksToolbar');\n const { formatMessage } = useIntl();\n\n /**\n * The modifier buttons are disabled when an image is selected.\n */\n const checkButtonDisabled = () => {\n // Always disabled when the whole editor is disabled\n if (disabled) {\n return true;\n }\n\n if (!editor.selection) {\n return false;\n }\n\n const selectedNode = editor.children[editor.selection.anchor.path[0]];\n if (!selectedNode) return true;\n\n if (['image', 'code'].includes(selectedNode.type)) {\n return true;\n }\n\n return false;\n };\n\n const isButtonDisabled = checkButtonDisabled();\n\n /**\n * Observed components are ones that may or may not be visible in the toolbar, depending on the\n * available space. They provide two render props:\n * - renderInToolbar: for when we try to render the component in the toolbar (may be hidden)\n * - renderInMenu: for when the component didn't fit in the toolbar and is relegated\n * to the \"more\" menu\n */\n const observedComponents: ObservedComponent[] = [\n ...Object.entries(modifiers).map(([name, modifier]) => {\n const Icon = modifier.icon;\n const isActive = modifier.checkIsActive(editor);\n const handleSelect = () => modifier.handleToggle(editor);\n\n return {\n toolbar: (\n <ToolbarButton\n key={name}\n name={name}\n icon={modifier.icon}\n label={modifier.label}\n isActive={modifier.checkIsActive(editor)}\n handleClick={handleSelect}\n disabled={isButtonDisabled}\n />\n ),\n menu: (\n <StyledMenuItem startIcon={<Icon />} onSelect={handleSelect} isActive={isActive}>\n {formatMessage(modifier.label)}\n </StyledMenuItem>\n ),\n key: `modifier.${name}`,\n };\n }),\n {\n toolbar: <LinkButton disabled={isButtonDisabled} location=\"toolbar\" />,\n menu: <LinkButton disabled={isButtonDisabled} location=\"menu\" />,\n key: 'block.link',\n },\n {\n // List buttons can only be rendered together when in the toolbar\n toolbar: (\n <Flex direction=\"row\">\n <ToolbarSeparator style={{ marginLeft: '0.4rem' }} />\n <Toolbar.ToggleGroup type=\"single\" asChild>\n <Flex gap={1}>\n <ListButton block={blocks['list-unordered']} format=\"unordered\" location=\"toolbar\" />\n <ListButton block={blocks['list-ordered']} format=\"ordered\" location=\"toolbar\" />\n </Flex>\n </Toolbar.ToggleGroup>\n </Flex>\n ),\n menu: (\n <>\n <Menu.Separator />\n <ListButton block={blocks['list-unordered']} format=\"unordered\" location=\"menu\" />\n <ListButton block={blocks['list-ordered']} format=\"ordered\" location=\"menu\" />\n </>\n ),\n key: 'block.list',\n },\n ];\n\n return (\n <Toolbar.Root aria-disabled={disabled} asChild>\n <ToolbarWrapper padding={2} width=\"100%\">\n <BlocksDropdown />\n <ToolbarSeparator />\n <Toolbar.ToggleGroup type=\"multiple\" asChild>\n <Flex direction=\"row\" gap={1} grow={1} overflow=\"hidden\">\n <EditorToolbarObserver observedComponents={observedComponents} />\n </Flex>\n </Toolbar.ToggleGroup>\n </ToolbarWrapper>\n </Toolbar.Root>\n );\n};\n\nexport { BlocksToolbar, useConversionModal };\n"],"names":["ToolbarWrapper","styled","Flex","theme","colors","neutral150","ToolbarSeparator","Toolbar","Separator","FlexButton","primary100","SelectWrapper","Box","neutral600","useConversionModal","modalElement","setModalComponent","React","useState","handleConversionResult","renderModal","cloneElement","key","Date","now","ToolbarButton","icon","Icon","name","label","isActive","disabled","handleClick","editor","useBlocksEditorContext","formatMessage","useIntl","labelMessage","enabledColor","_jsx","Tooltip","ToggleItem","value","data-state","onMouseDown","e","preventDefault","ReactEditor","focus","aria-disabled","aria-label","asChild","tag","background","alignItems","justifyContent","width","height","hasRadius","type","fill","BlocksDropdown","blocks","blockKeysToInclude","getEntries","reduce","currentKeys","entry","block","isInBlocksSelector","blockSelected","setBlockSelected","handleSelect","optionKey","isSelectorBlockKey","editorIsEmpty","children","length","Editor","isEmpty","selection","Transforms","insertNodes","text","select","start","currentListEntry","above","match","node","isEditor","includes","currentList","currentListPath","format","isListNode","setNodes","at","maybeRenderModal","handleConvert","preventSelectFocus","useEffect","selectedNode","anchor","anchorNode","parent","edge","depth","anchorBlockKey","getKeys","find","blockKey","matchNode","_jsxs","_Fragment","SingleSelect","startIcon","onChange","placeholder","onCloseAutoFocus","id","defaultMessage","map","BlockOption","isSelected","SingleSelectOption","Node","isNode","ListButton","location","isListActive","isListDisabled","anchorNodeEntry","focusNodeEntry","toggleList","_","lastNodePath","last","StyledMenuItem","onSelect","LinkButton","isLinkActive","Array","from","nodes","unhangRange","SlateElement","isElement","Boolean","isLinkDisabled","addLink","shouldSaveLinkPath","insertLink","url","Link","Menu","Item","props","css","primary600","neutral500","BlocksToolbar","modifiers","checkButtonDisabled","path","isButtonDisabled","observedComponents","Object","entries","modifier","checkIsActive","handleToggle","toolbar","menu","direction","style","marginLeft","ToggleGroup","gap","Root","padding","grow","overflow","EditorToolbarObserver"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAMA,cAAAA,GAAiBC,uBAAsBC,CAAAA,iBAAAA,CAAK;;;gBAGlC,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;AAEzD,CAAC;AAED,MAAMC,gBAAmBL,GAAAA,uBAAAA,CAAOM,kBAAQC,CAAAA,SAAS,CAAC;cACpC,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;;;;AAKvD,CAAC;AAED,MAAMI,UAAAA,GAAaR,uBAAgCC,CAAAA,iBAAAA,CAAK;;;;;;;;;;;kBAWtC,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACM,UAAU,CAAC;;;AAG3D,CAAC;AAED,MAAMC,aAAAA,GAAgBV,uBAAqBW,CAAAA,gBAAAA,CAAI;;;;;;;;;;;kBAW7B,EAAE,CAAC,EAAET,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACM,UAAU,CAAC;;;;;;;;;eAS5C,EAAE,CAAC,EAAEP,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACS,UAAU,CAAC;;;;AAIxD,CAAC;AAED;;AAEC,IACD,SAAS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AA;IAED,qBACEiB,cAAA,CAAChC,mBAAQ4K,IAAI,EAAA;QAAClI,eAAelB,EAAAA,QAAAA;QAAUoB,OAAO,EAAA,IAAA;AAC5C,QAAA,QAAA,gBAAA8D,eAACjH,CAAAA,cAAAA,EAAAA;YAAeoL,OAAS,EAAA,CAAA;YAAG5H,KAAM,EAAA,MAAA;;8BAChCjB,cAACsB,CAAAA,cAAAA,EAAAA,EAAAA,CAAAA;8BACDtB,cAACjC,CAAAA,gBAAAA,EAAAA,EAAAA,CAAAA;AACD,8BAAAiC,cAAA,CAAChC,mBAAQ0K,WAAW,EAAA;oBAACtH,IAAK,EAAA,UAAA;oBAAWR,OAAO,EAAA,IAAA;AAC1C,oBAAA,QAAA,gBAAAZ,cAACrC,CAAAA,iBAAAA,EAAAA;wBAAK4K,SAAU,EAAA,KAAA;wBAAMI,GAAK,EAAA,CAAA;wBAAGG,IAAM,EAAA,CAAA;wBAAGC,QAAS,EAAA,QAAA;AAC9C,wBAAA,QAAA,gBAAA/I,cAACgJ,CAAAA,2CAAAA,EAAAA;4BAAsBjB,kBAAoBA,EAAAA;;;;;;;AAMvD;;;;;"}
1
+ {"version":3,"file":"BlocksToolbar.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport * as Toolbar from '@radix-ui/react-toolbar';\nimport { useIsMobile } from '@strapi/admin/strapi-admin';\nimport {\n Flex,\n Tooltip,\n SingleSelect,\n SingleSelectOption,\n Box,\n FlexComponent,\n BoxComponent,\n Menu,\n} from '@strapi/design-system';\nimport { Link, ArrowUp, ArrowDown } from '@strapi/icons';\nimport { MessageDescriptor, useIntl } from 'react-intl';\nimport { Editor, Transforms, Element as SlateElement, Node, type Ancestor } from 'slate';\nimport { ReactEditor } from 'slate-react';\nimport { css, styled } from 'styled-components';\n\nimport { getTranslation } from '../../../../../utils/translations';\nimport { EditorToolbarObserver, type ObservedComponent } from '../../EditorToolbarObserver';\n\nimport { insertLink } from './Blocks/Link';\nimport {\n type BlocksStore,\n type SelectorBlockKey,\n isSelectorBlockKey,\n useBlocksEditorContext,\n} from './BlocksEditor';\nimport { type Block, getEntries, getKeys } from './utils/types';\n\nconst ToolbarWrapper = styled<FlexComponent>(Flex)`\n &[aria-disabled='true'] {\n cursor: not-allowed;\n background: ${({ theme }) => theme.colors.neutral150};\n }\n`;\n\nconst ToolbarSeparator = styled(Toolbar.Separator)`\n background: ${({ theme }) => theme.colors.neutral150};\n width: 1px;\n height: 2.4rem;\n margin-left: ${({ theme }) => theme.spaces[1]};\n margin-right: ${({ theme }) => theme.spaces[1]};\n\n ${({ theme }) => theme.breakpoints.medium} {\n margin-left: ${({ theme }) => theme.spaces[2]};\n margin-right: ${({ theme }) => theme.spaces[2]};\n }\n`;\n\nconst FlexButton = styled<FlexComponent<'button'>>(Flex)`\n // Inherit the not-allowed cursor from ToolbarWrapper when disabled\n &[aria-disabled] {\n cursor: not-allowed;\n }\n\n &[aria-disabled='false'] {\n cursor: pointer;\n\n // Only apply hover styles if the button is enabled on desktop\n ${({ theme }) => theme.breakpoints.medium} {\n &:hover {\n background: ${({ theme }) => theme.colors.primary100};\n }\n }\n }\n`;\n\nconst SelectWrapper = styled<BoxComponent>(Box)`\n // Styling changes to SingleSelect component don't work, so adding wrapper to target SingleSelect\n div[role='combobox'] {\n border: none;\n cursor: pointer;\n min-height: unset;\n padding-top: ${({ theme }) => theme.spaces[2]};\n padding-bottom: ${({ theme }) => theme.spaces[2]};\n padding-left: ${({ theme }) => theme.spaces[4]};\n padding-right: ${({ theme }) => theme.spaces[4]};\n gap: ${({ theme }) => theme.spaces[2]};\n \n ${({ theme }) => theme.breakpoints.medium} {\n padding-top: ${({ theme }) => theme.spaces[1]};\n padding-bottom: ${({ theme }) => theme.spaces[1]};\n gap: ${({ theme }) => theme.spaces[4]};\n }\n\n &[aria-disabled='false']:hover {\n cursor: pointer;\n background: ${({ theme }) => theme.colors.primary100};\n }\n\n &[aria-disabled] {\n background: transparent;\n cursor: inherit;\n\n // Select text and icons should also have disabled color\n span {\n color: ${({ theme }) => theme.colors.neutral600};\n }\n }\n\n & > span:first-child {\n gap: ${({ theme }) => theme.spaces[0]};\n\n ${({ theme }) => theme.breakpoints.medium} {\n gap: ${({ theme }) => theme.spaces[3]};\n }\n }\n`;\n\n/**\n * Handles the modal component that may be returned by a block when converting it\n */\nfunction useConversionModal() {\n const [modalElement, setModalComponent] = React.useState<React.JSX.Element | null>(null);\n\n const handleConversionResult = (renderModal: void | (() => React.JSX.Element) | undefined) => {\n // Not all blocks return a modal\n if (renderModal) {\n // Use cloneElement to apply a key because to create a new instance of the component\n // Without the new key, the state is kept from previous times that option was picked\n setModalComponent(React.cloneElement(renderModal(), { key: Date.now() }));\n }\n };\n\n return { modalElement, handleConversionResult };\n}\n\ninterface ToolbarButtonProps {\n icon: React.ComponentType<React.SVGProps<SVGSVGElement>>;\n name: string;\n label: MessageDescriptor;\n isActive: boolean;\n disabled: boolean;\n handleClick: () => void;\n}\n\nconst ToolbarButton = ({\n icon: Icon,\n name,\n label,\n isActive,\n disabled,\n handleClick,\n}: ToolbarButtonProps) => {\n const { editor } = useBlocksEditorContext('ToolbarButton');\n const { formatMessage } = useIntl();\n const labelMessage = formatMessage(label);\n\n const enabledColor = isActive ? 'primary600' : 'neutral600';\n\n return (\n <Tooltip label={labelMessage}>\n <Toolbar.ToggleItem\n value={name}\n data-state={isActive ? 'on' : 'off'}\n onPointerDown={(e) => {\n e.preventDefault();\n handleClick();\n ReactEditor.focus(editor);\n }}\n aria-disabled={disabled}\n disabled={disabled}\n aria-label={labelMessage}\n asChild\n >\n <FlexButton\n tag=\"button\"\n background={isActive ? 'primary100' : ''}\n alignItems=\"center\"\n justifyContent=\"center\"\n width={7}\n height={7}\n hasRadius\n type=\"button\"\n >\n <Icon fill={disabled ? 'neutral300' : enabledColor} />\n </FlexButton>\n </Toolbar.ToggleItem>\n </Tooltip>\n );\n};\n\nconst BlocksDropdown = () => {\n const { editor, blocks, disabled } = useBlocksEditorContext('BlocksDropdown');\n const { formatMessage } = useIntl();\n const { modalElement, handleConversionResult } = useConversionModal();\n const isMobile = useIsMobile();\n\n const blockKeysToInclude: SelectorBlockKey[] = getEntries(blocks).reduce<\n ReturnType<typeof getEntries>\n >((currentKeys, entry) => {\n const [key, block] = entry;\n\n return block.isInBlocksSelector ? [...currentKeys, key] : currentKeys;\n }, []);\n\n const [blockSelected, setBlockSelected] = React.useState<SelectorBlockKey>('paragraph');\n\n const handleSelect = (optionKey: unknown) => {\n if (!isSelectorBlockKey(optionKey)) {\n return;\n }\n\n const editorIsEmpty =\n editor.children.length === 1 && Editor.isEmpty(editor, editor.children[0]);\n\n if (!editor.selection && !editorIsEmpty) {\n // When there is no selection, create an empty block at the end of the editor\n // so that it can be converted to the selected block\n Transforms.insertNodes(\n editor,\n {\n type: 'quote',\n children: [{ type: 'text', text: '' }],\n },\n {\n select: true,\n // Since there's no selection, Slate will automatically insert the node at the end\n }\n );\n } else if (!editor.selection && editorIsEmpty) {\n // When there is no selection and the editor is empty,\n // select the empty paragraph from Slate's initialValue so it gets converted\n Transforms.select(editor, Editor.start(editor, [0, 0]));\n }\n\n // If selection is already a list block, toggle its format\n const currentListEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n });\n\n if (currentListEntry && ['list-ordered', 'list-unordered'].includes(optionKey)) {\n const [currentList, currentListPath] = currentListEntry;\n const format = optionKey === 'list-ordered' ? 'ordered' : 'unordered';\n\n if (!Editor.isEditor(currentList) && isListNode(currentList)) {\n // Format is different, toggle list format\n if (currentList.format !== format) {\n Transforms.setNodes(editor, { format }, { at: currentListPath });\n }\n }\n return;\n }\n\n // Let the block handle the Slate conversion logic\n const maybeRenderModal = blocks[optionKey].handleConvert?.(editor);\n handleConversionResult(maybeRenderModal);\n\n setBlockSelected(optionKey);\n\n ReactEditor.focus(editor);\n };\n\n /**\n * Prevent the select from focusing itself so ReactEditor.focus(editor) can focus the editor instead.\n *\n * The editor first loses focus to a blur event when clicking the select button. However,\n * refocusing the editor is not enough since the select's default behavior is to refocus itself\n * after an option is selected.\n *\n */\n const preventSelectFocus = (e: Event) => e.preventDefault();\n\n // Listen to the selection change and update the selected block in the dropdown\n React.useEffect(() => {\n if (editor.selection) {\n let selectedNode: Ancestor;\n\n // If selection anchor is a list-item, get its parent\n const currentListEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n at: editor.selection.anchor,\n });\n\n if (currentListEntry) {\n const [currentList] = currentListEntry;\n selectedNode = currentList;\n } else {\n // Get the parent node of the anchor other than list-item\n const [anchorNode] = Editor.parent(editor, editor.selection.anchor, {\n edge: 'start',\n depth: 2,\n });\n\n // @ts-expect-error slate's delete behaviour creates an exceptional type\n if (anchorNode.type === 'list-item') {\n // When the last node in the selection is a list item,\n // slate's default delete operation leaves an empty list-item instead of converting it into a paragraph.\n // Issue: https://github.com/ianstormtaylor/slate/issues/2500\n\n Transforms.setNodes(editor, { type: 'paragraph' });\n // @ts-expect-error convert explicitly type to paragraph\n selectedNode = { ...anchorNode, type: 'paragraph' };\n } else {\n selectedNode = anchorNode;\n }\n }\n\n // Find the block key that matches the anchor node\n const anchorBlockKey = getKeys(blocks).find(\n (blockKey) => !Editor.isEditor(selectedNode) && blocks[blockKey].matchNode(selectedNode)\n );\n\n // Change the value selected in the dropdown if it doesn't match the anchor block key\n if (anchorBlockKey && anchorBlockKey !== blockSelected) {\n setBlockSelected(anchorBlockKey as SelectorBlockKey);\n }\n }\n }, [editor.selection, editor, blocks, blockSelected]);\n\n const Icon = blocks[blockSelected].icon;\n\n return (\n <>\n <SelectWrapper>\n <SingleSelect\n startIcon={<Icon />}\n onChange={handleSelect}\n customizeContent={() => (isMobile ? '' : formatMessage(blocks[blockSelected].label))}\n value={blockSelected}\n onCloseAutoFocus={preventSelectFocus}\n aria-label={formatMessage({\n id: 'components.Blocks.blocks.selectBlock',\n defaultMessage: 'Select a block',\n })}\n disabled={disabled}\n >\n {blockKeysToInclude.map((key) => (\n <BlockOption\n key={key}\n value={key}\n label={blocks[key].label}\n icon={blocks[key].icon}\n blockSelected={blockSelected}\n />\n ))}\n </SingleSelect>\n </SelectWrapper>\n {modalElement}\n </>\n );\n};\n\ninterface BlockOptionProps {\n value: string;\n icon: React.ComponentType<React.SVGProps<SVGElement>>;\n label: MessageDescriptor;\n blockSelected: string;\n}\n\nconst BlockOption = ({ value, icon: Icon, label, blockSelected }: BlockOptionProps) => {\n const { formatMessage } = useIntl();\n\n const isSelected = value === blockSelected;\n\n return (\n <SingleSelectOption\n startIcon={<Icon fill={isSelected ? 'primary600' : 'neutral500'} />}\n value={value}\n >\n {formatMessage(label)}\n </SingleSelectOption>\n );\n};\n\nconst isListNode = (node: unknown): node is Block<'list'> => {\n return Node.isNode(node) && !Editor.isEditor(node) && node.type === 'list';\n};\n\ninterface ListButtonProps {\n block: BlocksStore['list-ordered'] | BlocksStore['list-unordered'];\n format: Block<'list'>['format'];\n location?: 'toolbar' | 'menu';\n}\n\nconst ListButton = ({ block, format, location = 'toolbar' }: ListButtonProps) => {\n const { formatMessage } = useIntl();\n const { editor, disabled, blocks } = useBlocksEditorContext('ListButton');\n\n const isListActive = () => {\n if (!editor.selection) return false;\n\n // Get the parent list at selection anchor node\n const currentListEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n at: editor.selection.anchor,\n });\n\n if (currentListEntry) {\n const [currentList] = currentListEntry;\n if (!Editor.isEditor(currentList) && isListNode(currentList) && currentList.format === format)\n return true;\n }\n\n return false;\n };\n\n /**\n * @TODO: Currently, applying list while multiple blocks are selected is not supported.\n * We should implement this feature in the future.\n */\n const isListDisabled = () => {\n // Always disabled when the whole editor is disabled\n if (disabled) {\n return true;\n }\n\n // Always enabled when there's no selection\n if (!editor.selection) {\n return false;\n }\n\n // Get the block node closest to the anchor and focus\n const anchorNodeEntry = Editor.above(editor, {\n at: editor.selection.anchor,\n match: (node) => !Editor.isEditor(node) && node.type !== 'text',\n });\n const focusNodeEntry = Editor.above(editor, {\n at: editor.selection.focus,\n match: (node) => !Editor.isEditor(node) && node.type !== 'text',\n });\n\n if (!anchorNodeEntry || !focusNodeEntry) {\n return false;\n }\n\n // Disabled if the anchor and focus are not in the same block\n return anchorNodeEntry[0] !== focusNodeEntry[0];\n };\n\n const toggleList = (format: Block<'list'>['format']) => {\n let currentListEntry;\n if (editor.selection) {\n currentListEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n });\n } else {\n // If no selection, toggle last inserted node\n const [_, lastNodePath] = Editor.last(editor, []);\n currentListEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n at: lastNodePath,\n });\n }\n\n if (!currentListEntry) {\n // If selection is not a list then convert it to list\n blocks[`list-${format}`].handleConvert!(editor);\n return;\n }\n\n // If selection is already a list then toggle format\n const [currentList, currentListPath] = currentListEntry;\n\n if (!Editor.isEditor(currentList) && isListNode(currentList)) {\n if (currentList.format !== format) {\n // Format is different, toggle list format\n Transforms.setNodes(editor, { format }, { at: currentListPath });\n } else {\n // Format is same, convert selected list-item to paragraph\n blocks['paragraph'].handleConvert!(editor);\n }\n }\n };\n\n if (location === 'menu') {\n const Icon = block.icon;\n\n return (\n <StyledMenuItem\n startIcon={<Icon />}\n onSelect={() => toggleList(format)}\n isActive={isListActive()}\n disabled={isListDisabled()}\n >\n {formatMessage(block.label)}\n </StyledMenuItem>\n );\n }\n\n return (\n <ToolbarButton\n icon={block.icon}\n name={format}\n label={block.label}\n isActive={isListActive()}\n disabled={isListDisabled()}\n handleClick={() => toggleList(format)}\n />\n );\n};\n\nconst LinkButton = ({\n disabled,\n location = 'toolbar',\n}: {\n disabled: boolean;\n location?: 'toolbar' | 'menu';\n}) => {\n const { editor } = useBlocksEditorContext('LinkButton');\n const { formatMessage } = useIntl();\n\n const isLinkActive = () => {\n const { selection } = editor;\n\n if (!selection) return false;\n\n const [match] = Array.from(\n Editor.nodes(editor, {\n at: Editor.unhangRange(editor, selection),\n match: (node) => SlateElement.isElement(node) && node.type === 'link',\n })\n );\n\n return Boolean(match);\n };\n\n const isLinkDisabled = () => {\n // Always disabled when the whole editor is disabled\n if (disabled) {\n return true;\n }\n\n // Always enabled when there's no selection\n if (!editor.selection) {\n return false;\n }\n\n // Get the block node closest to the anchor and focus\n const anchorNodeEntry = Editor.above(editor, {\n at: editor.selection.anchor,\n match: (node) => !Editor.isEditor(node) && node.type !== 'text',\n });\n const focusNodeEntry = Editor.above(editor, {\n at: editor.selection.focus,\n match: (node) => !Editor.isEditor(node) && node.type !== 'text',\n });\n\n if (!anchorNodeEntry || !focusNodeEntry) {\n return false;\n }\n\n // Disabled if the anchor and focus are not in the same block\n return anchorNodeEntry[0] !== focusNodeEntry[0];\n };\n\n const addLink = () => {\n editor.shouldSaveLinkPath = true;\n // We insert an empty anchor, so we split the DOM to have a element we can use as reference for the popover\n insertLink(editor, { url: '' });\n };\n\n const label = {\n id: 'components.Blocks.link',\n defaultMessage: 'Link',\n } as MessageDescriptor;\n\n if (location === 'menu') {\n return (\n <StyledMenuItem\n startIcon={<Link />}\n onSelect={addLink}\n isActive={isLinkActive()}\n disabled={isLinkDisabled()}\n >\n {formatMessage(label)}\n </StyledMenuItem>\n );\n }\n\n return (\n <ToolbarButton\n icon={Link}\n name=\"link\"\n label={label}\n isActive={isLinkActive()}\n handleClick={addLink}\n disabled={isLinkDisabled()}\n />\n );\n};\n\nconst StyledMenuItem = styled(Menu.Item)<{ isActive: boolean }>`\n ${(props) =>\n props.isActive &&\n css`\n color: ${({ theme }) => theme.colors.primary600};\n font-weight: 600;\n `}\n\n svg {\n fill: ${({ theme, isActive }) =>\n isActive ? theme.colors.primary600 : theme.colors.neutral500};\n }\n`;\n\nconst ReorderToolbarButtons = () => {\n const { editor, disabled, blocks, name, setLiveText } =\n useBlocksEditorContext('ReorderToolbarButtons');\n const { formatMessage } = useIntl();\n\n const selection = editor.selection;\n const totalBlocks = editor.children.length;\n\n const anchorIndex = selection ? selection.anchor.path[0] : null;\n const focusIndex = selection ? selection.focus.path[0] : null;\n const isSingleBlockSelection =\n anchorIndex !== null && focusIndex !== null && anchorIndex === focusIndex;\n\n const selectedTopLevelNode =\n isSingleBlockSelection && anchorIndex !== null ? editor.children[anchorIndex] : null;\n const selectedBlock =\n selectedTopLevelNode &&\n Object.values(blocks).find((block) => block.matchNode(selectedTopLevelNode));\n\n const isSelectedBlockDraggable =\n selectedTopLevelNode && selectedBlock\n ? (selectedBlock.isDraggable?.(selectedTopLevelNode) ?? true)\n : false;\n\n const canMoveUp =\n !disabled &&\n isSingleBlockSelection &&\n isSelectedBlockDraggable &&\n anchorIndex !== null &&\n anchorIndex > 0;\n const canMoveDown =\n !disabled &&\n isSingleBlockSelection &&\n isSelectedBlockDraggable &&\n anchorIndex !== null &&\n anchorIndex < totalBlocks - 1;\n\n const moveBlock = (direction: 'up' | 'down') => {\n if (!selection || anchorIndex === null) return;\n\n const currentIndex = [anchorIndex];\n const newIndex = [direction === 'up' ? anchorIndex - 1 : anchorIndex + 1];\n\n Transforms.moveNodes(editor, {\n at: currentIndex,\n to: newIndex,\n });\n\n // Keep the moved block focused so disabled states update immediately.\n Transforms.select(editor, Editor.start(editor, newIndex));\n ReactEditor.focus(editor);\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('components.Blocks.dnd.reorder'),\n defaultMessage: '{item}, moved. New position in the editor: {position}.',\n },\n {\n item: `${name}.${currentIndex[0] + 1}`,\n position: `${newIndex[0] + 1} of ${editor.children.length}`,\n }\n )\n );\n };\n\n return (\n <Flex direction=\"row\" gap={1}>\n <Tooltip\n label={formatMessage({\n id: getTranslation('components.DynamicZone.move-up'),\n defaultMessage: 'Move up',\n })}\n >\n <Toolbar.Button\n onPointerDown={(e) => {\n e.preventDefault();\n if (canMoveUp) moveBlock('up');\n }}\n aria-disabled={!canMoveUp}\n disabled={!canMoveUp}\n aria-label={formatMessage({\n id: getTranslation('components.DynamicZone.move-up'),\n defaultMessage: 'Move up',\n })}\n asChild\n >\n <FlexButton\n tag=\"button\"\n alignItems=\"center\"\n justifyContent=\"center\"\n width={7}\n height={7}\n hasRadius\n type=\"button\"\n >\n <ArrowUp fill={!canMoveUp ? 'neutral300' : 'neutral600'} />\n </FlexButton>\n </Toolbar.Button>\n </Tooltip>\n\n <Tooltip\n label={formatMessage({\n id: getTranslation('components.DynamicZone.move-down'),\n defaultMessage: 'Move down',\n })}\n >\n <Toolbar.Button\n onPointerDown={(e) => {\n e.preventDefault();\n if (canMoveDown) moveBlock('down');\n }}\n aria-disabled={!canMoveDown}\n disabled={!canMoveDown}\n aria-label={formatMessage({\n id: getTranslation('components.DynamicZone.move-down'),\n defaultMessage: 'Move down',\n })}\n asChild\n >\n <FlexButton\n tag=\"button\"\n alignItems=\"center\"\n justifyContent=\"center\"\n width={7}\n height={7}\n hasRadius\n type=\"button\"\n >\n <ArrowDown fill={!canMoveDown ? 'neutral300' : 'neutral600'} />\n </FlexButton>\n </Toolbar.Button>\n </Tooltip>\n </Flex>\n );\n};\n\nconst BlocksToolbar = () => {\n const { editor, blocks, modifiers, disabled } = useBlocksEditorContext('BlocksToolbar');\n const { formatMessage } = useIntl();\n const isMobile = useIsMobile();\n\n /**\n * The modifier buttons are disabled when an image is selected.\n */\n const checkButtonDisabled = () => {\n // Always disabled when the whole editor is disabled\n if (disabled) {\n return true;\n }\n\n if (!editor.selection) {\n return false;\n }\n\n const selectedNode = editor.children[editor.selection.anchor.path[0]];\n if (!selectedNode) return true;\n\n if (['image', 'code'].includes(selectedNode.type)) {\n return true;\n }\n\n return false;\n };\n\n const isButtonDisabled = checkButtonDisabled();\n\n /**\n * Observed components are ones that may or may not be visible in the toolbar, depending on the\n * available space. They provide two render props:\n * - renderInToolbar: for when we try to render the component in the toolbar (may be hidden)\n * - renderInMenu: for when the component didn't fit in the toolbar and is relegated\n * to the \"more\" menu\n */\n const observedComponents: ObservedComponent[] = [\n ...Object.entries(modifiers).map(([name, modifier]) => {\n const Icon = modifier.icon;\n const isActive = modifier.checkIsActive(editor);\n const handleSelect = () => modifier.handleToggle(editor);\n\n return {\n toolbar: (\n <ToolbarButton\n key={name}\n name={name}\n icon={modifier.icon}\n label={modifier.label}\n isActive={modifier.checkIsActive(editor)}\n handleClick={handleSelect}\n disabled={isButtonDisabled}\n />\n ),\n menu: (\n <StyledMenuItem startIcon={<Icon />} onSelect={handleSelect} isActive={isActive}>\n {formatMessage(modifier.label)}\n </StyledMenuItem>\n ),\n key: `modifier.${name}`,\n };\n }),\n {\n toolbar: <LinkButton disabled={isButtonDisabled} location=\"toolbar\" />,\n menu: <LinkButton disabled={isButtonDisabled} location=\"menu\" />,\n key: 'block.link',\n },\n {\n // List buttons can only be rendered together when in the toolbar\n toolbar: (\n <Flex direction=\"row\">\n <ToolbarSeparator style={{ marginLeft: '0.4rem' }} />\n <Toolbar.ToggleGroup type=\"single\" asChild>\n <Flex gap={1}>\n <ListButton block={blocks['list-unordered']} format=\"unordered\" location=\"toolbar\" />\n <ListButton block={blocks['list-ordered']} format=\"ordered\" location=\"toolbar\" />\n </Flex>\n </Toolbar.ToggleGroup>\n </Flex>\n ),\n menu: (\n <>\n <Menu.Separator />\n <ListButton block={blocks['list-unordered']} format=\"unordered\" location=\"menu\" />\n <ListButton block={blocks['list-ordered']} format=\"ordered\" location=\"menu\" />\n </>\n ),\n key: 'block.list',\n },\n ];\n\n return (\n <Toolbar.Root aria-disabled={disabled} asChild>\n <ToolbarWrapper padding={{ initial: 1, medium: 2 }} width=\"100%\">\n <BlocksDropdown />\n {isMobile && (\n <>\n <ToolbarSeparator />\n <ReorderToolbarButtons />\n </>\n )}\n <ToolbarSeparator />\n <Toolbar.ToggleGroup type=\"multiple\" asChild>\n <Flex direction=\"row\" gap={1} grow={1} overflow=\"hidden\">\n <EditorToolbarObserver observedComponents={observedComponents} />\n </Flex>\n </Toolbar.ToggleGroup>\n </ToolbarWrapper>\n </Toolbar.Root>\n );\n};\n\nexport { BlocksToolbar, useConversionModal };\n"],"names":["ToolbarWrapper","styled","Flex","theme","colors","neutral150","ToolbarSeparator","Toolbar","Separator","spaces","breakpoints","medium","FlexButton","primary100","SelectWrapper","Box","neutral600","useConversionModal","modalElement","setModalComponent","React","useState","handleConversionResult","renderModal","cloneElement","key","Date","now","ToolbarButton","icon","Icon","name","label","isActive","disabled","handleClick","editor","useBlocksEditorContext","formatMessage","useIntl","labelMessage","enabledColor","_jsx","Tooltip","ToggleItem","value","data-state","onPointerDown","e","preventDefault","ReactEditor","focus","aria-disabled","aria-label","asChild","tag","background","alignItems","justifyContent","width","height","hasRadius","type","fill","BlocksDropdown","blocks","isMobile","useIsMobile","blockKeysToInclude","getEntries","reduce","currentKeys","entry","block","isInBlocksSelector","blockSelected","setBlockSelected","handleSelect","optionKey","isSelectorBlockKey","editorIsEmpty","children","length","Editor","isEmpty","selection","Transforms","insertNodes","text","select","start","currentListEntry","above","match","node","isEditor","includes","currentList","currentListPath","format","isListNode","setNodes","at","maybeRenderModal","handleConvert","preventSelectFocus","useEffect","selectedNode","anchor","anchorNode","parent","edge","depth","anchorBlockKey","getKeys","find","blockKey","matchNode","_jsxs","_Fragment","SingleSelect","startIcon","onChange","customizeContent","onCloseAutoFocus","id","defaultMessage","map","BlockOption","isSelected","SingleSelectOption","Node","isNode","ListButton","location","isListActive","isListDisabled","anchorNodeEntry","focusNodeEntry","toggleList","_","lastNodePath","last","StyledMenuItem","onSelect","LinkButton","isLinkActive","Array","from","nodes","unhangRange","SlateElement","isElement","Boolean","isLinkDisabled","addLink","shouldSaveLinkPath","insertLink","url","Link","Menu","Item","props","css","primary600","neutral500","ReorderToolbarButtons","setLiveText","totalBlocks","anchorIndex","path","focusIndex","isSingleBlockSelection","selectedTopLevelNode","selectedBlock","Object","values","isSelectedBlockDraggable","isDraggable","canMoveUp","canMoveDown","moveBlock","direction","currentIndex","newIndex","moveNodes","to","getTranslation","item","position","gap","Button","ArrowUp","ArrowDown","BlocksToolbar","modifiers","checkButtonDisabled","isButtonDisabled","observedComponents","entries","modifier","checkIsActive","handleToggle","toolbar","menu","style","marginLeft","ToggleGroup","Root","padding","initial","grow","overflow","EditorToolbarObserver"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAMA,cAAAA,GAAiBC,uBAAsBC,CAAAA,iBAAAA,CAAK;;;gBAGlC,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;AAEzD,CAAC;AAED,MAAMC,gBAAmBL,GAAAA,uBAAAA,CAAOM,kBAAQC,CAAAA,SAAS,CAAC;cACpC,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;;eAGxC,EAAE,CAAC,EAAEF,KAAK,EAAE,GAAKA,KAAMM,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;gBAChC,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAKA,KAAMM,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;EAE/C,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAKA,KAAMO,CAAAA,WAAW,CAACC,MAAM,CAAC;iBAC3B,EAAE,CAAC,EAAER,KAAK,EAAE,GAAKA,KAAMM,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;kBAChC,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAKA,KAAMM,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;AAEnD,CAAC;AAED,MAAMG,UAAAA,GAAaX,uBAAgCC,CAAAA,iBAAAA,CAAK;;;;;;;;;;IAUpD,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMO,CAAAA,WAAW,CAACC,MAAM,CAAC;;oBAE1B,EAAE,CAAC,EAAER,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACS,UAAU,CAAC;;;;AAI7D,CAAC;AAED,MAAMC,aAAAA,GAAgBb,uBAAqBc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