@strapi/content-manager 5.51.1 → 5.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/admin/components/ConfigurationForm/Form.js +14 -16
  2. package/dist/admin/components/ConfigurationForm/Form.js.map +1 -1
  3. package/dist/admin/components/ConfigurationForm/Form.mjs +14 -16
  4. package/dist/admin/components/ConfigurationForm/Form.mjs.map +1 -1
  5. package/dist/admin/history/components/VersionHeader.js +1 -1
  6. package/dist/admin/history/components/VersionHeader.js.map +1 -1
  7. package/dist/admin/history/components/VersionHeader.mjs +1 -1
  8. package/dist/admin/history/components/VersionHeader.mjs.map +1 -1
  9. package/dist/admin/history/components/VersionsList.js +1 -1
  10. package/dist/admin/history/components/VersionsList.js.map +1 -1
  11. package/dist/admin/history/components/VersionsList.mjs +1 -1
  12. package/dist/admin/history/components/VersionsList.mjs.map +1 -1
  13. package/dist/admin/hooks/useDocument.js.map +1 -1
  14. package/dist/admin/hooks/useDocument.mjs.map +1 -1
  15. package/dist/admin/layout.js +77 -7
  16. package/dist/admin/layout.js.map +1 -1
  17. package/dist/admin/layout.mjs +58 -8
  18. package/dist/admin/layout.mjs.map +1 -1
  19. package/dist/admin/pages/EditView/components/DocumentActions.js +109 -81
  20. package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
  21. package/dist/admin/pages/EditView/components/DocumentActions.mjs +108 -76
  22. package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
  23. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.js +2 -2
  24. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.js.map +1 -1
  25. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.mjs +2 -2
  26. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.mjs.map +1 -1
  27. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.js +2 -2
  28. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.js.map +1 -1
  29. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs +2 -2
  30. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs.map +1 -1
  31. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.js +1 -1
  32. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.js.map +1 -1
  33. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.mjs +1 -1
  34. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.mjs.map +1 -1
  35. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.js +2 -2
  36. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.js.map +1 -1
  37. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.mjs +2 -2
  38. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.mjs.map +1 -1
  39. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.js +102 -7
  40. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.js.map +1 -1
  41. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.mjs +84 -8
  42. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.mjs.map +1 -1
  43. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js +2 -1
  44. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js.map +1 -1
  45. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs +2 -1
  46. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs.map +1 -1
  47. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js +14 -5
  48. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js.map +1 -1
  49. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs +14 -5
  50. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs.map +1 -1
  51. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js +17 -16
  52. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
  53. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs +17 -13
  54. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
  55. package/dist/admin/pages/EditView/components/FormInputs/UID.js +2 -2
  56. package/dist/admin/pages/EditView/components/FormInputs/UID.js.map +1 -1
  57. package/dist/admin/pages/EditView/components/FormInputs/UID.mjs +2 -2
  58. package/dist/admin/pages/EditView/components/FormInputs/UID.mjs.map +1 -1
  59. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.js +3 -2
  60. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.js.map +1 -1
  61. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.mjs +3 -2
  62. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.mjs.map +1 -1
  63. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.js +2 -1
  64. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.js.map +1 -1
  65. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.mjs +2 -1
  66. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.mjs.map +1 -1
  67. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js +7 -0
  68. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js.map +1 -1
  69. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs +7 -0
  70. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs.map +1 -1
  71. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +3 -1
  72. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.d.ts +2 -0
  73. package/dist/admin/src/pages/EditView/components/FormInputs/Relations/RelationModal.d.ts +4 -0
  74. package/dist/admin/src/utils/previewImage.d.ts +3 -0
  75. package/dist/admin/translations/en.json.js +1 -0
  76. package/dist/admin/translations/en.json.js.map +1 -1
  77. package/dist/admin/translations/en.json.mjs +1 -0
  78. package/dist/admin/translations/en.json.mjs.map +1 -1
  79. package/dist/admin/utils/objects.js +3 -1
  80. package/dist/admin/utils/objects.js.map +1 -1
  81. package/dist/admin/utils/objects.mjs +3 -1
  82. package/dist/admin/utils/objects.mjs.map +1 -1
  83. package/dist/admin/utils/previewImage.js +14 -0
  84. package/dist/admin/utils/previewImage.js.map +1 -0
  85. package/dist/admin/utils/previewImage.mjs +12 -0
  86. package/dist/admin/utils/previewImage.mjs.map +1 -0
  87. package/dist/admin/utils/validation.js +2 -2
  88. package/dist/admin/utils/validation.js.map +1 -1
  89. package/dist/admin/utils/validation.mjs +2 -2
  90. package/dist/admin/utils/validation.mjs.map +1 -1
  91. package/dist/server/controllers/utils/clone.js +1 -5
  92. package/dist/server/controllers/utils/clone.js.map +1 -1
  93. package/dist/server/controllers/utils/clone.mjs +2 -2
  94. package/dist/server/controllers/utils/clone.mjs.map +1 -1
  95. package/dist/server/controllers/validation/index.js +1 -1
  96. package/dist/server/controllers/validation/index.js.map +1 -1
  97. package/dist/server/controllers/validation/index.mjs +1 -1
  98. package/dist/server/controllers/validation/index.mjs.map +1 -1
  99. package/dist/server/services/document-manager.js +1 -1
  100. package/dist/server/services/document-manager.js.map +1 -1
  101. package/dist/server/services/document-manager.mjs +1 -1
  102. package/dist/server/services/document-manager.mjs.map +1 -1
  103. package/dist/server/services/document-metadata.js +24 -2
  104. package/dist/server/services/document-metadata.js.map +1 -1
  105. package/dist/server/services/document-metadata.mjs +24 -2
  106. package/dist/server/services/document-metadata.mjs.map +1 -1
  107. package/dist/server/services/utils/draft.js +19 -3
  108. package/dist/server/services/utils/draft.js.map +1 -1
  109. package/dist/server/services/utils/draft.mjs +1 -1
  110. package/dist/server/services/utils/draft.mjs.map +1 -1
  111. package/dist/server/services/utils/populate.js +23 -8
  112. package/dist/server/services/utils/populate.js.map +1 -1
  113. package/dist/server/services/utils/populate.mjs +2 -3
  114. package/dist/server/services/utils/populate.mjs.map +1 -1
  115. package/dist/server/src/index.d.ts.map +1 -1
  116. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  117. package/dist/server/src/services/index.d.ts.map +1 -1
  118. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  119. package/package.json +10 -10
@@ -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/**\n * Common handler for the shift+tab key on ordered and unordered lists (un-indentation)\n */\n\nconst hasChildren = (node: unknown): node is { children: unknown[] } => {\n return typeof node === 'object' && node !== null && 'children' in node;\n};\n\nconst isNestedListNode = (node: unknown): node is { type: 'list'; children: unknown[] } => {\n return hasChildren(node) && 'type' in node && node.type === 'list';\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 (!Editor.isEditor(currentList) && isNestedListNode(currentList)) {\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 (isNestedListNode(parentList)) {\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 (isNestedListNode(remainingList) && remainingList.children.length === 0) {\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","isNestedListNode","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;A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aAAAA,EAAe,CAACnG,sBACdkB,cAAA,CAACmG,uBAAAA,EAAAA;gBAAWC,GAAAA,EAAI,IAAA;AAAM,gBAAA,GAAGtH,MAAMU,UAAU;AACtCV,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMW;;;AAIXqG,QAAAA,SAAAA,EAAW,CAACnF,IAAAA,GAASA,IAAAA,CAAKrB,IAAI,KAAK,WAAA;QACnC4F,kBAAAA,EAAoB,KAAA;QACpBmB,mBAAAA,EAAqB,MAAA;AACrBf,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: unknown): node is { children: unknown[] } => {\n return typeof node === 'object' && node !== null && 'children' in node;\n};\n\nconst isNestedListNode = (node: unknown): node is { type: 'list'; children: unknown[] } => {\n return hasChildren(node) && 'type' in node && node.type === 'list';\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 (!Editor.isEditor(currentList) && isNestedListNode(currentList)) {\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 (isNestedListNode(parentList)) {\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 (isNestedListNode(remainingList) && remainingList.children.length === 0) {\n Transforms.removeNodes(editor, { at: remainingListPath });\n }\n } catch {\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","isNestedListNode","handleShiftTabOnList","parentListPath","parentList","remainingList","remainingListPath","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,EAAE,CAAC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ACkG,uBAAAA,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;;;;"}
@@ -348,7 +348,7 @@ const handleShiftTabOnList = (editor)=>{
348
348
  at: remainingListPath
349
349
  });
350
350
  }
351
- } catch (error) {
351
+ } catch {
352
352
  // The path might no longer exist if the structure changed, which is fine
353
353
  }
354
354
  }
@@ -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/**\n * Common handler for the shift+tab key on ordered and unordered lists (un-indentation)\n */\n\nconst hasChildren = (node: unknown): node is { children: unknown[] } => {\n return typeof node === 'object' && node !== null && 'children' in node;\n};\n\nconst isNestedListNode = (node: unknown): node is { type: 'list'; children: unknown[] } => {\n return hasChildren(node) && 'type' in node && node.type === 'list';\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 (!Editor.isEditor(currentList) && isNestedListNode(currentList)) {\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 (isNestedListNode(parentList)) {\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 (isNestedListNode(remainingList) && remainingList.children.length === 0) {\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","isNestedListNode","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,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,MAAAA,CAAOC,EAAsD;AAC9D,mBAAA,EAAE,CAACC,KAAAA,GAAUA,KAAAA,CA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A;AAAK,YAAA,GAAA;AAAK,YAAA;AAAI;AAC3B,KAAA;IACA,WAAA,EAAa;QACXhB,aAAAA,EAAe,CAACnG,sBACdkB,GAAA,CAACmG,UAAAA,EAAAA;gBAAWC,GAAAA,EAAI,IAAA;AAAM,gBAAA,GAAGtH,MAAMU,UAAU;AACtCV,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMW;;;AAIXqG,QAAAA,SAAAA,EAAW,CAACnF,IAAAA,GAASA,IAAAA,CAAKrB,IAAI,KAAK,WAAA;QACnC4F,kBAAAA,EAAoB,KAAA;QACpBmB,mBAAAA,EAAqB,MAAA;AACrBf,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: unknown): node is { children: unknown[] } => {\n return typeof node === 'object' && node !== null && 'children' in node;\n};\n\nconst isNestedListNode = (node: unknown): node is { type: 'list'; children: unknown[] } => {\n return hasChildren(node) && 'type' in node && node.type === 'list';\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 (!Editor.isEditor(currentList) && isNestedListNode(currentList)) {\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 (isNestedListNode(parentList)) {\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 (isNestedListNode(remainingList) && remainingList.children.length === 0) {\n Transforms.removeNodes(editor, { at: remainingListPath });\n }\n } catch {\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","isNestedListNode","handleShiftTabOnList","parentListPath","parentList","remainingList","remainingListPath","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,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,MAAAA,CAAOC,EAAsD;AAC9D,mBAAA,EAAE,CAACC,KAAAA,GAAUA,KAAAA,CAAMC,cAAc,CAAC;AACnD,EAAA,EAAER,SAAAA;AACJ,CAAC;AA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hB,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;;;;"}
@@ -35,8 +35,8 @@ const InlineCode = styledComponents.styled.code`
35
35
  background-color: ${({ theme })=>theme.colors.neutral150};
36
36
  border-radius: ${({ theme })=>theme.borderRadius};
37
37
  padding: ${({ theme })=>`0 ${theme.spaces[2]}`};
38
- font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,
39
- monospace;
38
+ font-family:
39
+ 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;
40
40
  color: inherit;
41
41
  `;
42
42
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Modifiers.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Modifiers.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Typography, TypographyComponent } from '@strapi/design-system';\nimport { Bold, Italic, Underline, StrikeThrough, Code } from '@strapi/icons';\nimport { type MessageDescriptor } from 'react-intl';\nimport { Editor, type NodeEntry, Range, Text, Transforms } from 'slate';\nimport { styled, css } from 'styled-components';\n\nconst stylesToInherit = css`\n font-size: inherit;\n color: inherit;\n line-height: inherit;\n`;\n\nconst BoldText = styled<TypographyComponent>(Typography).attrs({ fontWeight: 'bold' })`\n ${stylesToInherit}\n`;\n\nconst ItalicText = styled<TypographyComponent>(Typography)`\n font-style: italic;\n ${stylesToInherit}\n`;\n\nconst UnderlineText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'underline',\n})`\n ${stylesToInherit}\n`;\n\nconst StrikeThroughText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'line-through',\n})`\n ${stylesToInherit}\n`;\n\nconst InlineCode = styled.code`\n background-color: ${({ theme }) => theme.colors.neutral150};\n border-radius: ${({ theme }) => theme.borderRadius};\n padding: ${({ theme }) => `0 ${theme.spaces[2]}`};\n font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,\n monospace;\n color: inherit;\n`;\n\ntype ModifierKey = Exclude<keyof Text, 'type' | 'text'>;\n\ntype ModifiersStore = {\n [K in ModifierKey]: {\n icon: React.ComponentType;\n isValidEventKey: (event: React.KeyboardEvent<HTMLElement>) => boolean;\n label: MessageDescriptor;\n checkIsActive: (editor: Editor) => boolean;\n handleToggle: (editor: Editor) => void;\n renderLeaf: (children: React.JSX.Element | string) => React.JSX.Element;\n };\n};\n\n/**\n * The default handler for checking if a modifier is active\n */\nconst baseCheckIsActive = (editor: Editor, name: ModifierKey) => {\n const { selection } = editor;\n\n // If there's no selection, fall back to Slate's current marks.\n // (This is what will be applied to newly inserted text.)\n if (!selection) {\n const marks = Editor.marks(editor);\n return Boolean(marks?.[name]);\n }\n\n // Collapsed selection (caret): current marks are reliable.\n if (Range.isCollapsed(selection)) {\n const marks = Editor.marks(editor);\n return Boolean(marks?.[name]);\n }\n\n /**\n * Expanded selection: derive \"active\" state from the selected text nodes.\n *\n * This avoids a common mobile edge case where the selection focus can sit just\n * outside the formatted span (so relying on caret/focus marks would be wrong).\n *\n * Additionally, mobile selection often includes an extra whitespace character at\n * the edge (e.g. the trailing space after a word). We ignore whitespace-only\n * portions when computing active state so the toolbar reflects the intended\n * formatted text.\n */\n const range = Editor.unhangRange(editor, selection);\n const selectedTextEntries = Array.from(\n Editor.nodes(editor, { at: range, match: Text.isText, mode: 'all' })\n ) as NodeEntry<Text>[];\n\n if (selectedTextEntries.length === 0) return false;\n\n const summary = selectedTextEntries.reduce(\n (acc, [node, path]) => {\n const nodeRange = Editor.range(editor, path);\n const intersection = Range.intersection(range, nodeRange);\n\n if (!intersection) {\n return acc;\n }\n\n const start = Math.min(intersection.anchor.offset, intersection.focus.offset);\n const end = Math.max(intersection.anchor.offset, intersection.focus.offset);\n const selectedSlice = node.text.slice(start, end);\n\n // Ignore whitespace-only slices (common in mobile selection boundaries).\n if (selectedSlice.trim().length === 0) {\n return acc;\n }\n\n return {\n hasNonWhitespaceSelection: true,\n isEveryRelevantNodeMarked: acc.isEveryRelevantNodeMarked && Boolean(node[name]),\n };\n },\n { hasNonWhitespaceSelection: false, isEveryRelevantNodeMarked: true }\n );\n\n return summary.hasNonWhitespaceSelection && summary.isEveryRelevantNodeMarked;\n};\n\n/**\n * The default handler for toggling a modifier\n */\nconst baseHandleToggle = (editor: Editor, name: ModifierKey) => {\n // If there is no selection, set selection to the end of line\n if (!editor.selection) {\n const endOfEditor = Editor.end(editor, []);\n Transforms.select(editor, endOfEditor);\n }\n\n // Toggle the modifier\n if (baseCheckIsActive(editor, name)) {\n Editor.removeMark(editor, name);\n } else {\n Editor.addMark(editor, name, true);\n }\n};\n\nconst modifiers: ModifiersStore = {\n bold: {\n icon: Bold,\n isValidEventKey: (event) => event.key === 'b',\n label: { id: 'components.Blocks.modifiers.bold', defaultMessage: 'Bold' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'bold'),\n handleToggle: (editor) => baseHandleToggle(editor, 'bold'),\n renderLeaf: (children) => <BoldText>{children}</BoldText>,\n },\n italic: {\n icon: Italic,\n isValidEventKey: (event) => event.key === 'i',\n label: { id: 'components.Blocks.modifiers.italic', defaultMessage: 'Italic' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'italic'),\n handleToggle: (editor) => baseHandleToggle(editor, 'italic'),\n renderLeaf: (children) => <ItalicText>{children}</ItalicText>,\n },\n underline: {\n icon: Underline,\n isValidEventKey: (event) => event.key === 'u',\n label: { id: 'components.Blocks.modifiers.underline', defaultMessage: 'Underline' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'underline'),\n handleToggle: (editor) => baseHandleToggle(editor, 'underline'),\n renderLeaf: (children) => <UnderlineText>{children}</UnderlineText>,\n },\n strikethrough: {\n icon: StrikeThrough,\n isValidEventKey: (event) => event.key === 'S' && event.shiftKey,\n label: { id: 'components.Blocks.modifiers.strikethrough', defaultMessage: 'Strikethrough' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'strikethrough'),\n handleToggle: (editor) => baseHandleToggle(editor, 'strikethrough'),\n renderLeaf: (children) => <StrikeThroughText>{children}</StrikeThroughText>,\n },\n code: {\n icon: Code,\n isValidEventKey: (event) => event.key === 'e',\n label: { id: 'components.Blocks.modifiers.code', defaultMessage: 'Inline code' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'code'),\n handleToggle: (editor) => baseHandleToggle(editor, 'code'),\n renderLeaf: (children) => <InlineCode>{children}</InlineCode>,\n },\n};\n\nexport { type ModifiersStore, modifiers };\n"],"names":["stylesToInherit","css","BoldText","styled","Typography","attrs","fontWeight","ItalicText","UnderlineText","textDecoration","StrikeThroughText","InlineCode","code","theme","colors","neutral150","borderRadius","spaces","baseCheckIsActive","editor","name","selection","marks","Editor","Boolean","Range","isCollapsed","range","unhangRange","selectedTextEntries","Array","from","nodes","at","match","Text","isText","mode","length","summary","reduce","acc","node","path","nodeRange","intersection","start","Math","min","anchor","offset","focus","end","max","selectedSlice","text","slice","trim","hasNonWhitespaceSelection","isEveryRelevantNodeMarked","baseHandleToggle","endOfEditor","Transforms","select","removeMark","addMark","modifiers","bold","icon","Bold","isValidEventKey","event","key","label","id","defaultMessage","checkIsActive","handleToggle","renderLeaf","children","_jsx","italic","Italic","underline","Underline","strikethrough","StrikeThrough","shiftKey","Code"],"mappings":";;;;;;;;;AAQA,MAAMA,eAAAA,GAAkBC,oBAAG;;;;AAI3B,CAAC;AAED,MAAMC,QAAAA,GAAWC,uBAAAA,CAA4BC,uBAAAA,CAAAA,CAAYC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;AAAeuE,gBAAAA,QAAAA,EAAAA;;AAC5C,KAAA;IACAM,aAAAA,EAAe;QACbjB,IAAAA,EAAMkB,mBAAAA;AACNhB,QAAAA,eAAAA,EAAiB,CAACC,KAAAA,GAAUA,KAAAA,CAAMC,GAAG,KAAK,GAAA,IAAOD,MAAMgB,QAAQ;QAC/Dd,KAAAA,EAAO;YAAEC,EAAAA,EAAI,2CAAA;YAA6CC,cAAAA,EAAgB;AAAgB,SAAA;QAC1FC,aAAAA,EAAe,CAACzD,MAAAA,GAAWD,iBAAAA,CAAkBC,MAAAA,EAAQ,eAAA,CAAA;QACrD0D,YAAAA,EAAc,CAAC1D,MAAAA,GAAWyC,gBAAAA,CAAiBzC,MAAAA,EAAQ,eAAA,CAAA;QACnD2D,UAAAA,EAAY,CAACC,yBAAaC,cAAA,CAACtE,iBAAAA,EAAAA;AAAmBqE,gBAAAA,QAAAA,EAAAA;;AAChD,KAAA;IACAnE,IAAAA,EAAM;QACJwD,IAAAA,EAAMoB,UAAAA;AACNlB,QAAAA,eAAAA,EAAiB,CAACC,KAAAA,GAAUA,KAAAA,CAAMC,GAAG,KAAK,GAAA;QAC1CC,KAAAA,EAAO;YAAEC,EAAAA,EAAI,kCAAA;YAAoCC,cAAAA,EAAgB;AAAc,SAAA;QAC/EC,aAAAA,EAAe,CAACzD,MAAAA,GAAWD,iBAAAA,CAAkBC,MAAAA,EAAQ,MAAA,CAAA;QACrD0D,YAAAA,EAAc,CAAC1D,MAAAA,GAAWyC,gBAAAA,CAAiBzC,MAAAA,EAAQ,MAAA,CAAA;QACnD2D,UAAAA,EAAY,CAACC,yBAAaC,cAAA,CAACrE,UAAAA,EAAAA;AAAYoE,gBAAAA,QAAAA,EAAAA;;AACzC;AACF;;;;"}
1
+ {"version":3,"file":"Modifiers.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Modifiers.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Typography, TypographyComponent } from '@strapi/design-system';\nimport { Bold, Italic, Underline, StrikeThrough, Code } from '@strapi/icons';\nimport { type MessageDescriptor } from 'react-intl';\nimport { Editor, type NodeEntry, Range, Text, Transforms } from 'slate';\nimport { styled, css } from 'styled-components';\n\nconst stylesToInherit = css`\n font-size: inherit;\n color: inherit;\n line-height: inherit;\n`;\n\nconst BoldText = styled<TypographyComponent>(Typography).attrs({ fontWeight: 'bold' })`\n ${stylesToInherit}\n`;\n\nconst ItalicText = styled<TypographyComponent>(Typography)`\n font-style: italic;\n ${stylesToInherit}\n`;\n\nconst UnderlineText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'underline',\n})`\n ${stylesToInherit}\n`;\n\nconst StrikeThroughText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'line-through',\n})`\n ${stylesToInherit}\n`;\n\nconst InlineCode = styled.code`\n background-color: ${({ theme }) => theme.colors.neutral150};\n border-radius: ${({ theme }) => theme.borderRadius};\n padding: ${({ theme }) => `0 ${theme.spaces[2]}`};\n font-family:\n 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;\n color: inherit;\n`;\n\ntype ModifierKey = Exclude<keyof Text, 'type' | 'text'>;\n\ntype ModifiersStore = {\n [K in ModifierKey]: {\n icon: React.ComponentType;\n isValidEventKey: (event: React.KeyboardEvent<HTMLElement>) => boolean;\n label: MessageDescriptor;\n checkIsActive: (editor: Editor) => boolean;\n handleToggle: (editor: Editor) => void;\n renderLeaf: (children: React.JSX.Element | string) => React.JSX.Element;\n };\n};\n\n/**\n * The default handler for checking if a modifier is active\n */\nconst baseCheckIsActive = (editor: Editor, name: ModifierKey) => {\n const { selection } = editor;\n\n // If there's no selection, fall back to Slate's current marks.\n // (This is what will be applied to newly inserted text.)\n if (!selection) {\n const marks = Editor.marks(editor);\n return Boolean(marks?.[name]);\n }\n\n // Collapsed selection (caret): current marks are reliable.\n if (Range.isCollapsed(selection)) {\n const marks = Editor.marks(editor);\n return Boolean(marks?.[name]);\n }\n\n /**\n * Expanded selection: derive \"active\" state from the selected text nodes.\n *\n * This avoids a common mobile edge case where the selection focus can sit just\n * outside the formatted span (so relying on caret/focus marks would be wrong).\n *\n * Additionally, mobile selection often includes an extra whitespace character at\n * the edge (e.g. the trailing space after a word). We ignore whitespace-only\n * portions when computing active state so the toolbar reflects the intended\n * formatted text.\n */\n const range = Editor.unhangRange(editor, selection);\n const selectedTextEntries = Array.from(\n Editor.nodes(editor, { at: range, match: Text.isText, mode: 'all' })\n ) as NodeEntry<Text>[];\n\n if (selectedTextEntries.length === 0) return false;\n\n const summary = selectedTextEntries.reduce(\n (acc, [node, path]) => {\n const nodeRange = Editor.range(editor, path);\n const intersection = Range.intersection(range, nodeRange);\n\n if (!intersection) {\n return acc;\n }\n\n const start = Math.min(intersection.anchor.offset, intersection.focus.offset);\n const end = Math.max(intersection.anchor.offset, intersection.focus.offset);\n const selectedSlice = node.text.slice(start, end);\n\n // Ignore whitespace-only slices (common in mobile selection boundaries).\n if (selectedSlice.trim().length === 0) {\n return acc;\n }\n\n return {\n hasNonWhitespaceSelection: true,\n isEveryRelevantNodeMarked: acc.isEveryRelevantNodeMarked && Boolean(node[name]),\n };\n },\n { hasNonWhitespaceSelection: false, isEveryRelevantNodeMarked: true }\n );\n\n return summary.hasNonWhitespaceSelection && summary.isEveryRelevantNodeMarked;\n};\n\n/**\n * The default handler for toggling a modifier\n */\nconst baseHandleToggle = (editor: Editor, name: ModifierKey) => {\n // If there is no selection, set selection to the end of line\n if (!editor.selection) {\n const endOfEditor = Editor.end(editor, []);\n Transforms.select(editor, endOfEditor);\n }\n\n // Toggle the modifier\n if (baseCheckIsActive(editor, name)) {\n Editor.removeMark(editor, name);\n } else {\n Editor.addMark(editor, name, true);\n }\n};\n\nconst modifiers: ModifiersStore = {\n bold: {\n icon: Bold,\n isValidEventKey: (event) => event.key === 'b',\n label: { id: 'components.Blocks.modifiers.bold', defaultMessage: 'Bold' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'bold'),\n handleToggle: (editor) => baseHandleToggle(editor, 'bold'),\n renderLeaf: (children) => <BoldText>{children}</BoldText>,\n },\n italic: {\n icon: Italic,\n isValidEventKey: (event) => event.key === 'i',\n label: { id: 'components.Blocks.modifiers.italic', defaultMessage: 'Italic' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'italic'),\n handleToggle: (editor) => baseHandleToggle(editor, 'italic'),\n renderLeaf: (children) => <ItalicText>{children}</ItalicText>,\n },\n underline: {\n icon: Underline,\n isValidEventKey: (event) => event.key === 'u',\n label: { id: 'components.Blocks.modifiers.underline', defaultMessage: 'Underline' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'underline'),\n handleToggle: (editor) => baseHandleToggle(editor, 'underline'),\n renderLeaf: (children) => <UnderlineText>{children}</UnderlineText>,\n },\n strikethrough: {\n icon: StrikeThrough,\n isValidEventKey: (event) => event.key === 'S' && event.shiftKey,\n label: { id: 'components.Blocks.modifiers.strikethrough', defaultMessage: 'Strikethrough' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'strikethrough'),\n handleToggle: (editor) => baseHandleToggle(editor, 'strikethrough'),\n renderLeaf: (children) => <StrikeThroughText>{children}</StrikeThroughText>,\n },\n code: {\n icon: Code,\n isValidEventKey: (event) => event.key === 'e',\n label: { id: 'components.Blocks.modifiers.code', defaultMessage: 'Inline code' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'code'),\n handleToggle: (editor) => baseHandleToggle(editor, 'code'),\n renderLeaf: (children) => <InlineCode>{children}</InlineCode>,\n },\n};\n\nexport { type ModifiersStore, modifiers };\n"],"names":["stylesToInherit","css","BoldText","styled","Typography","attrs","fontWeight","ItalicText","UnderlineText","textDecoration","StrikeThroughText","InlineCode","code","theme","colors","neutral150","borderRadius","spaces","baseCheckIsActive","editor","name","selection","marks","Editor","Boolean","Range","isCollapsed","range","unhangRange","selectedTextEntries","Array","from","nodes","at","match","Text","isText","mode","length","summary","reduce","acc","node","path","nodeRange","intersection","start","Math","min","anchor","offset","focus","end","max","selectedSlice","text","slice","trim","hasNonWhitespaceSelection","isEveryRelevantNodeMarked","baseHandleToggle","endOfEditor","Transforms","select","removeMark","addMark","modifiers","bold","icon","Bold","isValidEventKey","event","key","label","id","defaultMessage","checkIsActive","handleToggle","renderLeaf","children","_jsx","italic","Italic","underline","Underline","strikethrough","StrikeThrough","shiftKey","Code"],"mappings":";;;;;;;;;AAQA,MAAMA,eAAAA,GAAkBC,oBAAG;;;;AAI3B,CAAC;AAED,MAAMC,QAAAA,GAAWC,uBAAAA,CAA4BC,uBAAAA,CAAAA,CAAYC,KAAK,CAAC;IAAEC,UAAAA,EAAY;AAAO,CAAA,CAAE;AACpF,EAAA,EAAEN,eAAAA;AACJ,CAAC;AAED,MAAMO,UAAAA,GAAaJ,uBAAAA,CAA4BC,uBAAAA,CAAW;;AAExD,EAAA,EAAEJ,eAAAA;AACJ,CAAC;AAED,MAAMQ,aAAAA,GAAgBL,uBAAAA,CAA4BC,uBAAAA,CAAAA,CAAYC,KAAK,CAAC;IAClEI,cAAAA,EAAgB;AAClB,CAAA,CAAE;AACA,EAAA,EAAET,eAAAA;AACJ,CAAC;AAED,MAAMU,iBAAAA,GAAoBP,uBAAAA,CAA4BC,uBAAAA,CAAAA,CAAYC,KAAK,CAAC;IACtEI,cAAAA,EAAgB;AAClB,CAAA,CAAE;AACA,EAAA,EAAET,eAAAA;AACJ,CAAC;AAED,MAAMW,UAAAA,GAAaR,uBAAAA,CAAOS,IAAI;oBACV,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAACC,UAAU,CAAC;AAC5C,iBAAA,EAAE,CAAC,EAAEF,KAAK,EAAE,GAAKA,KAAAA,CAAMG,YAAY,CAAC;AAC1C,WAAA,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAK,CAAC,EAAE,EAAEA,KAAAA,CAAMI,MAAM,CAAC,CAAA,CAAE,EAAE,CAAC;;;;AAInD,CAAC;AAeD;;IAGA,MAAMC,i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A,CAAA;QACrD0D,YAAAA,EAAc,CAAC1D,MAAAA,GAAWyC,gBAAAA,CAAiBzC,MAAAA,EAAQ,MAAA,CAAA;QACnD2D,UAAAA,EAAY,CAACC,yBAAaC,cAAA,CAACrE,UAAAA,EAAAA;AAAYoE,gBAAAA,QAAAA,EAAAA;;AACzC;AACF;;;;"}
@@ -33,8 +33,8 @@ const InlineCode = styled.code`
33
33
  background-color: ${({ theme })=>theme.colors.neutral150};
34
34
  border-radius: ${({ theme })=>theme.borderRadius};
35
35
  padding: ${({ theme })=>`0 ${theme.spaces[2]}`};
36
- font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,
37
- monospace;
36
+ font-family:
37
+ 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;
38
38
  color: inherit;
39
39
  `;
40
40
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Modifiers.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Modifiers.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Typography, TypographyComponent } from '@strapi/design-system';\nimport { Bold, Italic, Underline, StrikeThrough, Code } from '@strapi/icons';\nimport { type MessageDescriptor } from 'react-intl';\nimport { Editor, type NodeEntry, Range, Text, Transforms } from 'slate';\nimport { styled, css } from 'styled-components';\n\nconst stylesToInherit = css`\n font-size: inherit;\n color: inherit;\n line-height: inherit;\n`;\n\nconst BoldText = styled<TypographyComponent>(Typography).attrs({ fontWeight: 'bold' })`\n ${stylesToInherit}\n`;\n\nconst ItalicText = styled<TypographyComponent>(Typography)`\n font-style: italic;\n ${stylesToInherit}\n`;\n\nconst UnderlineText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'underline',\n})`\n ${stylesToInherit}\n`;\n\nconst StrikeThroughText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'line-through',\n})`\n ${stylesToInherit}\n`;\n\nconst InlineCode = styled.code`\n background-color: ${({ theme }) => theme.colors.neutral150};\n border-radius: ${({ theme }) => theme.borderRadius};\n padding: ${({ theme }) => `0 ${theme.spaces[2]}`};\n font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,\n monospace;\n color: inherit;\n`;\n\ntype ModifierKey = Exclude<keyof Text, 'type' | 'text'>;\n\ntype ModifiersStore = {\n [K in ModifierKey]: {\n icon: React.ComponentType;\n isValidEventKey: (event: React.KeyboardEvent<HTMLElement>) => boolean;\n label: MessageDescriptor;\n checkIsActive: (editor: Editor) => boolean;\n handleToggle: (editor: Editor) => void;\n renderLeaf: (children: React.JSX.Element | string) => React.JSX.Element;\n };\n};\n\n/**\n * The default handler for checking if a modifier is active\n */\nconst baseCheckIsActive = (editor: Editor, name: ModifierKey) => {\n const { selection } = editor;\n\n // If there's no selection, fall back to Slate's current marks.\n // (This is what will be applied to newly inserted text.)\n if (!selection) {\n const marks = Editor.marks(editor);\n return Boolean(marks?.[name]);\n }\n\n // Collapsed selection (caret): current marks are reliable.\n if (Range.isCollapsed(selection)) {\n const marks = Editor.marks(editor);\n return Boolean(marks?.[name]);\n }\n\n /**\n * Expanded selection: derive \"active\" state from the selected text nodes.\n *\n * This avoids a common mobile edge case where the selection focus can sit just\n * outside the formatted span (so relying on caret/focus marks would be wrong).\n *\n * Additionally, mobile selection often includes an extra whitespace character at\n * the edge (e.g. the trailing space after a word). We ignore whitespace-only\n * portions when computing active state so the toolbar reflects the intended\n * formatted text.\n */\n const range = Editor.unhangRange(editor, selection);\n const selectedTextEntries = Array.from(\n Editor.nodes(editor, { at: range, match: Text.isText, mode: 'all' })\n ) as NodeEntry<Text>[];\n\n if (selectedTextEntries.length === 0) return false;\n\n const summary = selectedTextEntries.reduce(\n (acc, [node, path]) => {\n const nodeRange = Editor.range(editor, path);\n const intersection = Range.intersection(range, nodeRange);\n\n if (!intersection) {\n return acc;\n }\n\n const start = Math.min(intersection.anchor.offset, intersection.focus.offset);\n const end = Math.max(intersection.anchor.offset, intersection.focus.offset);\n const selectedSlice = node.text.slice(start, end);\n\n // Ignore whitespace-only slices (common in mobile selection boundaries).\n if (selectedSlice.trim().length === 0) {\n return acc;\n }\n\n return {\n hasNonWhitespaceSelection: true,\n isEveryRelevantNodeMarked: acc.isEveryRelevantNodeMarked && Boolean(node[name]),\n };\n },\n { hasNonWhitespaceSelection: false, isEveryRelevantNodeMarked: true }\n );\n\n return summary.hasNonWhitespaceSelection && summary.isEveryRelevantNodeMarked;\n};\n\n/**\n * The default handler for toggling a modifier\n */\nconst baseHandleToggle = (editor: Editor, name: ModifierKey) => {\n // If there is no selection, set selection to the end of line\n if (!editor.selection) {\n const endOfEditor = Editor.end(editor, []);\n Transforms.select(editor, endOfEditor);\n }\n\n // Toggle the modifier\n if (baseCheckIsActive(editor, name)) {\n Editor.removeMark(editor, name);\n } else {\n Editor.addMark(editor, name, true);\n }\n};\n\nconst modifiers: ModifiersStore = {\n bold: {\n icon: Bold,\n isValidEventKey: (event) => event.key === 'b',\n label: { id: 'components.Blocks.modifiers.bold', defaultMessage: 'Bold' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'bold'),\n handleToggle: (editor) => baseHandleToggle(editor, 'bold'),\n renderLeaf: (children) => <BoldText>{children}</BoldText>,\n },\n italic: {\n icon: Italic,\n isValidEventKey: (event) => event.key === 'i',\n label: { id: 'components.Blocks.modifiers.italic', defaultMessage: 'Italic' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'italic'),\n handleToggle: (editor) => baseHandleToggle(editor, 'italic'),\n renderLeaf: (children) => <ItalicText>{children}</ItalicText>,\n },\n underline: {\n icon: Underline,\n isValidEventKey: (event) => event.key === 'u',\n label: { id: 'components.Blocks.modifiers.underline', defaultMessage: 'Underline' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'underline'),\n handleToggle: (editor) => baseHandleToggle(editor, 'underline'),\n renderLeaf: (children) => <UnderlineText>{children}</UnderlineText>,\n },\n strikethrough: {\n icon: StrikeThrough,\n isValidEventKey: (event) => event.key === 'S' && event.shiftKey,\n label: { id: 'components.Blocks.modifiers.strikethrough', defaultMessage: 'Strikethrough' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'strikethrough'),\n handleToggle: (editor) => baseHandleToggle(editor, 'strikethrough'),\n renderLeaf: (children) => <StrikeThroughText>{children}</StrikeThroughText>,\n },\n code: {\n icon: Code,\n isValidEventKey: (event) => event.key === 'e',\n label: { id: 'components.Blocks.modifiers.code', defaultMessage: 'Inline code' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'code'),\n handleToggle: (editor) => baseHandleToggle(editor, 'code'),\n renderLeaf: (children) => <InlineCode>{children}</InlineCode>,\n },\n};\n\nexport { type ModifiersStore, modifiers };\n"],"names":["stylesToInherit","css","BoldText","styled","Typography","attrs","fontWeight","ItalicText","UnderlineText","textDecoration","StrikeThroughText","InlineCode","code","theme","colors","neutral150","borderRadius","spaces","baseCheckIsActive","editor","name","selection","marks","Editor","Boolean","Range","isCollapsed","range","unhangRange","selectedTextEntries","Array","from","nodes","at","match","Text","isText","mode","length","summary","reduce","acc","node","path","nodeRange","intersection","start","Math","min","anchor","offset","focus","end","max","selectedSlice","text","slice","trim","hasNonWhitespaceSelection","isEveryRelevantNodeMarked","baseHandleToggle","endOfEditor","Transforms","select","removeMark","addMark","modifiers","bold","icon","Bold","isValidEventKey","event","key","label","id","defaultMessage","checkIsActive","handleToggle","renderLeaf","children","_jsx","italic","Italic","underline","Underline","strikethrough","StrikeThrough","shiftKey","Code"],"mappings":";;;;;;;AAQA,MAAMA,eAAAA,GAAkBC,GAAG;;;;AAI3B,CAAC;AAED,MAAMC,QAAAA,GAAWC,MAAAA,CAA4BC,UAAAA,CAAAA,CAAYC,KAAK,CAAC;IAAEC,UAAAA,EAAY;AAAO,CAAA,CAAE;AACpF,EAAA,EAAEN,eAAAA;AACJ,CAAC;AAED,MAAMO,UAAAA,GAAaJ,MAAAA,CAA4BC,UAAAA,CAAW;;AAExD,EAAA,EA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GAAA,IAAOD,MAAMgB,QAAQ;QAC/Dd,KAAAA,EAAO;YAAEC,EAAAA,EAAI,2CAAA;YAA6CC,cAAAA,EAAgB;AAAgB,SAAA;QAC1FC,aAAAA,EAAe,CAACzD,MAAAA,GAAWD,iBAAAA,CAAkBC,MAAAA,EAAQ,eAAA,CAAA;QACrD0D,YAAAA,EAAc,CAAC1D,MAAAA,GAAWyC,gBAAAA,CAAiBzC,MAAAA,EAAQ,eAAA,CAAA;QACnD2D,UAAAA,EAAY,CAACC,yBAAaC,GAAA,CAACtE,iBAAAA,EAAAA;AAAmBqE,gBAAAA,QAAAA,EAAAA;;AAChD,KAAA;IACAnE,IAAAA,EAAM;QACJwD,IAAAA,EAAMoB,IAAAA;AACNlB,QAAAA,eAAAA,EAAiB,CAACC,KAAAA,GAAUA,KAAAA,CAAMC,GAAG,KAAK,GAAA;QAC1CC,KAAAA,EAAO;YAAEC,EAAAA,EAAI,kCAAA;YAAoCC,cAAAA,EAAgB;AAAc,SAAA;QAC/EC,aAAAA,EAAe,CAACzD,MAAAA,GAAWD,iBAAAA,CAAkBC,MAAAA,EAAQ,MAAA,CAAA;QACrD0D,YAAAA,EAAc,CAAC1D,MAAAA,GAAWyC,gBAAAA,CAAiBzC,MAAAA,EAAQ,MAAA,CAAA;QACnD2D,UAAAA,EAAY,CAACC,yBAAaC,GAAA,CAACrE,UAAAA,EAAAA;AAAYoE,gBAAAA,QAAAA,EAAAA;;AACzC;AACF;;;;"}
1
+ {"version":3,"file":"Modifiers.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Modifiers.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Typography, TypographyComponent } from '@strapi/design-system';\nimport { Bold, Italic, Underline, StrikeThrough, Code } from '@strapi/icons';\nimport { type MessageDescriptor } from 'react-intl';\nimport { Editor, type NodeEntry, Range, Text, Transforms } from 'slate';\nimport { styled, css } from 'styled-components';\n\nconst stylesToInherit = css`\n font-size: inherit;\n color: inherit;\n line-height: inherit;\n`;\n\nconst BoldText = styled<TypographyComponent>(Typography).attrs({ fontWeight: 'bold' })`\n ${stylesToInherit}\n`;\n\nconst ItalicText = styled<TypographyComponent>(Typography)`\n font-style: italic;\n ${stylesToInherit}\n`;\n\nconst UnderlineText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'underline',\n})`\n ${stylesToInherit}\n`;\n\nconst StrikeThroughText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'line-through',\n})`\n ${stylesToInherit}\n`;\n\nconst InlineCode = styled.code`\n background-color: ${({ theme }) => theme.colors.neutral150};\n border-radius: ${({ theme }) => theme.borderRadius};\n padding: ${({ theme }) => `0 ${theme.spaces[2]}`};\n font-family:\n 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;\n color: inherit;\n`;\n\ntype ModifierKey = Exclude<keyof Text, 'type' | 'text'>;\n\ntype ModifiersStore = {\n [K in ModifierKey]: {\n icon: React.ComponentType;\n isValidEventKey: (event: React.KeyboardEvent<HTMLElement>) => boolean;\n label: MessageDescriptor;\n checkIsActive: (editor: Editor) => boolean;\n handleToggle: (editor: Editor) => void;\n renderLeaf: (children: React.JSX.Element | string) => React.JSX.Element;\n };\n};\n\n/**\n * The default handler for checking if a modifier is active\n */\nconst baseCheckIsActive = (editor: Editor, name: ModifierKey) => {\n const { selection } = editor;\n\n // If there's no selection, fall back to Slate's current marks.\n // (This is what will be applied to newly inserted text.)\n if (!selection) {\n const marks = Editor.marks(editor);\n return Boolean(marks?.[name]);\n }\n\n // Collapsed selection (caret): current marks are reliable.\n if (Range.isCollapsed(selection)) {\n const marks = Editor.marks(editor);\n return Boolean(marks?.[name]);\n }\n\n /**\n * Expanded selection: derive \"active\" state from the selected text nodes.\n *\n * This avoids a common mobile edge case where the selection focus can sit just\n * outside the formatted span (so relying on caret/focus marks would be wrong).\n *\n * Additionally, mobile selection often includes an extra whitespace character at\n * the edge (e.g. the trailing space after a word). We ignore whitespace-only\n * portions when computing active state so the toolbar reflects the intended\n * formatted text.\n */\n const range = Editor.unhangRange(editor, selection);\n const selectedTextEntries = Array.from(\n Editor.nodes(editor, { at: range, match: Text.isText, mode: 'all' })\n ) as NodeEntry<Text>[];\n\n if (selectedTextEntries.length === 0) return false;\n\n const summary = selectedTextEntries.reduce(\n (acc, [node, path]) => {\n const nodeRange = Editor.range(editor, path);\n const intersection = Range.intersection(range, nodeRange);\n\n if (!intersection) {\n return acc;\n }\n\n const start = Math.min(intersection.anchor.offset, intersection.focus.offset);\n const end = Math.max(intersection.anchor.offset, intersection.focus.offset);\n const selectedSlice = node.text.slice(start, end);\n\n // Ignore whitespace-only slices (common in mobile selection boundaries).\n if (selectedSlice.trim().length === 0) {\n return acc;\n }\n\n return {\n hasNonWhitespaceSelection: true,\n isEveryRelevantNodeMarked: acc.isEveryRelevantNodeMarked && Boolean(node[name]),\n };\n },\n { hasNonWhitespaceSelection: false, isEveryRelevantNodeMarked: true }\n );\n\n return summary.hasNonWhitespaceSelection && summary.isEveryRelevantNodeMarked;\n};\n\n/**\n * The default handler for toggling a modifier\n */\nconst baseHandleToggle = (editor: Editor, name: ModifierKey) => {\n // If there is no selection, set selection to the end of line\n if (!editor.selection) {\n const endOfEditor = Editor.end(editor, []);\n Transforms.select(editor, endOfEditor);\n }\n\n // Toggle the modifier\n if (baseCheckIsActive(editor, name)) {\n Editor.removeMark(editor, name);\n } else {\n Editor.addMark(editor, name, true);\n }\n};\n\nconst modifiers: ModifiersStore = {\n bold: {\n icon: Bold,\n isValidEventKey: (event) => event.key === 'b',\n label: { id: 'components.Blocks.modifiers.bold', defaultMessage: 'Bold' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'bold'),\n handleToggle: (editor) => baseHandleToggle(editor, 'bold'),\n renderLeaf: (children) => <BoldText>{children}</BoldText>,\n },\n italic: {\n icon: Italic,\n isValidEventKey: (event) => event.key === 'i',\n label: { id: 'components.Blocks.modifiers.italic', defaultMessage: 'Italic' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'italic'),\n handleToggle: (editor) => baseHandleToggle(editor, 'italic'),\n renderLeaf: (children) => <ItalicText>{children}</ItalicText>,\n },\n underline: {\n icon: Underline,\n isValidEventKey: (event) => event.key === 'u',\n label: { id: 'components.Blocks.modifiers.underline', defaultMessage: 'Underline' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'underline'),\n handleToggle: (editor) => baseHandleToggle(editor, 'underline'),\n renderLeaf: (children) => <UnderlineText>{children}</UnderlineText>,\n },\n strikethrough: {\n icon: StrikeThrough,\n isValidEventKey: (event) => event.key === 'S' && event.shiftKey,\n label: { id: 'components.Blocks.modifiers.strikethrough', defaultMessage: 'Strikethrough' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'strikethrough'),\n handleToggle: (editor) => baseHandleToggle(editor, 'strikethrough'),\n renderLeaf: (children) => <StrikeThroughText>{children}</StrikeThroughText>,\n },\n code: {\n icon: Code,\n isValidEventKey: (event) => event.key === 'e',\n label: { id: 'components.Blocks.modifiers.code', defaultMessage: 'Inline code' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'code'),\n handleToggle: (editor) => baseHandleToggle(editor, 'code'),\n renderLeaf: (children) => <InlineCode>{children}</InlineCode>,\n },\n};\n\nexport { type ModifiersStore, modifiers };\n"],"names":["stylesToInherit","css","BoldText","styled","Typography","attrs","fontWeight","ItalicText","UnderlineText","textDecoration","StrikeThroughText","InlineCode","code","theme","colors","neutral150","borderRadius","spaces","baseCheckIsActive","editor","name","selection","marks","Editor","Boolean","Range","isCollapsed","range","unhangRange","selectedTextEntries","Array","from","nodes","at","match","Text","isText","mode","length","summary","reduce","acc","node","path","nodeRange","intersection","start","Math","min","anchor","offset","focus","end","max","selectedSlice","text","slice","trim","hasNonWhitespaceSelection","isEveryRelevantNodeMarked","baseHandleToggle","endOfEditor","Transforms","select","removeMark","addMark","modifiers","bold","icon","Bold","isValidEventKey","event","key","label","id","defaultMessage","checkIsActive","handleToggle","renderLeaf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