@strapi/content-manager 5.38.0 → 5.38.1

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 (62) hide show
  1. package/dist/admin/history/components/VersionContent.js +48 -16
  2. package/dist/admin/history/components/VersionContent.js.map +1 -1
  3. package/dist/admin/history/components/VersionContent.mjs +48 -16
  4. package/dist/admin/history/components/VersionContent.mjs.map +1 -1
  5. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.js +51 -0
  6. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.js.map +1 -1
  7. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.mjs +52 -1
  8. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.mjs.map +1 -1
  9. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js +6 -2
  10. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js.map +1 -1
  11. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs +6 -2
  12. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs.map +1 -1
  13. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js.map +1 -1
  14. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs.map +1 -1
  15. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js +1 -1
  16. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js.map +1 -1
  17. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs +1 -1
  18. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs.map +1 -1
  19. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs +1 -1
  20. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js +148 -111
  21. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
  22. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs +152 -115
  23. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
  24. package/dist/admin/pages/EditView/components/InputRenderer.js +15 -5
  25. package/dist/admin/pages/EditView/components/InputRenderer.js.map +1 -1
  26. package/dist/admin/pages/EditView/components/InputRenderer.mjs +15 -5
  27. package/dist/admin/pages/EditView/components/InputRenderer.mjs.map +1 -1
  28. package/dist/admin/pages/ListView/components/Filters.js +54 -1
  29. package/dist/admin/pages/ListView/components/Filters.js.map +1 -1
  30. package/dist/admin/pages/ListView/components/Filters.mjs +54 -1
  31. package/dist/admin/pages/ListView/components/Filters.mjs.map +1 -1
  32. package/dist/admin/src/exports.d.ts +1 -1
  33. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.d.ts +1 -0
  34. package/dist/admin/src/utils/conditionalFields.d.ts +12 -0
  35. package/dist/admin/translations/en.json.js +5 -0
  36. package/dist/admin/translations/en.json.js.map +1 -1
  37. package/dist/admin/translations/en.json.mjs +5 -0
  38. package/dist/admin/translations/en.json.mjs.map +1 -1
  39. package/dist/admin/translations/es.json.js +136 -2
  40. package/dist/admin/translations/es.json.js.map +1 -1
  41. package/dist/admin/translations/es.json.mjs +136 -2
  42. package/dist/admin/translations/es.json.mjs.map +1 -1
  43. package/dist/admin/utils/conditionalFields.js +76 -0
  44. package/dist/admin/utils/conditionalFields.js.map +1 -0
  45. package/dist/admin/utils/conditionalFields.mjs +69 -0
  46. package/dist/admin/utils/conditionalFields.mjs.map +1 -0
  47. package/dist/server/controllers/collection-types.js +157 -4
  48. package/dist/server/controllers/collection-types.js.map +1 -1
  49. package/dist/server/controllers/collection-types.mjs +159 -6
  50. package/dist/server/controllers/collection-types.mjs.map +1 -1
  51. package/dist/server/controllers/single-types.js +19 -4
  52. package/dist/server/controllers/single-types.js.map +1 -1
  53. package/dist/server/controllers/single-types.mjs +19 -4
  54. package/dist/server/controllers/single-types.mjs.map +1 -1
  55. package/dist/server/preview/services/preview.js +2 -1
  56. package/dist/server/preview/services/preview.js.map +1 -1
  57. package/dist/server/preview/services/preview.mjs +2 -1
  58. package/dist/server/preview/services/preview.mjs.map +1 -1
  59. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  60. package/dist/server/src/controllers/single-types.d.ts.map +1 -1
  61. package/dist/server/src/preview/services/preview.d.ts.map +1 -1
  62. package/package.json +13 -8
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Typography } from '@strapi/design-system';\nimport { BulletList, NumberList } from '@strapi/icons';\nimport { Schema } from '@strapi/types';\nimport { type Text, Editor, Node, Transforms, Path, Element } from 'slate';\nimport { type RenderElementProps, ReactEditor } from 'slate-react';\nimport { styled, type CSSProperties, css } from 'styled-components';\n\nimport { type BlocksStore } from '../BlocksEditor';\nimport { baseHandleConvert } from '../utils/conversions';\nimport { type Block } from '../utils/types';\n\nconst listStyle = css`\n display: flex;\n flex-direction: column;\n gap: ${({ theme }) => theme.spaces[2]};\n margin-inline-start: ${({ theme }) => theme.spaces[0]};\n margin-inline-end: ${({ theme }) => theme.spaces[0]};\n padding-inline-start: ${({ theme }) => theme.spaces[2]};\n\n ol,\n ul {\n margin-block-start: ${({ theme }) => theme.spaces[0]};\n margin-block-end: ${({ theme }) => theme.spaces[0]};\n }\n\n li {\n margin-inline-start: ${({ theme }) => theme.spaces[3]};\n }\n`;\n\nconst Orderedlist = styled.ol<{ $listStyleType: CSSProperties['listStyleType'] }>`\n list-style-type: ${(props) => props.$listStyleType};\n ${listStyle}\n`;\n\nconst Unorderedlist = styled.ul<{ $listStyleType: CSSProperties['listStyleType'] }>`\n list-style-type: ${(props) => props.$listStyleType};\n ${listStyle}\n`;\n\nconst orderedStyles = ['decimal', 'lower-alpha', 'upper-roman'];\nconst unorderedStyles = ['disc', 'circle', 'square'];\n\nconst isListNode = (element: Element): element is Schema.Attribute.ListBlockNode => {\n return element.type === 'list';\n};\n\nconst List = ({ attributes, children, element }: RenderElementProps) => {\n if (!isListNode(element)) {\n return null;\n }\n\n // Decide the subsequent style by referencing the given styles according to the format,\n // allowing for infinite nested lists\n const listStyles = element.format === 'ordered' ? orderedStyles : unorderedStyles;\n const nextIndex = (element.indentLevel || 0) % listStyles!.length;\n const listStyleType = listStyles![nextIndex];\n\n if (element.format === 'ordered') {\n return (\n <Orderedlist $listStyleType={listStyleType} {...attributes}>\n {children}\n </Orderedlist>\n );\n }\n\n return (\n <Unorderedlist $listStyleType={listStyleType} {...attributes}>\n {children}\n </Unorderedlist>\n );\n};\n\nconst replaceListWithEmptyBlock = (editor: Editor, currentListPath: Path) => {\n // Delete the empty list\n Transforms.removeNodes(editor, { at: currentListPath });\n\n if (currentListPath[0] === 0) {\n // If the list was the only (or first) block element then insert empty paragraph as editor needs default value\n Transforms.insertNodes(\n editor,\n {\n type: 'paragraph',\n children: [{ type: 'text', text: '' }],\n },\n { at: currentListPath }\n );\n Transforms.select(editor, currentListPath);\n }\n};\n\nconst isText = (node: unknown): node is Text => {\n return Node.isNode(node) && !Editor.isEditor(node) && node.type === 'text';\n};\n\n/**\n * Common handler for the backspace event on ordered and unordered lists\n */\nconst handleBackspaceKeyOnList = (editor: Editor, event: React.KeyboardEvent<HTMLElement>) => {\n if (!editor.selection) return;\n\n const [currentListItem, currentListItemPath] = Editor.parent(editor, editor.selection.anchor);\n const [currentList, currentListPath] = Editor.parent(editor, currentListItemPath);\n const isListEmpty =\n currentList.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isListItemEmpty =\n currentListItem.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isFocusAtTheBeginningOfAChild =\n editor.selection.focus.offset === 0 && editor.selection.focus.path.at(-2) === 0;\n\n if (isListEmpty) {\n const parentListEntry = Editor.above(editor, {\n at: currentListPath,\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n });\n if (!parentListEntry) {\n event.preventDefault();\n replaceListWithEmptyBlock(editor, currentListPath);\n }\n } else if (isFocusAtTheBeginningOfAChild) {\n // If the focus is at the beginning of a child node we need to replace it with a paragraph\n Transforms.liftNodes(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list-item',\n });\n Transforms.setNodes(editor, { type: 'paragraph' });\n } else if (isListItemEmpty) {\n const previousEntry = Editor.previous(editor, {\n at: currentListItemPath,\n });\n const nextEntry = Editor.next(editor, {\n at: currentListItemPath,\n });\n\n if (previousEntry && nextEntry) {\n // If previous and next nodes are lists or list-items, delete empty list item\n event.preventDefault();\n Transforms.removeNodes(editor, {\n at: currentListItemPath,\n });\n\n // If previous and next nodes are lists with same format and indent Levels, then merge the nodes\n const [previousList] = previousEntry;\n const [nextList] = nextEntry;\n if (\n !Editor.isEditor(previousList) &&\n !isText(previousList) &&\n isListNode(previousList) &&\n !Editor.isEditor(nextList) &&\n !isText(nextList) &&\n isListNode(nextList)\n ) {\n if (\n previousList.type === 'list' &&\n nextList.type === 'list' &&\n previousList.format === nextList.format &&\n previousList.indentLevel === nextList.indentLevel\n ) {\n Transforms.mergeNodes(editor, {\n at: currentListItemPath,\n });\n }\n }\n }\n }\n};\n\n/**\n * Common handler for the enter key on ordered and unordered lists\n */\nconst handleEnterKeyOnList = (editor: Editor) => {\n const currentListItemEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list-item',\n });\n\n if (!currentListItemEntry || !editor.selection) {\n return;\n }\n\n const [currentListItem, currentListItemPath] = currentListItemEntry;\n const [currentList, currentListPath] = Editor.parent(editor, currentListItemPath);\n const isListEmpty =\n currentList.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isListItemEmpty =\n currentListItem.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isFocusAtTheBeginningOfAChild =\n editor.selection.focus.offset === 0 && editor.selection.focus.path.at(-1) === 0;\n\n if (isListEmpty) {\n replaceListWithEmptyBlock(editor, currentListPath);\n } else if (isFocusAtTheBeginningOfAChild && !isListItemEmpty) {\n // If the focus is at the beginning of a child node, shift below the list item and create a new list-item\n const currentNode = Editor.above(editor, { at: editor.selection.anchor });\n Transforms.insertNodes(editor, { type: 'list-item', children: [{ type: 'text', text: '' }] });\n if (currentNode) {\n const path = currentNode[1];\n const updatedPath = [...path.slice(0, -1), path[path.length - 1] + 1];\n Transforms.select(editor, {\n anchor: { path: updatedPath.concat(0), offset: 0 },\n focus: { path: updatedPath.concat(0), offset: 0 },\n });\n }\n } else if (isListItemEmpty) {\n // Check if there is a list above the current list and shift list-item under it\n if (\n !Editor.isEditor(currentList) &&\n isListNode(currentList) &&\n currentList?.indentLevel &&\n currentList.indentLevel > 0\n ) {\n const previousIndentLevel = currentList.indentLevel - 1;\n\n const parentListNodeEntry = Editor.above(editor, {\n match: (node) =>\n !Editor.isEditor(node) &&\n node.type === 'list' &&\n (node.indentLevel || 0) === previousIndentLevel,\n });\n\n if (parentListNodeEntry) {\n // Get the parent list path and add 1 to it to exit from the current list\n const modifiedPath = currentListItemPath.slice(0, -1);\n if (modifiedPath.length > 0) {\n modifiedPath[modifiedPath.length - 1] += 1;\n }\n\n // Shift list-item under parent list\n Transforms.moveNodes(editor, {\n at: currentListItemPath,\n to: modifiedPath,\n });\n return;\n }\n }\n\n // Otherwise delete the empty list item and create a new paragraph below the parent list\n Transforms.removeNodes(editor, { at: currentListItemPath });\n\n const createdParagraphPath = Path.next(currentListPath);\n Transforms.insertNodes(\n editor,\n {\n type: 'paragraph',\n children: [{ type: 'text', text: '' }],\n },\n { at: createdParagraphPath }\n );\n\n // Move the selection to the newly created paragraph\n Transforms.select(editor, createdParagraphPath);\n } else {\n // Check if the cursor is at the end of the list item\n const isNodeEnd = Editor.isEnd(editor, editor.selection.anchor, currentListItemPath);\n\n if (isNodeEnd) {\n // If there was nothing after the cursor, create a fresh new list item,\n // in order to avoid carrying over the modifiers from the previous list item\n Transforms.insertNodes(editor, { type: 'list-item', children: [{ type: 'text', text: '' }] });\n } else {\n // If there is something after the cursor, split the current list item,\n // so that we keep the content and the modifiers\n Transforms.splitNodes(editor);\n }\n }\n};\n\n/**\n * Common handler for converting a node to a list\n */\nconst handleConvertToList = (editor: Editor, format: Block<'list'>['format']) => {\n const convertedPath = baseHandleConvert<Block<'list-item'>>(editor, { type: 'list-item' });\n\n if (!convertedPath) return;\n\n Transforms.wrapNodes(editor, { type: 'list', format, children: [] }, { at: convertedPath });\n};\n\n/**\n * Common handler for the tab key on ordered and unordered lists\n */\nconst handleTabOnList = (editor: Editor) => {\n const currentListItemEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list-item',\n });\n\n if (!currentListItemEntry || !editor.selection) {\n return;\n }\n\n const [currentListItem, currentListItemPath] = currentListItemEntry;\n const [currentList] = Editor.parent(editor, currentListItemPath);\n\n // Skip tabbing if list-item is the first item in the list\n if (currentListItem === currentList.children[0]) return;\n\n const currentListItemIndex = currentList.children.findIndex((item) => item === currentListItem);\n const previousNode = currentList.children[currentListItemIndex - 1];\n\n // If previous node is a list block then move the list-item under it\n if (previousNode.type === 'list') {\n const nodePath = ReactEditor.findPath(editor, previousNode);\n const insertAtPath = previousNode.children.length;\n\n Transforms.moveNodes(editor, {\n at: currentListItemPath,\n to: nodePath.concat(insertAtPath),\n });\n return;\n }\n\n if (!Editor.isEditor(currentList) && isListNode(currentList)) {\n // Wrap list-item with list block on tab\n Transforms.wrapNodes(editor, {\n type: 'list',\n format: currentList.format,\n indentLevel: (currentList.indentLevel || 0) + 1,\n children: [],\n });\n }\n};\n\n// All that's in common between ordered and unordered list blocks\nconst baseListBlock = {\n renderElement: (props) => <List {...props} />,\n isInBlocksSelector: true,\n handleEnterKey: handleEnterKeyOnList,\n handleBackspaceKey: handleBackspaceKeyOnList,\n handleTab: handleTabOnList,\n isDraggable: (element) => {\n if (!isListNode(element)) {\n throw Error();\n }\n const indentLevel = element.indentLevel ?? 0;\n return indentLevel === 0;\n },\n} satisfies Partial<BlocksStore['list-ordered' | 'list-unordered']>;\n\nconst listBlocks: Pick<BlocksStore, 'list-ordered' | 'list-unordered' | 'list-item'> = {\n 'list-ordered': {\n ...baseListBlock,\n label: {\n id: 'components.Blocks.blocks.orderedList',\n defaultMessage: 'Numbered list',\n },\n icon: NumberList,\n matchNode: (node) => node.type === 'list' && node.format === 'ordered',\n handleConvert: (editor) => handleConvertToList(editor, 'ordered'),\n snippets: ['1.'],\n },\n 'list-unordered': {\n ...baseListBlock,\n label: {\n id: 'components.Blocks.blocks.unorderedList',\n defaultMessage: 'Bulleted list',\n },\n icon: BulletList,\n matchNode: (node) => node.type === 'list' && node.format === 'unordered',\n handleConvert: (editor) => handleConvertToList(editor, 'unordered'),\n snippets: ['-', '*', '+'],\n },\n 'list-item': {\n renderElement: (props) => (\n <Typography tag=\"li\" {...props.attributes}>\n {props.children}\n </Typography>\n ),\n // No handleConvert, list items are created when converting to the parent list\n matchNode: (node) => node.type === 'list-item',\n isInBlocksSelector: false,\n dragHandleTopMargin: '-2px',\n isDraggable: () => false,\n },\n};\n\nexport { listBlocks };\n"],"names":["listStyle","css","theme","spaces","Orderedlist","styled","ol","props","$listStyleType","Unorderedlist","ul","orderedStyles","unorderedStyles","isListNode","element","type","List","attributes","children","listStyles","format","nextIndex","indentLevel","length","listStyleType","_jsx","replaceListWithEmptyBlock","editor","currentListPath","Transforms","removeNodes","at","insertNodes","text","select","isText","node","Node","isNode","Editor","isEditor","handleBackspaceKeyOnList","event","selection","currentListItem","currentListItemPath","parent","anchor","currentList","isListEmpty","isListItemEmpty","isFocusAtTheBeginningOfAChild","focus","offset","path","parentListEntry","above","match","preventDefault","liftNodes","setNodes","previousEntry","previous","nextEntry","next","previousList","nextList","mergeNodes","handleEnterKeyOnList","currentListItemEntry","currentNode","updatedPath","slice","concat","previousIndentLevel","parentListNodeEntry","modifiedPath","moveNodes","to","createdParagraphPath","Path","isNodeEnd","isEnd","splitNodes","handleConvertToList","convertedPath","baseHandleConvert","wrapNodes","handleTabOnList","currentListItemIndex","findIndex","item","previousNode","nodePath","ReactEditor","findPath","insertAtPath","baseListBlock","renderElement","isInBlocksSelector","handleEnterKey","handleBackspaceKey","handleTab","isDraggable","Error","listBlocks","label","id","defaultMessage","icon","NumberList","matchNode","handleConvert","snippets","BulletList","Typography","tag","dragHandleTopMargin"],"mappings":";;;;;;;;;;;AAaA,MAAMA,SAAAA,GAAYC,oBAAG;;;OAGd,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;uBACjB,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;qBACnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;wBAC9B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;;;;wBAIjC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;sBACnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;;;;yBAI9B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;;AAE1D,CAAC;AAED,MAAMC,WAAAA,GAAcC,uBAAAA,CAAOC,EAAsD;AAC9D,mBAAA,EAAE,CAACC,KAAAA,GAAUA,KAAAA,CAAMC,cAAc,CAAC;AACnD,EAAA,EAAER,SAAAA;AACJ,CAAC;AAED,MAAMS,aAAAA,GAAgBJ,uBAAAA,CAAOK,EAAsD;AAChE,mBAAA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AAA;IACA,WAAA,EAAa;QACXf,aAAAA,EAAe,CAAC3F,sBACdkB,cAAA,CAAC0F,uBAAAA,EAAAA;gBAAWC,GAAAA,EAAI,IAAA;AAAM,gBAAA,GAAG7G,MAAMU,UAAU;AACtCV,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMW;;;AAIX6F,QAAAA,SAAAA,EAAW,CAAC3E,IAAAA,GAASA,IAAAA,CAAKrB,IAAI,KAAK,WAAA;QACnCoF,kBAAAA,EAAoB,KAAA;QACpBkB,mBAAAA,EAAqB,MAAA;AACrBd,QAAAA,WAAAA,EAAa,IAAM;AACrB;AACF;;;;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Typography } from '@strapi/design-system';\nimport { BulletList, NumberList } from '@strapi/icons';\nimport { Schema } from '@strapi/types';\nimport { type Text, Editor, Node, Transforms, Path, Element } from 'slate';\nimport { type RenderElementProps, ReactEditor } from 'slate-react';\nimport { styled, type CSSProperties, css } from 'styled-components';\n\nimport { type BlocksStore } from '../BlocksEditor';\nimport { baseHandleConvert } from '../utils/conversions';\nimport { type Block } from '../utils/types';\n\nconst listStyle = css`\n display: flex;\n flex-direction: column;\n gap: ${({ theme }) => theme.spaces[2]};\n margin-inline-start: ${({ theme }) => theme.spaces[0]};\n margin-inline-end: ${({ theme }) => theme.spaces[0]};\n padding-inline-start: ${({ theme }) => theme.spaces[2]};\n\n ol,\n ul {\n margin-block-start: ${({ theme }) => theme.spaces[0]};\n margin-block-end: ${({ theme }) => theme.spaces[0]};\n }\n\n li {\n margin-inline-start: ${({ theme }) => theme.spaces[3]};\n }\n`;\n\nconst Orderedlist = styled.ol<{ $listStyleType: CSSProperties['listStyleType'] }>`\n list-style-type: ${(props) => props.$listStyleType};\n ${listStyle}\n`;\n\nconst Unorderedlist = styled.ul<{ $listStyleType: CSSProperties['listStyleType'] }>`\n list-style-type: ${(props) => props.$listStyleType};\n ${listStyle}\n`;\n\nconst orderedStyles = ['decimal', 'lower-alpha', 'upper-roman'];\nconst unorderedStyles = ['disc', 'circle', 'square'];\n\nconst isListNode = (element: Element): element is Schema.Attribute.ListBlockNode => {\n return element.type === 'list';\n};\n\nconst List = ({ attributes, children, element }: RenderElementProps) => {\n if (!isListNode(element)) {\n return null;\n }\n\n // Decide the subsequent style by referencing the given styles according to the format,\n // allowing for infinite nested lists\n const listStyles = element.format === 'ordered' ? orderedStyles : unorderedStyles;\n const nextIndex = (element.indentLevel || 0) % listStyles!.length;\n const listStyleType = listStyles![nextIndex];\n\n if (element.format === 'ordered') {\n return (\n <Orderedlist $listStyleType={listStyleType} {...attributes}>\n {children}\n </Orderedlist>\n );\n }\n\n return (\n <Unorderedlist $listStyleType={listStyleType} {...attributes}>\n {children}\n </Unorderedlist>\n );\n};\n\nconst replaceListWithEmptyBlock = (editor: Editor, currentListPath: Path) => {\n // Delete the empty list\n Transforms.removeNodes(editor, { at: currentListPath });\n\n if (currentListPath[0] === 0) {\n // If the list was the only (or first) block element then insert empty paragraph as editor needs default value\n Transforms.insertNodes(\n editor,\n {\n type: 'paragraph',\n children: [{ type: 'text', text: '' }],\n },\n { at: currentListPath }\n );\n Transforms.select(editor, currentListPath);\n }\n};\n\nconst isText = (node: unknown): node is Text => {\n return Node.isNode(node) && !Editor.isEditor(node) && node.type === 'text';\n};\n\n/**\n * Common handler for the backspace event on ordered and unordered lists\n */\nconst handleBackspaceKeyOnList = (editor: Editor, event: React.KeyboardEvent<HTMLElement>) => {\n if (!editor.selection) return;\n\n const [currentListItem, currentListItemPath] = Editor.parent(editor, editor.selection.anchor);\n const [currentList, currentListPath] = Editor.parent(editor, currentListItemPath);\n const isListEmpty =\n currentList.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isListItemEmpty =\n currentListItem.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isFocusAtTheBeginningOfAChild =\n editor.selection.focus.offset === 0 && editor.selection.focus.path.at(-2) === 0;\n\n if (isListEmpty) {\n const parentListEntry = Editor.above(editor, {\n at: currentListPath,\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n });\n if (!parentListEntry) {\n event.preventDefault();\n replaceListWithEmptyBlock(editor, currentListPath);\n }\n } else if (isFocusAtTheBeginningOfAChild) {\n // If the focus is at the beginning of a child node we need to replace it with a paragraph\n Transforms.liftNodes(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list-item',\n });\n Transforms.setNodes(editor, { type: 'paragraph' });\n } else if (isListItemEmpty) {\n const previousEntry = Editor.previous(editor, {\n at: currentListItemPath,\n });\n const nextEntry = Editor.next(editor, {\n at: currentListItemPath,\n });\n\n if (previousEntry && nextEntry) {\n // If previous and next nodes are lists or list-items, delete empty list item\n event.preventDefault();\n Transforms.removeNodes(editor, {\n at: currentListItemPath,\n });\n\n // If previous and next nodes are lists with same format and indent Levels, then merge the nodes\n const [previousList] = previousEntry;\n const [nextList] = nextEntry;\n if (\n !Editor.isEditor(previousList) &&\n !isText(previousList) &&\n isListNode(previousList) &&\n !Editor.isEditor(nextList) &&\n !isText(nextList) &&\n isListNode(nextList)\n ) {\n if (\n previousList.type === 'list' &&\n nextList.type === 'list' &&\n previousList.format === nextList.format &&\n previousList.indentLevel === nextList.indentLevel\n ) {\n Transforms.mergeNodes(editor, {\n at: currentListItemPath,\n });\n }\n }\n }\n }\n};\n\n/**\n * Common handler for the enter key on ordered and unordered lists\n */\nconst handleEnterKeyOnList = (editor: Editor) => {\n const currentListItemEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list-item',\n });\n\n if (!currentListItemEntry || !editor.selection) {\n return;\n }\n\n const [currentListItem, currentListItemPath] = currentListItemEntry;\n const [currentList, currentListPath] = Editor.parent(editor, currentListItemPath);\n const isListEmpty =\n currentList.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isListItemEmpty =\n currentListItem.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isFocusAtTheBeginningOfAChild =\n editor.selection.focus.offset === 0 && editor.selection.focus.path.at(-1) === 0;\n\n if (isListEmpty) {\n replaceListWithEmptyBlock(editor, currentListPath);\n } else if (isFocusAtTheBeginningOfAChild && !isListItemEmpty) {\n // If the focus is at the beginning of a child node, shift below the list item and create a new list-item\n const currentNode = Editor.above(editor, { at: editor.selection.anchor });\n Transforms.insertNodes(editor, { type: 'list-item', children: [{ type: 'text', text: '' }] });\n if (currentNode) {\n const path = currentNode[1];\n const updatedPath = [...path.slice(0, -1), path[path.length - 1] + 1];\n Transforms.select(editor, {\n anchor: { path: updatedPath.concat(0), offset: 0 },\n focus: { path: updatedPath.concat(0), offset: 0 },\n });\n }\n } else if (isListItemEmpty) {\n // Check if there is a list above the current list and shift list-item under it\n if (\n !Editor.isEditor(currentList) &&\n isListNode(currentList) &&\n currentList?.indentLevel &&\n currentList.indentLevel > 0\n ) {\n const previousIndentLevel = currentList.indentLevel - 1;\n\n const parentListNodeEntry = Editor.above(editor, {\n match: (node) =>\n !Editor.isEditor(node) &&\n node.type === 'list' &&\n (node.indentLevel || 0) === previousIndentLevel,\n });\n\n if (parentListNodeEntry) {\n // Get the parent list path and add 1 to it to exit from the current list\n const modifiedPath = currentListItemPath.slice(0, -1);\n if (modifiedPath.length > 0) {\n modifiedPath[modifiedPath.length - 1] += 1;\n }\n\n // Shift list-item under parent list\n Transforms.moveNodes(editor, {\n at: currentListItemPath,\n to: modifiedPath,\n });\n return;\n }\n }\n\n // Otherwise delete the empty list item and create a new paragraph below the parent list\n Transforms.removeNodes(editor, { at: currentListItemPath });\n\n const createdParagraphPath = Path.next(currentListPath);\n Transforms.insertNodes(\n editor,\n {\n type: 'paragraph',\n children: [{ type: 'text', text: '' }],\n },\n { at: createdParagraphPath }\n );\n\n // Move the selection to the newly created paragraph\n Transforms.select(editor, createdParagraphPath);\n } else {\n // Check if the cursor is at the end of the list item\n const isNodeEnd = Editor.isEnd(editor, editor.selection.anchor, currentListItemPath);\n\n if (isNodeEnd) {\n // If there was nothing after the cursor, create a fresh new list item,\n // in order to avoid carrying over the modifiers from the previous list item\n Transforms.insertNodes(editor, { type: 'list-item', children: [{ type: 'text', text: '' }] });\n } else {\n // If there is something after the cursor, split the current list item,\n // so that we keep the content and the modifiers\n Transforms.splitNodes(editor);\n }\n }\n};\n\n/**\n * Common handler for converting a node to a list\n */\nconst handleConvertToList = (editor: Editor, format: Block<'list'>['format']) => {\n const convertedPath = baseHandleConvert<Block<'list-item'>>(editor, { type: 'list-item' });\n\n if (!convertedPath) return;\n\n Transforms.wrapNodes(editor, { type: 'list', format, children: [] }, { at: convertedPath });\n};\n\n/**\n * Common handler for the tab key on ordered and unordered lists\n */\nconst handleTabOnList = (editor: Editor) => {\n const currentListItemEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list-item',\n });\n\n if (!currentListItemEntry || !editor.selection) {\n return;\n }\n\n const [currentListItem, currentListItemPath] = currentListItemEntry;\n const [currentList] = Editor.parent(editor, currentListItemPath);\n\n // Skip tabbing if list-item is the first item in the list\n if (currentListItem === currentList.children[0]) return;\n\n const currentListItemIndex = currentList.children.findIndex((item) => item === currentListItem);\n const previousNode = currentList.children[currentListItemIndex - 1];\n\n // If previous node is a list block then move the list-item under it\n if (previousNode.type === 'list') {\n const nodePath = ReactEditor.findPath(editor, previousNode);\n const insertAtPath = previousNode.children.length;\n\n Transforms.moveNodes(editor, {\n at: currentListItemPath,\n to: nodePath.concat(insertAtPath),\n });\n return;\n }\n\n if (!Editor.isEditor(currentList) && isListNode(currentList)) {\n // Wrap list-item with list block on tab\n Transforms.wrapNodes(editor, {\n type: 'list',\n format: currentList.format,\n indentLevel: (currentList.indentLevel || 0) + 1,\n children: [],\n });\n }\n};\n\n/**\n * Common handler for the shift+tab key on ordered and unordered lists (un-indentation)\n */\n\nconst hasChildren = (node: any): node is { children: unknown[] } => {\n return typeof node === 'object' && node !== null && 'children' in node;\n};\n\nconst handleShiftTabOnList = (editor: Editor) => {\n const currentListItemEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && 'type' in node && node.type === 'list-item',\n });\n\n if (!currentListItemEntry || !editor.selection) {\n return;\n }\n\n const [, currentListItemPath] = currentListItemEntry;\n\n const [currentList] = Editor.parent(editor, currentListItemPath);\n\n if (\n !Editor.isEditor(currentList) &&\n hasChildren(currentList) &&\n (currentList as any).type === 'list'\n ) {\n const parentListPath = Path.parent(currentListItemPath);\n\n const [parentList] = Editor.parent(editor, parentListPath);\n\n // Case 1: The parent of the current list is the editor itself.\n if (Editor.isEditor(parentList)) {\n // Lift the list item to the top level of the editor's children.\n Transforms.liftNodes(editor, {\n at: currentListItemPath,\n match: (node) => !Editor.isEditor(node) && 'type' in node && node.type === 'list-item',\n });\n // Change the type of the newly lifted node from 'list-item' to 'paragraph'.\n Transforms.setNodes(editor, { type: 'paragraph' });\n return;\n }\n\n // Case 2: The parent of the current list is another list.\n if (hasChildren(parentList) && (parentList as any).type === 'list') {\n Transforms.liftNodes(editor, {\n at: currentListItemPath,\n match: (node) => !Editor.isEditor(node) && 'type' in node && node.type === 'list-item',\n });\n\n try {\n const [remainingList, remainingListPath] = Editor.node(editor, parentListPath);\n\n if (\n hasChildren(remainingList) &&\n (remainingList as any).type === 'list' &&\n remainingList.children.length === 0\n ) {\n Transforms.removeNodes(editor, { at: remainingListPath });\n }\n } catch (error) {\n // The path might no longer exist if the structure changed, which is fine\n }\n }\n }\n};\n\n// All that's in common between ordered and unordered list blocks\nconst baseListBlock = {\n renderElement: (props) => <List {...props} />,\n isInBlocksSelector: true,\n handleEnterKey: handleEnterKeyOnList,\n handleBackspaceKey: handleBackspaceKeyOnList,\n handleTab: handleTabOnList,\n isDraggable: (element) => {\n if (!isListNode(element)) {\n throw Error();\n }\n const indentLevel = element.indentLevel ?? 0;\n return indentLevel === 0;\n },\n} satisfies Partial<BlocksStore['list-ordered' | 'list-unordered']>;\n\nconst listBlocks: Pick<BlocksStore, 'list-ordered' | 'list-unordered' | 'list-item'> = {\n 'list-ordered': {\n ...baseListBlock,\n label: {\n id: 'components.Blocks.blocks.orderedList',\n defaultMessage: 'Numbered list',\n },\n icon: NumberList,\n matchNode: (node) => node.type === 'list' && node.format === 'ordered',\n handleConvert: (editor) => handleConvertToList(editor, 'ordered'),\n handleShiftTab: handleShiftTabOnList,\n snippets: ['1.'],\n },\n 'list-unordered': {\n ...baseListBlock,\n label: {\n id: 'components.Blocks.blocks.unorderedList',\n defaultMessage: 'Bulleted list',\n },\n icon: BulletList,\n matchNode: (node) => node.type === 'list' && node.format === 'unordered',\n handleConvert: (editor) => handleConvertToList(editor, 'unordered'),\n handleShiftTab: handleShiftTabOnList,\n snippets: ['-', '*', '+'],\n },\n 'list-item': {\n renderElement: (props) => (\n <Typography tag=\"li\" {...props.attributes}>\n {props.children}\n </Typography>\n ),\n // No handleConvert, list items are created when converting to the parent list\n matchNode: (node) => node.type === 'list-item',\n isInBlocksSelector: false,\n dragHandleTopMargin: '-2px',\n isDraggable: () => false,\n },\n};\n\nexport { listBlocks };\n"],"names":["listStyle","css","theme","spaces","Orderedlist","styled","ol","props","$listStyleType","Unorderedlist","ul","orderedStyles","unorderedStyles","isListNode","element","type","List","attributes","children","listStyles","format","nextIndex","indentLevel","length","listStyleType","_jsx","replaceListWithEmptyBlock","editor","currentListPath","Transforms","removeNodes","at","insertNodes","text","select","isText","node","Node","isNode","Editor","isEditor","handleBackspaceKeyOnList","event","selection","currentListItem","currentListItemPath","parent","anchor","currentList","isListEmpty","isListItemEmpty","isFocusAtTheBeginningOfAChild","focus","offset","path","parentListEntry","above","match","preventDefault","liftNodes","setNodes","previousEntry","previous","nextEntry","next","previousList","nextList","mergeNodes","handleEnterKeyOnList","currentListItemEntry","currentNode","updatedPath","slice","concat","previousIndentLevel","parentListNodeEntry","modifiedPath","moveNodes","to","createdParagraphPath","Path","isNodeEnd","isEnd","splitNodes","handleConvertToList","convertedPath","baseHandleConvert","wrapNodes","handleTabOnList","currentListItemIndex","findIndex","item","previousNode","nodePath","ReactEditor","findPath","insertAtPath","hasChildren","handleShiftTabOnList","parentListPath","parentList","remainingList","remainingListPath","error","baseListBlock","renderElement","isInBlocksSelector","handleEnterKey","handleBackspaceKey","handleTab","isDraggable","Error","listBlocks","label","id","defaultMessage","icon","NumberList","matchNode","handleConvert","handleShiftTab","snippets","BulletList","Typography","tag","dragHandleTopMargin"],"mappings":";;;;;;;;;;;AAaA,MAAMA,SAAAA,GAAYC,oBAAG;;;OAGd,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;uBACjB,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;qBACnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;wBAC9B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;;;;wBAIjC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;sBACnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;;;;yBAI9B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;;AAE1D,CAAC;AAED,MAAMC,WAAAA,GAAcC,uBAAAA,CAAOC,EAAsD;AAC9D,mBAAA,EAAE,CAACC,KAAAA,GAAUA,KAAAA,CAAMC,cAAc,CAAC;AACnD,EAAA,EAAER,SAAAA;AACJ,CAAC;AAED,MAAMS,aAAAA,GAAgBJ,uBAAAA,CAAOK,EAAsD;AAChE,mBAAA,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AWC,GAAAA,EAAI,IAAA;AAAM,gBAAA,GAAGrH,MAAMU,UAAU;AACtCV,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMW;;;AAIXoG,QAAAA,SAAAA,EAAW,CAAClF,IAAAA,GAASA,IAAAA,CAAKrB,IAAI,KAAK,WAAA;QACnC2F,kBAAAA,EAAoB,KAAA;QACpBmB,mBAAAA,EAAqB,MAAA;AACrBf,QAAAA,WAAAA,EAAa,IAAM;AACrB;AACF;;;;"}
@@ -2,7 +2,7 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import 'react';
3
3
  import { Typography } from '@strapi/design-system';
4
4
  import { BulletList, NumberList } from '@strapi/icons';
5
- import { Editor, Transforms, Path, Node } from 'slate';
5
+ import { Editor, Path, Transforms, Node } from 'slate';
6
6
  import { ReactEditor } from 'slate-react';
7
7
  import { css, styled } from 'styled-components';
8
8
  import { baseHandleConvert } from '../utils/conversions.mjs';
@@ -302,6 +302,55 @@ const isText = (node)=>{
302
302
  });
303
303
  }
304
304
  };
305
+ /**
306
+ * Common handler for the shift+tab key on ordered and unordered lists (un-indentation)
307
+ */ const hasChildren = (node)=>{
308
+ return typeof node === 'object' && node !== null && 'children' in node;
309
+ };
310
+ const handleShiftTabOnList = (editor)=>{
311
+ const currentListItemEntry = Editor.above(editor, {
312
+ match: (node)=>!Editor.isEditor(node) && 'type' in node && node.type === 'list-item'
313
+ });
314
+ if (!currentListItemEntry || !editor.selection) {
315
+ return;
316
+ }
317
+ const [, currentListItemPath] = currentListItemEntry;
318
+ const [currentList] = Editor.parent(editor, currentListItemPath);
319
+ if (!Editor.isEditor(currentList) && hasChildren(currentList) && currentList.type === 'list') {
320
+ const parentListPath = Path.parent(currentListItemPath);
321
+ const [parentList] = Editor.parent(editor, parentListPath);
322
+ // Case 1: The parent of the current list is the editor itself.
323
+ if (Editor.isEditor(parentList)) {
324
+ // Lift the list item to the top level of the editor's children.
325
+ Transforms.liftNodes(editor, {
326
+ at: currentListItemPath,
327
+ match: (node)=>!Editor.isEditor(node) && 'type' in node && node.type === 'list-item'
328
+ });
329
+ // Change the type of the newly lifted node from 'list-item' to 'paragraph'.
330
+ Transforms.setNodes(editor, {
331
+ type: 'paragraph'
332
+ });
333
+ return;
334
+ }
335
+ // Case 2: The parent of the current list is another list.
336
+ if (hasChildren(parentList) && parentList.type === 'list') {
337
+ Transforms.liftNodes(editor, {
338
+ at: currentListItemPath,
339
+ match: (node)=>!Editor.isEditor(node) && 'type' in node && node.type === 'list-item'
340
+ });
341
+ try {
342
+ const [remainingList, remainingListPath] = Editor.node(editor, parentListPath);
343
+ if (hasChildren(remainingList) && remainingList.type === 'list' && remainingList.children.length === 0) {
344
+ Transforms.removeNodes(editor, {
345
+ at: remainingListPath
346
+ });
347
+ }
348
+ } catch (error) {
349
+ // The path might no longer exist if the structure changed, which is fine
350
+ }
351
+ }
352
+ }
353
+ };
305
354
  // All that's in common between ordered and unordered list blocks
306
355
  const baseListBlock = {
307
356
  renderElement: (props)=>/*#__PURE__*/ jsx(List, {
@@ -329,6 +378,7 @@ const listBlocks = {
329
378
  icon: NumberList,
330
379
  matchNode: (node)=>node.type === 'list' && node.format === 'ordered',
331
380
  handleConvert: (editor)=>handleConvertToList(editor, 'ordered'),
381
+ handleShiftTab: handleShiftTabOnList,
332
382
  snippets: [
333
383
  '1.'
334
384
  ]
@@ -342,6 +392,7 @@ const listBlocks = {
342
392
  icon: BulletList,
343
393
  matchNode: (node)=>node.type === 'list' && node.format === 'unordered',
344
394
  handleConvert: (editor)=>handleConvertToList(editor, 'unordered'),
395
+ handleShiftTab: handleShiftTabOnList,
345
396
  snippets: [
346
397
  '-',
347
398
  '*',
@@ -1 +1 @@
1
- {"version":3,"file":"List.mjs","sources":["../../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Typography } from '@strapi/design-system';\nimport { BulletList, NumberList } from '@strapi/icons';\nimport { Schema } from '@strapi/types';\nimport { type Text, Editor, Node, Transforms, Path, Element } from 'slate';\nimport { type RenderElementProps, ReactEditor } from 'slate-react';\nimport { styled, type CSSProperties, css } from 'styled-components';\n\nimport { type BlocksStore } from '../BlocksEditor';\nimport { baseHandleConvert } from '../utils/conversions';\nimport { type Block } from '../utils/types';\n\nconst listStyle = css`\n display: flex;\n flex-direction: column;\n gap: ${({ theme }) => theme.spaces[2]};\n margin-inline-start: ${({ theme }) => theme.spaces[0]};\n margin-inline-end: ${({ theme }) => theme.spaces[0]};\n padding-inline-start: ${({ theme }) => theme.spaces[2]};\n\n ol,\n ul {\n margin-block-start: ${({ theme }) => theme.spaces[0]};\n margin-block-end: ${({ theme }) => theme.spaces[0]};\n }\n\n li {\n margin-inline-start: ${({ theme }) => theme.spaces[3]};\n }\n`;\n\nconst Orderedlist = styled.ol<{ $listStyleType: CSSProperties['listStyleType'] }>`\n list-style-type: ${(props) => props.$listStyleType};\n ${listStyle}\n`;\n\nconst Unorderedlist = styled.ul<{ $listStyleType: CSSProperties['listStyleType'] }>`\n list-style-type: ${(props) => props.$listStyleType};\n ${listStyle}\n`;\n\nconst orderedStyles = ['decimal', 'lower-alpha', 'upper-roman'];\nconst unorderedStyles = ['disc', 'circle', 'square'];\n\nconst isListNode = (element: Element): element is Schema.Attribute.ListBlockNode => {\n return element.type === 'list';\n};\n\nconst List = ({ attributes, children, element }: RenderElementProps) => {\n if (!isListNode(element)) {\n return null;\n }\n\n // Decide the subsequent style by referencing the given styles according to the format,\n // allowing for infinite nested lists\n const listStyles = element.format === 'ordered' ? orderedStyles : unorderedStyles;\n const nextIndex = (element.indentLevel || 0) % listStyles!.length;\n const listStyleType = listStyles![nextIndex];\n\n if (element.format === 'ordered') {\n return (\n <Orderedlist $listStyleType={listStyleType} {...attributes}>\n {children}\n </Orderedlist>\n );\n }\n\n return (\n <Unorderedlist $listStyleType={listStyleType} {...attributes}>\n {children}\n </Unorderedlist>\n );\n};\n\nconst replaceListWithEmptyBlock = (editor: Editor, currentListPath: Path) => {\n // Delete the empty list\n Transforms.removeNodes(editor, { at: currentListPath });\n\n if (currentListPath[0] === 0) {\n // If the list was the only (or first) block element then insert empty paragraph as editor needs default value\n Transforms.insertNodes(\n editor,\n {\n type: 'paragraph',\n children: [{ type: 'text', text: '' }],\n },\n { at: currentListPath }\n );\n Transforms.select(editor, currentListPath);\n }\n};\n\nconst isText = (node: unknown): node is Text => {\n return Node.isNode(node) && !Editor.isEditor(node) && node.type === 'text';\n};\n\n/**\n * Common handler for the backspace event on ordered and unordered lists\n */\nconst handleBackspaceKeyOnList = (editor: Editor, event: React.KeyboardEvent<HTMLElement>) => {\n if (!editor.selection) return;\n\n const [currentListItem, currentListItemPath] = Editor.parent(editor, editor.selection.anchor);\n const [currentList, currentListPath] = Editor.parent(editor, currentListItemPath);\n const isListEmpty =\n currentList.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isListItemEmpty =\n currentListItem.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isFocusAtTheBeginningOfAChild =\n editor.selection.focus.offset === 0 && editor.selection.focus.path.at(-2) === 0;\n\n if (isListEmpty) {\n const parentListEntry = Editor.above(editor, {\n at: currentListPath,\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n });\n if (!parentListEntry) {\n event.preventDefault();\n replaceListWithEmptyBlock(editor, currentListPath);\n }\n } else if (isFocusAtTheBeginningOfAChild) {\n // If the focus is at the beginning of a child node we need to replace it with a paragraph\n Transforms.liftNodes(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list-item',\n });\n Transforms.setNodes(editor, { type: 'paragraph' });\n } else if (isListItemEmpty) {\n const previousEntry = Editor.previous(editor, {\n at: currentListItemPath,\n });\n const nextEntry = Editor.next(editor, {\n at: currentListItemPath,\n });\n\n if (previousEntry && nextEntry) {\n // If previous and next nodes are lists or list-items, delete empty list item\n event.preventDefault();\n Transforms.removeNodes(editor, {\n at: currentListItemPath,\n });\n\n // If previous and next nodes are lists with same format and indent Levels, then merge the nodes\n const [previousList] = previousEntry;\n const [nextList] = nextEntry;\n if (\n !Editor.isEditor(previousList) &&\n !isText(previousList) &&\n isListNode(previousList) &&\n !Editor.isEditor(nextList) &&\n !isText(nextList) &&\n isListNode(nextList)\n ) {\n if (\n previousList.type === 'list' &&\n nextList.type === 'list' &&\n previousList.format === nextList.format &&\n previousList.indentLevel === nextList.indentLevel\n ) {\n Transforms.mergeNodes(editor, {\n at: currentListItemPath,\n });\n }\n }\n }\n }\n};\n\n/**\n * Common handler for the enter key on ordered and unordered lists\n */\nconst handleEnterKeyOnList = (editor: Editor) => {\n const currentListItemEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list-item',\n });\n\n if (!currentListItemEntry || !editor.selection) {\n return;\n }\n\n const [currentListItem, currentListItemPath] = currentListItemEntry;\n const [currentList, currentListPath] = Editor.parent(editor, currentListItemPath);\n const isListEmpty =\n currentList.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isListItemEmpty =\n currentListItem.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isFocusAtTheBeginningOfAChild =\n editor.selection.focus.offset === 0 && editor.selection.focus.path.at(-1) === 0;\n\n if (isListEmpty) {\n replaceListWithEmptyBlock(editor, currentListPath);\n } else if (isFocusAtTheBeginningOfAChild && !isListItemEmpty) {\n // If the focus is at the beginning of a child node, shift below the list item and create a new list-item\n const currentNode = Editor.above(editor, { at: editor.selection.anchor });\n Transforms.insertNodes(editor, { type: 'list-item', children: [{ type: 'text', text: '' }] });\n if (currentNode) {\n const path = currentNode[1];\n const updatedPath = [...path.slice(0, -1), path[path.length - 1] + 1];\n Transforms.select(editor, {\n anchor: { path: updatedPath.concat(0), offset: 0 },\n focus: { path: updatedPath.concat(0), offset: 0 },\n });\n }\n } else if (isListItemEmpty) {\n // Check if there is a list above the current list and shift list-item under it\n if (\n !Editor.isEditor(currentList) &&\n isListNode(currentList) &&\n currentList?.indentLevel &&\n currentList.indentLevel > 0\n ) {\n const previousIndentLevel = currentList.indentLevel - 1;\n\n const parentListNodeEntry = Editor.above(editor, {\n match: (node) =>\n !Editor.isEditor(node) &&\n node.type === 'list' &&\n (node.indentLevel || 0) === previousIndentLevel,\n });\n\n if (parentListNodeEntry) {\n // Get the parent list path and add 1 to it to exit from the current list\n const modifiedPath = currentListItemPath.slice(0, -1);\n if (modifiedPath.length > 0) {\n modifiedPath[modifiedPath.length - 1] += 1;\n }\n\n // Shift list-item under parent list\n Transforms.moveNodes(editor, {\n at: currentListItemPath,\n to: modifiedPath,\n });\n return;\n }\n }\n\n // Otherwise delete the empty list item and create a new paragraph below the parent list\n Transforms.removeNodes(editor, { at: currentListItemPath });\n\n const createdParagraphPath = Path.next(currentListPath);\n Transforms.insertNodes(\n editor,\n {\n type: 'paragraph',\n children: [{ type: 'text', text: '' }],\n },\n { at: createdParagraphPath }\n );\n\n // Move the selection to the newly created paragraph\n Transforms.select(editor, createdParagraphPath);\n } else {\n // Check if the cursor is at the end of the list item\n const isNodeEnd = Editor.isEnd(editor, editor.selection.anchor, currentListItemPath);\n\n if (isNodeEnd) {\n // If there was nothing after the cursor, create a fresh new list item,\n // in order to avoid carrying over the modifiers from the previous list item\n Transforms.insertNodes(editor, { type: 'list-item', children: [{ type: 'text', text: '' }] });\n } else {\n // If there is something after the cursor, split the current list item,\n // so that we keep the content and the modifiers\n Transforms.splitNodes(editor);\n }\n }\n};\n\n/**\n * Common handler for converting a node to a list\n */\nconst handleConvertToList = (editor: Editor, format: Block<'list'>['format']) => {\n const convertedPath = baseHandleConvert<Block<'list-item'>>(editor, { type: 'list-item' });\n\n if (!convertedPath) return;\n\n Transforms.wrapNodes(editor, { type: 'list', format, children: [] }, { at: convertedPath });\n};\n\n/**\n * Common handler for the tab key on ordered and unordered lists\n */\nconst handleTabOnList = (editor: Editor) => {\n const currentListItemEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list-item',\n });\n\n if (!currentListItemEntry || !editor.selection) {\n return;\n }\n\n const [currentListItem, currentListItemPath] = currentListItemEntry;\n const [currentList] = Editor.parent(editor, currentListItemPath);\n\n // Skip tabbing if list-item is the first item in the list\n if (currentListItem === currentList.children[0]) return;\n\n const currentListItemIndex = currentList.children.findIndex((item) => item === currentListItem);\n const previousNode = currentList.children[currentListItemIndex - 1];\n\n // If previous node is a list block then move the list-item under it\n if (previousNode.type === 'list') {\n const nodePath = ReactEditor.findPath(editor, previousNode);\n const insertAtPath = previousNode.children.length;\n\n Transforms.moveNodes(editor, {\n at: currentListItemPath,\n to: nodePath.concat(insertAtPath),\n });\n return;\n }\n\n if (!Editor.isEditor(currentList) && isListNode(currentList)) {\n // Wrap list-item with list block on tab\n Transforms.wrapNodes(editor, {\n type: 'list',\n format: currentList.format,\n indentLevel: (currentList.indentLevel || 0) + 1,\n children: [],\n });\n }\n};\n\n// All that's in common between ordered and unordered list blocks\nconst baseListBlock = {\n renderElement: (props) => <List {...props} />,\n isInBlocksSelector: true,\n handleEnterKey: handleEnterKeyOnList,\n handleBackspaceKey: handleBackspaceKeyOnList,\n handleTab: handleTabOnList,\n isDraggable: (element) => {\n if (!isListNode(element)) {\n throw Error();\n }\n const indentLevel = element.indentLevel ?? 0;\n return indentLevel === 0;\n },\n} satisfies Partial<BlocksStore['list-ordered' | 'list-unordered']>;\n\nconst listBlocks: Pick<BlocksStore, 'list-ordered' | 'list-unordered' | 'list-item'> = {\n 'list-ordered': {\n ...baseListBlock,\n label: {\n id: 'components.Blocks.blocks.orderedList',\n defaultMessage: 'Numbered list',\n },\n icon: NumberList,\n matchNode: (node) => node.type === 'list' && node.format === 'ordered',\n handleConvert: (editor) => handleConvertToList(editor, 'ordered'),\n snippets: ['1.'],\n },\n 'list-unordered': {\n ...baseListBlock,\n label: {\n id: 'components.Blocks.blocks.unorderedList',\n defaultMessage: 'Bulleted list',\n },\n icon: BulletList,\n matchNode: (node) => node.type === 'list' && node.format === 'unordered',\n handleConvert: (editor) => handleConvertToList(editor, 'unordered'),\n snippets: ['-', '*', '+'],\n },\n 'list-item': {\n renderElement: (props) => (\n <Typography tag=\"li\" {...props.attributes}>\n {props.children}\n </Typography>\n ),\n // No handleConvert, list items are created when converting to the parent list\n matchNode: (node) => node.type === 'list-item',\n isInBlocksSelector: false,\n dragHandleTopMargin: '-2px',\n isDraggable: () => false,\n },\n};\n\nexport { listBlocks };\n"],"names":["listStyle","css","theme","spaces","Orderedlist","styled","ol","props","$listStyleType","Unorderedlist","ul","orderedStyles","unorderedStyles","isListNode","element","type","List","attributes","children","listStyles","format","nextIndex","indentLevel","length","listStyleType","_jsx","replaceListWithEmptyBlock","editor","currentListPath","Transforms","removeNodes","at","insertNodes","text","select","isText","node","Node","isNode","Editor","isEditor","handleBackspaceKeyOnList","event","selection","currentListItem","currentListItemPath","parent","anchor","currentList","isListEmpty","isListItemEmpty","isFocusAtTheBeginningOfAChild","focus","offset","path","parentListEntry","above","match","preventDefault","liftNodes","setNodes","previousEntry","previous","nextEntry","next","previousList","nextList","mergeNodes","handleEnterKeyOnList","currentListItemEntry","currentNode","updatedPath","slice","concat","previousIndentLevel","parentListNodeEntry","modifiedPath","moveNodes","to","createdParagraphPath","Path","isNodeEnd","isEnd","splitNodes","handleConvertToList","convertedPath","baseHandleConvert","wrapNodes","handleTabOnList","currentListItemIndex","findIndex","item","previousNode","nodePath","ReactEditor","findPath","insertAtPath","baseListBlock","renderElement","isInBlocksSelector","handleEnterKey","handleBackspaceKey","handleTab","isDraggable","Error","listBlocks","label","id","defaultMessage","icon","NumberList","matchNode","handleConvert","snippets","BulletList","Typography","tag","dragHandleTopMargin"],"mappings":";;;;;;;;;AAaA,MAAMA,SAAAA,GAAYC,GAAG;;;OAGd,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;uBACjB,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAA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AAAA;QACNC,SAAAA,EAAW,CAAC3E,OAASA,IAAAA,CAAKrB,IAAI,KAAK,MAAA,IAAUqB,IAAAA,CAAKhB,MAAM,KAAK,SAAA;QAC7D4F,aAAAA,EAAe,CAACrF,MAAAA,GAAWyD,mBAAAA,CAAoBzD,MAAAA,EAAQ,SAAA,CAAA;QACvDsF,QAAAA,EAAU;AAAC,YAAA;AAAK;AAClB,KAAA;IACA,gBAAA,EAAkB;AAChB,QAAA,GAAGhB,aAAa;QAChBS,KAAAA,EAAO;YACLC,EAAAA,EAAI,wCAAA;YACJC,cAAAA,EAAgB;AAClB,SAAA;QACAC,IAAAA,EAAMK,UAAAA;QACNH,SAAAA,EAAW,CAAC3E,OAASA,IAAAA,CAAKrB,IAAI,KAAK,MAAA,IAAUqB,IAAAA,CAAKhB,MAAM,KAAK,WAAA;QAC7D4F,aAAAA,EAAe,CAACrF,MAAAA,GAAWyD,mBAAAA,CAAoBzD,MAAAA,EAAQ,WAAA,CAAA;QACvDsF,QAAAA,EAAU;AAAC,YAAA,GAAA;AAAK,YAAA,GAAA;AAAK,YAAA;AAAI;AAC3B,KAAA;IACA,WAAA,EAAa;QACXf,aAAAA,EAAe,CAAC3F,sBACdkB,GAAA,CAAC0F,UAAAA,EAAAA;gBAAWC,GAAAA,EAAI,IAAA;AAAM,gBAAA,GAAG7G,MAAMU,UAAU;AACtCV,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMW;;;AAIX6F,QAAAA,SAAAA,EAAW,CAAC3E,IAAAA,GAASA,IAAAA,CAAKrB,IAAI,KAAK,WAAA;QACnCoF,kBAAAA,EAAoB,KAAA;QACpBkB,mBAAAA,EAAqB,MAAA;AACrBd,QAAAA,WAAAA,EAAa,IAAM;AACrB;AACF;;;;"}
1
+ {"version":3,"file":"List.mjs","sources":["../../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Typography } from '@strapi/design-system';\nimport { BulletList, NumberList } from '@strapi/icons';\nimport { Schema } from '@strapi/types';\nimport { type Text, Editor, Node, Transforms, Path, Element } from 'slate';\nimport { type RenderElementProps, ReactEditor } from 'slate-react';\nimport { styled, type CSSProperties, css } from 'styled-components';\n\nimport { type BlocksStore } from '../BlocksEditor';\nimport { baseHandleConvert } from '../utils/conversions';\nimport { type Block } from '../utils/types';\n\nconst listStyle = css`\n display: flex;\n flex-direction: column;\n gap: ${({ theme }) => theme.spaces[2]};\n margin-inline-start: ${({ theme }) => theme.spaces[0]};\n margin-inline-end: ${({ theme }) => theme.spaces[0]};\n padding-inline-start: ${({ theme }) => theme.spaces[2]};\n\n ol,\n ul {\n margin-block-start: ${({ theme }) => theme.spaces[0]};\n margin-block-end: ${({ theme }) => theme.spaces[0]};\n }\n\n li {\n margin-inline-start: ${({ theme }) => theme.spaces[3]};\n }\n`;\n\nconst Orderedlist = styled.ol<{ $listStyleType: CSSProperties['listStyleType'] }>`\n list-style-type: ${(props) => props.$listStyleType};\n ${listStyle}\n`;\n\nconst Unorderedlist = styled.ul<{ $listStyleType: CSSProperties['listStyleType'] }>`\n list-style-type: ${(props) => props.$listStyleType};\n ${listStyle}\n`;\n\nconst orderedStyles = ['decimal', 'lower-alpha', 'upper-roman'];\nconst unorderedStyles = ['disc', 'circle', 'square'];\n\nconst isListNode = (element: Element): element is Schema.Attribute.ListBlockNode => {\n return element.type === 'list';\n};\n\nconst List = ({ attributes, children, element }: RenderElementProps) => {\n if (!isListNode(element)) {\n return null;\n }\n\n // Decide the subsequent style by referencing the given styles according to the format,\n // allowing for infinite nested lists\n const listStyles = element.format === 'ordered' ? orderedStyles : unorderedStyles;\n const nextIndex = (element.indentLevel || 0) % listStyles!.length;\n const listStyleType = listStyles![nextIndex];\n\n if (element.format === 'ordered') {\n return (\n <Orderedlist $listStyleType={listStyleType} {...attributes}>\n {children}\n </Orderedlist>\n );\n }\n\n return (\n <Unorderedlist $listStyleType={listStyleType} {...attributes}>\n {children}\n </Unorderedlist>\n );\n};\n\nconst replaceListWithEmptyBlock = (editor: Editor, currentListPath: Path) => {\n // Delete the empty list\n Transforms.removeNodes(editor, { at: currentListPath });\n\n if (currentListPath[0] === 0) {\n // If the list was the only (or first) block element then insert empty paragraph as editor needs default value\n Transforms.insertNodes(\n editor,\n {\n type: 'paragraph',\n children: [{ type: 'text', text: '' }],\n },\n { at: currentListPath }\n );\n Transforms.select(editor, currentListPath);\n }\n};\n\nconst isText = (node: unknown): node is Text => {\n return Node.isNode(node) && !Editor.isEditor(node) && node.type === 'text';\n};\n\n/**\n * Common handler for the backspace event on ordered and unordered lists\n */\nconst handleBackspaceKeyOnList = (editor: Editor, event: React.KeyboardEvent<HTMLElement>) => {\n if (!editor.selection) return;\n\n const [currentListItem, currentListItemPath] = Editor.parent(editor, editor.selection.anchor);\n const [currentList, currentListPath] = Editor.parent(editor, currentListItemPath);\n const isListEmpty =\n currentList.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isListItemEmpty =\n currentListItem.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isFocusAtTheBeginningOfAChild =\n editor.selection.focus.offset === 0 && editor.selection.focus.path.at(-2) === 0;\n\n if (isListEmpty) {\n const parentListEntry = Editor.above(editor, {\n at: currentListPath,\n match: (node) => !Editor.isEditor(node) && node.type === 'list',\n });\n if (!parentListEntry) {\n event.preventDefault();\n replaceListWithEmptyBlock(editor, currentListPath);\n }\n } else if (isFocusAtTheBeginningOfAChild) {\n // If the focus is at the beginning of a child node we need to replace it with a paragraph\n Transforms.liftNodes(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list-item',\n });\n Transforms.setNodes(editor, { type: 'paragraph' });\n } else if (isListItemEmpty) {\n const previousEntry = Editor.previous(editor, {\n at: currentListItemPath,\n });\n const nextEntry = Editor.next(editor, {\n at: currentListItemPath,\n });\n\n if (previousEntry && nextEntry) {\n // If previous and next nodes are lists or list-items, delete empty list item\n event.preventDefault();\n Transforms.removeNodes(editor, {\n at: currentListItemPath,\n });\n\n // If previous and next nodes are lists with same format and indent Levels, then merge the nodes\n const [previousList] = previousEntry;\n const [nextList] = nextEntry;\n if (\n !Editor.isEditor(previousList) &&\n !isText(previousList) &&\n isListNode(previousList) &&\n !Editor.isEditor(nextList) &&\n !isText(nextList) &&\n isListNode(nextList)\n ) {\n if (\n previousList.type === 'list' &&\n nextList.type === 'list' &&\n previousList.format === nextList.format &&\n previousList.indentLevel === nextList.indentLevel\n ) {\n Transforms.mergeNodes(editor, {\n at: currentListItemPath,\n });\n }\n }\n }\n }\n};\n\n/**\n * Common handler for the enter key on ordered and unordered lists\n */\nconst handleEnterKeyOnList = (editor: Editor) => {\n const currentListItemEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list-item',\n });\n\n if (!currentListItemEntry || !editor.selection) {\n return;\n }\n\n const [currentListItem, currentListItemPath] = currentListItemEntry;\n const [currentList, currentListPath] = Editor.parent(editor, currentListItemPath);\n const isListEmpty =\n currentList.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isListItemEmpty =\n currentListItem.children.length === 1 &&\n isText(currentListItem.children[0]) &&\n currentListItem.children[0].text === '';\n const isFocusAtTheBeginningOfAChild =\n editor.selection.focus.offset === 0 && editor.selection.focus.path.at(-1) === 0;\n\n if (isListEmpty) {\n replaceListWithEmptyBlock(editor, currentListPath);\n } else if (isFocusAtTheBeginningOfAChild && !isListItemEmpty) {\n // If the focus is at the beginning of a child node, shift below the list item and create a new list-item\n const currentNode = Editor.above(editor, { at: editor.selection.anchor });\n Transforms.insertNodes(editor, { type: 'list-item', children: [{ type: 'text', text: '' }] });\n if (currentNode) {\n const path = currentNode[1];\n const updatedPath = [...path.slice(0, -1), path[path.length - 1] + 1];\n Transforms.select(editor, {\n anchor: { path: updatedPath.concat(0), offset: 0 },\n focus: { path: updatedPath.concat(0), offset: 0 },\n });\n }\n } else if (isListItemEmpty) {\n // Check if there is a list above the current list and shift list-item under it\n if (\n !Editor.isEditor(currentList) &&\n isListNode(currentList) &&\n currentList?.indentLevel &&\n currentList.indentLevel > 0\n ) {\n const previousIndentLevel = currentList.indentLevel - 1;\n\n const parentListNodeEntry = Editor.above(editor, {\n match: (node) =>\n !Editor.isEditor(node) &&\n node.type === 'list' &&\n (node.indentLevel || 0) === previousIndentLevel,\n });\n\n if (parentListNodeEntry) {\n // Get the parent list path and add 1 to it to exit from the current list\n const modifiedPath = currentListItemPath.slice(0, -1);\n if (modifiedPath.length > 0) {\n modifiedPath[modifiedPath.length - 1] += 1;\n }\n\n // Shift list-item under parent list\n Transforms.moveNodes(editor, {\n at: currentListItemPath,\n to: modifiedPath,\n });\n return;\n }\n }\n\n // Otherwise delete the empty list item and create a new paragraph below the parent list\n Transforms.removeNodes(editor, { at: currentListItemPath });\n\n const createdParagraphPath = Path.next(currentListPath);\n Transforms.insertNodes(\n editor,\n {\n type: 'paragraph',\n children: [{ type: 'text', text: '' }],\n },\n { at: createdParagraphPath }\n );\n\n // Move the selection to the newly created paragraph\n Transforms.select(editor, createdParagraphPath);\n } else {\n // Check if the cursor is at the end of the list item\n const isNodeEnd = Editor.isEnd(editor, editor.selection.anchor, currentListItemPath);\n\n if (isNodeEnd) {\n // If there was nothing after the cursor, create a fresh new list item,\n // in order to avoid carrying over the modifiers from the previous list item\n Transforms.insertNodes(editor, { type: 'list-item', children: [{ type: 'text', text: '' }] });\n } else {\n // If there is something after the cursor, split the current list item,\n // so that we keep the content and the modifiers\n Transforms.splitNodes(editor);\n }\n }\n};\n\n/**\n * Common handler for converting a node to a list\n */\nconst handleConvertToList = (editor: Editor, format: Block<'list'>['format']) => {\n const convertedPath = baseHandleConvert<Block<'list-item'>>(editor, { type: 'list-item' });\n\n if (!convertedPath) return;\n\n Transforms.wrapNodes(editor, { type: 'list', format, children: [] }, { at: convertedPath });\n};\n\n/**\n * Common handler for the tab key on ordered and unordered lists\n */\nconst handleTabOnList = (editor: Editor) => {\n const currentListItemEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'list-item',\n });\n\n if (!currentListItemEntry || !editor.selection) {\n return;\n }\n\n const [currentListItem, currentListItemPath] = currentListItemEntry;\n const [currentList] = Editor.parent(editor, currentListItemPath);\n\n // Skip tabbing if list-item is the first item in the list\n if (currentListItem === currentList.children[0]) return;\n\n const currentListItemIndex = currentList.children.findIndex((item) => item === currentListItem);\n const previousNode = currentList.children[currentListItemIndex - 1];\n\n // If previous node is a list block then move the list-item under it\n if (previousNode.type === 'list') {\n const nodePath = ReactEditor.findPath(editor, previousNode);\n const insertAtPath = previousNode.children.length;\n\n Transforms.moveNodes(editor, {\n at: currentListItemPath,\n to: nodePath.concat(insertAtPath),\n });\n return;\n }\n\n if (!Editor.isEditor(currentList) && isListNode(currentList)) {\n // Wrap list-item with list block on tab\n Transforms.wrapNodes(editor, {\n type: 'list',\n format: currentList.format,\n indentLevel: (currentList.indentLevel || 0) + 1,\n children: [],\n });\n }\n};\n\n/**\n * Common handler for the shift+tab key on ordered and unordered lists (un-indentation)\n */\n\nconst hasChildren = (node: any): node is { children: unknown[] } => {\n return typeof node === 'object' && node !== null && 'children' in node;\n};\n\nconst handleShiftTabOnList = (editor: Editor) => {\n const currentListItemEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && 'type' in node && node.type === 'list-item',\n });\n\n if (!currentListItemEntry || !editor.selection) {\n return;\n }\n\n const [, currentListItemPath] = currentListItemEntry;\n\n const [currentList] = Editor.parent(editor, currentListItemPath);\n\n if (\n !Editor.isEditor(currentList) &&\n hasChildren(currentList) &&\n (currentList as any).type === 'list'\n ) {\n const parentListPath = Path.parent(currentListItemPath);\n\n const [parentList] = Editor.parent(editor, parentListPath);\n\n // Case 1: The parent of the current list is the editor itself.\n if (Editor.isEditor(parentList)) {\n // Lift the list item to the top level of the editor's children.\n Transforms.liftNodes(editor, {\n at: currentListItemPath,\n match: (node) => !Editor.isEditor(node) && 'type' in node && node.type === 'list-item',\n });\n // Change the type of the newly lifted node from 'list-item' to 'paragraph'.\n Transforms.setNodes(editor, { type: 'paragraph' });\n return;\n }\n\n // Case 2: The parent of the current list is another list.\n if (hasChildren(parentList) && (parentList as any).type === 'list') {\n Transforms.liftNodes(editor, {\n at: currentListItemPath,\n match: (node) => !Editor.isEditor(node) && 'type' in node && node.type === 'list-item',\n });\n\n try {\n const [remainingList, remainingListPath] = Editor.node(editor, parentListPath);\n\n if (\n hasChildren(remainingList) &&\n (remainingList as any).type === 'list' &&\n remainingList.children.length === 0\n ) {\n Transforms.removeNodes(editor, { at: remainingListPath });\n }\n } catch (error) {\n // The path might no longer exist if the structure changed, which is fine\n }\n }\n }\n};\n\n// All that's in common between ordered and unordered list blocks\nconst baseListBlock = {\n renderElement: (props) => <List {...props} />,\n isInBlocksSelector: true,\n handleEnterKey: handleEnterKeyOnList,\n handleBackspaceKey: handleBackspaceKeyOnList,\n handleTab: handleTabOnList,\n isDraggable: (element) => {\n if (!isListNode(element)) {\n throw Error();\n }\n const indentLevel = element.indentLevel ?? 0;\n return indentLevel === 0;\n },\n} satisfies Partial<BlocksStore['list-ordered' | 'list-unordered']>;\n\nconst listBlocks: Pick<BlocksStore, 'list-ordered' | 'list-unordered' | 'list-item'> = {\n 'list-ordered': {\n ...baseListBlock,\n label: {\n id: 'components.Blocks.blocks.orderedList',\n defaultMessage: 'Numbered list',\n },\n icon: NumberList,\n matchNode: (node) => node.type === 'list' && node.format === 'ordered',\n handleConvert: (editor) => handleConvertToList(editor, 'ordered'),\n handleShiftTab: handleShiftTabOnList,\n snippets: ['1.'],\n },\n 'list-unordered': {\n ...baseListBlock,\n label: {\n id: 'components.Blocks.blocks.unorderedList',\n defaultMessage: 'Bulleted list',\n },\n icon: BulletList,\n matchNode: (node) => node.type === 'list' && node.format === 'unordered',\n handleConvert: (editor) => handleConvertToList(editor, 'unordered'),\n handleShiftTab: handleShiftTabOnList,\n snippets: ['-', '*', '+'],\n },\n 'list-item': {\n renderElement: (props) => (\n <Typography tag=\"li\" {...props.attributes}>\n {props.children}\n </Typography>\n ),\n // No handleConvert, list items are created when converting to the parent list\n matchNode: (node) => node.type === 'list-item',\n isInBlocksSelector: false,\n dragHandleTopMargin: '-2px',\n isDraggable: () => false,\n },\n};\n\nexport { listBlocks };\n"],"names":["listStyle","css","theme","spaces","Orderedlist","styled","ol","props","$listStyleType","Unorderedlist","ul","orderedStyles","unorderedStyles","isListNode","element","type","List","attributes","children","listStyles","format","nextIndex","indentLevel","length","listStyleType","_jsx","replaceListWithEmptyBlock","editor","currentListPath","Transforms","removeNodes","at","insertNodes","text","select","isText","node","Node","isNode","Editor","isEditor","handleBackspaceKeyOnList","event","selection","currentListItem","currentListItemPath","parent","anchor","currentList","isListEmpty","isListItemEmpty","isFocusAtTheBeginningOfAChild","focus","offset","path","parentListEntry","above","match","preventDefault","liftNodes","setNodes","previousEntry","previous","nextEntry","next","previousList","nextList","mergeNodes","handleEnterKeyOnList","currentListItemEntry","currentNode","updatedPath","slice","concat","previousIndentLevel","parentListNodeEntry","modifiedPath","moveNodes","to","createdParagraphPath","Path","isNodeEnd","isEnd","splitNodes","handleConvertToList","convertedPath","baseHandleConvert","wrapNodes","handleTabOnList","currentListItemIndex","findIndex","item","previousNode","nodePath","ReactEditor","findPath","insertAtPath","hasChildren","handleShiftTabOnList","parentListPath","parentList","remainingList","remainingListPath","error","baseListBlock","renderElement","isInBlocksSelector","handleEnterKey","handleBackspaceKey","handleTab","isDraggable","Error","listBlocks","label","id","defaultMessage","icon","NumberList","matchNode","handleConvert","handleShiftTab","snippets","BulletList","Typography","tag","dragHandleTopMargin"],"mappings":";;;;;;;;;AAaA,MAAMA,SAAAA,GAAYC,GAAG;;;OAGd,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;uBACjB,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAA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SAAA,CAAA;QACvD6F,cAAAA,EAAgBtB,oBAAAA;QAChBuB,QAAAA,EAAU;AAAC,YAAA;AAAK;AAClB,KAAA;IACA,gBAAA,EAAkB;AAChB,QAAA,GAAGjB,aAAa;QAChBS,KAAAA,EAAO;YACLC,EAAAA,EAAI,wCAAA;YACJC,cAAAA,EAAgB;AAClB,SAAA;QACAC,IAAAA,EAAMM,UAAAA;QACNJ,SAAAA,EAAW,CAAClF,OAASA,IAAAA,CAAKrB,IAAI,KAAK,MAAA,IAAUqB,IAAAA,CAAKhB,MAAM,KAAK,WAAA;QAC7DmG,aAAAA,EAAe,CAAC5F,MAAAA,GAAWyD,mBAAAA,CAAoBzD,MAAAA,EAAQ,WAAA,CAAA;QACvD6F,cAAAA,EAAgBtB,oBAAAA;QAChBuB,QAAAA,EAAU;AAAC,YAAA,GAAA;AAAK,YAAA,GAAA;AAAK,YAAA;AAAI;AAC3B,KAAA;IACA,WAAA,EAAa;QACXhB,aAAAA,EAAe,CAAClG,sBACdkB,GAAA,CAACkG,UAAAA,EAAAA;gBAAWC,GAAAA,EAAI,IAAA;AAAM,gBAAA,GAAGrH,MAAMU,UAAU;AACtCV,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMW;;;AAIXoG,QAAAA,SAAAA,EAAW,CAAClF,IAAAA,GAASA,IAAAA,CAAKrB,IAAI,KAAK,WAAA;QACnC2F,kBAAAA,EAAoB,KAAA;QACpBmB,mBAAAA,EAAqB,MAAA;AACrBf,QAAAA,WAAAA,EAAa,IAAM;AACrB;AACF;;;;"}
@@ -437,8 +437,12 @@ const BlocksContent = ({ placeholder, ariaLabelId })=>{
437
437
  if (!selectedBlock) {
438
438
  return;
439
439
  }
440
- if (selectedBlock.handleTab) {
441
- event.preventDefault();
440
+ event.preventDefault();
441
+ if (event.shiftKey && selectedBlock.handleShiftTab) {
442
+ // Handle Shift+Tab (unindent)
443
+ selectedBlock.handleShiftTab(editor);
444
+ } else if (!event.shiftKey && selectedBlock.handleTab) {
445
+ // Handle Tab (indent)
442
446
  selectedBlock.handleTab(editor);
443
447
  }
444
448
  };
@@ -1 +1 @@
1
- {"version":3,"file":"BlocksContent.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useIsMobile } from '@strapi/admin/strapi-admin';\nimport {\n Box,\n BoxComponent,\n Flex,\n FlexComponent,\n IconButton,\n IconButtonComponent,\n useComposedRefs,\n} from '@strapi/design-system';\nimport { Drag } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { Editor, Range, Transforms } from 'slate';\nimport { ReactEditor, type RenderElementProps, type RenderLeafProps, Editable } from 'slate-react';\nimport { styled, CSSProperties, css } from 'styled-components';\n\nimport { ItemTypes } from '../../../../../constants/dragAndDrop';\nimport { useDragAndDrop, DIRECTIONS } from '../../../../../hooks/useDragAndDrop';\nimport { getTranslation } from '../../../../../utils/translations';\n\nimport { decorateCode } from './Blocks/Code';\nimport { type BlocksStore, useBlocksEditorContext } from './BlocksEditor';\nimport { useConversionModal } from './BlocksToolbar';\nimport { type ModifiersStore } from './Modifiers';\nimport { getEntries } from './utils/types';\n\nconst StyledEditable = styled(Editable)<{ $isExpandedMode: boolean }>`\n // The outline style is set on the wrapper with :focus-within\n outline: none;\n display: flex;\n flex-direction: column;\n gap: ${({ theme }) => theme.spaces[3]};\n height: 100%;\n // For fullscreen align input in the center with fixed width\n width: ${(props) => (props.$isExpandedMode ? '512px' : '100%')};\n margin: auto;\n font-size: 1.6rem;\n\n ${({ theme }) => theme.breakpoints.medium} {\n font-size: 1.4rem;\n }\n > *:last-child {\n padding-bottom: ${({ theme }) => theme.spaces[3]};\n }\n`;\n\nconst Wrapper = styled<BoxComponent>(Box)<{ $isOverDropTarget: boolean }>`\n position: ${({ $isOverDropTarget }) => $isOverDropTarget && 'relative'};\n`;\n\ntype DragDirection = (typeof DIRECTIONS)[keyof typeof DIRECTIONS];\n\nconst DropPlaceholder = styled<BoxComponent>(Box)<{\n dragDirection: DragDirection | null;\n placeholderMargin: 1 | 2;\n}>`\n position: absolute;\n right: 0;\n\n // Show drop placeholder 8px above or below the drop target\n ${({ dragDirection, theme, placeholderMargin }) => css`\n top: ${dragDirection === DIRECTIONS.UPWARD && `-${theme.spaces[placeholderMargin]}`};\n bottom: ${dragDirection === DIRECTIONS.DOWNWARD && `-${theme.spaces[placeholderMargin]}`};\n `}\n`;\n\nconst DragItem = styled<FlexComponent>(Flex)<{ $dragVisibility: CSSProperties['visibility'] }>`\n // Style each block rendered using renderElement()\n & > [data-slate-node='element'] {\n width: 100%;\n opacity: inherit;\n }\n\n // Set the visibility of drag button\n [role='button'] {\n visibility: ${(props) => props.$dragVisibility};\n opacity: inherit;\n }\n &[aria-disabled='true'] {\n user-drag: none;\n }\n`;\n\nconst DragIconButton = styled<IconButtonComponent<'div'>>(IconButton)<{\n $dragHandleTopMargin?: CSSProperties['marginTop'];\n}>`\n user-select: none;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: ${({ theme }) => theme.borderRadius};\n padding-left: ${({ theme }) => theme.spaces[0]};\n padding-right: ${({ theme }) => theme.spaces[0]};\n padding-top: ${({ theme }) => theme.spaces[1]};\n padding-bottom: ${({ theme }) => theme.spaces[1]};\n visibility: hidden;\n cursor: grab;\n opacity: inherit;\n margin-top: ${(props) => props.$dragHandleTopMargin ?? 0};\n\n &:hover {\n background: ${({ theme }) => theme.colors.neutral100};\n }\n &:active {\n cursor: grabbing;\n background: ${({ theme }) => theme.colors.neutral150};\n }\n &[aria-disabled='true'] {\n visibility: hidden;\n }\n svg {\n min-width: ${({ theme }) => theme.spaces[3]};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral500};\n }\n }\n`;\n\ntype Direction = {\n setDragDirection: (direction: DragDirection) => void;\n dragDirection: DragDirection | null;\n};\n\ntype DragAndDropElementProps = Direction & {\n children: RenderElementProps['children'];\n index: Array<number>;\n dragHandleTopMargin?: CSSProperties['marginTop'];\n};\n\nconst DragAndDropElement = ({\n children,\n index,\n setDragDirection,\n dragDirection,\n dragHandleTopMargin,\n}: DragAndDropElementProps) => {\n const { editor, disabled, name, setLiveText } = useBlocksEditorContext('DragAndDropElement');\n const { formatMessage } = useIntl();\n const [dragVisibility, setDragVisibility] = React.useState<CSSProperties['visibility']>('hidden');\n const isDragAndDropEnabled = !disabled;\n\n const handleMoveBlock = React.useCallback(\n (newIndex: Array<number>, currentIndex: Array<number>) => {\n Transforms.moveNodes(editor, {\n at: currentIndex,\n to: newIndex,\n });\n\n // Add 1 to the index for the live text message\n const currentIndexPosition = [currentIndex[0] + 1, ...currentIndex.slice(1)];\n const newIndexPosition = [newIndex[0] + 1, ...newIndex.slice(1)];\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('components.Blocks.dnd.reorder'),\n defaultMessage: '{item}, moved. New position in the editor: {position}.',\n },\n {\n item: `${name}.${currentIndexPosition.join(',')}`,\n position: `${newIndexPosition.join(',')} of ${editor.children.length}`,\n }\n )\n );\n },\n [editor, formatMessage, name, setLiveText]\n );\n\n const [{ handlerId, isDragging, isOverDropTarget, direction }, blockRef, dropRef, dragRef] =\n useDragAndDrop(isDragAndDropEnabled, {\n type: `${ItemTypes.BLOCKS}_${name}`,\n index,\n item: {\n index,\n displayedValue: children,\n },\n onDropItem(currentIndex, newIndex) {\n if (newIndex) handleMoveBlock(newIndex, currentIndex);\n },\n });\n\n const composedBoxRefs = useComposedRefs(blockRef, dropRef);\n\n // Set Drag direction before loosing state while dragging\n React.useEffect(() => {\n if (direction) {\n setDragDirection(direction);\n }\n }, [direction, setDragDirection]);\n\n // On selection change hide drag handle\n React.useEffect(() => {\n setDragVisibility('hidden');\n }, [editor.selection]);\n\n return (\n <Wrapper ref={composedBoxRefs} $isOverDropTarget={isOverDropTarget}>\n {isOverDropTarget && (\n <DropPlaceholder\n borderStyle=\"solid\"\n borderColor=\"secondary200\"\n borderWidth=\"2px\"\n width=\"calc(100% - 24px)\"\n marginLeft=\"auto\"\n dragDirection={dragDirection}\n // For list items placeholder reduce the margin around\n placeholderMargin={children.props.as && children.props.as === 'li' ? 1 : 2}\n />\n )}\n {isDragging ? (\n <CloneDragItem dragHandleTopMargin={dragHandleTopMargin}>{children}</CloneDragItem>\n ) : (\n <DragItem\n ref={dragRef}\n data-handler-id={handlerId}\n gap={2}\n paddingLeft={2}\n alignItems=\"start\"\n onDragStart={\n isDragAndDropEnabled\n ? (event) => {\n const target = event.target as HTMLElement;\n const currentTarget = event.currentTarget as HTMLElement;\n\n // Dragging action should only trigger drag event when button is dragged, however update styles on the whole dragItem.\n if (target.getAttribute('role') !== 'button') {\n event.preventDefault();\n } else {\n // Setting styles using dragging state is not working, so set it on current target element as nodes get dragged\n currentTarget.style.opacity = '0.5';\n }\n }\n : undefined\n }\n onDragEnd={\n isDragAndDropEnabled\n ? (event) => {\n const currentTarget = event.currentTarget as HTMLElement;\n currentTarget.style.opacity = '1';\n }\n : undefined\n }\n onMouseEnter={() => setDragVisibility('visible')}\n onFocusCapture={() => setDragVisibility('visible')}\n onBlurCapture={() => setDragVisibility('hidden')}\n onMouseLeave={() => setDragVisibility('hidden')}\n aria-disabled={disabled}\n $dragVisibility={dragVisibility}\n >\n <DragIconButton\n tag=\"div\"\n contentEditable={false}\n role=\"button\"\n tabIndex={0}\n withTooltip={false}\n label={formatMessage({\n id: getTranslation('components.DragHandle-label'),\n defaultMessage: 'Drag',\n })}\n onClick={(e: React.MouseEvent) => e.stopPropagation()}\n aria-disabled={disabled}\n disabled={disabled}\n draggable={isDragAndDropEnabled}\n // For some blocks top margin added to drag handle to align at the text level\n $dragHandleTopMargin={dragHandleTopMargin}\n >\n <Drag color=\"primary500\" />\n </DragIconButton>\n {children}\n </DragItem>\n )}\n </Wrapper>\n );\n};\n\ninterface CloneDragItemProps {\n children: RenderElementProps['children'];\n dragHandleTopMargin?: CSSProperties['marginTop'];\n}\n\n// To prevent applying opacity to the original item being dragged, display a cloned element without opacity.\nconst CloneDragItem = ({ children, dragHandleTopMargin }: CloneDragItemProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <DragItem gap={2} paddingLeft={2} alignItems=\"start\" $dragVisibility=\"visible\">\n <DragIconButton\n tag=\"div\"\n role=\"button\"\n withTooltip={false}\n label={formatMessage({\n id: getTranslation('components.DragHandle-label'),\n defaultMessage: 'Drag',\n })}\n $dragHandleTopMargin={dragHandleTopMargin}\n >\n <Drag color=\"neutral600\" />\n </DragIconButton>\n {children}\n </DragItem>\n );\n};\n\ninterface ExtendedRenderLeafProps extends RenderLeafProps {\n leaf: RenderLeafProps['leaf'] & { className?: string };\n}\n\nconst baseRenderLeaf = (props: ExtendedRenderLeafProps, modifiers: ModifiersStore) => {\n // Recursively wrap the children for each active modifier\n const wrappedChildren = getEntries(modifiers).reduce((currentChildren, modifierEntry) => {\n const [name, modifier] = modifierEntry;\n\n if (props.leaf[name]) {\n return modifier.renderLeaf(currentChildren);\n }\n\n return currentChildren;\n }, props.children);\n\n return (\n <span {...props.attributes} className={props.leaf.className}>\n {wrappedChildren}\n </span>\n );\n};\n\ntype BaseRenderElementProps = Direction & {\n props: RenderElementProps['children'];\n blocks: BlocksStore;\n editor: Editor;\n isMobile: boolean;\n};\n\nconst baseRenderElement = ({\n props,\n blocks,\n editor,\n dragDirection,\n setDragDirection,\n isMobile,\n}: BaseRenderElementProps) => {\n const { element } = props;\n\n const blockMatch = Object.values(blocks).find((block) => block.matchNode(element));\n const block = blockMatch || blocks.paragraph;\n const nodePath = ReactEditor.findPath(editor, element);\n\n const isDraggable = block.isDraggable?.(element) ?? true;\n\n if (!isDraggable || isMobile) {\n return block.renderElement(props);\n }\n\n return (\n <DragAndDropElement\n index={nodePath}\n setDragDirection={setDragDirection}\n dragDirection={dragDirection}\n dragHandleTopMargin={block.dragHandleTopMargin}\n >\n {block.renderElement(props)}\n </DragAndDropElement>\n );\n};\n\nconst dragNoop = () => true;\n\ninterface BlocksContentProps {\n placeholder?: string;\n ariaLabelId: string;\n}\n\nconst BlocksContent = ({ placeholder, ariaLabelId }: BlocksContentProps) => {\n const { editor, disabled, blocks, modifiers, setLiveText, isExpandedMode } =\n useBlocksEditorContext('BlocksContent');\n const isMobile = useIsMobile();\n const blocksRef = React.useRef<HTMLDivElement>(null);\n const { formatMessage } = useIntl();\n const [dragDirection, setDragDirection] = React.useState<DragDirection | null>(null);\n const { modalElement, handleConversionResult } = useConversionModal();\n\n // Create renderLeaf function based on the modifiers store\n const renderLeaf = React.useCallback(\n (props: ExtendedRenderLeafProps) => baseRenderLeaf(props, modifiers),\n [modifiers]\n );\n\n const handleMoveBlocks = (editor: Editor, event: React.KeyboardEvent<HTMLElement>) => {\n if (!editor.selection) return;\n\n const start = Range.start(editor.selection);\n const currentIndex = [start.path[0]];\n let newIndexPosition = 0;\n\n if (event.key === 'ArrowUp') {\n newIndexPosition = currentIndex[0] > 0 ? currentIndex[0] - 1 : currentIndex[0];\n } else {\n newIndexPosition =\n currentIndex[0] < editor.children.length - 1 ? currentIndex[0] + 1 : currentIndex[0];\n }\n\n const newIndex = [newIndexPosition];\n\n if (newIndexPosition !== currentIndex[0]) {\n Transforms.moveNodes(editor, {\n at: currentIndex,\n to: newIndex,\n });\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('components.Blocks.dnd.reorder'),\n defaultMessage: '{item}, moved. New position in the editor: {position}.',\n },\n {\n item: `${name}.${currentIndex[0] + 1}`,\n position: `${newIndex[0] + 1} of ${editor.children.length}`,\n }\n )\n );\n\n event.preventDefault();\n }\n };\n\n // Create renderElement function base on the blocks store\n const renderElement = React.useCallback(\n (props: RenderElementProps) =>\n baseRenderElement({ props, blocks, editor, dragDirection, setDragDirection, isMobile }),\n [blocks, editor, dragDirection, isMobile, setDragDirection]\n );\n\n const checkSnippet = (event: React.KeyboardEvent<HTMLElement>) => {\n // Get current text block\n if (!editor.selection) {\n return;\n }\n\n const [textNode, textNodePath] = Editor.node(editor, editor.selection.anchor.path);\n\n // Narrow the type to a text node\n if (Editor.isEditor(textNode) || textNode.type !== 'text') {\n return;\n }\n\n // Don't check for snippets if we're not at the start of a block\n if (textNodePath.at(-1) !== 0) {\n return;\n }\n\n // Check if the text node starts with a known snippet\n const blockMatchingSnippet = Object.values(blocks).find((block) => {\n return block.snippets?.includes(textNode.text);\n });\n\n if (blockMatchingSnippet?.handleConvert) {\n // Prevent the space from being created and delete the snippet\n event.preventDefault();\n Transforms.delete(editor, {\n distance: textNode.text.length,\n unit: 'character',\n reverse: true,\n });\n\n // Convert the selected block\n const maybeRenderModal = blockMatchingSnippet.handleConvert(editor);\n handleConversionResult(maybeRenderModal);\n }\n };\n\n const handleEnter = (event: React.KeyboardEvent<HTMLElement>) => {\n if (!editor.selection) {\n return;\n }\n\n const selectedNode = editor.children[editor.selection.anchor.path[0]];\n const selectedBlock = Object.values(blocks).find((block) => block.matchNode(selectedNode));\n if (!selectedBlock) {\n return;\n }\n\n // Allow forced line breaks when shift is pressed\n if (event.shiftKey && selectedNode.type !== 'image') {\n Transforms.insertText(editor, '\\n');\n return;\n }\n\n // Check if there's an enter handler for the selected block\n if (selectedBlock.handleEnterKey) {\n selectedBlock.handleEnterKey(editor);\n } else {\n blocks.paragraph.handleEnterKey!(editor);\n }\n };\n\n const handleBackspaceEvent = (event: React.KeyboardEvent<HTMLElement>) => {\n if (!editor.selection) {\n return;\n }\n\n const selectedNode = editor.children[editor.selection.anchor.path[0]];\n const selectedBlock = Object.values(blocks).find((block) => block.matchNode(selectedNode));\n\n if (!selectedBlock) {\n return;\n }\n\n if (selectedBlock.handleBackspaceKey) {\n selectedBlock.handleBackspaceKey(editor, event);\n }\n };\n\n const handleTab = (event: React.KeyboardEvent<HTMLElement>) => {\n if (!editor.selection) {\n return;\n }\n\n const selectedNode = editor.children[editor.selection.anchor.path[0]];\n const selectedBlock = Object.values(blocks).find((block) => block.matchNode(selectedNode));\n if (!selectedBlock) {\n return;\n }\n\n if (selectedBlock.handleTab) {\n event.preventDefault();\n selectedBlock.handleTab(editor);\n }\n };\n\n const handleKeyboardShortcuts = (event: React.KeyboardEvent<HTMLElement>) => {\n const isCtrlOrCmd = event.metaKey || event.ctrlKey;\n\n if (isCtrlOrCmd) {\n // Check if there's a modifier to toggle\n Object.values(modifiers).forEach((value) => {\n if (value.isValidEventKey(event)) {\n value.handleToggle(editor);\n return;\n }\n });\n if (event.shiftKey && ['ArrowUp', 'ArrowDown'].includes(event.key)) {\n handleMoveBlocks(editor, event);\n }\n }\n };\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLElement> = (event) => {\n // Find the right block-specific handlers for enter and backspace key presses\n switch (event.key) {\n case 'Enter':\n event.preventDefault();\n return handleEnter(event);\n case 'Backspace':\n return handleBackspaceEvent(event);\n case 'Tab':\n return handleTab(event);\n case 'Escape':\n return ReactEditor.blur(editor);\n }\n handleKeyboardShortcuts(event);\n // Check if a snippet was triggered\n if (event.key === ' ') {\n checkSnippet(event);\n }\n };\n\n /**\n * scrollSelectionIntoView : Slate's default method to scroll a DOM selection into the view,\n * thats shifting layout for us when there is a overflowY:scroll on the viewport.\n * We are overriding it to check if the selection is not fully within the visible area of the editor,\n * we use scrollBy one line to the bottom\n */\n\n const handleScrollSelectionIntoView = React.useCallback(() => {\n if (!editor.selection || !blocksRef.current) {\n return;\n }\n\n const domRange = ReactEditor.toDOMRange(editor, editor.selection);\n const domRect = domRange.getBoundingClientRect();\n\n const editorRect = blocksRef.current.getBoundingClientRect();\n\n // Check if the selection is not fully within the visible area of the editor\n if (domRect.top < editorRect.top || domRect.bottom > editorRect.bottom) {\n // Scroll by one line to the bottom\n blocksRef.current.scrollBy({\n top: 28, // 20px is the line-height + 8px line gap\n behavior: 'smooth',\n });\n }\n }, [editor]);\n\n return (\n <Box\n ref={blocksRef}\n grow={1}\n width=\"100%\"\n overflow=\"auto\"\n fontSize={2}\n background=\"neutral0\"\n color=\"neutral800\"\n lineHeight={6}\n paddingLeft={{ initial: 4, medium: 0 }}\n paddingRight={7}\n paddingTop={6}\n paddingBottom={3}\n >\n <StyledEditable\n aria-labelledby={ariaLabelId}\n readOnly={disabled}\n placeholder={placeholder}\n $isExpandedMode={isExpandedMode}\n decorate={decorateCode}\n renderElement={renderElement}\n renderLeaf={renderLeaf}\n onKeyDown={handleKeyDown}\n scrollSelectionIntoView={handleScrollSelectionIntoView}\n // As we have our own handler to drag and drop the elements returing true will skip slate's own event handler\n onDrop={dragNoop}\n onDragStart={dragNoop}\n />\n {modalElement}\n </Box>\n );\n};\n\nexport { BlocksContent, BlocksContentProps };\n"],"names":["StyledEditable","styled","Editable","theme","spaces","props","$isExpandedMode","breakpoints","medium","Wrapper","Box","$isOverDropTarget","DropPlaceholder","dragDirection","placeholderMargin","css","DIRECTIONS","UPWARD","DOWNWARD","DragItem","Flex","$dragVisibility","DragIconButton","IconButton","borderRadius","$dragHandleTopMargin","colors","neutral100","neutral150","neutral500","DragAndDropElement","children","index","setDragDirection","dragHandleTopMargin","editor","disabled","name","setLiveText","useBlocksEditorContext","formatMessage","useIntl","dragVisibility","setDragVisibility","React","useState","isDragAndDropEnabled","handleMoveBlock","useCallback","newIndex","currentIndex","Transforms","moveNodes","at","to","currentIndexPosition","slice","newIndexPosition","id","getTranslation","defaultMessage","item","join","position","length","handlerId","isDragging","isOverDropTarget","direction","blockRef","dropRef","dragRef","useDragAndDrop","type","ItemTypes","BLOCKS","displayedValue","onDropItem","composedBoxRefs","useComposedRefs","useEffect","selection","_jsxs","ref","_jsx","borderStyle","borderColor","borderWidth","width","marginLeft","as","CloneDragItem","data-handler-id","gap","paddingLeft","alignItems","onDragStart","event","target","currentTarget","getAttribute","preventDefault","style","opacity","undefined","onDragEnd","onMouseEnter","onFocusCapture","onBlurCapture","onMouseLeave","aria-disabled","tag","contentEditable","role","tabIndex","withTooltip","label","onClick","e","stopPropagation","draggable","Drag","color","baseRenderLeaf","modifiers","wrappedChildren","getEntries","reduce","currentChildren","modifierEntry","modifier","leaf","renderLeaf","span","attributes","className","baseRenderElement","blocks","isMobile","element","blockMatch","Object","values","find","block","matchNode","paragraph","nodePath","ReactEditor","findPath","isDraggable","renderElement","dragNoop","BlocksContent","placeholder","ariaLabelId","isExpandedMode","useIsMobile","blocksRef","useRef","modalElement","handleConversionResult","useConversionModal","handleMoveBlocks","start","Range","path","key","checkSnippet","textNode","textNodePath","Editor","node","anchor","isEditor","blockMatchingSnippet","snippets","includes","text","handleConvert","delete","distance","unit","reverse","maybeRenderModal","handleEnter","selectedNode","selectedBlock","shiftKey","insertText","handleEnterKey","handleBackspaceEvent","handleBackspaceKey","handleTab","handleKeyboardShortcuts","isCtrlOrCmd","metaKey","ctrlKey","forEach","value","isValidEventKey","handleToggle","handleKeyDown","blur","handleScrollSelectionIntoView","current","domRange","toDOMRange","domRect","getBoundingClientRect","editorRect","top","bottom","scrollBy","behavior","grow","overflow","fontSize","background","lineHeight","initial","paddingRight","paddingTop","paddingBottom","aria-labelledby","readOnly","decorate","decorateCode","onKeyDown","scrollSelectionIntoView","onDrop"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAMA,cAAAA,GAAiBC,uBAAAA,CAAOC,mBAAAA,CAAuC;;;;;OAK9D,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;;;AAG/B,SAAA,EAAE,CAACC,KAAAA,GAAWA,KAAAA,CAAMC,eAAe,GAAG,UAAU,MAAA,CAAQ;;;;EAI/D,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAAA,CAAMI,WAAW,CAACC,MAAM,CAAC;;;;oBAIxB,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;;AAErD,CAAC;AAED,MAAMK,OAAAA,GAAUR,uBAAAA,CAAqBS,gBAAAA,CAAoC;AAC7D,YAAA,EAAE,CAAC,EAAEC,iBAAiB,EAAE,GAAKA,qBAAqB,UAAA,CAAW;AACzE,CAAC;AAID,MAAMC,eAAAA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;"}
1
+ {"version":3,"file":"BlocksContent.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useIsMobile } from '@strapi/admin/strapi-admin';\nimport {\n Box,\n BoxComponent,\n Flex,\n FlexComponent,\n IconButton,\n IconButtonComponent,\n useComposedRefs,\n} from '@strapi/design-system';\nimport { Drag } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { Editor, Range, Transforms } from 'slate';\nimport { ReactEditor, type RenderElementProps, type RenderLeafProps, Editable } from 'slate-react';\nimport { styled, CSSProperties, css } from 'styled-components';\n\nimport { ItemTypes } from '../../../../../constants/dragAndDrop';\nimport { useDragAndDrop, DIRECTIONS } from '../../../../../hooks/useDragAndDrop';\nimport { getTranslation } from '../../../../../utils/translations';\n\nimport { decorateCode } from './Blocks/Code';\nimport { type BlocksStore, useBlocksEditorContext } from './BlocksEditor';\nimport { useConversionModal } from './BlocksToolbar';\nimport { type ModifiersStore } from './Modifiers';\nimport { getEntries } from './utils/types';\n\nconst StyledEditable = styled(Editable)<{ $isExpandedMode: boolean }>`\n // The outline style is set on the wrapper with :focus-within\n outline: none;\n display: flex;\n flex-direction: column;\n gap: ${({ theme }) => theme.spaces[3]};\n height: 100%;\n // For fullscreen align input in the center with fixed width\n width: ${(props) => (props.$isExpandedMode ? '512px' : '100%')};\n margin: auto;\n font-size: 1.6rem;\n\n ${({ theme }) => theme.breakpoints.medium} {\n font-size: 1.4rem;\n }\n > *:last-child {\n padding-bottom: ${({ theme }) => theme.spaces[3]};\n }\n`;\n\nconst Wrapper = styled<BoxComponent>(Box)<{ $isOverDropTarget: boolean }>`\n position: ${({ $isOverDropTarget }) => $isOverDropTarget && 'relative'};\n`;\n\ntype DragDirection = (typeof DIRECTIONS)[keyof typeof DIRECTIONS];\n\nconst DropPlaceholder = styled<BoxComponent>(Box)<{\n dragDirection: DragDirection | null;\n placeholderMargin: 1 | 2;\n}>`\n position: absolute;\n right: 0;\n\n // Show drop placeholder 8px above or below the drop target\n ${({ dragDirection, theme, placeholderMargin }) => css`\n top: ${dragDirection === DIRECTIONS.UPWARD && `-${theme.spaces[placeholderMargin]}`};\n bottom: ${dragDirection === DIRECTIONS.DOWNWARD && `-${theme.spaces[placeholderMargin]}`};\n `}\n`;\n\nconst DragItem = styled<FlexComponent>(Flex)<{ $dragVisibility: CSSProperties['visibility'] }>`\n // Style each block rendered using renderElement()\n & > [data-slate-node='element'] {\n width: 100%;\n opacity: inherit;\n }\n\n // Set the visibility of drag button\n [role='button'] {\n visibility: ${(props) => props.$dragVisibility};\n opacity: inherit;\n }\n &[aria-disabled='true'] {\n user-drag: none;\n }\n`;\n\nconst DragIconButton = styled<IconButtonComponent<'div'>>(IconButton)<{\n $dragHandleTopMargin?: CSSProperties['marginTop'];\n}>`\n user-select: none;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: ${({ theme }) => theme.borderRadius};\n padding-left: ${({ theme }) => theme.spaces[0]};\n padding-right: ${({ theme }) => theme.spaces[0]};\n padding-top: ${({ theme }) => theme.spaces[1]};\n padding-bottom: ${({ theme }) => theme.spaces[1]};\n visibility: hidden;\n cursor: grab;\n opacity: inherit;\n margin-top: ${(props) => props.$dragHandleTopMargin ?? 0};\n\n &:hover {\n background: ${({ theme }) => theme.colors.neutral100};\n }\n &:active {\n cursor: grabbing;\n background: ${({ theme }) => theme.colors.neutral150};\n }\n &[aria-disabled='true'] {\n visibility: hidden;\n }\n svg {\n min-width: ${({ theme }) => theme.spaces[3]};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral500};\n }\n }\n`;\n\ntype Direction = {\n setDragDirection: (direction: DragDirection) => void;\n dragDirection: DragDirection | null;\n};\n\ntype DragAndDropElementProps = Direction & {\n children: RenderElementProps['children'];\n index: Array<number>;\n dragHandleTopMargin?: CSSProperties['marginTop'];\n};\n\nconst DragAndDropElement = ({\n children,\n index,\n setDragDirection,\n dragDirection,\n dragHandleTopMargin,\n}: DragAndDropElementProps) => {\n const { editor, disabled, name, setLiveText } = useBlocksEditorContext('DragAndDropElement');\n const { formatMessage } = useIntl();\n const [dragVisibility, setDragVisibility] = React.useState<CSSProperties['visibility']>('hidden');\n const isDragAndDropEnabled = !disabled;\n\n const handleMoveBlock = React.useCallback(\n (newIndex: Array<number>, currentIndex: Array<number>) => {\n Transforms.moveNodes(editor, {\n at: currentIndex,\n to: newIndex,\n });\n\n // Add 1 to the index for the live text message\n const currentIndexPosition = [currentIndex[0] + 1, ...currentIndex.slice(1)];\n const newIndexPosition = [newIndex[0] + 1, ...newIndex.slice(1)];\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('components.Blocks.dnd.reorder'),\n defaultMessage: '{item}, moved. New position in the editor: {position}.',\n },\n {\n item: `${name}.${currentIndexPosition.join(',')}`,\n position: `${newIndexPosition.join(',')} of ${editor.children.length}`,\n }\n )\n );\n },\n [editor, formatMessage, name, setLiveText]\n );\n\n const [{ handlerId, isDragging, isOverDropTarget, direction }, blockRef, dropRef, dragRef] =\n useDragAndDrop(isDragAndDropEnabled, {\n type: `${ItemTypes.BLOCKS}_${name}`,\n index,\n item: {\n index,\n displayedValue: children,\n },\n onDropItem(currentIndex, newIndex) {\n if (newIndex) handleMoveBlock(newIndex, currentIndex);\n },\n });\n\n const composedBoxRefs = useComposedRefs(blockRef, dropRef);\n\n // Set Drag direction before loosing state while dragging\n React.useEffect(() => {\n if (direction) {\n setDragDirection(direction);\n }\n }, [direction, setDragDirection]);\n\n // On selection change hide drag handle\n React.useEffect(() => {\n setDragVisibility('hidden');\n }, [editor.selection]);\n\n return (\n <Wrapper ref={composedBoxRefs} $isOverDropTarget={isOverDropTarget}>\n {isOverDropTarget && (\n <DropPlaceholder\n borderStyle=\"solid\"\n borderColor=\"secondary200\"\n borderWidth=\"2px\"\n width=\"calc(100% - 24px)\"\n marginLeft=\"auto\"\n dragDirection={dragDirection}\n // For list items placeholder reduce the margin around\n placeholderMargin={children.props.as && children.props.as === 'li' ? 1 : 2}\n />\n )}\n {isDragging ? (\n <CloneDragItem dragHandleTopMargin={dragHandleTopMargin}>{children}</CloneDragItem>\n ) : (\n <DragItem\n ref={dragRef}\n data-handler-id={handlerId}\n gap={2}\n paddingLeft={2}\n alignItems=\"start\"\n onDragStart={\n isDragAndDropEnabled\n ? (event) => {\n const target = event.target as HTMLElement;\n const currentTarget = event.currentTarget as HTMLElement;\n\n // Dragging action should only trigger drag event when button is dragged, however update styles on the whole dragItem.\n if (target.getAttribute('role') !== 'button') {\n event.preventDefault();\n } else {\n // Setting styles using dragging state is not working, so set it on current target element as nodes get dragged\n currentTarget.style.opacity = '0.5';\n }\n }\n : undefined\n }\n onDragEnd={\n isDragAndDropEnabled\n ? (event) => {\n const currentTarget = event.currentTarget as HTMLElement;\n currentTarget.style.opacity = '1';\n }\n : undefined\n }\n onMouseEnter={() => setDragVisibility('visible')}\n onFocusCapture={() => setDragVisibility('visible')}\n onBlurCapture={() => setDragVisibility('hidden')}\n onMouseLeave={() => setDragVisibility('hidden')}\n aria-disabled={disabled}\n $dragVisibility={dragVisibility}\n >\n <DragIconButton\n tag=\"div\"\n contentEditable={false}\n role=\"button\"\n tabIndex={0}\n withTooltip={false}\n label={formatMessage({\n id: getTranslation('components.DragHandle-label'),\n defaultMessage: 'Drag',\n })}\n onClick={(e: React.MouseEvent) => e.stopPropagation()}\n aria-disabled={disabled}\n disabled={disabled}\n draggable={isDragAndDropEnabled}\n // For some blocks top margin added to drag handle to align at the text level\n $dragHandleTopMargin={dragHandleTopMargin}\n >\n <Drag color=\"primary500\" />\n </DragIconButton>\n {children}\n </DragItem>\n )}\n </Wrapper>\n );\n};\n\ninterface CloneDragItemProps {\n children: RenderElementProps['children'];\n dragHandleTopMargin?: CSSProperties['marginTop'];\n}\n\n// To prevent applying opacity to the original item being dragged, display a cloned element without opacity.\nconst CloneDragItem = ({ children, dragHandleTopMargin }: CloneDragItemProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <DragItem gap={2} paddingLeft={2} alignItems=\"start\" $dragVisibility=\"visible\">\n <DragIconButton\n tag=\"div\"\n role=\"button\"\n withTooltip={false}\n label={formatMessage({\n id: getTranslation('components.DragHandle-label'),\n defaultMessage: 'Drag',\n })}\n $dragHandleTopMargin={dragHandleTopMargin}\n >\n <Drag color=\"neutral600\" />\n </DragIconButton>\n {children}\n </DragItem>\n );\n};\n\ninterface ExtendedRenderLeafProps extends RenderLeafProps {\n leaf: RenderLeafProps['leaf'] & { className?: string };\n}\n\nconst baseRenderLeaf = (props: ExtendedRenderLeafProps, modifiers: ModifiersStore) => {\n // Recursively wrap the children for each active modifier\n const wrappedChildren = getEntries(modifiers).reduce((currentChildren, modifierEntry) => {\n const [name, modifier] = modifierEntry;\n\n if (props.leaf[name]) {\n return modifier.renderLeaf(currentChildren);\n }\n\n return currentChildren;\n }, props.children);\n\n return (\n <span {...props.attributes} className={props.leaf.className}>\n {wrappedChildren}\n </span>\n );\n};\n\ntype BaseRenderElementProps = Direction & {\n props: RenderElementProps['children'];\n blocks: BlocksStore;\n editor: Editor;\n isMobile: boolean;\n};\n\nconst baseRenderElement = ({\n props,\n blocks,\n editor,\n dragDirection,\n setDragDirection,\n isMobile,\n}: BaseRenderElementProps) => {\n const { element } = props;\n\n const blockMatch = Object.values(blocks).find((block) => block.matchNode(element));\n const block = blockMatch || blocks.paragraph;\n const nodePath = ReactEditor.findPath(editor, element);\n\n const isDraggable = block.isDraggable?.(element) ?? true;\n\n if (!isDraggable || isMobile) {\n return block.renderElement(props);\n }\n\n return (\n <DragAndDropElement\n index={nodePath}\n setDragDirection={setDragDirection}\n dragDirection={dragDirection}\n dragHandleTopMargin={block.dragHandleTopMargin}\n >\n {block.renderElement(props)}\n </DragAndDropElement>\n );\n};\n\nconst dragNoop = () => true;\n\ninterface BlocksContentProps {\n placeholder?: string;\n ariaLabelId: string;\n}\n\nconst BlocksContent = ({ placeholder, ariaLabelId }: BlocksContentProps) => {\n const { editor, disabled, blocks, modifiers, setLiveText, isExpandedMode } =\n useBlocksEditorContext('BlocksContent');\n const isMobile = useIsMobile();\n const blocksRef = React.useRef<HTMLDivElement>(null);\n const { formatMessage } = useIntl();\n const [dragDirection, setDragDirection] = React.useState<DragDirection | null>(null);\n const { modalElement, handleConversionResult } = useConversionModal();\n\n // Create renderLeaf function based on the modifiers store\n const renderLeaf = React.useCallback(\n (props: ExtendedRenderLeafProps) => baseRenderLeaf(props, modifiers),\n [modifiers]\n );\n\n const handleMoveBlocks = (editor: Editor, event: React.KeyboardEvent<HTMLElement>) => {\n if (!editor.selection) return;\n\n const start = Range.start(editor.selection);\n const currentIndex = [start.path[0]];\n let newIndexPosition = 0;\n\n if (event.key === 'ArrowUp') {\n newIndexPosition = currentIndex[0] > 0 ? currentIndex[0] - 1 : currentIndex[0];\n } else {\n newIndexPosition =\n currentIndex[0] < editor.children.length - 1 ? currentIndex[0] + 1 : currentIndex[0];\n }\n\n const newIndex = [newIndexPosition];\n\n if (newIndexPosition !== currentIndex[0]) {\n Transforms.moveNodes(editor, {\n at: currentIndex,\n to: newIndex,\n });\n\n setLiveText(\n formatMessage(\n {\n id: getTranslation('components.Blocks.dnd.reorder'),\n defaultMessage: '{item}, moved. New position in the editor: {position}.',\n },\n {\n item: `${name}.${currentIndex[0] + 1}`,\n position: `${newIndex[0] + 1} of ${editor.children.length}`,\n }\n )\n );\n\n event.preventDefault();\n }\n };\n\n // Create renderElement function base on the blocks store\n const renderElement = React.useCallback(\n (props: RenderElementProps) =>\n baseRenderElement({ props, blocks, editor, dragDirection, setDragDirection, isMobile }),\n [blocks, editor, dragDirection, isMobile, setDragDirection]\n );\n\n const checkSnippet = (event: React.KeyboardEvent<HTMLElement>) => {\n // Get current text block\n if (!editor.selection) {\n return;\n }\n\n const [textNode, textNodePath] = Editor.node(editor, editor.selection.anchor.path);\n\n // Narrow the type to a text node\n if (Editor.isEditor(textNode) || textNode.type !== 'text') {\n return;\n }\n\n // Don't check for snippets if we're not at the start of a block\n if (textNodePath.at(-1) !== 0) {\n return;\n }\n\n // Check if the text node starts with a known snippet\n const blockMatchingSnippet = Object.values(blocks).find((block) => {\n return block.snippets?.includes(textNode.text);\n });\n\n if (blockMatchingSnippet?.handleConvert) {\n // Prevent the space from being created and delete the snippet\n event.preventDefault();\n Transforms.delete(editor, {\n distance: textNode.text.length,\n unit: 'character',\n reverse: true,\n });\n\n // Convert the selected block\n const maybeRenderModal = blockMatchingSnippet.handleConvert(editor);\n handleConversionResult(maybeRenderModal);\n }\n };\n\n const handleEnter = (event: React.KeyboardEvent<HTMLElement>) => {\n if (!editor.selection) {\n return;\n }\n\n const selectedNode = editor.children[editor.selection.anchor.path[0]];\n const selectedBlock = Object.values(blocks).find((block) => block.matchNode(selectedNode));\n if (!selectedBlock) {\n return;\n }\n\n // Allow forced line breaks when shift is pressed\n if (event.shiftKey && selectedNode.type !== 'image') {\n Transforms.insertText(editor, '\\n');\n return;\n }\n\n // Check if there's an enter handler for the selected block\n if (selectedBlock.handleEnterKey) {\n selectedBlock.handleEnterKey(editor);\n } else {\n blocks.paragraph.handleEnterKey!(editor);\n }\n };\n\n const handleBackspaceEvent = (event: React.KeyboardEvent<HTMLElement>) => {\n if (!editor.selection) {\n return;\n }\n\n const selectedNode = editor.children[editor.selection.anchor.path[0]];\n const selectedBlock = Object.values(blocks).find((block) => block.matchNode(selectedNode));\n\n if (!selectedBlock) {\n return;\n }\n\n if (selectedBlock.handleBackspaceKey) {\n selectedBlock.handleBackspaceKey(editor, event);\n }\n };\n\n const handleTab = (event: React.KeyboardEvent<HTMLElement>) => {\n if (!editor.selection) {\n return;\n }\n\n const selectedNode = editor.children[editor.selection.anchor.path[0]];\n const selectedBlock = Object.values(blocks).find((block) => block.matchNode(selectedNode));\n if (!selectedBlock) {\n return;\n }\n\n event.preventDefault();\n\n if (event.shiftKey && selectedBlock.handleShiftTab) {\n // Handle Shift+Tab (unindent)\n selectedBlock.handleShiftTab(editor);\n } else if (!event.shiftKey && selectedBlock.handleTab) {\n // Handle Tab (indent)\n selectedBlock.handleTab(editor);\n }\n };\n\n const handleKeyboardShortcuts = (event: React.KeyboardEvent<HTMLElement>) => {\n const isCtrlOrCmd = event.metaKey || event.ctrlKey;\n\n if (isCtrlOrCmd) {\n // Check if there's a modifier to toggle\n Object.values(modifiers).forEach((value) => {\n if (value.isValidEventKey(event)) {\n value.handleToggle(editor);\n return;\n }\n });\n if (event.shiftKey && ['ArrowUp', 'ArrowDown'].includes(event.key)) {\n handleMoveBlocks(editor, event);\n }\n }\n };\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLElement> = (event) => {\n // Find the right block-specific handlers for enter and backspace key presses\n switch (event.key) {\n case 'Enter':\n event.preventDefault();\n return handleEnter(event);\n case 'Backspace':\n return handleBackspaceEvent(event);\n case 'Tab':\n return handleTab(event);\n case 'Escape':\n return ReactEditor.blur(editor);\n }\n handleKeyboardShortcuts(event);\n // Check if a snippet was triggered\n if (event.key === ' ') {\n checkSnippet(event);\n }\n };\n\n /**\n * scrollSelectionIntoView : Slate's default method to scroll a DOM selection into the view,\n * thats shifting layout for us when there is a overflowY:scroll on the viewport.\n * We are overriding it to check if the selection is not fully within the visible area of the editor,\n * we use scrollBy one line to the bottom\n */\n\n const handleScrollSelectionIntoView = React.useCallback(() => {\n if (!editor.selection || !blocksRef.current) {\n return;\n }\n\n const domRange = ReactEditor.toDOMRange(editor, editor.selection);\n const domRect = domRange.getBoundingClientRect();\n\n const editorRect = blocksRef.current.getBoundingClientRect();\n\n // Check if the selection is not fully within the visible area of the editor\n if (domRect.top < editorRect.top || domRect.bottom > editorRect.bottom) {\n // Scroll by one line to the bottom\n blocksRef.current.scrollBy({\n top: 28, // 20px is the line-height + 8px line gap\n behavior: 'smooth',\n });\n }\n }, [editor]);\n\n return (\n <Box\n ref={blocksRef}\n grow={1}\n width=\"100%\"\n overflow=\"auto\"\n fontSize={2}\n background=\"neutral0\"\n color=\"neutral800\"\n lineHeight={6}\n paddingLeft={{ initial: 4, medium: 0 }}\n paddingRight={7}\n paddingTop={6}\n paddingBottom={3}\n >\n <StyledEditable\n aria-labelledby={ariaLabelId}\n readOnly={disabled}\n placeholder={placeholder}\n $isExpandedMode={isExpandedMode}\n decorate={decorateCode}\n renderElement={renderElement}\n renderLeaf={renderLeaf}\n onKeyDown={handleKeyDown}\n scrollSelectionIntoView={handleScrollSelectionIntoView}\n // As we have our own handler to drag and drop the elements returing true will skip slate's own event handler\n onDrop={dragNoop}\n onDragStart={dragNoop}\n />\n {modalElement}\n </Box>\n );\n};\n\nexport { BlocksContent, BlocksContentProps };\n"],"names":["StyledEditable","styled","Editable","theme","spaces","props","$isExpandedMode","breakpoints","medium","Wrapper","Box","$isOverDropTarget","DropPlaceholder","dragDirection","placeholderMargin","css","DIRECTIONS","UPWARD","DOWNWARD","DragItem","Flex","$dragVisibility","DragIconButton","IconButton","borderRadius","$dragHandleTopMargin","colors","neutral100","neutral150","neutral500","DragAndDropElement","children","index","setDragDirection","dragHandleTopMargin","editor","disabled","name","setLiveText","useBlocksEditorContext","formatMessage","useIntl","dragVisibility","setDragVisibility","React","useState","isDragAndDropEnabled","handleMoveBlock","useCallback","newIndex","currentIndex","Transforms","moveNodes","at","to","currentIndexPosition","slice","newIndexPosition","id","getTranslation","defaultMessage","item","join","position","length","handlerId","isDragging","isOverDropTarget","direction","blockRef","dropRef","dragRef","useDragAndDrop","type","ItemTypes","BLOCKS","displayedValue","onDropItem","composedBoxRefs","useComposedRefs","useEffect","selection","_jsxs","ref","_jsx","borderStyle","borderColor","borderWidth","width","marginLeft","as","CloneDragItem","data-handler-id","gap","paddingLeft","alignItems","onDragStart","event","target","currentTarget","getAttribute","preventDefault","style","opacity","undefined","onDragEnd","onMouseEnter","onFocusCapture","onBlurCapture","onMouseLeave","aria-disabled","tag","contentEditable","role","tabIndex","withTooltip","label","onClick","e","stopPropagation","draggable","Drag","color","baseRenderLeaf","modifiers","wrappedChildren","getEntries","reduce","currentChildren","modifierEntry","modifier","leaf","renderLeaf","span","attributes","className","baseRenderElement","blocks","isMobile","element","blockMatch","Object","values","find","block","matchNode","paragraph","nodePath","ReactEditor","findPath","isDraggable","renderElement","dragNoop","BlocksContent","placeholder","ariaLabelId","isExpandedMode","useIsMobile","blocksRef","useRef","modalElement","handleConversionResult","useConversionModal","handleMoveBlocks","start","Range","path","key","checkSnippet","textNode","textNodePath","Editor","node","anchor","isEditor","blockMatchingSnippet","snippets","includes","text","handleConvert","delete","distance","unit","reverse","maybeRenderModal","handleEnter","selectedNode","selectedBlock","shiftKey","insertText","handleEnterKey","handleBackspaceEvent","handleBackspaceKey","handleTab","handleShiftTab","handleKeyboardShortcuts","isCtrlOrCmd","metaKey","ctrlKey","forEach","value","isValidEventKey","handleToggle","handleKeyDown","blur","handleScrollSelectionIntoView","current","domRange","toDOMRange","domRect","getBoundingClientRect","editorRect","top","bottom","scrollBy","behavior","grow","overflow","fontSize","background","lineHeight","initial","paddingRight","paddingTop","paddingBottom","aria-labelledby","readOnly","decorate","decorateCode","onKeyDown","scrollSelectionIntoView","onDrop"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAMA,cAAAA,GAAiBC,uBAAAA,CAAOC,mBAAAA,CAAuC;;;;;OAK9D,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;;;AAG/B,SAAA,EAAE,CAACC,KAAAA,GAAWA,KAAAA,CAAMC,eAAe,GAAG,UAAU,MAAA,CAAQ;;;;EAI/D,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAAA,CAAMI,WAAW,CAACC,MAAM,CAAC;;;;oBAIxB,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAAC,CAAA,CAAE,CAAC;;AAErD,CAAC;AAED,MAAMK,OAAAA,GAAUR,uBAAAA,CAAqBS,gBAAAA,CAAoC;AAC7D,YAAA,EAAE,CAAC,EAAEC,iBAAiB,EAAE,GAAKA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