@strapi/content-manager 0.0.0-next.0791cd2736057a8f66ee1682f02c46307a4d6e4a → 0.0.0-next.0fc44faf3ab6f94c481a4d426988705776878bb3

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 (156) hide show
  1. package/dist/admin/components/LeftMenu.js +34 -30
  2. package/dist/admin/components/LeftMenu.js.map +1 -1
  3. package/dist/admin/components/LeftMenu.mjs +36 -32
  4. package/dist/admin/components/LeftMenu.mjs.map +1 -1
  5. package/dist/admin/components/Widgets.js +161 -0
  6. package/dist/admin/components/Widgets.js.map +1 -0
  7. package/dist/admin/components/Widgets.mjs +158 -0
  8. package/dist/admin/components/Widgets.mjs.map +1 -0
  9. package/dist/admin/hooks/useDocumentActions.js +5 -1
  10. package/dist/admin/hooks/useDocumentActions.js.map +1 -1
  11. package/dist/admin/hooks/useDocumentActions.mjs +5 -1
  12. package/dist/admin/hooks/useDocumentActions.mjs.map +1 -1
  13. package/dist/admin/hooks/useDocumentContext.js.map +1 -1
  14. package/dist/admin/hooks/useDocumentContext.mjs.map +1 -1
  15. package/dist/admin/index.js +42 -5
  16. package/dist/admin/index.js.map +1 -1
  17. package/dist/admin/index.mjs +42 -3
  18. package/dist/admin/index.mjs.map +1 -1
  19. package/dist/admin/pages/EditView/components/DocumentActions.js +230 -28
  20. package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
  21. package/dist/admin/pages/EditView/components/DocumentActions.mjs +232 -30
  22. package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
  23. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js +7 -12
  24. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js.map +1 -1
  25. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs +8 -13
  26. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs.map +1 -1
  27. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js +19 -33
  28. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js.map +1 -1
  29. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs +19 -33
  30. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs.map +1 -1
  31. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/EditorLayout.js +46 -95
  32. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/EditorLayout.js.map +1 -1
  33. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/EditorLayout.mjs +48 -78
  34. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/EditorLayout.mjs.map +1 -1
  35. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js +2 -0
  36. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js.map +1 -1
  37. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs +2 -0
  38. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs.map +1 -1
  39. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js +128 -55
  40. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js.map +1 -1
  41. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs +128 -55
  42. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs.map +1 -1
  43. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js +89 -50
  44. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
  45. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs +91 -52
  46. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
  47. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.js +50 -97
  48. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.js.map +1 -1
  49. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.mjs +51 -79
  50. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.mjs.map +1 -1
  51. package/dist/admin/pages/EditView/components/FormLayout.js +3 -3
  52. package/dist/admin/pages/EditView/components/FormLayout.js.map +1 -1
  53. package/dist/admin/pages/EditView/components/FormLayout.mjs +3 -3
  54. package/dist/admin/pages/EditView/components/FormLayout.mjs.map +1 -1
  55. package/dist/admin/pages/ListView/ListViewPage.js +77 -0
  56. package/dist/admin/pages/ListView/ListViewPage.js.map +1 -1
  57. package/dist/admin/pages/ListView/ListViewPage.mjs +78 -1
  58. package/dist/admin/pages/ListView/ListViewPage.mjs.map +1 -1
  59. package/dist/admin/preview/components/PreviewHeader.js +1 -1
  60. package/dist/admin/preview/components/PreviewHeader.js.map +1 -1
  61. package/dist/admin/preview/components/PreviewHeader.mjs +1 -1
  62. package/dist/admin/preview/components/PreviewHeader.mjs.map +1 -1
  63. package/dist/admin/services/homepage.js +30 -0
  64. package/dist/admin/services/homepage.js.map +1 -0
  65. package/dist/admin/services/homepage.mjs +28 -0
  66. package/dist/admin/services/homepage.mjs.map +1 -0
  67. package/dist/admin/src/components/Widgets.d.ts +3 -0
  68. package/dist/admin/src/hooks/useDocumentContext.d.ts +1 -1
  69. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/EditorLayout.d.ts +2 -2
  70. package/dist/admin/src/pages/EditView/components/FormInputs/Relations/RelationModal.d.ts +26 -5
  71. package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +0 -1
  72. package/dist/admin/src/services/homepage.d.ts +5 -0
  73. package/dist/admin/translations/en.json.js +3 -1
  74. package/dist/admin/translations/en.json.js.map +1 -1
  75. package/dist/admin/translations/en.json.mjs +3 -1
  76. package/dist/admin/translations/en.json.mjs.map +1 -1
  77. package/dist/admin/translations/ru.json.js +235 -226
  78. package/dist/admin/translations/ru.json.js.map +1 -1
  79. package/dist/admin/translations/ru.json.mjs +230 -226
  80. package/dist/admin/translations/ru.json.mjs.map +1 -1
  81. package/dist/server/controllers/index.js +3 -1
  82. package/dist/server/controllers/index.js.map +1 -1
  83. package/dist/server/controllers/index.mjs +3 -1
  84. package/dist/server/controllers/index.mjs.map +1 -1
  85. package/dist/server/history/services/lifecycles.js +3 -0
  86. package/dist/server/history/services/lifecycles.js.map +1 -1
  87. package/dist/server/history/services/lifecycles.mjs +3 -0
  88. package/dist/server/history/services/lifecycles.mjs.map +1 -1
  89. package/dist/server/homepage/controllers/homepage.js +57 -0
  90. package/dist/server/homepage/controllers/homepage.js.map +1 -0
  91. package/dist/server/homepage/controllers/homepage.mjs +36 -0
  92. package/dist/server/homepage/controllers/homepage.mjs.map +1 -0
  93. package/dist/server/homepage/controllers/index.js +10 -0
  94. package/dist/server/homepage/controllers/index.js.map +1 -0
  95. package/dist/server/homepage/controllers/index.mjs +8 -0
  96. package/dist/server/homepage/controllers/index.mjs.map +1 -0
  97. package/dist/server/homepage/index.js +14 -0
  98. package/dist/server/homepage/index.js.map +1 -0
  99. package/dist/server/homepage/index.mjs +12 -0
  100. package/dist/server/homepage/index.mjs.map +1 -0
  101. package/dist/server/homepage/routes/homepage.js +25 -0
  102. package/dist/server/homepage/routes/homepage.js.map +1 -0
  103. package/dist/server/homepage/routes/homepage.mjs +23 -0
  104. package/dist/server/homepage/routes/homepage.mjs.map +1 -0
  105. package/dist/server/homepage/routes/index.js +13 -0
  106. package/dist/server/homepage/routes/index.js.map +1 -0
  107. package/dist/server/homepage/routes/index.mjs +11 -0
  108. package/dist/server/homepage/routes/index.mjs.map +1 -0
  109. package/dist/server/homepage/services/homepage.js +157 -0
  110. package/dist/server/homepage/services/homepage.js.map +1 -0
  111. package/dist/server/homepage/services/homepage.mjs +155 -0
  112. package/dist/server/homepage/services/homepage.mjs.map +1 -0
  113. package/dist/server/homepage/services/index.js +10 -0
  114. package/dist/server/homepage/services/index.js.map +1 -0
  115. package/dist/server/homepage/services/index.mjs +8 -0
  116. package/dist/server/homepage/services/index.mjs.map +1 -0
  117. package/dist/server/preview/services/preview.js +0 -1
  118. package/dist/server/preview/services/preview.js.map +1 -1
  119. package/dist/server/preview/services/preview.mjs +0 -1
  120. package/dist/server/preview/services/preview.mjs.map +1 -1
  121. package/dist/server/routes/index.js +3 -1
  122. package/dist/server/routes/index.js.map +1 -1
  123. package/dist/server/routes/index.mjs +3 -1
  124. package/dist/server/routes/index.mjs.map +1 -1
  125. package/dist/server/services/index.js +3 -1
  126. package/dist/server/services/index.js.map +1 -1
  127. package/dist/server/services/index.mjs +3 -1
  128. package/dist/server/services/index.mjs.map +1 -1
  129. package/dist/server/src/controllers/index.d.ts.map +1 -1
  130. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  131. package/dist/server/src/homepage/controllers/homepage.d.ts +7 -0
  132. package/dist/server/src/homepage/controllers/homepage.d.ts.map +1 -0
  133. package/dist/server/src/homepage/controllers/index.d.ts +2 -0
  134. package/dist/server/src/homepage/controllers/index.d.ts.map +1 -0
  135. package/dist/server/src/homepage/index.d.ts +16 -0
  136. package/dist/server/src/homepage/index.d.ts.map +1 -0
  137. package/dist/server/src/homepage/routes/homepage.d.ts +4 -0
  138. package/dist/server/src/homepage/routes/homepage.d.ts.map +1 -0
  139. package/dist/server/src/homepage/routes/index.d.ts +8 -0
  140. package/dist/server/src/homepage/routes/index.d.ts.map +1 -0
  141. package/dist/server/src/homepage/services/homepage.d.ts +11 -0
  142. package/dist/server/src/homepage/services/homepage.d.ts.map +1 -0
  143. package/dist/server/src/homepage/services/index.d.ts +9 -0
  144. package/dist/server/src/homepage/services/index.d.ts.map +1 -0
  145. package/dist/server/src/index.d.ts +8 -0
  146. package/dist/server/src/index.d.ts.map +1 -1
  147. package/dist/server/src/preview/services/preview.d.ts.map +1 -1
  148. package/dist/server/src/routes/index.d.ts +1 -0
  149. package/dist/server/src/routes/index.d.ts.map +1 -1
  150. package/dist/server/src/services/data-mapper.d.ts +1 -0
  151. package/dist/server/src/services/data-mapper.d.ts.map +1 -1
  152. package/dist/server/src/services/index.d.ts +7 -0
  153. package/dist/server/src/services/index.d.ts.map +1 -1
  154. package/dist/shared/contracts/homepage.d.ts +25 -0
  155. package/dist/shared/contracts/homepage.d.ts.map +1 -0
  156. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"BlocksEditor.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { createContext, type FieldValue } from '@strapi/admin/strapi-admin';\nimport { IconButton, Divider, VisuallyHidden } from '@strapi/design-system';\nimport { Expand } from '@strapi/icons';\nimport { MessageDescriptor, useIntl } from 'react-intl';\nimport { Editor, type Descendant, createEditor } from 'slate';\nimport { withHistory } from 'slate-history';\nimport { type RenderElementProps, Slate, withReact, ReactEditor, useSlate } from 'slate-react';\nimport { styled, type CSSProperties } from 'styled-components';\n\nimport { getTranslation } from '../../../../../utils/translations';\n\nimport { codeBlocks } from './Blocks/Code';\nimport { headingBlocks } from './Blocks/Heading';\nimport { imageBlocks } from './Blocks/Image';\nimport { linkBlocks } from './Blocks/Link';\nimport { listBlocks } from './Blocks/List';\nimport { paragraphBlocks } from './Blocks/Paragraph';\nimport { quoteBlocks } from './Blocks/Quote';\nimport { BlocksContent, type BlocksContentProps } from './BlocksContent';\nimport { BlocksToolbar } from './BlocksToolbar';\nimport { EditorLayout } from './EditorLayout';\nimport { type ModifiersStore, modifiers } from './Modifiers';\nimport { withImages } from './plugins/withImages';\nimport { withLinks } from './plugins/withLinks';\nimport { withStrapiSchema } from './plugins/withStrapiSchema';\n\nimport type { Schema } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * BlocksEditorProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface BaseBlock {\n renderElement: (props: RenderElementProps) => React.JSX.Element;\n matchNode: (node: Schema.Attribute.BlocksNode) => boolean;\n handleConvert?: (editor: Editor) => void | (() => React.JSX.Element);\n handleEnterKey?: (editor: Editor) => void;\n handleBackspaceKey?: (editor: Editor, event: React.KeyboardEvent<HTMLElement>) => void;\n handleTab?: (editor: Editor) => void;\n snippets?: string[];\n dragHandleTopMargin?: CSSProperties['marginTop'];\n}\n\ninterface NonSelectorBlock extends BaseBlock {\n isInBlocksSelector: false;\n}\n\ninterface SelectorBlock extends BaseBlock {\n isInBlocksSelector: true;\n icon: React.ComponentType;\n label: MessageDescriptor;\n}\n\ntype NonSelectorBlockKey = 'list-item' | 'link';\n\nconst selectorBlockKeys = [\n 'paragraph',\n 'heading-one',\n 'heading-two',\n 'heading-three',\n 'heading-four',\n 'heading-five',\n 'heading-six',\n 'list-ordered',\n 'list-unordered',\n 'image',\n 'quote',\n 'code',\n] as const;\n\ntype SelectorBlockKey = (typeof selectorBlockKeys)[number];\n\nconst isSelectorBlockKey = (key: unknown): key is SelectorBlockKey => {\n return typeof key === 'string' && selectorBlockKeys.includes(key as SelectorBlockKey);\n};\n\ntype BlocksStore = {\n [K in SelectorBlockKey]: SelectorBlock;\n} & {\n [K in NonSelectorBlockKey]: NonSelectorBlock;\n};\n\ninterface BlocksEditorContextValue {\n blocks: BlocksStore;\n modifiers: ModifiersStore;\n disabled: boolean;\n name: string;\n setLiveText: (text: string) => void;\n isExpandedMode: boolean;\n}\n\nconst [BlocksEditorProvider, usePartialBlocksEditorContext] =\n createContext<BlocksEditorContextValue>('BlocksEditor');\n\nfunction useBlocksEditorContext(\n consumerName: string\n): BlocksEditorContextValue & { editor: Editor } {\n const context = usePartialBlocksEditorContext(consumerName, (state) => state);\n const editor = useSlate();\n\n return {\n ...context,\n editor,\n };\n}\n\n/* -------------------------------------------------------------------------------------------------\n * BlocksEditor\n * -----------------------------------------------------------------------------------------------*/\n\nconst EditorDivider = styled(Divider)`\n background: ${({ theme }) => theme.colors.neutral200};\n`;\n\nconst ExpandIconButton = styled(IconButton)`\n position: absolute;\n bottom: 1.2rem;\n right: 1.2rem;\n box-shadow: ${({ theme }) => theme.shadows.filterShadow};\n`;\n\n/**\n * Forces an update of the Slate editor when the value prop changes from outside of Slate.\n * The root cause is that Slate is not a controlled component: https://github.com/ianstormtaylor/slate/issues/4612\n * Why not use JSON.stringify(value) as the key?\n * Because it would force a rerender of the entire editor every time the user types a character.\n * Why not use the entity id as the key, since it's unique for each locale?\n * Because it would not solve the problem when using the \"fill in from other locale\" feature\n */\nfunction useResetKey(value?: Schema.Attribute.BlocksValue): {\n key: number;\n incrementSlateUpdatesCount: () => void;\n} {\n // Keep track how many times Slate detected a change from a user interaction in the editor\n const slateUpdatesCount = React.useRef(0);\n // Keep track of how many times the value prop was updated, whether from within editor or from outside\n const valueUpdatesCount = React.useRef(0);\n // Use a key to force a rerender of the Slate editor when needed\n const [key, setKey] = React.useState(0);\n\n React.useEffect(() => {\n valueUpdatesCount.current += 1;\n\n // If the 2 refs are not equal, it means the value was updated from outside\n if (valueUpdatesCount.current !== slateUpdatesCount.current) {\n // So we change the key to force a rerender of the Slate editor,\n // which will pick up the new value through its initialValue prop\n setKey((previousKey) => previousKey + 1);\n\n // Then bring the 2 refs back in sync\n slateUpdatesCount.current = valueUpdatesCount.current;\n }\n }, [value]);\n\n return { key, incrementSlateUpdatesCount: () => (slateUpdatesCount.current += 1) };\n}\n\nconst pipe =\n (...fns: ((baseEditor: Editor) => Editor)[]) =>\n (value: Editor) =>\n fns.reduce<Editor>((prev, fn) => fn(prev), value);\n\ninterface BlocksEditorProps\n extends Pick<FieldValue<Schema.Attribute.BlocksValue>, 'onChange' | 'value' | 'error'>,\n BlocksContentProps {\n disabled?: boolean;\n name: string;\n}\n\nconst BlocksEditor = React.forwardRef<{ focus: () => void }, BlocksEditorProps>(\n ({ disabled = false, name, onChange, value, error, ...contentProps }, forwardedRef) => {\n const { formatMessage } = useIntl();\n const [editor] = React.useState(() =>\n pipe(withHistory, withImages, withStrapiSchema, withReact, withLinks)(createEditor())\n );\n const [liveText, setLiveText] = React.useState('');\n const ariaDescriptionId = React.useId();\n const [isExpandedMode, setIsExpandedMode] = React.useState(false);\n\n const handleToggleExpand = () => {\n setIsExpandedMode((prev) => !prev);\n };\n\n /**\n * Editable is not able to hold the ref, https://github.com/ianstormtaylor/slate/issues/4082\n * so with \"useImperativeHandle\" we can use ReactEditor methods to expose to the parent above\n * also not passing forwarded ref here, gives console warning.\n */\n React.useImperativeHandle(\n forwardedRef,\n () => ({\n focus() {\n ReactEditor.focus(editor);\n },\n }),\n [editor]\n );\n\n const { key, incrementSlateUpdatesCount } = useResetKey(value);\n\n const handleSlateChange = (state: Descendant[]) => {\n const isAstChange = editor.operations.some((op) => op.type !== 'set_selection');\n\n if (isAstChange) {\n incrementSlateUpdatesCount();\n\n onChange(name, state as Schema.Attribute.BlocksValue);\n }\n };\n\n const blocks: BlocksStore = {\n ...paragraphBlocks,\n ...headingBlocks,\n ...listBlocks,\n ...linkBlocks,\n ...imageBlocks,\n ...quoteBlocks,\n ...codeBlocks,\n };\n\n return (\n <>\n <VisuallyHidden id={ariaDescriptionId}>\n {formatMessage({\n id: getTranslation('components.Blocks.dnd.instruction'),\n defaultMessage: `To reorder blocks, press Command or Control along with Shift and the Up or Down arrow keys`,\n })}\n </VisuallyHidden>\n <VisuallyHidden aria-live=\"assertive\">{liveText}</VisuallyHidden>\n <Slate\n editor={editor}\n initialValue={value || [{ type: 'paragraph', children: [{ type: 'text', text: '' }] }]}\n onChange={handleSlateChange}\n key={key}\n >\n <BlocksEditorProvider\n blocks={blocks}\n modifiers={modifiers}\n disabled={disabled}\n name={name}\n setLiveText={setLiveText}\n isExpandedMode={isExpandedMode}\n >\n <EditorLayout\n error={error}\n disabled={disabled}\n onCollapse={handleToggleExpand}\n ariaDescriptionId={ariaDescriptionId}\n >\n <BlocksToolbar />\n <EditorDivider width=\"100%\" />\n <BlocksContent {...contentProps} />\n {!isExpandedMode && (\n <ExpandIconButton\n label={formatMessage({\n id: getTranslation('components.Blocks.expand'),\n defaultMessage: 'Expand',\n })}\n onClick={handleToggleExpand}\n >\n <Expand />\n </ExpandIconButton>\n )}\n </EditorLayout>\n </BlocksEditorProvider>\n </Slate>\n </>\n );\n }\n);\n\nexport {\n type BlocksStore,\n type SelectorBlockKey,\n BlocksEditor,\n BlocksEditorProvider,\n useBlocksEditorContext,\n isSelectorBlockKey,\n};\n"],"names":["selectorBlockKeys","isSelectorBlockKey","key","includes","BlocksEditorProvider","usePartialBlocksEditorContext","createContext","useBlocksEditorContext","consumerName","context","state","editor","useSlate","EditorDivider","styled","Divider","theme","colors","neutral200","ExpandIconButton","IconButton","shadows","filterShadow","useResetKey","value","slateUpdatesCount","React","useRef","valueUpdatesCount","setKey","useState","useEffect","current","previousKey","incrementSlateUpdatesCount","pipe","fns","reduce","prev","fn","BlocksEditor","forwardRef","disabled","name","onChange","error","contentProps","forwardedRef","formatMessage","useIntl","withHistory","withImages","withStrapiSchema","withReact","withLinks","createEditor","liveText","setLiveText","ariaDescriptionId","useId","isExpandedMode","setIsExpandedMode","handleToggleExpand","useImperativeHandle","focus","ReactEditor","handleSlateChange","isAstChange","operations","some","op","type","blocks","paragraphBlocks","headingBlocks","listBlocks","linkBlocks","imageBlocks","quoteBlocks","codeBlocks","_jsxs","_Fragment","_jsx","VisuallyHidden","id","getTranslation","defaultMessage","aria-live","Slate","initialValue","children","text","modifiers","EditorLayout","onCollapse","BlocksToolbar","width","BlocksContent","label","onClick","Expand"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAMA,iBAAoB,GAAA;AACxB,IAAA,WAAA;AACA,IAAA,aAAA;AACA,IAAA,aAAA;AACA,IAAA,eAAA;AACA,IAAA,cAAA;AACA,IAAA,cAAA;AACA,IAAA,aAAA;AACA,IAAA,cAAA;AACA,IAAA,gBAAA;AACA,IAAA,OAAA;AACA,IAAA,OAAA;AACA,IAAA;AACD,CAAA;AAID,MAAMC,qBAAqB,CAACC,GAAAA,GAAAA;AAC1B,IAAA,OAAO,OAAOA,GAAAA,KAAQ,QAAYF,IAAAA,iBAAAA,CAAkBG,QAAQ,CAACD,GA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wBAAE+C,IAAM,EAAA,WAAA;wBAAamB,QAAU,EAAA;AAAC,4BAAA;gCAAEnB,IAAM,EAAA,MAAA;gCAAQoB,IAAM,EAAA;AAAG;AAAE;AAAC;AAAE,iBAAA;gBACtF/C,QAAUsB,EAAAA,iBAAAA;AAGV,gBAAA,QAAA,gBAAAgB,GAAC9E,CAAAA,oBAAAA,EAAAA;oBACCoE,MAAQA,EAAAA,MAAAA;oBACRoB,SAAWA,EAAAA,SAAAA;oBACXlD,QAAUA,EAAAA,QAAAA;oBACVC,IAAMA,EAAAA,IAAAA;oBACNc,WAAaA,EAAAA,WAAAA;oBACbG,cAAgBA,EAAAA,cAAAA;AAEhB,oBAAA,QAAA,gBAAAoB,IAACa,CAAAA,YAAAA,EAAAA;wBACChD,KAAOA,EAAAA,KAAAA;wBACPH,QAAUA,EAAAA,QAAAA;wBACVoD,UAAYhC,EAAAA,kBAAAA;wBACZJ,iBAAmBA,EAAAA,iBAAAA;;0CAEnBwB,GAACa,CAAAA,aAAAA,EAAAA,EAAAA,CAAAA;0CACDb,GAACrE,CAAAA,aAAAA,EAAAA;gCAAcmF,KAAM,EAAA;;0CACrBd,GAACe,CAAAA,aAAAA,EAAAA;AAAe,gCAAA,GAAGnD;;AAClB,4BAAA,CAACc,gCACAsB,GAAC/D,CAAAA,gBAAAA,EAAAA;AACC+E,gCAAAA,KAAAA,EAAOlD,aAAc,CAAA;AACnBoC,oCAAAA,EAAAA,EAAIC,cAAe,CAAA,0BAAA,CAAA;oCACnBC,cAAgB,EAAA;AAClB,iCAAA,CAAA;gCACAa,OAASrC,EAAAA,kBAAAA;AAET,gCAAA,QAAA,gBAAAoB,GAACkB,CAAAA,MAAAA,EAAAA,EAAAA;;;;;AA3BJlG,aAAAA,EAAAA,GAAAA;;;AAmCb,CAAA;;;;"}
1
+ {"version":3,"file":"BlocksEditor.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { createContext, type FieldValue } from '@strapi/admin/strapi-admin';\nimport { IconButton, Divider, VisuallyHidden } from '@strapi/design-system';\nimport { Expand } from '@strapi/icons';\nimport { MessageDescriptor, useIntl } from 'react-intl';\nimport { Editor, type Descendant, createEditor } from 'slate';\nimport { withHistory } from 'slate-history';\nimport { type RenderElementProps, Slate, withReact, ReactEditor, useSlate } from 'slate-react';\nimport { styled, type CSSProperties } from 'styled-components';\n\nimport { getTranslation } from '../../../../../utils/translations';\n\nimport { codeBlocks } from './Blocks/Code';\nimport { headingBlocks } from './Blocks/Heading';\nimport { imageBlocks } from './Blocks/Image';\nimport { linkBlocks } from './Blocks/Link';\nimport { listBlocks } from './Blocks/List';\nimport { paragraphBlocks } from './Blocks/Paragraph';\nimport { quoteBlocks } from './Blocks/Quote';\nimport { BlocksContent, type BlocksContentProps } from './BlocksContent';\nimport { BlocksToolbar } from './BlocksToolbar';\nimport { EditorLayout } from './EditorLayout';\nimport { type ModifiersStore, modifiers } from './Modifiers';\nimport { withImages } from './plugins/withImages';\nimport { withLinks } from './plugins/withLinks';\nimport { withStrapiSchema } from './plugins/withStrapiSchema';\n\nimport type { Schema } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * BlocksEditorProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface BaseBlock {\n renderElement: (props: RenderElementProps) => React.JSX.Element;\n matchNode: (node: Schema.Attribute.BlocksNode) => boolean;\n handleConvert?: (editor: Editor) => void | (() => React.JSX.Element);\n handleEnterKey?: (editor: Editor) => void;\n handleBackspaceKey?: (editor: Editor, event: React.KeyboardEvent<HTMLElement>) => void;\n handleTab?: (editor: Editor) => void;\n snippets?: string[];\n dragHandleTopMargin?: CSSProperties['marginTop'];\n}\n\ninterface NonSelectorBlock extends BaseBlock {\n isInBlocksSelector: false;\n}\n\ninterface SelectorBlock extends BaseBlock {\n isInBlocksSelector: true;\n icon: React.ComponentType;\n label: MessageDescriptor;\n}\n\ntype NonSelectorBlockKey = 'list-item' | 'link';\n\nconst selectorBlockKeys = [\n 'paragraph',\n 'heading-one',\n 'heading-two',\n 'heading-three',\n 'heading-four',\n 'heading-five',\n 'heading-six',\n 'list-ordered',\n 'list-unordered',\n 'image',\n 'quote',\n 'code',\n] as const;\n\ntype SelectorBlockKey = (typeof selectorBlockKeys)[number];\n\nconst isSelectorBlockKey = (key: unknown): key is SelectorBlockKey => {\n return typeof key === 'string' && selectorBlockKeys.includes(key as SelectorBlockKey);\n};\n\ntype BlocksStore = {\n [K in SelectorBlockKey]: SelectorBlock;\n} & {\n [K in NonSelectorBlockKey]: NonSelectorBlock;\n};\n\ninterface BlocksEditorContextValue {\n blocks: BlocksStore;\n modifiers: ModifiersStore;\n disabled: boolean;\n name: string;\n setLiveText: (text: string) => void;\n isExpandedMode: boolean;\n}\n\nconst [BlocksEditorProvider, usePartialBlocksEditorContext] =\n createContext<BlocksEditorContextValue>('BlocksEditor');\n\nfunction useBlocksEditorContext(\n consumerName: string\n): BlocksEditorContextValue & { editor: Editor } {\n const context = usePartialBlocksEditorContext(consumerName, (state) => state);\n const editor = useSlate();\n\n return {\n ...context,\n editor,\n };\n}\n\n/* -------------------------------------------------------------------------------------------------\n * BlocksEditor\n * -----------------------------------------------------------------------------------------------*/\n\nconst EditorDivider = styled(Divider)`\n background: ${({ theme }) => theme.colors.neutral200};\n`;\n\n/**\n * Forces an update of the Slate editor when the value prop changes from outside of Slate.\n * The root cause is that Slate is not a controlled component: https://github.com/ianstormtaylor/slate/issues/4612\n * Why not use JSON.stringify(value) as the key?\n * Because it would force a rerender of the entire editor every time the user types a character.\n * Why not use the entity id as the key, since it's unique for each locale?\n * Because it would not solve the problem when using the \"fill in from other locale\" feature\n */\nfunction useResetKey(value?: Schema.Attribute.BlocksValue): {\n key: number;\n incrementSlateUpdatesCount: () => void;\n} {\n // Keep track how many times Slate detected a change from a user interaction in the editor\n const slateUpdatesCount = React.useRef(0);\n // Keep track of how many times the value prop was updated, whether from within editor or from outside\n const valueUpdatesCount = React.useRef(0);\n // Use a key to force a rerender of the Slate editor when needed\n const [key, setKey] = React.useState(0);\n\n React.useEffect(() => {\n valueUpdatesCount.current += 1;\n\n // If the 2 refs are not equal, it means the value was updated from outside\n if (valueUpdatesCount.current !== slateUpdatesCount.current) {\n // So we change the key to force a rerender of the Slate editor,\n // which will pick up the new value through its initialValue prop\n setKey((previousKey) => previousKey + 1);\n\n // Then bring the 2 refs back in sync\n slateUpdatesCount.current = valueUpdatesCount.current;\n }\n }, [value]);\n\n return { key, incrementSlateUpdatesCount: () => (slateUpdatesCount.current += 1) };\n}\n\nconst pipe =\n (...fns: ((baseEditor: Editor) => Editor)[]) =>\n (value: Editor) =>\n fns.reduce<Editor>((prev, fn) => fn(prev), value);\n\ninterface BlocksEditorProps\n extends Pick<FieldValue<Schema.Attribute.BlocksValue>, 'onChange' | 'value' | 'error'>,\n BlocksContentProps {\n disabled?: boolean;\n name: string;\n}\n\nconst BlocksEditor = React.forwardRef<{ focus: () => void }, BlocksEditorProps>(\n ({ disabled = false, name, onChange, value, error, ...contentProps }, forwardedRef) => {\n const { formatMessage } = useIntl();\n const [editor] = React.useState(() =>\n pipe(withHistory, withImages, withStrapiSchema, withReact, withLinks)(createEditor())\n );\n const [liveText, setLiveText] = React.useState('');\n const ariaDescriptionId = React.useId();\n const [isExpandedMode, handleToggleExpand] = React.useReducer((prev) => !prev, false);\n\n /**\n * Editable is not able to hold the ref, https://github.com/ianstormtaylor/slate/issues/4082\n * so with \"useImperativeHandle\" we can use ReactEditor methods to expose to the parent above\n * also not passing forwarded ref here, gives console warning.\n */\n React.useImperativeHandle(\n forwardedRef,\n () => ({\n focus() {\n ReactEditor.focus(editor);\n },\n }),\n [editor]\n );\n\n const { key, incrementSlateUpdatesCount } = useResetKey(value);\n\n const handleSlateChange = (state: Descendant[]) => {\n const isAstChange = editor.operations.some((op) => op.type !== 'set_selection');\n\n if (isAstChange) {\n incrementSlateUpdatesCount();\n\n onChange(name, state as Schema.Attribute.BlocksValue);\n }\n };\n\n const blocks: BlocksStore = {\n ...paragraphBlocks,\n ...headingBlocks,\n ...listBlocks,\n ...linkBlocks,\n ...imageBlocks,\n ...quoteBlocks,\n ...codeBlocks,\n };\n\n return (\n <>\n <VisuallyHidden id={ariaDescriptionId}>\n {formatMessage({\n id: getTranslation('components.Blocks.dnd.instruction'),\n defaultMessage: `To reorder blocks, press Command or Control along with Shift and the Up or Down arrow keys`,\n })}\n </VisuallyHidden>\n <VisuallyHidden aria-live=\"assertive\">{liveText}</VisuallyHidden>\n <Slate\n editor={editor}\n initialValue={value || [{ type: 'paragraph', children: [{ type: 'text', text: '' }] }]}\n onChange={handleSlateChange}\n key={key}\n >\n <BlocksEditorProvider\n blocks={blocks}\n modifiers={modifiers}\n disabled={disabled}\n name={name}\n setLiveText={setLiveText}\n isExpandedMode={isExpandedMode}\n >\n <EditorLayout\n error={error}\n disabled={disabled}\n onToggleExpand={handleToggleExpand}\n ariaDescriptionId={ariaDescriptionId}\n >\n <BlocksToolbar />\n <EditorDivider width=\"100%\" />\n <BlocksContent {...contentProps} />\n {!isExpandedMode && (\n <IconButton\n position=\"absolute\"\n bottom=\"1.2rem\"\n right=\"1.2rem\"\n shadow=\"filterShadow\"\n label={formatMessage({\n id: getTranslation('components.Blocks.expand'),\n defaultMessage: 'Expand',\n })}\n onClick={handleToggleExpand}\n >\n <Expand />\n </IconButton>\n )}\n </EditorLayout>\n </BlocksEditorProvider>\n </Slate>\n </>\n );\n }\n);\n\nexport {\n type BlocksStore,\n type SelectorBlockKey,\n BlocksEditor,\n BlocksEditorProvider,\n useBlocksEditorContext,\n isSelectorBlockKey,\n};\n"],"names":["selectorBlockKeys","isSelectorBlockKey","key","includes","BlocksEditorProvider","usePartialBlocksEditorContext","createContext","useBlocksEditorContext","consumerName","context","state","editor","useSlate","EditorDivider","styled","Divider","theme","colors","neutral200","useResetKey","value","slateUpdatesCount","React","useRef","valueUpdatesCount","setKey","useState","useEffect","current","previousKey","incrementSlateUpdatesCount","pipe","fns","reduce","prev","fn","BlocksEditor","forwardRef","disabled","name","onChange","error","contentProps","forwardedRef","formatMessage","useIntl","withHistory","withImages","withStrapiSchema","withReact","withLinks","createEditor","liveText","setLiveText","ariaDescriptionId","useId","isExpandedMode","handleToggleExpand","useReducer","useImperativeHandle","focus","ReactEditor","handleSlateChange","isAstChange","operations","some","op","type","blocks","paragraphBlocks","headingBlocks","listBlocks","linkBlocks","imageBlocks","quoteBlocks","codeBlocks","_jsxs","_Fragment","_jsx","VisuallyHidden","id","getTranslation","defaultMessage","aria-live","Slate","initialValue","children","text","modifiers","EditorLayout","onToggleExpand","BlocksToolbar","width","BlocksContent","IconButton","position","bottom","right","shadow","label","onClick","Expand"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAMA,iBAAoB,GAAA;AACxB,IAAA,WAAA;AACA,IAAA,aAAA;AACA,IAAA,aAAA;AACA,IAAA,eAAA;AACA,IAAA,cAAA;AACA,IAAA,cAAA;AACA,IAAA,aAAA;AACA,IAAA,cAAA;AACA,IAAA,gBAAA;AACA,IAAA,OAAA;AACA,IAAA,OAAA;AACA,IAAA;AACD,CAAA;AAID,MAAMC,qBAAqB,CAACC,GAAAA,GAAAA;AAC1B,IAAA,OAAO,OAAOA,GAAAA,KAAQ,QAAYF,IAAAA,iBAAAA,CAAkBG,QAAQ,CAACD,GAAAA,CAAAA;AAC/D;AAiBA,MAAM,CAACE,oBAAAA,EAAsBC,6BAA8B,CAAA,GACzDC,aAAwC,CAAA,cAAA;AAE1C,SAASC,uBACPC,YAAoB,EAAA;AAEpB,IAAA,MAAMC,OAAUJ,GAAAA,6BAAAA,CAA8BG,YAAc,EAAA,CAACE,KAAUA,GAAAA,KAAAA,CAAAA;AACvE,IAAA,MAAMC,MAASC,GAAAA,QAAAA,EAAAA;IAEf,OAAO;AACL,QAAA,GAAGH,OAAO;AACVE,QAAAA;AACF,KAAA;AACF;AAEA;;AAEkG,qGAElG,MAAME,aAAAA,GAAgBC,MAAO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,EAAAA,EAAAA,CAAAA;0CACDb,GAACjE,CAAAA,aAAAA,EAAAA;gCAAc+E,KAAM,EAAA;;0CACrBd,GAACe,CAAAA,aAAAA,EAAAA;AAAe,gCAAA,GAAGnD;;AAClB,4BAAA,CAACc,gCACAsB,GAACgB,CAAAA,UAAAA,EAAAA;gCACCC,QAAS,EAAA,UAAA;gCACTC,MAAO,EAAA,QAAA;gCACPC,KAAM,EAAA,QAAA;gCACNC,MAAO,EAAA,cAAA;AACPC,gCAAAA,KAAAA,EAAOvD,aAAc,CAAA;AACnBoC,oCAAAA,EAAAA,EAAIC,cAAe,CAAA,0BAAA,CAAA;oCACnBC,cAAgB,EAAA;AAClB,iCAAA,CAAA;gCACAkB,OAAS3C,EAAAA,kBAAAA;AAET,gCAAA,QAAA,gBAAAqB,GAACuB,CAAAA,MAAAA,EAAAA,EAAAA;;;;;AA/BJnG,aAAAA,EAAAA,GAAAA;;;AAuCb,CAAA;;;;"}
@@ -45,6 +45,8 @@ const ToolbarSeparator = styledComponents.styled(Toolbar__namespace.Separator)`
45
45
  background: ${({ theme })=>theme.colors.neutral150};
46
46
  width: 1px;
47
47
  height: 2.4rem;
48
+ margin-left: 0.8rem;
49
+ margin-right: 0.8rem;
48
50
  `;
49
51
  const FlexButton = styledComponents.styled(designSystem.Flex)`
50
52
  // Inherit the not-allowed cursor from ToolbarWrapper when disabled
@@ -294,7 +296,7 @@ const BlockOption = ({ value, icon: Icon, label, blockSelected })=>{
294
296
  const isSelected = value === blockSelected;
295
297
  return /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
296
298
  startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icon, {
297
- fill: isSelected ? 'primary600' : 'neutral600'
299
+ fill: isSelected ? 'primary600' : 'neutral500'
298
300
  }),
299
301
  value: value,
300
302
  children: formatMessage(label)
@@ -383,14 +385,12 @@ const ListButton = ({ block, format, location = 'toolbar' })=>{
383
385
  };
384
386
  if (location === 'menu') {
385
387
  const Icon = block.icon;
386
- return /*#__PURE__*/ jsxRuntime.jsxs(StyledMenuItem, {
388
+ return /*#__PURE__*/ jsxRuntime.jsx(StyledMenuItem, {
389
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icon, {}),
387
390
  onSelect: ()=>toggleList(format),
388
391
  isActive: isListActive(),
389
392
  disabled: isListDisabled(),
390
- children: [
391
- /*#__PURE__*/ jsxRuntime.jsx(Icon, {}),
392
- formatMessage(block.label)
393
- ]
393
+ children: formatMessage(block.label)
394
394
  });
395
395
  }
396
396
  return /*#__PURE__*/ jsxRuntime.jsx(ToolbarButton, {
@@ -450,14 +450,12 @@ const LinkButton = ({ disabled, location = 'toolbar' })=>{
450
450
  defaultMessage: 'Link'
451
451
  };
452
452
  if (location === 'menu') {
453
- return /*#__PURE__*/ jsxRuntime.jsxs(StyledMenuItem, {
453
+ return /*#__PURE__*/ jsxRuntime.jsx(StyledMenuItem, {
454
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Link, {}),
454
455
  onSelect: addLink,
455
456
  isActive: isLinkActive(),
456
457
  disabled: isLinkDisabled(),
457
- children: [
458
- /*#__PURE__*/ jsxRuntime.jsx(Icons.Link, {}),
459
- formatMessage(label)
460
- ]
458
+ children: formatMessage(label)
461
459
  });
462
460
  }
463
461
  return /*#__PURE__*/ jsxRuntime.jsx(ToolbarButton, {
@@ -470,25 +468,13 @@ const LinkButton = ({ disabled, location = 'toolbar' })=>{
470
468
  });
471
469
  };
472
470
  const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
473
- &:hover {
474
- background-color: ${({ theme })=>theme.colors.primary100};
475
- }
476
-
477
471
  ${(props)=>props.isActive && styledComponents.css`
478
- font-weight: bold;
479
- background-color: ${({ theme })=>theme.colors.primary100};
480
472
  color: ${({ theme })=>theme.colors.primary600};
481
- font-weight: bold;
473
+ font-weight: 600;
482
474
  `}
483
475
 
484
- > span {
485
- display: inline-flex;
486
- gap: ${({ theme })=>theme.spaces[2]};
487
- align-items: center;
488
- }
489
-
490
476
  svg {
491
- fill: ${({ theme, isActive })=>isActive ? theme.colors.primary600 : theme.colors.neutral600};
477
+ fill: ${({ theme, isActive })=>isActive ? theme.colors.primary600 : theme.colors.neutral500};
492
478
  }
493
479
  `;
494
480
  const BlocksToolbar = ()=>{
@@ -534,13 +520,11 @@ const BlocksToolbar = ()=>{
534
520
  handleClick: handleSelect,
535
521
  disabled: isButtonDisabled
536
522
  }, name),
537
- menu: /*#__PURE__*/ jsxRuntime.jsxs(StyledMenuItem, {
523
+ menu: /*#__PURE__*/ jsxRuntime.jsx(StyledMenuItem, {
524
+ startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icon, {}),
538
525
  onSelect: handleSelect,
539
526
  isActive: isActive,
540
- children: [
541
- /*#__PURE__*/ jsxRuntime.jsx(Icon, {}),
542
- formatMessage(modifier.label)
543
- ]
527
+ children: formatMessage(modifier.label)
544
528
  }),
545
529
  key: `modifier.${name}`
546
530
  };
@@ -560,9 +544,12 @@ const BlocksToolbar = ()=>{
560
544
  // List buttons can only be rendered together when in the toolbar
561
545
  toolbar: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
562
546
  direction: "row",
563
- gap: 1,
564
547
  children: [
565
- /*#__PURE__*/ jsxRuntime.jsx(ToolbarSeparator, {}),
548
+ /*#__PURE__*/ jsxRuntime.jsx(ToolbarSeparator, {
549
+ style: {
550
+ marginLeft: '0.4rem'
551
+ }
552
+ }),
566
553
  /*#__PURE__*/ jsxRuntime.jsx(Toolbar__namespace.ToggleGroup, {
567
554
  type: "single",
568
555
  asChild: true,
@@ -606,7 +593,6 @@ const BlocksToolbar = ()=>{
606
593
  "aria-disabled": disabled,
607
594
  asChild: true,
608
595
  children: /*#__PURE__*/ jsxRuntime.jsxs(ToolbarWrapper, {
609
- gap: 2,
610
596
  padding: 2,
611
597
  width: "100%",
612
598
  children: [
@@ -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 { useElementOnScreen } from '@strapi/admin/strapi-admin';\nimport {\n Flex,\n Tooltip,\n SingleSelect,\n SingleSelectOption,\n Box,\n FlexComponent,\n BoxComponent,\n Menu,\n IconButton,\n} from '@strapi/design-system';\nimport { Link, More } 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 } from '../../EditorToolbarObserver';\n\nimport {\n type BlocksStore,\n type SelectorBlockKey,\n isSelectorBlockKey,\n useBlocksEditorContext,\n} from './BlocksEditor';\nimport { insertLink } from './utils/links';\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`;\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 >\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' : 'neutral600'} />}\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 { editor, disabled, blocks } = useBlocksEditorContext('ListButton');\n const { formatMessage } = useIntl();\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 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 onSelect={() => toggleList(format)}\n isActive={isListActive()}\n disabled={isListDisabled()}\n >\n <Icon />\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 onSelect={addLink} isActive={isLinkActive()} disabled={isLinkDisabled()}>\n <Link />\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\ninterface ObservedToolbarComponentProps {\n index: number;\n lastVisibleIndex: number;\n setLastVisibleIndex: React.Dispatch<React.SetStateAction<number>>;\n rootRef: React.RefObject<HTMLElement>;\n children: React.ReactNode;\n}\n\nconst ObservedToolbarComponent = ({\n index,\n lastVisibleIndex,\n setLastVisibleIndex,\n rootRef,\n children,\n}: ObservedToolbarComponentProps) => {\n const isVisible = index <= lastVisibleIndex;\n\n const containerRef = useElementOnScreen<HTMLDivElement>(\n (isVisible) => {\n /**\n * It's the MoreMenu's job to make an item not visible when there's not room for it.\n * But we need to react here to the element becoming visible again.\n */\n if (isVisible) {\n setLastVisibleIndex((prev) => Math.max(prev, index));\n }\n },\n { threshold: 1, root: rootRef.current }\n );\n\n return (\n <div\n ref={containerRef}\n style={{\n /**\n * Use visibility so that the element occupies the space if requires even when there's not\n * enough room for it to be visible. The empty reserved space will be clipped by the\n * overflow:hidden rule on the parent, so it doesn't affect the UI.\n * This way we can keep observing its visiblity and react to browser resize events.\n */\n visibility: isVisible ? 'visible' : 'hidden',\n }}\n >\n {children}\n </div>\n );\n};\n\ninterface ObservedComponent {\n toolbar: React.ReactNode;\n menu: React.ReactNode;\n key: string;\n}\n\ninterface MoreMenuProps {\n setLastVisibleIndex: React.Dispatch<React.SetStateAction<number>>;\n hasHiddenItems: boolean;\n rootRef: React.RefObject<HTMLElement>;\n children: React.ReactNode;\n}\n\nconst MoreMenu = ({ setLastVisibleIndex, hasHiddenItems, rootRef, children }: MoreMenuProps) => {\n const { formatMessage } = useIntl();\n const containerRef = useElementOnScreen<HTMLButtonElement>(\n (isVisible) => {\n // We only react to the menu becoming invisible. When that happens, we hide the last item.\n if (!isVisible) {\n /**\n * If there's no room for any item, the index can be -1.\n * This is intentional, in that case only the more menu will be visible.\n **/\n setLastVisibleIndex((prev) => prev - 1);\n }\n },\n { threshold: 1, root: rootRef.current }\n );\n\n return (\n <Menu.Root defaultOpen={false}>\n <Menu.Trigger\n endIcon={null}\n paddingLeft={0}\n paddingRight={0}\n ref={containerRef}\n style={{ visibility: hasHiddenItems ? 'visible' : 'hidden' }}\n >\n <IconButton\n variant=\"ghost\"\n label={formatMessage({ id: 'global.more', defaultMessage: 'More' })}\n tag=\"span\"\n >\n <More aria-hidden focusable={false} />\n </IconButton>\n </Menu.Trigger>\n <Menu.Content onCloseAutoFocus={(e) => e.preventDefault()}>{children}</Menu.Content>\n </Menu.Root>\n );\n};\n\nconst StyledMenuItem = styled(Menu.Item)<{ isActive: boolean }>`\n &:hover {\n background-color: ${({ theme }) => theme.colors.primary100};\n }\n\n ${(props) =>\n props.isActive &&\n css`\n font-weight: bold;\n background-color: ${({ theme }) => theme.colors.primary100};\n color: ${({ theme }) => theme.colors.primary600};\n font-weight: bold;\n `}\n\n > span {\n display: inline-flex;\n gap: ${({ theme }) => theme.spaces[2]};\n align-items: center;\n }\n\n svg {\n fill: ${({ theme, isActive }) =>\n isActive ? theme.colors.primary600 : theme.colors.neutral600};\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\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 onSelect={handleSelect} isActive={isActive}>\n <Icon />\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\" gap={1}>\n <ToolbarSeparator />\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 gap={2} 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","fill","BlocksDropdown","blocks","blockKeysToInclude","getEntries","reduce","currentKeys","entry","block","isInBlocksSelector","blockSelected","setBlockSelected","handleSelect","optionKey","isSelectorBlockKey","editorIsEmpty","children","length","Editor","isEmpty","selection","Transforms","insertNodes","type","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","spaces","BlocksToolbar","modifiers","checkButtonDisabled","path","isButtonDisabled","observedComponents","Object","entries","modifier","checkIsActive","handleToggle","toolbar","menu","direction","gap","ToggleGroup","Root","padding","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;;;AAGvD,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,SAASC,kBA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AON,EAAAA,MAAM,CAAC,cAAe,CAAA;wBAAEiC,MAAO,EAAA,SAAA;wBAAUmC,QAAS,EAAA;;;;YAGzE3G,GAAK,EAAA;AACP;AACD,KAAA;IAED,qBACEiB,cAAA,CAAChC,mBAAQ0K,IAAI,EAAA;QAAChI,eAAelB,EAAAA,QAAAA;QAAUoB,OAAO,EAAA,IAAA;AAC5C,QAAA,QAAA,gBAAA8D,eAACjH,CAAAA,cAAAA,EAAAA;YAAe+K,GAAK,EAAA,CAAA;YAAGG,OAAS,EAAA,CAAA;YAAG1H,KAAM,EAAA,MAAA;;8BACxCjB,cAACqB,CAAAA,cAAAA,EAAAA,EAAAA,CAAAA;8BACDrB,cAACjC,CAAAA,gBAAAA,EAAAA,EAAAA,CAAAA;AACD,8BAAAiC,cAAA,CAAChC,mBAAQyK,WAAW,EAAA;oBAAC9F,IAAK,EAAA,UAAA;oBAAW/B,OAAO,EAAA,IAAA;AAC1C,oBAAA,QAAA,gBAAAZ,cAACrC,CAAAA,iBAAAA,EAAAA;wBAAK4K,SAAU,EAAA,KAAA;wBAAMC,GAAK,EAAA,CAAA;wBAAGI,IAAM,EAAA,CAAA;wBAAGC,QAAS,EAAA,QAAA;AAC9C,wBAAA,QAAA,gBAAA7I,cAAC8I,CAAAA,2CAAAA,EAAAA;4BAAsBf,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 { useElementOnScreen } from '@strapi/admin/strapi-admin';\nimport {\n Flex,\n Tooltip,\n SingleSelect,\n SingleSelectOption,\n Box,\n FlexComponent,\n BoxComponent,\n Menu,\n IconButton,\n} from '@strapi/design-system';\nimport { Link, More } 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 } from '../../EditorToolbarObserver';\n\nimport {\n type BlocksStore,\n type SelectorBlockKey,\n isSelectorBlockKey,\n useBlocksEditorContext,\n} from './BlocksEditor';\nimport { insertLink } from './utils/links';\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 >\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 { editor, disabled, blocks } = useBlocksEditorContext('ListButton');\n const { formatMessage } = useIntl();\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 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\ninterface ObservedToolbarComponentProps {\n index: number;\n lastVisibleIndex: number;\n setLastVisibleIndex: React.Dispatch<React.SetStateAction<number>>;\n rootRef: React.RefObject<HTMLElement>;\n children: React.ReactNode;\n}\n\nconst ObservedToolbarComponent = ({\n index,\n lastVisibleIndex,\n setLastVisibleIndex,\n rootRef,\n children,\n}: ObservedToolbarComponentProps) => {\n const isVisible = index <= lastVisibleIndex;\n\n const containerRef = useElementOnScreen<HTMLDivElement>(\n (isVisible) => {\n /**\n * It's the MoreMenu's job to make an item not visible when there's not room for it.\n * But we need to react here to the element becoming visible again.\n */\n if (isVisible) {\n setLastVisibleIndex((prev) => Math.max(prev, index));\n }\n },\n { threshold: 1, root: rootRef.current }\n );\n\n return (\n <div\n ref={containerRef}\n style={{\n /**\n * Use visibility so that the element occupies the space if requires even when there's not\n * enough room for it to be visible. The empty reserved space will be clipped by the\n * overflow:hidden rule on the parent, so it doesn't affect the UI.\n * This way we can keep observing its visiblity and react to browser resize events.\n */\n visibility: isVisible ? 'visible' : 'hidden',\n }}\n >\n {children}\n </div>\n );\n};\n\ninterface ObservedComponent {\n toolbar: React.ReactNode;\n menu: React.ReactNode;\n key: string;\n}\n\ninterface MoreMenuProps {\n setLastVisibleIndex: React.Dispatch<React.SetStateAction<number>>;\n hasHiddenItems: boolean;\n rootRef: React.RefObject<HTMLElement>;\n children: React.ReactNode;\n}\n\nconst MoreMenu = ({ setLastVisibleIndex, hasHiddenItems, rootRef, children }: MoreMenuProps) => {\n const { formatMessage } = useIntl();\n const containerRef = useElementOnScreen<HTMLButtonElement>(\n (isVisible) => {\n // We only react to the menu becoming invisible. When that happens, we hide the last item.\n if (!isVisible) {\n /**\n * If there's no room for any item, the index can be -1.\n * This is intentional, in that case only the more menu will be visible.\n **/\n setLastVisibleIndex((prev) => prev - 1);\n }\n },\n { threshold: 1, root: rootRef.current }\n );\n\n return (\n <Menu.Root defaultOpen={false}>\n <Menu.Trigger\n endIcon={null}\n paddingLeft={0}\n paddingRight={0}\n ref={containerRef}\n style={{ visibility: hasHiddenItems ? 'visible' : 'hidden' }}\n >\n <IconButton\n variant=\"ghost\"\n label={formatMessage({ id: 'global.more', defaultMessage: 'More' })}\n tag=\"span\"\n >\n <More aria-hidden focusable={false} />\n </IconButton>\n </Menu.Trigger>\n <Menu.Content onCloseAutoFocus={(e) => e.preventDefault()}>{children}</Menu.Content>\n </Menu.Root>\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\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","fill","BlocksDropdown","blocks","blockKeysToInclude","getEntries","reduce","currentKeys","entry","block","isInBlocksSelector","blockSelected","setBlockSelected","handleSelect","optionKey","isSelectorBlockKey","editorIsEmpty","children","length","Editor","isEmpty","selection","Transforms","insertNodes","type","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"],"mapp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AA,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;;;;;"}
@@ -23,6 +23,8 @@ const ToolbarSeparator = styled(Toolbar.Separator)`
23
23
  background: ${({ theme })=>theme.colors.neutral150};
24
24
  width: 1px;
25
25
  height: 2.4rem;
26
+ margin-left: 0.8rem;
27
+ margin-right: 0.8rem;
26
28
  `;
27
29
  const FlexButton = styled(Flex)`
28
30
  // Inherit the not-allowed cursor from ToolbarWrapper when disabled
@@ -272,7 +274,7 @@ const BlockOption = ({ value, icon: Icon, label, blockSelected })=>{
272
274
  const isSelected = value === blockSelected;
273
275
  return /*#__PURE__*/ jsx(SingleSelectOption, {
274
276
  startIcon: /*#__PURE__*/ jsx(Icon, {
275
- fill: isSelected ? 'primary600' : 'neutral600'
277
+ fill: isSelected ? 'primary600' : 'neutral500'
276
278
  }),
277
279
  value: value,
278
280
  children: formatMessage(label)
@@ -361,14 +363,12 @@ const ListButton = ({ block, format, location = 'toolbar' })=>{
361
363
  };
362
364
  if (location === 'menu') {
363
365
  const Icon = block.icon;
364
- return /*#__PURE__*/ jsxs(StyledMenuItem, {
366
+ return /*#__PURE__*/ jsx(StyledMenuItem, {
367
+ startIcon: /*#__PURE__*/ jsx(Icon, {}),
365
368
  onSelect: ()=>toggleList(format),
366
369
  isActive: isListActive(),
367
370
  disabled: isListDisabled(),
368
- children: [
369
- /*#__PURE__*/ jsx(Icon, {}),
370
- formatMessage(block.label)
371
- ]
371
+ children: formatMessage(block.label)
372
372
  });
373
373
  }
374
374
  return /*#__PURE__*/ jsx(ToolbarButton, {
@@ -428,14 +428,12 @@ const LinkButton = ({ disabled, location = 'toolbar' })=>{
428
428
  defaultMessage: 'Link'
429
429
  };
430
430
  if (location === 'menu') {
431
- return /*#__PURE__*/ jsxs(StyledMenuItem, {
431
+ return /*#__PURE__*/ jsx(StyledMenuItem, {
432
+ startIcon: /*#__PURE__*/ jsx(Link, {}),
432
433
  onSelect: addLink,
433
434
  isActive: isLinkActive(),
434
435
  disabled: isLinkDisabled(),
435
- children: [
436
- /*#__PURE__*/ jsx(Link, {}),
437
- formatMessage(label)
438
- ]
436
+ children: formatMessage(label)
439
437
  });
440
438
  }
441
439
  return /*#__PURE__*/ jsx(ToolbarButton, {
@@ -448,25 +446,13 @@ const LinkButton = ({ disabled, location = 'toolbar' })=>{
448
446
  });
449
447
  };
450
448
  const StyledMenuItem = styled(Menu.Item)`
451
- &:hover {
452
- background-color: ${({ theme })=>theme.colors.primary100};
453
- }
454
-
455
449
  ${(props)=>props.isActive && css`
456
- font-weight: bold;
457
- background-color: ${({ theme })=>theme.colors.primary100};
458
450
  color: ${({ theme })=>theme.colors.primary600};
459
- font-weight: bold;
451
+ font-weight: 600;
460
452
  `}
461
453
 
462
- > span {
463
- display: inline-flex;
464
- gap: ${({ theme })=>theme.spaces[2]};
465
- align-items: center;
466
- }
467
-
468
454
  svg {
469
- fill: ${({ theme, isActive })=>isActive ? theme.colors.primary600 : theme.colors.neutral600};
455
+ fill: ${({ theme, isActive })=>isActive ? theme.colors.primary600 : theme.colors.neutral500};
470
456
  }
471
457
  `;
472
458
  const BlocksToolbar = ()=>{
@@ -512,13 +498,11 @@ const BlocksToolbar = ()=>{
512
498
  handleClick: handleSelect,
513
499
  disabled: isButtonDisabled
514
500
  }, name),
515
- menu: /*#__PURE__*/ jsxs(StyledMenuItem, {
501
+ menu: /*#__PURE__*/ jsx(StyledMenuItem, {
502
+ startIcon: /*#__PURE__*/ jsx(Icon, {}),
516
503
  onSelect: handleSelect,
517
504
  isActive: isActive,
518
- children: [
519
- /*#__PURE__*/ jsx(Icon, {}),
520
- formatMessage(modifier.label)
521
- ]
505
+ children: formatMessage(modifier.label)
522
506
  }),
523
507
  key: `modifier.${name}`
524
508
  };
@@ -538,9 +522,12 @@ const BlocksToolbar = ()=>{
538
522
  // List buttons can only be rendered together when in the toolbar
539
523
  toolbar: /*#__PURE__*/ jsxs(Flex, {
540
524
  direction: "row",
541
- gap: 1,
542
525
  children: [
543
- /*#__PURE__*/ jsx(ToolbarSeparator, {}),
526
+ /*#__PURE__*/ jsx(ToolbarSeparator, {
527
+ style: {
528
+ marginLeft: '0.4rem'
529
+ }
530
+ }),
544
531
  /*#__PURE__*/ jsx(Toolbar.ToggleGroup, {
545
532
  type: "single",
546
533
  asChild: true,
@@ -584,7 +571,6 @@ const BlocksToolbar = ()=>{
584
571
  "aria-disabled": disabled,
585
572
  asChild: true,
586
573
  children: /*#__PURE__*/ jsxs(ToolbarWrapper, {
587
- gap: 2,
588
574
  padding: 2,
589
575
  width: "100%",
590
576
  children: [