@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
@@ -1,12 +1,14 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import * as Toolbar from '@radix-ui/react-toolbar';
4
+ import { useIsMobile } from '@strapi/admin/strapi-admin';
4
5
  import { Flex, Box, Menu, Tooltip, SingleSelect, SingleSelectOption } from '@strapi/design-system';
5
- import { Link } from '@strapi/icons';
6
+ import { Link, ArrowUp, ArrowDown } from '@strapi/icons';
6
7
  import { useIntl } from 'react-intl';
7
8
  import { Editor, Transforms, Node, Element } from 'slate';
8
9
  import { ReactEditor } from 'slate-react';
9
10
  import { styled, css } from 'styled-components';
11
+ import { getTranslation } from '../../../../../utils/translations.mjs';
10
12
  import { EditorToolbarObserver } from '../../EditorToolbarObserver.mjs';
11
13
  import { insertLink } from './Blocks/Link.mjs';
12
14
  import { useBlocksEditorContext, isSelectorBlockKey } from './BlocksEditor.mjs';
@@ -22,8 +24,13 @@ const ToolbarSeparator = styled(Toolbar.Separator)`
22
24
  background: ${({ theme })=>theme.colors.neutral150};
23
25
  width: 1px;
24
26
  height: 2.4rem;
25
- margin-left: 0.8rem;
26
- margin-right: 0.8rem;
27
+ margin-left: ${({ theme })=>theme.spaces[1]};
28
+ margin-right: ${({ theme })=>theme.spaces[1]};
29
+
30
+ ${({ theme })=>theme.breakpoints.medium} {
31
+ margin-left: ${({ theme })=>theme.spaces[2]};
32
+ margin-right: ${({ theme })=>theme.spaces[2]};
33
+ }
27
34
  `;
28
35
  const FlexButton = styled(Flex)`
29
36
  // Inherit the not-allowed cursor from ToolbarWrapper when disabled
@@ -34,9 +41,11 @@ const FlexButton = styled(Flex)`
34
41
  &[aria-disabled='false'] {
35
42
  cursor: pointer;
36
43
 
37
- // Only apply hover styles if the button is enabled
38
- &:hover {
39
- background: ${({ theme })=>theme.colors.primary100};
44
+ // Only apply hover styles if the button is enabled on desktop
45
+ ${({ theme })=>theme.breakpoints.medium} {
46
+ &:hover {
47
+ background: ${({ theme })=>theme.colors.primary100};
48
+ }
40
49
  }
41
50
  }
42
51
  `;
@@ -46,8 +55,17 @@ const SelectWrapper = styled(Box)`
46
55
  border: none;
47
56
  cursor: pointer;
48
57
  min-height: unset;
49
- padding-top: 6px;
50
- padding-bottom: 6px;
58
+ padding-top: ${({ theme })=>theme.spaces[2]};
59
+ padding-bottom: ${({ theme })=>theme.spaces[2]};
60
+ padding-left: ${({ theme })=>theme.spaces[4]};
61
+ padding-right: ${({ theme })=>theme.spaces[4]};
62
+ gap: ${({ theme })=>theme.spaces[2]};
63
+
64
+ ${({ theme })=>theme.breakpoints.medium} {
65
+ padding-top: ${({ theme })=>theme.spaces[1]};
66
+ padding-bottom: ${({ theme })=>theme.spaces[1]};
67
+ gap: ${({ theme })=>theme.spaces[4]};
68
+ }
51
69
 
52
70
  &[aria-disabled='false']:hover {
53
71
  cursor: pointer;
@@ -63,6 +81,13 @@ const SelectWrapper = styled(Box)`
63
81
  color: ${({ theme })=>theme.colors.neutral600};
64
82
  }
65
83
  }
84
+
85
+ & > span:first-child {
86
+ gap: ${({ theme })=>theme.spaces[0]};
87
+
88
+ ${({ theme })=>theme.breakpoints.medium} {
89
+ gap: ${({ theme })=>theme.spaces[3]};
90
+ }
66
91
  }
67
92
  `;
68
93
  /**
@@ -94,7 +119,7 @@ const ToolbarButton = ({ icon: Icon, name, label, isActive, disabled, handleClic
94
119
  children: /*#__PURE__*/ jsx(Toolbar.ToggleItem, {
95
120
  value: name,
96
121
  "data-state": isActive ? 'on' : 'off',
97
- onMouseDown: (e)=>{
122
+ onPointerDown: (e)=>{
98
123
  e.preventDefault();
99
124
  handleClick();
100
125
  ReactEditor.focus(editor);
@@ -123,6 +148,7 @@ const BlocksDropdown = ()=>{
123
148
  const { editor, blocks, disabled } = useBlocksEditorContext('BlocksDropdown');
124
149
  const { formatMessage } = useIntl();
125
150
  const { modalElement, handleConversionResult } = useConversionModal();
151
+ const isMobile = useIsMobile();
126
152
  const blockKeysToInclude = getEntries(blocks).reduce((currentKeys, entry)=>{
127
153
  const [key, block] = entry;
128
154
  return block.isInBlocksSelector ? [
@@ -249,7 +275,7 @@ const BlocksDropdown = ()=>{
249
275
  children: /*#__PURE__*/ jsx(SingleSelect, {
250
276
  startIcon: /*#__PURE__*/ jsx(Icon, {}),
251
277
  onChange: handleSelect,
252
- placeholder: formatMessage(blocks[blockSelected].label),
278
+ customizeContent: ()=>isMobile ? '' : formatMessage(blocks[blockSelected].label),
253
279
  value: blockSelected,
254
280
  onCloseAutoFocus: preventSelectFocus,
255
281
  "aria-label": formatMessage({
@@ -455,9 +481,115 @@ const StyledMenuItem = styled(Menu.Item)`
455
481
  fill: ${({ theme, isActive })=>isActive ? theme.colors.primary600 : theme.colors.neutral500};
456
482
  }
457
483
  `;
484
+ const ReorderToolbarButtons = ()=>{
485
+ const { editor, disabled, blocks, name, setLiveText } = useBlocksEditorContext('ReorderToolbarButtons');
486
+ const { formatMessage } = useIntl();
487
+ const selection = editor.selection;
488
+ const totalBlocks = editor.children.length;
489
+ const anchorIndex = selection ? selection.anchor.path[0] : null;
490
+ const focusIndex = selection ? selection.focus.path[0] : null;
491
+ const isSingleBlockSelection = anchorIndex !== null && focusIndex !== null && anchorIndex === focusIndex;
492
+ const selectedTopLevelNode = isSingleBlockSelection && anchorIndex !== null ? editor.children[anchorIndex] : null;
493
+ const selectedBlock = selectedTopLevelNode && Object.values(blocks).find((block)=>block.matchNode(selectedTopLevelNode));
494
+ const isSelectedBlockDraggable = selectedTopLevelNode && selectedBlock ? selectedBlock.isDraggable?.(selectedTopLevelNode) ?? true : false;
495
+ const canMoveUp = !disabled && isSingleBlockSelection && isSelectedBlockDraggable && anchorIndex !== null && anchorIndex > 0;
496
+ const canMoveDown = !disabled && isSingleBlockSelection && isSelectedBlockDraggable && anchorIndex !== null && anchorIndex < totalBlocks - 1;
497
+ const moveBlock = (direction)=>{
498
+ if (!selection || anchorIndex === null) return;
499
+ const currentIndex = [
500
+ anchorIndex
501
+ ];
502
+ const newIndex = [
503
+ direction === 'up' ? anchorIndex - 1 : anchorIndex + 1
504
+ ];
505
+ Transforms.moveNodes(editor, {
506
+ at: currentIndex,
507
+ to: newIndex
508
+ });
509
+ // Keep the moved block focused so disabled states update immediately.
510
+ Transforms.select(editor, Editor.start(editor, newIndex));
511
+ ReactEditor.focus(editor);
512
+ setLiveText(formatMessage({
513
+ id: getTranslation('components.Blocks.dnd.reorder'),
514
+ defaultMessage: '{item}, moved. New position in the editor: {position}.'
515
+ }, {
516
+ item: `${name}.${currentIndex[0] + 1}`,
517
+ position: `${newIndex[0] + 1} of ${editor.children.length}`
518
+ }));
519
+ };
520
+ return /*#__PURE__*/ jsxs(Flex, {
521
+ direction: "row",
522
+ gap: 1,
523
+ children: [
524
+ /*#__PURE__*/ jsx(Tooltip, {
525
+ label: formatMessage({
526
+ id: getTranslation('components.DynamicZone.move-up'),
527
+ defaultMessage: 'Move up'
528
+ }),
529
+ children: /*#__PURE__*/ jsx(Toolbar.Button, {
530
+ onPointerDown: (e)=>{
531
+ e.preventDefault();
532
+ if (canMoveUp) moveBlock('up');
533
+ },
534
+ "aria-disabled": !canMoveUp,
535
+ disabled: !canMoveUp,
536
+ "aria-label": formatMessage({
537
+ id: getTranslation('components.DynamicZone.move-up'),
538
+ defaultMessage: 'Move up'
539
+ }),
540
+ asChild: true,
541
+ children: /*#__PURE__*/ jsx(FlexButton, {
542
+ tag: "button",
543
+ alignItems: "center",
544
+ justifyContent: "center",
545
+ width: 7,
546
+ height: 7,
547
+ hasRadius: true,
548
+ type: "button",
549
+ children: /*#__PURE__*/ jsx(ArrowUp, {
550
+ fill: !canMoveUp ? 'neutral300' : 'neutral600'
551
+ })
552
+ })
553
+ })
554
+ }),
555
+ /*#__PURE__*/ jsx(Tooltip, {
556
+ label: formatMessage({
557
+ id: getTranslation('components.DynamicZone.move-down'),
558
+ defaultMessage: 'Move down'
559
+ }),
560
+ children: /*#__PURE__*/ jsx(Toolbar.Button, {
561
+ onPointerDown: (e)=>{
562
+ e.preventDefault();
563
+ if (canMoveDown) moveBlock('down');
564
+ },
565
+ "aria-disabled": !canMoveDown,
566
+ disabled: !canMoveDown,
567
+ "aria-label": formatMessage({
568
+ id: getTranslation('components.DynamicZone.move-down'),
569
+ defaultMessage: 'Move down'
570
+ }),
571
+ asChild: true,
572
+ children: /*#__PURE__*/ jsx(FlexButton, {
573
+ tag: "button",
574
+ alignItems: "center",
575
+ justifyContent: "center",
576
+ width: 7,
577
+ height: 7,
578
+ hasRadius: true,
579
+ type: "button",
580
+ children: /*#__PURE__*/ jsx(ArrowDown, {
581
+ fill: !canMoveDown ? 'neutral300' : 'neutral600'
582
+ })
583
+ })
584
+ })
585
+ })
586
+ ]
587
+ });
588
+ };
458
589
  const BlocksToolbar = ()=>{
459
590
  const { editor, blocks, modifiers, disabled } = useBlocksEditorContext('BlocksToolbar');
460
591
  const { formatMessage } = useIntl();
592
+ const isMobile = useIsMobile();
461
593
  /**
462
594
  * The modifier buttons are disabled when an image is selected.
463
595
  */ const checkButtonDisabled = ()=>{
@@ -572,10 +704,19 @@ const BlocksToolbar = ()=>{
572
704
  "aria-disabled": disabled,
573
705
  asChild: true,
574
706
  children: /*#__PURE__*/ jsxs(ToolbarWrapper, {
575
- padding: 2,
707
+ padding: {
708
+ initial: 1,
709
+ medium: 2
710
+ },
576
711
  width: "100%",
577
712
  children: [
578
713
  /*#__PURE__*/ jsx(BlocksDropdown, {}),
714
+ isMobile && /*#__PURE__*/ jsxs(Fragment, {
715
+ children: [
716
+ /*#__PURE__*/ jsx(ToolbarSeparator, {}),
717
+ /*#__PURE__*/ jsx(ReorderToolbarButtons, {})
718
+ ]
719
+ }),
579
720
  /*#__PURE__*/ jsx(ToolbarSeparator, {}),
580
721
  /*#__PURE__*/ jsx(Toolbar.ToggleGroup, {
581
722
  type: "multiple",
@@ -1 +1 @@
1
- {"version":3,"file":"BlocksToolbar.mjs","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,MAAsBC,CAAAA,IAAAA,CAAK;;;gBAGlC,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;AAEzD,CAAC;AAED,MAAMC,gBAAmBL,GAAAA,MAAAA,CAAOM,OAAQC,CAAAA,SAAS,CAAC;cACpC,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;;;;AAKvD,CAAC;AAED,MAAMI,UAAAA,GAAaR,MAAgCC,CAAAA,IAAAA,CAAK;;;;;;;;;;;kBAWtC,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACM,UAAU,CAAC;;;AAG3D,CAAC;AAED,MAAMC,aAAAA,GAAgBV,MAAqBW,CAAAA,GAAAA,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,SAASC,kBAAAA,GAAAA;AACP,IAAA,MAAM,CAACC,YAAcC,EAAAA,iBAAAA,CAAkB,GAAGC,KAAAA,CAAMC,QAAQ,CAA2B,IAAA,CAAA;AAEnF,IAAA,MAAMC,yBAAyB,CAACC,WAAAA,GAAAA;;AAE9B,QAAA,IAAIA,WAAa,EAAA;;;YAGfJ,iBAAkBC,eAAAA,KAAAA,CAAMI,YAAY,CAACD,WAAe,EAAA,EAAA;AAAEE,gBAAAA,GAAAA,EAAKC,KAAKC,GAAG;AAAG,a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,WAAW,EAAA;oBAACtH,IAAK,EAAA,UAAA;oBAAWR,OAAO,EAAA,IAAA;AAC1C,oBAAA,QAAA,gBAAAZ,GAACrC,CAAAA,IAAAA,EAAAA;wBAAK4K,SAAU,EAAA,KAAA;wBAAMI,GAAK,EAAA,CAAA;wBAAGG,IAAM,EAAA,CAAA;wBAAGC,QAAS,EAAA,QAAA;AAC9C,wBAAA,QAAA,gBAAA/I,GAACgJ,CAAAA,qBAAAA,EAAAA;4BAAsBjB,kBAAoBA,EAAAA;;;;;;;AAMvD;;;;"}
1
+ {"version":3,"file":"BlocksToolbar.mjs","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,MAAsBC,CAAAA,IAAAA,CAAK;;;gBAGlC,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;AAEzD,CAAC;AAED,MAAMC,gBAAmBL,GAAAA,MAAAA,CAAOM,OAAQC,CAAAA,SAAS,CAAC;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A;AAC9C,wBAAA,QAAA,gBAAA1K,GAAC2K,CAAAA,qBAAAA,EAAAA;4BAAsBf,kBAAoBA,EAAAA;;;;;;;AAMvD;;;;"}
@@ -42,21 +42,68 @@ const InlineCode = styledComponents.styled.code`
42
42
  /**
43
43
  * The default handler for checking if a modifier is active
44
44
  */ const baseCheckIsActive = (editor, name)=>{
45
- const marks = slate.Editor.marks(editor);
46
- if (!marks) return false;
47
- return Boolean(marks[name]);
45
+ const { selection } = editor;
46
+ // If there's no selection, fall back to Slate's current marks.
47
+ // (This is what will be applied to newly inserted text.)
48
+ if (!selection) {
49
+ const marks = slate.Editor.marks(editor);
50
+ return Boolean(marks?.[name]);
51
+ }
52
+ // Collapsed selection (caret): current marks are reliable.
53
+ if (slate.Range.isCollapsed(selection)) {
54
+ const marks = slate.Editor.marks(editor);
55
+ return Boolean(marks?.[name]);
56
+ }
57
+ /**
58
+ * Expanded selection: derive "active" state from the selected text nodes.
59
+ *
60
+ * This avoids a common mobile edge case where the selection focus can sit just
61
+ * outside the formatted span (so relying on caret/focus marks would be wrong).
62
+ *
63
+ * Additionally, mobile selection often includes an extra whitespace character at
64
+ * the edge (e.g. the trailing space after a word). We ignore whitespace-only
65
+ * portions when computing active state so the toolbar reflects the intended
66
+ * formatted text.
67
+ */ const range = slate.Editor.unhangRange(editor, selection);
68
+ const selectedTextEntries = Array.from(slate.Editor.nodes(editor, {
69
+ at: range,
70
+ match: slate.Text.isText,
71
+ mode: 'all'
72
+ }));
73
+ if (selectedTextEntries.length === 0) return false;
74
+ const summary = selectedTextEntries.reduce((acc, [node, path])=>{
75
+ const nodeRange = slate.Editor.range(editor, path);
76
+ const intersection = slate.Range.intersection(range, nodeRange);
77
+ if (!intersection) {
78
+ return acc;
79
+ }
80
+ const start = Math.min(intersection.anchor.offset, intersection.focus.offset);
81
+ const end = Math.max(intersection.anchor.offset, intersection.focus.offset);
82
+ const selectedSlice = node.text.slice(start, end);
83
+ // Ignore whitespace-only slices (common in mobile selection boundaries).
84
+ if (selectedSlice.trim().length === 0) {
85
+ return acc;
86
+ }
87
+ return {
88
+ hasNonWhitespaceSelection: true,
89
+ isEveryRelevantNodeMarked: acc.isEveryRelevantNodeMarked && Boolean(node[name])
90
+ };
91
+ }, {
92
+ hasNonWhitespaceSelection: false,
93
+ isEveryRelevantNodeMarked: true
94
+ });
95
+ return summary.hasNonWhitespaceSelection && summary.isEveryRelevantNodeMarked;
48
96
  };
49
97
  /**
50
98
  * The default handler for toggling a modifier
51
99
  */ const baseHandleToggle = (editor, name)=>{
52
- const marks = slate.Editor.marks(editor);
53
100
  // If there is no selection, set selection to the end of line
54
101
  if (!editor.selection) {
55
102
  const endOfEditor = slate.Editor.end(editor, []);
56
103
  slate.Transforms.select(editor, endOfEditor);
57
104
  }
58
105
  // Toggle the modifier
59
- if (marks?.[name]) {
106
+ if (baseCheckIsActive(editor, name)) {
60
107
  slate.Editor.removeMark(editor, name);
61
108
  } else {
62
109
  slate.Editor.addMark(editor, name, true);
@@ -1 +1 @@
1
- {"version":3,"file":"Modifiers.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Modifiers.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Typography, TypographyComponent } from '@strapi/design-system';\nimport { Bold, Italic, Underline, StrikeThrough, Code } from '@strapi/icons';\nimport { type MessageDescriptor } from 'react-intl';\nimport { Editor, Text, Transforms } from 'slate';\nimport { styled, css } from 'styled-components';\n\nconst stylesToInherit = css`\n font-size: inherit;\n color: inherit;\n line-height: inherit;\n`;\n\nconst BoldText = styled<TypographyComponent>(Typography).attrs({ fontWeight: 'bold' })`\n ${stylesToInherit}\n`;\n\nconst ItalicText = styled<TypographyComponent>(Typography)`\n font-style: italic;\n ${stylesToInherit}\n`;\n\nconst UnderlineText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'underline',\n})`\n ${stylesToInherit}\n`;\n\nconst StrikeThroughText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'line-through',\n})`\n ${stylesToInherit}\n`;\n\nconst InlineCode = styled.code`\n background-color: ${({ theme }) => theme.colors.neutral150};\n border-radius: ${({ theme }) => theme.borderRadius};\n padding: ${({ theme }) => `0 ${theme.spaces[2]}`};\n font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,\n monospace;\n color: inherit;\n`;\n\ntype ModifierKey = Exclude<keyof Text, 'type' | 'text'>;\n\ntype ModifiersStore = {\n [K in ModifierKey]: {\n icon: React.ComponentType;\n isValidEventKey: (event: React.KeyboardEvent<HTMLElement>) => boolean;\n label: MessageDescriptor;\n checkIsActive: (editor: Editor) => boolean;\n handleToggle: (editor: Editor) => void;\n renderLeaf: (children: React.JSX.Element | string) => React.JSX.Element;\n };\n};\n\n/**\n * The default handler for checking if a modifier is active\n */\nconst baseCheckIsActive = (editor: Editor, name: ModifierKey) => {\n const marks = Editor.marks(editor);\n if (!marks) return false;\n\n return Boolean(marks[name]);\n};\n\n/**\n * The default handler for toggling a modifier\n */\nconst baseHandleToggle = (editor: Editor, name: ModifierKey) => {\n const marks = Editor.marks(editor);\n\n // If there is no selection, set selection to the end of line\n if (!editor.selection) {\n const endOfEditor = Editor.end(editor, []);\n Transforms.select(editor, endOfEditor);\n }\n\n // Toggle the modifier\n if (marks?.[name]) {\n Editor.removeMark(editor, name);\n } else {\n Editor.addMark(editor, name, true);\n }\n};\n\nconst modifiers: ModifiersStore = {\n bold: {\n icon: Bold,\n isValidEventKey: (event) => event.key === 'b',\n label: { id: 'components.Blocks.modifiers.bold', defaultMessage: 'Bold' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'bold'),\n handleToggle: (editor) => baseHandleToggle(editor, 'bold'),\n renderLeaf: (children) => <BoldText>{children}</BoldText>,\n },\n italic: {\n icon: Italic,\n isValidEventKey: (event) => event.key === 'i',\n label: { id: 'components.Blocks.modifiers.italic', defaultMessage: 'Italic' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'italic'),\n handleToggle: (editor) => baseHandleToggle(editor, 'italic'),\n renderLeaf: (children) => <ItalicText>{children}</ItalicText>,\n },\n underline: {\n icon: Underline,\n isValidEventKey: (event) => event.key === 'u',\n label: { id: 'components.Blocks.modifiers.underline', defaultMessage: 'Underline' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'underline'),\n handleToggle: (editor) => baseHandleToggle(editor, 'underline'),\n renderLeaf: (children) => <UnderlineText>{children}</UnderlineText>,\n },\n strikethrough: {\n icon: StrikeThrough,\n isValidEventKey: (event) => event.key === 'S' && event.shiftKey,\n label: { id: 'components.Blocks.modifiers.strikethrough', defaultMessage: 'Strikethrough' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'strikethrough'),\n handleToggle: (editor) => baseHandleToggle(editor, 'strikethrough'),\n renderLeaf: (children) => <StrikeThroughText>{children}</StrikeThroughText>,\n },\n code: {\n icon: Code,\n isValidEventKey: (event) => event.key === 'e',\n label: { id: 'components.Blocks.modifiers.code', defaultMessage: 'Inline code' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'code'),\n handleToggle: (editor) => baseHandleToggle(editor, 'code'),\n renderLeaf: (children) => <InlineCode>{children}</InlineCode>,\n },\n};\n\nexport { type ModifiersStore, modifiers };\n"],"names":["stylesToInherit","css","BoldText","styled","Typography","attrs","fontWeight","ItalicText","UnderlineText","textDecoration","StrikeThroughText","InlineCode","code","theme","colors","neutral150","borderRadius","spaces","baseCheckIsActive","editor","name","marks","Editor","Boolean","baseHandleToggle","selection","endOfEditor","end","Transforms","select","removeMark","addMark","modifiers","bold","icon","Bold","isValidEventKey","event","key","label","id","defaultMessage","checkIsActive","handleToggle","renderLeaf","children","_jsx","italic","Italic","underline","Underline","strikethrough","StrikeThrough","shiftKey","Code"],"mappings":";;;;;;;;;AAQA,MAAMA,eAAAA,GAAkBC,oBAAG;;;;AAI3B,CAAC;AAED,MAAMC,QAAWC,GAAAA,uBAAAA,CAA4BC,uBAAYC,CAAAA,CAAAA,KAAK,CAAC;IAAEC,U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AAiB,CAACC,KAAAA,GAAUA,KAAMC,CAAAA,GAAG,KAAK,GAAA;QAC1CC,KAAO,EAAA;YAAEC,EAAI,EAAA,kCAAA;YAAoCC,cAAgB,EAAA;AAAc,SAAA;QAC/EC,aAAe,EAAA,CAACvB,MAAWD,GAAAA,iBAAAA,CAAkBC,MAAQ,EAAA,MAAA,CAAA;QACrDwB,YAAc,EAAA,CAACxB,MAAWK,GAAAA,gBAAAA,CAAiBL,MAAQ,EAAA,MAAA,CAAA;QACnDyB,UAAY,EAAA,CAACC,yBAAaC,cAACnC,CAAAA,UAAAA,EAAAA;AAAYkC,gBAAAA,QAAAA,EAAAA;;AACzC;AACF;;;;"}
1
+ {"version":3,"file":"Modifiers.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Modifiers.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Typography, TypographyComponent } from '@strapi/design-system';\nimport { Bold, Italic, Underline, StrikeThrough, Code } from '@strapi/icons';\nimport { type MessageDescriptor } from 'react-intl';\nimport { Editor, type NodeEntry, Range, Text, Transforms } from 'slate';\nimport { styled, css } from 'styled-components';\n\nconst stylesToInherit = css`\n font-size: inherit;\n color: inherit;\n line-height: inherit;\n`;\n\nconst BoldText = styled<TypographyComponent>(Typography).attrs({ fontWeight: 'bold' })`\n ${stylesToInherit}\n`;\n\nconst ItalicText = styled<TypographyComponent>(Typography)`\n font-style: italic;\n ${stylesToInherit}\n`;\n\nconst UnderlineText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'underline',\n})`\n ${stylesToInherit}\n`;\n\nconst StrikeThroughText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'line-through',\n})`\n ${stylesToInherit}\n`;\n\nconst InlineCode = styled.code`\n background-color: ${({ theme }) => theme.colors.neutral150};\n border-radius: ${({ theme }) => theme.borderRadius};\n padding: ${({ theme }) => `0 ${theme.spaces[2]}`};\n font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,\n monospace;\n color: inherit;\n`;\n\ntype ModifierKey = Exclude<keyof Text, 'type' | 'text'>;\n\ntype ModifiersStore = {\n [K in ModifierKey]: {\n icon: React.ComponentType;\n isValidEventKey: (event: React.KeyboardEvent<HTMLElement>) => boolean;\n label: MessageDescriptor;\n checkIsActive: (editor: Editor) => boolean;\n handleToggle: (editor: Editor) => void;\n renderLeaf: (children: React.JSX.Element | string) => React.JSX.Element;\n };\n};\n\n/**\n * The default handler for checking if a modifier is active\n */\nconst baseCheckIsActive = (editor: Editor, name: ModifierKey) => {\n const { selection } = editor;\n\n // If there's no selection, fall back to Slate's current marks.\n // (This is what will be applied to newly inserted text.)\n if (!selection) {\n const marks = Editor.marks(editor);\n return Boolean(marks?.[name]);\n }\n\n // Collapsed selection (caret): current marks are reliable.\n if (Range.isCollapsed(selection)) {\n const marks = Editor.marks(editor);\n return Boolean(marks?.[name]);\n }\n\n /**\n * Expanded selection: derive \"active\" state from the selected text nodes.\n *\n * This avoids a common mobile edge case where the selection focus can sit just\n * outside the formatted span (so relying on caret/focus marks would be wrong).\n *\n * Additionally, mobile selection often includes an extra whitespace character at\n * the edge (e.g. the trailing space after a word). We ignore whitespace-only\n * portions when computing active state so the toolbar reflects the intended\n * formatted text.\n */\n const range = Editor.unhangRange(editor, selection);\n const selectedTextEntries = Array.from(\n Editor.nodes(editor, { at: range, match: Text.isText, mode: 'all' })\n ) as NodeEntry<Text>[];\n\n if (selectedTextEntries.length === 0) return false;\n\n const summary = selectedTextEntries.reduce(\n (acc, [node, path]) => {\n const nodeRange = Editor.range(editor, path);\n const intersection = Range.intersection(range, nodeRange);\n\n if (!intersection) {\n return acc;\n }\n\n const start = Math.min(intersection.anchor.offset, intersection.focus.offset);\n const end = Math.max(intersection.anchor.offset, intersection.focus.offset);\n const selectedSlice = node.text.slice(start, end);\n\n // Ignore whitespace-only slices (common in mobile selection boundaries).\n if (selectedSlice.trim().length === 0) {\n return acc;\n }\n\n return {\n hasNonWhitespaceSelection: true,\n isEveryRelevantNodeMarked: acc.isEveryRelevantNodeMarked && Boolean(node[name]),\n };\n },\n { hasNonWhitespaceSelection: false, isEveryRelevantNodeMarked: true }\n );\n\n return summary.hasNonWhitespaceSelection && summary.isEveryRelevantNodeMarked;\n};\n\n/**\n * The default handler for toggling a modifier\n */\nconst baseHandleToggle = (editor: Editor, name: ModifierKey) => {\n // If there is no selection, set selection to the end of line\n if (!editor.selection) {\n const endOfEditor = Editor.end(editor, []);\n Transforms.select(editor, endOfEditor);\n }\n\n // Toggle the modifier\n if (baseCheckIsActive(editor, name)) {\n Editor.removeMark(editor, name);\n } else {\n Editor.addMark(editor, name, true);\n }\n};\n\nconst modifiers: ModifiersStore = {\n bold: {\n icon: Bold,\n isValidEventKey: (event) => event.key === 'b',\n label: { id: 'components.Blocks.modifiers.bold', defaultMessage: 'Bold' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'bold'),\n handleToggle: (editor) => baseHandleToggle(editor, 'bold'),\n renderLeaf: (children) => <BoldText>{children}</BoldText>,\n },\n italic: {\n icon: Italic,\n isValidEventKey: (event) => event.key === 'i',\n label: { id: 'components.Blocks.modifiers.italic', defaultMessage: 'Italic' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'italic'),\n handleToggle: (editor) => baseHandleToggle(editor, 'italic'),\n renderLeaf: (children) => <ItalicText>{children}</ItalicText>,\n },\n underline: {\n icon: Underline,\n isValidEventKey: (event) => event.key === 'u',\n label: { id: 'components.Blocks.modifiers.underline', defaultMessage: 'Underline' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'underline'),\n handleToggle: (editor) => baseHandleToggle(editor, 'underline'),\n renderLeaf: (children) => <UnderlineText>{children}</UnderlineText>,\n },\n strikethrough: {\n icon: StrikeThrough,\n isValidEventKey: (event) => event.key === 'S' && event.shiftKey,\n label: { id: 'components.Blocks.modifiers.strikethrough', defaultMessage: 'Strikethrough' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'strikethrough'),\n handleToggle: (editor) => baseHandleToggle(editor, 'strikethrough'),\n renderLeaf: (children) => <StrikeThroughText>{children}</StrikeThroughText>,\n },\n code: {\n icon: Code,\n isValidEventKey: (event) => event.key === 'e',\n label: { id: 'components.Blocks.modifiers.code', defaultMessage: 'Inline code' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'code'),\n handleToggle: (editor) => baseHandleToggle(editor, 'code'),\n renderLeaf: (children) => <InlineCode>{children}</InlineCode>,\n },\n};\n\nexport { type ModifiersStore, modifiers };\n"],"names":["stylesToInherit","css","BoldText","styled","Typography","attrs","fontWeight","ItalicText","UnderlineText","textDecoration","StrikeThroughText","InlineCode","code","theme","colors","neutral150","borderRadius","spaces","baseCheckIsActive","editor","name","selection","marks","Editor","Boolean","Range","isCollapsed","range","unhangRange","selectedTextEntries","Array","from","nodes","at","match","Text","isText","mode","length","summary","reduce","acc","node","path","nodeRange","intersection","start","Math","min","anchor","offset","focus","end","max","selectedSlice","text","slice","trim","hasNonWhitespaceSelection","isEveryRelevantNodeMarked","baseHandleToggle","endOfEditor","Transforms","select","removeMark","addMark","modifiers","bold","icon","Bold","isValidEventKey","event","key","label","id","defaultMessage","checkIsActive","handleToggle","renderLeaf","children","_jsx","italic","Italic","underline","Underline","strikethrough","StrikeThrough","shiftKey","Code"],"mappings":";;;;;;;;;AAQA,MAAMA,eAAAA,GAAkBC,oBAAG;;;;AAI3B,CAAC;AAED,MAAMC,QAAWC,GAAAA,uBAAAA,CAA4BC,uBAAYC,CAAAA,CAAAA,KAAK,CAAC;IAAEC,UAAY,EAAA;AAAO,CAAA,CAAE;AACpF,EAAA,EAAEN,eAAgB;AACpB,CAAC;AAED,MAAMO,UAAAA,GAAaJ,uBAA4BC,CAAAA,uBAAAA,CAAW;;AAExD,EAAA,EAAEJ,eAAgB;AACpB,CAAC;AAED,MAAMQ,aAAgBL,GAAAA,uBAAAA,CAA4BC,uBAAYC,CAAAA,CAAAA,KAAK,CAAC;IAClEI,cAAgB,EAAA;AAClB,CAAA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