@strapi/content-manager 5.51.1 → 5.51.2

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 (106) 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/Link.js +2 -2
  24. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.js.map +1 -1
  25. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs +2 -2
  26. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs.map +1 -1
  27. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.js +1 -1
  28. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.js.map +1 -1
  29. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.mjs +1 -1
  30. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.mjs.map +1 -1
  31. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.js +102 -7
  32. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.js.map +1 -1
  33. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.mjs +84 -8
  34. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.mjs.map +1 -1
  35. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js +2 -1
  36. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js.map +1 -1
  37. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs +2 -1
  38. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs.map +1 -1
  39. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js +14 -5
  40. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js.map +1 -1
  41. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs +14 -5
  42. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs.map +1 -1
  43. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js +17 -16
  44. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
  45. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs +17 -13
  46. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
  47. package/dist/admin/pages/EditView/components/FormInputs/UID.js +2 -2
  48. package/dist/admin/pages/EditView/components/FormInputs/UID.js.map +1 -1
  49. package/dist/admin/pages/EditView/components/FormInputs/UID.mjs +2 -2
  50. package/dist/admin/pages/EditView/components/FormInputs/UID.mjs.map +1 -1
  51. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.js +2 -1
  52. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.js.map +1 -1
  53. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.mjs +2 -1
  54. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/sanitizer.mjs.map +1 -1
  55. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js +7 -0
  56. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js.map +1 -1
  57. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs +7 -0
  58. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs.map +1 -1
  59. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +3 -1
  60. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.d.ts +2 -0
  61. package/dist/admin/src/pages/EditView/components/FormInputs/Relations/RelationModal.d.ts +4 -0
  62. package/dist/admin/src/utils/previewImage.d.ts +3 -0
  63. package/dist/admin/translations/en.json.js +1 -0
  64. package/dist/admin/translations/en.json.js.map +1 -1
  65. package/dist/admin/translations/en.json.mjs +1 -0
  66. package/dist/admin/translations/en.json.mjs.map +1 -1
  67. package/dist/admin/utils/objects.js +3 -1
  68. package/dist/admin/utils/objects.js.map +1 -1
  69. package/dist/admin/utils/objects.mjs +3 -1
  70. package/dist/admin/utils/objects.mjs.map +1 -1
  71. package/dist/admin/utils/previewImage.js +14 -0
  72. package/dist/admin/utils/previewImage.js.map +1 -0
  73. package/dist/admin/utils/previewImage.mjs +12 -0
  74. package/dist/admin/utils/previewImage.mjs.map +1 -0
  75. package/dist/admin/utils/validation.js +2 -2
  76. package/dist/admin/utils/validation.js.map +1 -1
  77. package/dist/admin/utils/validation.mjs +2 -2
  78. package/dist/admin/utils/validation.mjs.map +1 -1
  79. package/dist/server/controllers/utils/clone.js +1 -5
  80. package/dist/server/controllers/utils/clone.js.map +1 -1
  81. package/dist/server/controllers/utils/clone.mjs +2 -2
  82. package/dist/server/controllers/utils/clone.mjs.map +1 -1
  83. package/dist/server/controllers/validation/index.js +1 -1
  84. package/dist/server/controllers/validation/index.js.map +1 -1
  85. package/dist/server/controllers/validation/index.mjs +1 -1
  86. package/dist/server/controllers/validation/index.mjs.map +1 -1
  87. package/dist/server/services/document-manager.js +1 -1
  88. package/dist/server/services/document-manager.js.map +1 -1
  89. package/dist/server/services/document-manager.mjs +1 -1
  90. package/dist/server/services/document-manager.mjs.map +1 -1
  91. package/dist/server/services/document-metadata.js +24 -2
  92. package/dist/server/services/document-metadata.js.map +1 -1
  93. package/dist/server/services/document-metadata.mjs +24 -2
  94. package/dist/server/services/document-metadata.mjs.map +1 -1
  95. package/dist/server/services/utils/draft.js +19 -3
  96. package/dist/server/services/utils/draft.js.map +1 -1
  97. package/dist/server/services/utils/draft.mjs +1 -1
  98. package/dist/server/services/utils/draft.mjs.map +1 -1
  99. package/dist/server/services/utils/populate.js +22 -6
  100. package/dist/server/services/utils/populate.js.map +1 -1
  101. package/dist/server/services/utils/populate.mjs +1 -1
  102. package/dist/server/services/utils/populate.mjs.map +1 -1
  103. package/dist/server/src/index.d.ts.map +1 -1
  104. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  105. package/dist/server/src/services/index.d.ts.map +1 -1
  106. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sources":["../../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, Button, Field, Flex, Popover } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport {\n BaseEditor,\n Editor,\n Element,\n Path,\n Point,\n Range,\n Transforms,\n Element as SlateElement,\n Node,\n} from 'slate';\nimport { type RenderElementProps, ReactEditor } from 'slate-react';\nimport { styled } from 'styled-components';\n\nimport { type BlocksStore, useBlocksEditorContext } from '../BlocksEditor';\nimport { type Block } from '../utils/types';\n\nimport type { Schema } from '@strapi/types';\n\nconst isLinkNode = (element: Element): element is Schema.Attribute.LinkInlineNode => {\n return element.type === 'link';\n};\n\nconst removeLink = (editor: Editor) => {\n Transforms.unwrapNodes(editor, {\n match: (node) => !Editor.isEditor(node) && SlateElement.isElement(node) && node.type === 'link',\n });\n};\n\nconst insertLink = (editor: Editor, { url }: { url: string }) => {\n if (editor.selection) {\n // We want to remove all link on the selection\n const linkNodes = Array.from(\n Editor.nodes(editor, {\n at: editor.selection,\n match: (node) => !Editor.isEditor(node) && node.type === 'link',\n })\n );\n\n linkNodes.forEach(([, path]) => {\n Transforms.unwrapNodes(editor, { at: path });\n });\n\n if (Range.isCollapsed(editor.selection)) {\n const link: Block<'link'> = {\n type: 'link',\n url: url ?? '',\n children: [{ type: 'text', text: url }],\n rel: '',\n target: '',\n };\n\n Transforms.insertNodes(editor, link);\n } else {\n Transforms.wrapNodes(editor, { type: 'link', url: url ?? '' } as Block<'link'>, {\n split: true,\n });\n }\n }\n};\n\nconst editLink = (\n editor: Editor,\n link: { url: string; text: string; rel: string; target: string }\n) => {\n const { url, text, rel, target } = link;\n\n if (!editor.selection) {\n return;\n }\n\n const linkEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'link',\n });\n\n if (linkEntry) {\n const [, linkPath] = linkEntry;\n Transforms.setNodes(editor, { url, rel, target }, { at: linkPath });\n\n // If link text is different, we remove the old text and insert the new one\n if (text !== '' && text !== Editor.string(editor, linkPath)) {\n const linkNodeChildrens = Array.from(Node.children(editor, linkPath, { reverse: true }));\n\n linkNodeChildrens.forEach(([, childPath]) => {\n Transforms.removeNodes(editor, { at: childPath });\n });\n\n Transforms.insertNodes(editor, [{ type: 'text', text }], { at: linkPath.concat(0) });\n }\n }\n};\n\nconst StyledLink = styled(Box)`\n text-decoration: none;\n`;\n\nconst RemoveButton = styled(Button)<{ $visible: boolean }>`\n visibility: ${(props) => (props.$visible ? 'visible' : 'hidden')};\n`;\n\ninterface LinkContentProps extends RenderElementProps {\n link: Block<'link'>;\n}\n\nconst LinkContent = React.forwardRef<HTMLAnchorElement, LinkContentProps>(\n ({ link, children, attributes }, forwardedRef) => {\n const { formatMessage } = useIntl();\n const { editor } = useBlocksEditorContext('Link');\n const path = ReactEditor.findPath(editor, link);\n const [popoverOpen, setPopoverOpen] = React.useState(\n editor.lastInsertedLinkPath ? Path.equals(path, editor.lastInsertedLinkPath) : false\n );\n const elementText = link.children.map((child) => child.text).join('');\n const [linkText, setLinkText] = React.useState(elementText);\n const [linkUrl, setLinkUrl] = React.useState(link.url);\n const [linkRel, setLinRel] = React.useState(link.rel);\n const [linkTarget, setLinkTarget] = React.useState(link.target);\n const linkInputRef = React.useRef<HTMLInputElement>(null);\n const isLastInsertedLink = editor.lastInsertedLinkPath\n ? !Path.equals(path, editor.lastInsertedLinkPath)\n : true;\n const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);\n\n const onLinkChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setIsSaveDisabled(false);\n setLinkUrl(e.target.value);\n\n try {\n // eslint-disable-next-line no-new\n new URL(\n e.target.value?.startsWith('/') ? `https://strapi.io${e.target.value}` : e.target.value\n );\n } catch (error) {\n setIsSaveDisabled(true);\n }\n };\n\n const onLinkRelChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setIsSaveDisabled(false);\n setLinRel(e.target.value);\n };\n\n const onLinkTargetChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setIsSaveDisabled(false);\n setLinkTarget(e.target.value);\n };\n\n const handleSave: React.FormEventHandler = (e) => {\n e.stopPropagation();\n\n // If the selection is collapsed, we select the parent node because we want all the link to be replaced)\n if (editor.selection && Range.isCollapsed(editor.selection)) {\n const [, parentPath] = Editor.parent(editor, editor.selection.focus?.path);\n Transforms.select(editor, parentPath);\n }\n\n editLink(editor, { url: linkUrl, text: linkText, rel: linkRel, target: linkTarget });\n setPopoverOpen(false);\n editor.lastInsertedLinkPath = null;\n ReactEditor.focus(editor);\n };\n\n const handleClose = () => {\n if (link.url === '') {\n removeLink(editor);\n }\n\n setPopoverOpen(false);\n ReactEditor.focus(editor);\n };\n\n React.useEffect(() => {\n // Focus on the link input element when the popover opens\n if (popoverOpen) linkInputRef.current?.focus();\n }, [popoverOpen]);\n\n const inputNotDirty =\n !linkText ||\n !linkUrl ||\n (link.url &&\n link.url === linkUrl &&\n elementText &&\n elementText === linkText &&\n link.rel === linkRel &&\n link.target === linkTarget);\n\n return (\n <Popover.Root open={popoverOpen}>\n <Popover.Trigger>\n <StyledLink\n {...attributes}\n ref={forwardedRef}\n tag=\"a\"\n href={link.url}\n rel={link.rel}\n target={link.target}\n onClick={() => setPopoverOpen(true)}\n color=\"primary600\"\n >\n {children}\n </StyledLink>\n </Popover.Trigger>\n <Popover.Content onPointerDownOutside={handleClose}>\n <Flex padding={4} direction=\"column\" gap={4}>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.text',\n defaultMessage: 'Text',\n })}\n </Field.Label>\n <Field.Input\n name=\"text\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.text.placeholder',\n defaultMessage: 'Enter link text',\n })}\n value={linkText}\n onChange={(e) => {\n setLinkText(e.target.value);\n }}\n />\n </Flex>\n </Field.Root>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.link',\n defaultMessage: 'Link',\n })}\n </Field.Label>\n <Field.Input\n ref={linkInputRef}\n name=\"url\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.link.placeholder',\n defaultMessage: 'Paste link',\n })}\n value={linkUrl}\n onChange={onLinkChange}\n />\n </Flex>\n </Field.Root>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.link.rel',\n defaultMessage: 'Rel (optional)',\n })}\n </Field.Label>\n <Field.Input\n name=\"rel\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.link.rel.placeholder',\n defaultMessage: 'noopener, nofollow, noreferrer',\n })}\n value={linkRel}\n onChange={onLinkRelChange}\n />\n </Flex>\n </Field.Root>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.link.target',\n defaultMessage: 'Target (optional)',\n })}\n </Field.Label>\n <Field.Input\n name=\"target\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.link.target.placeholder',\n defaultMessage: '_blank, _self, _parent, _top',\n })}\n value={linkTarget}\n onChange={onLinkTargetChange}\n />\n </Flex>\n </Field.Root>\n <Flex justifyContent=\"space-between\" width={{ initial: '100%', medium: '368px' }}>\n <RemoveButton\n variant=\"danger-light\"\n onClick={() => removeLink(editor)}\n $visible={isLastInsertedLink}\n >\n {formatMessage({\n id: 'components.Blocks.popover.remove',\n defaultMessage: 'Remove',\n })}\n </RemoveButton>\n <Flex gap={2}>\n <Button variant=\"tertiary\" onClick={handleClose}>\n {formatMessage({\n id: 'global.cancel',\n defaultMessage: 'Cancel',\n })}\n </Button>\n <Button disabled={Boolean(inputNotDirty) || isSaveDisabled} onClick={handleSave}>\n {formatMessage({\n id: 'global.save',\n defaultMessage: 'Save',\n })}\n </Button>\n </Flex>\n </Flex>\n </Flex>\n </Popover.Content>\n </Popover.Root>\n );\n }\n);\n\nconst Link = React.forwardRef<HTMLAnchorElement, RenderElementProps>((props, forwardedRef) => {\n if (!isLinkNode(props.element)) {\n return null;\n }\n\n // LinkContent uses React hooks that rely on props.element being a link. If the type guard above\n // doesn't pass, those hooks would be called conditionnally, which is not allowed.\n // Hence the need for a separate component.\n return <LinkContent {...props} link={props.element} ref={forwardedRef} />;\n});\n\nconst withLinks = (editor: Editor) => {\n const { isInline, apply, insertText, insertData } = editor;\n\n // Links are inline elements, so we need to override the isInline method for slate\n editor.isInline = (element) => {\n return element.type === 'link' ? true : isInline(element);\n };\n\n // We keep a track of the last inserted link path\n // So we can show the popover on the link component if that link is the last one inserted\n editor.lastInsertedLinkPath = null;\n\n // We intercept the apply method, so everytime we insert a new link, we save its path\n editor.apply = (operation) => {\n if (operation.type === 'insert_node') {\n if (\n !Editor.isEditor(operation.node) &&\n operation.node.type === 'link' &&\n editor.shouldSaveLinkPath\n ) {\n editor.lastInsertedLinkPath = operation.path;\n }\n } else if (operation.type === 'move_node') {\n // We need to update the last inserted link path when link is moved\n // If link is the first word in the paragraph we dont need to update the path\n if (\n Path.hasPrevious(operation.path) &&\n editor.lastInsertedLinkPath &&\n editor.shouldSaveLinkPath\n ) {\n editor.lastInsertedLinkPath = Path.transform(editor.lastInsertedLinkPath, operation);\n }\n }\n\n apply(operation);\n };\n\n editor.insertText = (text) => {\n // When selection is at the end of a link and user types a space, we want to break the link\n if (editor.selection && Range.isCollapsed(editor.selection) && text === ' ') {\n const linksInSelection = Array.from(\n Editor.nodes(editor, {\n at: editor.selection,\n match: (node) => !Editor.isEditor(node) && node.type === 'link',\n })\n );\n\n const selectionIsInLink = editor.selection && linksInSelection.length > 0;\n const selectionIsAtEndOfLink =\n selectionIsInLink &&\n Point.equals(editor.selection.anchor, Editor.end(editor, linksInSelection[0][1]));\n\n if (selectionIsAtEndOfLink) {\n Transforms.insertNodes(\n editor,\n { text: ' ', type: 'text' },\n { at: Path.next(linksInSelection[0][1]), select: true }\n );\n\n return;\n }\n }\n\n insertText(text);\n };\n\n // Add data as a clickable link if its a valid URL\n editor.insertData = (data) => {\n const pastedText = data.getData('text/plain');\n\n if (pastedText) {\n try {\n // eslint-disable-next-line no-new\n new URL(pastedText);\n // Do not show link popup on copy-paste a link, so do not save its path\n editor.shouldSaveLinkPath = false;\n insertLink(editor, { url: pastedText });\n return;\n } catch (error) {\n // continue normal data insertion\n }\n }\n\n insertData(data);\n };\n\n return editor;\n};\n\nconst linkBlocks: Pick<BlocksStore, 'link'> = {\n link: {\n renderElement: (props) => (\n <Link element={props.element} attributes={props.attributes}>\n {props.children}\n </Link>\n ),\n // No handleConvert here, links are created via the link button in the toolbar\n matchNode: (node) => node.type === 'link',\n isInBlocksSelector: false,\n plugin: withLinks,\n isDraggable: () => false,\n },\n};\n\nexport interface LinkEditor extends BaseEditor {\n lastInsertedLinkPath: Path | null;\n shouldSaveLinkPath: boolean;\n}\n\nexport { linkBlocks, insertLink };\n"],"names":["isLinkNode","element","type","removeLink","editor","Transforms","unwrapNodes","match","node","Editor","isEditor","SlateElement","isElement","insertLink","url","selection","linkNodes","Array","from","nodes","at","forEach","path","Range","isCollapsed","link","children","text","rel","target","insertNodes","wrapNodes","split","editLink","linkEntry","above","linkPath","setNodes","string","linkNodeChildrens","Node","reverse","childPath","removeNodes","concat","StyledLink","styled","Box","RemoveButton","Button","props","$visible","LinkContent","React","forwardRef","attributes","forwardedRef","formatMessage","useIntl","useBlocksEditorContext","ReactEditor","findPath","popoverOpen","setPopoverOpen","useState","lastInsertedLinkPath","Path","equals","elementText","map","child","join","linkText","setLinkText","linkUrl","setLinkUrl","linkRel","setLinRel","linkTarget","setLinkTarget","linkInputRef","useRef","isLastInsertedLink","isSaveDisabled","setIsSaveDisabled","onLinkChange","e","value","URL","startsWith","error","onLinkRelChange","onLinkTargetChange","handleSave","stopPropagation","parentPath","parent","focus","select","handleClose","useEffect","current","inputNotDirty","_jsxs","Popover","Root","open","_jsx","Trigger","ref","tag","href","onClick","color","Content","onPointerDownOutside","Flex","padding","direction","gap","Field","width","initial","medium","alignItems","Label","id","defaultMessage","Input","name","placeholder","onChange","justifyContent","variant","disabled","Boolean","Link","withLinks","isInline","apply","insertText","insertData","operation","shouldSaveLinkPath","hasPrevious","transform","linksInSelection","selectionIsInLink","length","selectionIsAtEndOfLink","Point","anchor","end","next","data","pastedText","getData","linkBlocks","renderElement","mat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AAA,UAAAA,EAAYL,MAAMK,UAAU;AACvDL,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMxB;;;AAIXqI,QAAAA,SAAAA,EAAW,CAACvJ,IAAAA,GAASA,IAAAA,CAAKN,IAAI,KAAK,MAAA;QACnC8J,kBAAAA,EAAoB,KAAA;QACpBC,MAAAA,EAAQxB,SAAAA;AACRyB,QAAAA,WAAAA,EAAa,IAAM;AACrB;AACF;;;;;"}
1
+ {"version":3,"file":"Link.js","sources":["../../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, Button, Field, Flex, Popover } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport {\n BaseEditor,\n Editor,\n Element,\n Path,\n Point,\n Range,\n Transforms,\n Element as SlateElement,\n Node,\n} from 'slate';\nimport { type RenderElementProps, ReactEditor } from 'slate-react';\nimport { styled } from 'styled-components';\n\nimport { type BlocksStore, useBlocksEditorContext } from '../BlocksEditor';\nimport { type Block } from '../utils/types';\n\nimport type { Schema } from '@strapi/types';\n\nconst isLinkNode = (element: Element): element is Schema.Attribute.LinkInlineNode => {\n return element.type === 'link';\n};\n\nconst removeLink = (editor: Editor) => {\n Transforms.unwrapNodes(editor, {\n match: (node) => !Editor.isEditor(node) && SlateElement.isElement(node) && node.type === 'link',\n });\n};\n\nconst insertLink = (editor: Editor, { url }: { url: string }) => {\n if (editor.selection) {\n // We want to remove all link on the selection\n const linkNodes = Array.from(\n Editor.nodes(editor, {\n at: editor.selection,\n match: (node) => !Editor.isEditor(node) && node.type === 'link',\n })\n );\n\n linkNodes.forEach(([, path]) => {\n Transforms.unwrapNodes(editor, { at: path });\n });\n\n if (Range.isCollapsed(editor.selection)) {\n const link: Block<'link'> = {\n type: 'link',\n url: url ?? '',\n children: [{ type: 'text', text: url }],\n rel: '',\n target: '',\n };\n\n Transforms.insertNodes(editor, link);\n } else {\n Transforms.wrapNodes(editor, { type: 'link', url: url ?? '' } as Block<'link'>, {\n split: true,\n });\n }\n }\n};\n\nconst editLink = (\n editor: Editor,\n link: { url: string; text: string; rel: string; target: string }\n) => {\n const { url, text, rel, target } = link;\n\n if (!editor.selection) {\n return;\n }\n\n const linkEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'link',\n });\n\n if (linkEntry) {\n const [, linkPath] = linkEntry;\n Transforms.setNodes(editor, { url, rel, target }, { at: linkPath });\n\n // If link text is different, we remove the old text and insert the new one\n if (text !== '' && text !== Editor.string(editor, linkPath)) {\n const linkNodeChildrens = Array.from(Node.children(editor, linkPath, { reverse: true }));\n\n linkNodeChildrens.forEach(([, childPath]) => {\n Transforms.removeNodes(editor, { at: childPath });\n });\n\n Transforms.insertNodes(editor, [{ type: 'text', text }], { at: linkPath.concat(0) });\n }\n }\n};\n\nconst StyledLink = styled(Box)`\n text-decoration: none;\n`;\n\nconst RemoveButton = styled(Button)<{ $visible: boolean }>`\n visibility: ${(props) => (props.$visible ? 'visible' : 'hidden')};\n`;\n\ninterface LinkContentProps extends RenderElementProps {\n link: Block<'link'>;\n}\n\nconst LinkContent = React.forwardRef<HTMLAnchorElement, LinkContentProps>(\n ({ link, children, attributes }, forwardedRef) => {\n const { formatMessage } = useIntl();\n const { editor } = useBlocksEditorContext('Link');\n const path = ReactEditor.findPath(editor, link);\n const [popoverOpen, setPopoverOpen] = React.useState(\n editor.lastInsertedLinkPath ? Path.equals(path, editor.lastInsertedLinkPath) : false\n );\n const elementText = link.children.map((child) => child.text).join('');\n const [linkText, setLinkText] = React.useState(elementText);\n const [linkUrl, setLinkUrl] = React.useState(link.url);\n const [linkRel, setLinRel] = React.useState(link.rel);\n const [linkTarget, setLinkTarget] = React.useState(link.target);\n const linkInputRef = React.useRef<HTMLInputElement>(null);\n const isLastInsertedLink = editor.lastInsertedLinkPath\n ? !Path.equals(path, editor.lastInsertedLinkPath)\n : true;\n const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);\n\n const onLinkChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setIsSaveDisabled(false);\n setLinkUrl(e.target.value);\n\n try {\n // eslint-disable-next-line no-new\n new URL(\n e.target.value?.startsWith('/') ? `https://strapi.io${e.target.value}` : e.target.value\n );\n } catch {\n setIsSaveDisabled(true);\n }\n };\n\n const onLinkRelChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setIsSaveDisabled(false);\n setLinRel(e.target.value);\n };\n\n const onLinkTargetChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setIsSaveDisabled(false);\n setLinkTarget(e.target.value);\n };\n\n const handleSave: React.FormEventHandler = (e) => {\n e.stopPropagation();\n\n // If the selection is collapsed, we select the parent node because we want all the link to be replaced)\n if (editor.selection && Range.isCollapsed(editor.selection)) {\n const [, parentPath] = Editor.parent(editor, editor.selection.focus?.path);\n Transforms.select(editor, parentPath);\n }\n\n editLink(editor, { url: linkUrl, text: linkText, rel: linkRel, target: linkTarget });\n setPopoverOpen(false);\n editor.lastInsertedLinkPath = null;\n ReactEditor.focus(editor);\n };\n\n const handleClose = () => {\n if (link.url === '') {\n removeLink(editor);\n }\n\n setPopoverOpen(false);\n ReactEditor.focus(editor);\n };\n\n React.useEffect(() => {\n // Focus on the link input element when the popover opens\n if (popoverOpen) linkInputRef.current?.focus();\n }, [popoverOpen]);\n\n const inputNotDirty =\n !linkText ||\n !linkUrl ||\n (link.url &&\n link.url === linkUrl &&\n elementText &&\n elementText === linkText &&\n link.rel === linkRel &&\n link.target === linkTarget);\n\n return (\n <Popover.Root open={popoverOpen}>\n <Popover.Trigger>\n <StyledLink\n {...attributes}\n ref={forwardedRef}\n tag=\"a\"\n href={link.url}\n rel={link.rel}\n target={link.target}\n onClick={() => setPopoverOpen(true)}\n color=\"primary600\"\n >\n {children}\n </StyledLink>\n </Popover.Trigger>\n <Popover.Content onPointerDownOutside={handleClose}>\n <Flex padding={4} direction=\"column\" gap={4}>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.text',\n defaultMessage: 'Text',\n })}\n </Field.Label>\n <Field.Input\n name=\"text\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.text.placeholder',\n defaultMessage: 'Enter link text',\n })}\n value={linkText}\n onChange={(e) => {\n setLinkText(e.target.value);\n }}\n />\n </Flex>\n </Field.Root>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.link',\n defaultMessage: 'Link',\n })}\n </Field.Label>\n <Field.Input\n ref={linkInputRef}\n name=\"url\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.link.placeholder',\n defaultMessage: 'Paste link',\n })}\n value={linkUrl}\n onChange={onLinkChange}\n />\n </Flex>\n </Field.Root>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.link.rel',\n defaultMessage: 'Rel (optional)',\n })}\n </Field.Label>\n <Field.Input\n name=\"rel\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.link.rel.placeholder',\n defaultMessage: 'noopener, nofollow, noreferrer',\n })}\n value={linkRel}\n onChange={onLinkRelChange}\n />\n </Flex>\n </Field.Root>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.link.target',\n defaultMessage: 'Target (optional)',\n })}\n </Field.Label>\n <Field.Input\n name=\"target\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.link.target.placeholder',\n defaultMessage: '_blank, _self, _parent, _top',\n })}\n value={linkTarget}\n onChange={onLinkTargetChange}\n />\n </Flex>\n </Field.Root>\n <Flex justifyContent=\"space-between\" width={{ initial: '100%', medium: '368px' }}>\n <RemoveButton\n variant=\"danger-light\"\n onClick={() => removeLink(editor)}\n $visible={isLastInsertedLink}\n >\n {formatMessage({\n id: 'components.Blocks.popover.remove',\n defaultMessage: 'Remove',\n })}\n </RemoveButton>\n <Flex gap={2}>\n <Button variant=\"tertiary\" onClick={handleClose}>\n {formatMessage({\n id: 'global.cancel',\n defaultMessage: 'Cancel',\n })}\n </Button>\n <Button disabled={Boolean(inputNotDirty) || isSaveDisabled} onClick={handleSave}>\n {formatMessage({\n id: 'global.save',\n defaultMessage: 'Save',\n })}\n </Button>\n </Flex>\n </Flex>\n </Flex>\n </Popover.Content>\n </Popover.Root>\n );\n }\n);\n\nconst Link = React.forwardRef<HTMLAnchorElement, RenderElementProps>((props, forwardedRef) => {\n if (!isLinkNode(props.element)) {\n return null;\n }\n\n // LinkContent uses React hooks that rely on props.element being a link. If the type guard above\n // doesn't pass, those hooks would be called conditionnally, which is not allowed.\n // Hence the need for a separate component.\n return <LinkContent {...props} link={props.element} ref={forwardedRef} />;\n});\n\nconst withLinks = (editor: Editor) => {\n const { isInline, apply, insertText, insertData } = editor;\n\n // Links are inline elements, so we need to override the isInline method for slate\n editor.isInline = (element) => {\n return element.type === 'link' ? true : isInline(element);\n };\n\n // We keep a track of the last inserted link path\n // So we can show the popover on the link component if that link is the last one inserted\n editor.lastInsertedLinkPath = null;\n\n // We intercept the apply method, so everytime we insert a new link, we save its path\n editor.apply = (operation) => {\n if (operation.type === 'insert_node') {\n if (\n !Editor.isEditor(operation.node) &&\n operation.node.type === 'link' &&\n editor.shouldSaveLinkPath\n ) {\n editor.lastInsertedLinkPath = operation.path;\n }\n } else if (operation.type === 'move_node') {\n // We need to update the last inserted link path when link is moved\n // If link is the first word in the paragraph we dont need to update the path\n if (\n Path.hasPrevious(operation.path) &&\n editor.lastInsertedLinkPath &&\n editor.shouldSaveLinkPath\n ) {\n editor.lastInsertedLinkPath = Path.transform(editor.lastInsertedLinkPath, operation);\n }\n }\n\n apply(operation);\n };\n\n editor.insertText = (text) => {\n // When selection is at the end of a link and user types a space, we want to break the link\n if (editor.selection && Range.isCollapsed(editor.selection) && text === ' ') {\n const linksInSelection = Array.from(\n Editor.nodes(editor, {\n at: editor.selection,\n match: (node) => !Editor.isEditor(node) && node.type === 'link',\n })\n );\n\n const selectionIsInLink = editor.selection && linksInSelection.length > 0;\n const selectionIsAtEndOfLink =\n selectionIsInLink &&\n Point.equals(editor.selection.anchor, Editor.end(editor, linksInSelection[0][1]));\n\n if (selectionIsAtEndOfLink) {\n Transforms.insertNodes(\n editor,\n { text: ' ', type: 'text' },\n { at: Path.next(linksInSelection[0][1]), select: true }\n );\n\n return;\n }\n }\n\n insertText(text);\n };\n\n // Add data as a clickable link if its a valid URL\n editor.insertData = (data) => {\n const pastedText = data.getData('text/plain');\n\n if (pastedText) {\n try {\n // eslint-disable-next-line no-new\n new URL(pastedText);\n // Do not show link popup on copy-paste a link, so do not save its path\n editor.shouldSaveLinkPath = false;\n insertLink(editor, { url: pastedText });\n return;\n } catch {\n // continue normal data insertion\n }\n }\n\n insertData(data);\n };\n\n return editor;\n};\n\nconst linkBlocks: Pick<BlocksStore, 'link'> = {\n link: {\n renderElement: (props) => (\n <Link element={props.element} attributes={props.attributes}>\n {props.children}\n </Link>\n ),\n // No handleConvert here, links are created via the link button in the toolbar\n matchNode: (node) => node.type === 'link',\n isInBlocksSelector: false,\n plugin: withLinks,\n isDraggable: () => false,\n },\n};\n\nexport interface LinkEditor extends BaseEditor {\n lastInsertedLinkPath: Path | null;\n shouldSaveLinkPath: boolean;\n}\n\nexport { linkBlocks, insertLink };\n"],"names":["isLinkNode","element","type","removeLink","editor","Transforms","unwrapNodes","match","node","Editor","isEditor","SlateElement","isElement","insertLink","url","selection","linkNodes","Array","from","nodes","at","forEach","path","Range","isCollapsed","link","children","text","rel","target","insertNodes","wrapNodes","split","editLink","linkEntry","above","linkPath","setNodes","string","linkNodeChildrens","Node","reverse","childPath","removeNodes","concat","StyledLink","styled","Box","RemoveButton","Button","props","$visible","LinkContent","React","forwardRef","attributes","forwardedRef","formatMessage","useIntl","useBlocksEditorContext","ReactEditor","findPath","popoverOpen","setPopoverOpen","useState","lastInsertedLinkPath","Path","equals","elementText","map","child","join","linkText","setLinkText","linkUrl","setLinkUrl","linkRel","setLinRel","linkTarget","setLinkTarget","linkInputRef","useRef","isLastInsertedLink","isSaveDisabled","setIsSaveDisabled","onLinkChange","e","value","URL","startsWith","onLinkRelChange","onLinkTargetChange","handleSave","stopPropagation","parentPath","parent","focus","select","handleClose","useEffect","current","inputNotDirty","_jsxs","Popover","Root","open","_jsx","Trigger","ref","tag","href","onClick","color","Content","onPointerDownOutside","Flex","padding","direction","gap","Field","width","initial","medium","alignItems","Label","id","defaultMessage","Input","name","placeholder","onChange","justifyContent","variant","disabled","Boolean","Link","withLinks","isInline","apply","insertText","insertData","operation","shouldSaveLinkPath","hasPrevious","transform","linksInSelection","selectionIsInLink","length","selectionIsAtEndOfLink","Point","anchor","end","next","data","pastedText","getData","linkBlocks","renderElement","matchNode","isInBlocksSelector","plugin","isDraggable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAMA,aAAa,CAACC,OAAAA,GAAAA;IAClB,OAAOA,OAAAA,CAAQC,IAAI,KAAK,MAAA;AAC1B,CAAA;AAEA,MAAMC,aAAa,CAACC,MAAAA,GAAAA;IAClBC,gBAAAA,CAAWC,WAAW,CAACF,MAAAA,EAAQ;AAC7BG,QAAAA,KAAAA,EAAO,CAACC,IAAAA,GAAS,CAACC,YAAAA,CAAOC,QAAQ,CAACF,IAAAA,CAAAA,IAASG,aAAAA,CAAaC,SAAS,CAACJ,IAAAA,CAAAA,IAASA,IAAAA,CAAKN,IAAI,KAAK;AAC3F,KAAA,CAAA;AACF,CAAA;AAEA,MAAMW,UAAAA,GAAa,CAACT,MAAAA,EAAgB,EAAEU,GAAG,EAAmB,GAAA;IAC1D,IAAIV,MAAAA,CAAOW,SAAS,EAAE;;AAEpB,QAAA,MAAMC,Y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O,CAAC,YAAA,CAAA;AAEhC,QAAA,IAAID,UAAAA,EAAY;YACd,IAAI;;AAEF,gBAAA,IAAIlE,GAAAA,CAAIkE,UAAAA,CAAAA;;AAERtJ,gBAAAA,MAAAA,CAAO0I,kBAAkB,GAAG,KAAA;AAC5BjI,gBAAAA,UAAAA,CAAWT,MAAAA,EAAQ;oBAAEU,GAAAA,EAAK4I;AAAW,iBAAA,CAAA;AACrC,gBAAA;AACF,YAAA,CAAA,CAAE,OAAM;;AAER,YAAA;AACF,QAAA;QAEAd,UAAAA,CAAWa,IAAAA,CAAAA;AACb,IAAA,CAAA;IAEA,OAAOrJ,MAAAA;AACT,CAAA;AAEA,MAAMwJ,UAAAA,GAAwC;IAC5CnI,IAAAA,EAAM;QACJoI,aAAAA,EAAe,CAAC3G,sBACdwD,cAAA,CAAC6B,IAAAA,EAAAA;AAAKtI,gBAAAA,OAAAA,EAASiD,MAAMjD,OAAO;AAAEsD,gBAAAA,UAAAA,EAAYL,MAAMK,UAAU;AACvDL,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMxB;;;AAIXoI,QAAAA,SAAAA,EAAW,CAACtJ,IAAAA,GAASA,IAAAA,CAAKN,IAAI,KAAK,MAAA;QACnC6J,kBAAAA,EAAoB,KAAA;QACpBC,MAAAA,EAAQxB,SAAAA;AACRyB,QAAAA,WAAAA,EAAa,IAAM;AACrB;AACF;;;;;"}
@@ -114,7 +114,7 @@ const LinkContent = /*#__PURE__*/ React.forwardRef(({ link, children, attributes
114
114
  try {
115
115
  // eslint-disable-next-line no-new
116
116
  new URL(e.target.value?.startsWith('/') ? `https://strapi.io${e.target.value}` : e.target.value);
117
- } catch (error) {
117
+ } catch {
118
118
  setIsSaveDisabled(true);
119
119
  }
120
120
  };
@@ -412,7 +412,7 @@ const withLinks = (editor)=>{
412
412
  url: pastedText
413
413
  });
414
414
  return;
415
- } catch (error) {
415
+ } catch {
416
416
  // continue normal data insertion
417
417
  }
418
418
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Link.mjs","sources":["../../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, Button, Field, Flex, Popover } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport {\n BaseEditor,\n Editor,\n Element,\n Path,\n Point,\n Range,\n Transforms,\n Element as SlateElement,\n Node,\n} from 'slate';\nimport { type RenderElementProps, ReactEditor } from 'slate-react';\nimport { styled } from 'styled-components';\n\nimport { type BlocksStore, useBlocksEditorContext } from '../BlocksEditor';\nimport { type Block } from '../utils/types';\n\nimport type { Schema } from '@strapi/types';\n\nconst isLinkNode = (element: Element): element is Schema.Attribute.LinkInlineNode => {\n return element.type === 'link';\n};\n\nconst removeLink = (editor: Editor) => {\n Transforms.unwrapNodes(editor, {\n match: (node) => !Editor.isEditor(node) && SlateElement.isElement(node) && node.type === 'link',\n });\n};\n\nconst insertLink = (editor: Editor, { url }: { url: string }) => {\n if (editor.selection) {\n // We want to remove all link on the selection\n const linkNodes = Array.from(\n Editor.nodes(editor, {\n at: editor.selection,\n match: (node) => !Editor.isEditor(node) && node.type === 'link',\n })\n );\n\n linkNodes.forEach(([, path]) => {\n Transforms.unwrapNodes(editor, { at: path });\n });\n\n if (Range.isCollapsed(editor.selection)) {\n const link: Block<'link'> = {\n type: 'link',\n url: url ?? '',\n children: [{ type: 'text', text: url }],\n rel: '',\n target: '',\n };\n\n Transforms.insertNodes(editor, link);\n } else {\n Transforms.wrapNodes(editor, { type: 'link', url: url ?? '' } as Block<'link'>, {\n split: true,\n });\n }\n }\n};\n\nconst editLink = (\n editor: Editor,\n link: { url: string; text: string; rel: string; target: string }\n) => {\n const { url, text, rel, target } = link;\n\n if (!editor.selection) {\n return;\n }\n\n const linkEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'link',\n });\n\n if (linkEntry) {\n const [, linkPath] = linkEntry;\n Transforms.setNodes(editor, { url, rel, target }, { at: linkPath });\n\n // If link text is different, we remove the old text and insert the new one\n if (text !== '' && text !== Editor.string(editor, linkPath)) {\n const linkNodeChildrens = Array.from(Node.children(editor, linkPath, { reverse: true }));\n\n linkNodeChildrens.forEach(([, childPath]) => {\n Transforms.removeNodes(editor, { at: childPath });\n });\n\n Transforms.insertNodes(editor, [{ type: 'text', text }], { at: linkPath.concat(0) });\n }\n }\n};\n\nconst StyledLink = styled(Box)`\n text-decoration: none;\n`;\n\nconst RemoveButton = styled(Button)<{ $visible: boolean }>`\n visibility: ${(props) => (props.$visible ? 'visible' : 'hidden')};\n`;\n\ninterface LinkContentProps extends RenderElementProps {\n link: Block<'link'>;\n}\n\nconst LinkContent = React.forwardRef<HTMLAnchorElement, LinkContentProps>(\n ({ link, children, attributes }, forwardedRef) => {\n const { formatMessage } = useIntl();\n const { editor } = useBlocksEditorContext('Link');\n const path = ReactEditor.findPath(editor, link);\n const [popoverOpen, setPopoverOpen] = React.useState(\n editor.lastInsertedLinkPath ? Path.equals(path, editor.lastInsertedLinkPath) : false\n );\n const elementText = link.children.map((child) => child.text).join('');\n const [linkText, setLinkText] = React.useState(elementText);\n const [linkUrl, setLinkUrl] = React.useState(link.url);\n const [linkRel, setLinRel] = React.useState(link.rel);\n const [linkTarget, setLinkTarget] = React.useState(link.target);\n const linkInputRef = React.useRef<HTMLInputElement>(null);\n const isLastInsertedLink = editor.lastInsertedLinkPath\n ? !Path.equals(path, editor.lastInsertedLinkPath)\n : true;\n const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);\n\n const onLinkChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setIsSaveDisabled(false);\n setLinkUrl(e.target.value);\n\n try {\n // eslint-disable-next-line no-new\n new URL(\n e.target.value?.startsWith('/') ? `https://strapi.io${e.target.value}` : e.target.value\n );\n } catch (error) {\n setIsSaveDisabled(true);\n }\n };\n\n const onLinkRelChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setIsSaveDisabled(false);\n setLinRel(e.target.value);\n };\n\n const onLinkTargetChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setIsSaveDisabled(false);\n setLinkTarget(e.target.value);\n };\n\n const handleSave: React.FormEventHandler = (e) => {\n e.stopPropagation();\n\n // If the selection is collapsed, we select the parent node because we want all the link to be replaced)\n if (editor.selection && Range.isCollapsed(editor.selection)) {\n const [, parentPath] = Editor.parent(editor, editor.selection.focus?.path);\n Transforms.select(editor, parentPath);\n }\n\n editLink(editor, { url: linkUrl, text: linkText, rel: linkRel, target: linkTarget });\n setPopoverOpen(false);\n editor.lastInsertedLinkPath = null;\n ReactEditor.focus(editor);\n };\n\n const handleClose = () => {\n if (link.url === '') {\n removeLink(editor);\n }\n\n setPopoverOpen(false);\n ReactEditor.focus(editor);\n };\n\n React.useEffect(() => {\n // Focus on the link input element when the popover opens\n if (popoverOpen) linkInputRef.current?.focus();\n }, [popoverOpen]);\n\n const inputNotDirty =\n !linkText ||\n !linkUrl ||\n (link.url &&\n link.url === linkUrl &&\n elementText &&\n elementText === linkText &&\n link.rel === linkRel &&\n link.target === linkTarget);\n\n return (\n <Popover.Root open={popoverOpen}>\n <Popover.Trigger>\n <StyledLink\n {...attributes}\n ref={forwardedRef}\n tag=\"a\"\n href={link.url}\n rel={link.rel}\n target={link.target}\n onClick={() => setPopoverOpen(true)}\n color=\"primary600\"\n >\n {children}\n </StyledLink>\n </Popover.Trigger>\n <Popover.Content onPointerDownOutside={handleClose}>\n <Flex padding={4} direction=\"column\" gap={4}>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.text',\n defaultMessage: 'Text',\n })}\n </Field.Label>\n <Field.Input\n name=\"text\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.text.placeholder',\n defaultMessage: 'Enter link text',\n })}\n value={linkText}\n onChange={(e) => {\n setLinkText(e.target.value);\n }}\n />\n </Flex>\n </Field.Root>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.link',\n defaultMessage: 'Link',\n })}\n </Field.Label>\n <Field.Input\n ref={linkInputRef}\n name=\"url\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.link.placeholder',\n defaultMessage: 'Paste link',\n })}\n value={linkUrl}\n onChange={onLinkChange}\n />\n </Flex>\n </Field.Root>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.link.rel',\n defaultMessage: 'Rel (optional)',\n })}\n </Field.Label>\n <Field.Input\n name=\"rel\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.link.rel.placeholder',\n defaultMessage: 'noopener, nofollow, noreferrer',\n })}\n value={linkRel}\n onChange={onLinkRelChange}\n />\n </Flex>\n </Field.Root>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.link.target',\n defaultMessage: 'Target (optional)',\n })}\n </Field.Label>\n <Field.Input\n name=\"target\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.link.target.placeholder',\n defaultMessage: '_blank, _self, _parent, _top',\n })}\n value={linkTarget}\n onChange={onLinkTargetChange}\n />\n </Flex>\n </Field.Root>\n <Flex justifyContent=\"space-between\" width={{ initial: '100%', medium: '368px' }}>\n <RemoveButton\n variant=\"danger-light\"\n onClick={() => removeLink(editor)}\n $visible={isLastInsertedLink}\n >\n {formatMessage({\n id: 'components.Blocks.popover.remove',\n defaultMessage: 'Remove',\n })}\n </RemoveButton>\n <Flex gap={2}>\n <Button variant=\"tertiary\" onClick={handleClose}>\n {formatMessage({\n id: 'global.cancel',\n defaultMessage: 'Cancel',\n })}\n </Button>\n <Button disabled={Boolean(inputNotDirty) || isSaveDisabled} onClick={handleSave}>\n {formatMessage({\n id: 'global.save',\n defaultMessage: 'Save',\n })}\n </Button>\n </Flex>\n </Flex>\n </Flex>\n </Popover.Content>\n </Popover.Root>\n );\n }\n);\n\nconst Link = React.forwardRef<HTMLAnchorElement, RenderElementProps>((props, forwardedRef) => {\n if (!isLinkNode(props.element)) {\n return null;\n }\n\n // LinkContent uses React hooks that rely on props.element being a link. If the type guard above\n // doesn't pass, those hooks would be called conditionnally, which is not allowed.\n // Hence the need for a separate component.\n return <LinkContent {...props} link={props.element} ref={forwardedRef} />;\n});\n\nconst withLinks = (editor: Editor) => {\n const { isInline, apply, insertText, insertData } = editor;\n\n // Links are inline elements, so we need to override the isInline method for slate\n editor.isInline = (element) => {\n return element.type === 'link' ? true : isInline(element);\n };\n\n // We keep a track of the last inserted link path\n // So we can show the popover on the link component if that link is the last one inserted\n editor.lastInsertedLinkPath = null;\n\n // We intercept the apply method, so everytime we insert a new link, we save its path\n editor.apply = (operation) => {\n if (operation.type === 'insert_node') {\n if (\n !Editor.isEditor(operation.node) &&\n operation.node.type === 'link' &&\n editor.shouldSaveLinkPath\n ) {\n editor.lastInsertedLinkPath = operation.path;\n }\n } else if (operation.type === 'move_node') {\n // We need to update the last inserted link path when link is moved\n // If link is the first word in the paragraph we dont need to update the path\n if (\n Path.hasPrevious(operation.path) &&\n editor.lastInsertedLinkPath &&\n editor.shouldSaveLinkPath\n ) {\n editor.lastInsertedLinkPath = Path.transform(editor.lastInsertedLinkPath, operation);\n }\n }\n\n apply(operation);\n };\n\n editor.insertText = (text) => {\n // When selection is at the end of a link and user types a space, we want to break the link\n if (editor.selection && Range.isCollapsed(editor.selection) && text === ' ') {\n const linksInSelection = Array.from(\n Editor.nodes(editor, {\n at: editor.selection,\n match: (node) => !Editor.isEditor(node) && node.type === 'link',\n })\n );\n\n const selectionIsInLink = editor.selection && linksInSelection.length > 0;\n const selectionIsAtEndOfLink =\n selectionIsInLink &&\n Point.equals(editor.selection.anchor, Editor.end(editor, linksInSelection[0][1]));\n\n if (selectionIsAtEndOfLink) {\n Transforms.insertNodes(\n editor,\n { text: ' ', type: 'text' },\n { at: Path.next(linksInSelection[0][1]), select: true }\n );\n\n return;\n }\n }\n\n insertText(text);\n };\n\n // Add data as a clickable link if its a valid URL\n editor.insertData = (data) => {\n const pastedText = data.getData('text/plain');\n\n if (pastedText) {\n try {\n // eslint-disable-next-line no-new\n new URL(pastedText);\n // Do not show link popup on copy-paste a link, so do not save its path\n editor.shouldSaveLinkPath = false;\n insertLink(editor, { url: pastedText });\n return;\n } catch (error) {\n // continue normal data insertion\n }\n }\n\n insertData(data);\n };\n\n return editor;\n};\n\nconst linkBlocks: Pick<BlocksStore, 'link'> = {\n link: {\n renderElement: (props) => (\n <Link element={props.element} attributes={props.attributes}>\n {props.children}\n </Link>\n ),\n // No handleConvert here, links are created via the link button in the toolbar\n matchNode: (node) => node.type === 'link',\n isInBlocksSelector: false,\n plugin: withLinks,\n isDraggable: () => false,\n },\n};\n\nexport interface LinkEditor extends BaseEditor {\n lastInsertedLinkPath: Path | null;\n shouldSaveLinkPath: boolean;\n}\n\nexport { linkBlocks, insertLink };\n"],"names":["isLinkNode","element","type","removeLink","editor","Transforms","unwrapNodes","match","node","Editor","isEditor","SlateElement","isElement","insertLink","url","selection","linkNodes","Array","from","nodes","at","forEach","path","Range","isCollapsed","link","children","text","rel","target","insertNodes","wrapNodes","split","editLink","linkEntry","above","linkPath","setNodes","string","linkNodeChildrens","Node","reverse","childPath","removeNodes","concat","StyledLink","styled","Box","RemoveButton","Button","props","$visible","LinkContent","React","forwardRef","attributes","forwardedRef","formatMessage","useIntl","useBlocksEditorContext","ReactEditor","findPath","popoverOpen","setPopoverOpen","useState","lastInsertedLinkPath","Path","equals","elementText","map","child","join","linkText","setLinkText","linkUrl","setLinkUrl","linkRel","setLinRel","linkTarget","setLinkTarget","linkInputRef","useRef","isLastInsertedLink","isSaveDisabled","setIsSaveDisabled","onLinkChange","e","value","URL","startsWith","error","onLinkRelChange","onLinkTargetChange","handleSave","stopPropagation","parentPath","parent","focus","select","handleClose","useEffect","current","inputNotDirty","_jsxs","Popover","Root","open","_jsx","Trigger","ref","tag","href","onClick","color","Content","onPointerDownOutside","Flex","padding","direction","gap","Field","width","initial","medium","alignItems","Label","id","defaultMessage","Input","name","placeholder","onChange","justifyContent","variant","disabled","Boolean","Link","withLinks","isInline","apply","insertText","insertData","operation","shouldSaveLinkPath","hasPrevious","transform","linksInSelection","selectionIsInLink","length","selectionIsAtEndOfLink","Point","anchor","end","next","data","pastedText","getData","linkBlocks","renderElement","matchNode","isInBlocksSelector","plugin","isDraggable"],"mappings":";;;;;;;;;AAuBA,MAAMA,aAAa,CAACC,OAAAA,GAAAA;IAClB,OAAOA,OAAAA,CAAQC,IAAI,KAAK,MAAA;AAC1B,CAAA;AAEA,MAAMC,aAAa,CAACC,MAAAA,GAAAA;IAClBC,UAAAA,CAAWC,WAAW,CAACF,MAAAA,EAAQ;AAC7BG,QAAAA,KAAAA,EAAO,CAACC,IAAAA,GAAS,CAACC,MAAAA,CAAOC,QAAQ,CAACF,IAAAA,CAAAA,IAASG,OAAAA,CAAaC,SAAS,CAACJ,IAAAA,CAAAA,IAASA,IAAAA,CAAKN,IAAI,KAAK;AAC3F,KAAA,CAAA;AACF,CAAA;AAEA,MAAMW,UAAAA,GAAa,CAACT,MAAAA,EAAgB,EAAEU,GAAG,EAAmB,GAAA;IAC1D,IAAIV,MAAAA,CAAOW,SAAS,EAAE;;AAEpB,QAAA,MAAMC,YAAYC,KAAAA,CAAMC,IAAI,CAC1BT,MAAAA,CAAOU,KAAK,CAACf,MAAAA,EAAQ;AACnBgB,YAAAA,EAAAA,EAAIhB,OAAOW,SAAS;YACpBR,KAAAA,EAAO,CAACC,OAAS,CAACC,MAAAA,CAAOC,QAAQ,CAACF,IAAAA,CAAAA,IAASA,IAAAA,CAAKN,IAAI,KAAK;AAC3D,SAAA,CAAA,CAAA;AAGFc,QAAAA,SAAAA,CAAUK,OAAO,CAAC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A;QAEAmD,UAAAA,CAAWa,IAAAA,CAAAA;AACb,IAAA,CAAA;IAEA,OAAOtJ,MAAAA;AACT,CAAA;AAEA,MAAMyJ,UAAAA,GAAwC;IAC5CpI,IAAAA,EAAM;QACJqI,aAAAA,EAAe,CAAC5G,sBACdyD,GAAA,CAAC6B,IAAAA,EAAAA;AAAKvI,gBAAAA,OAAAA,EAASiD,MAAMjD,OAAO;AAAEsD,gBAAAA,UAAAA,EAAYL,MAAMK,UAAU;AACvDL,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMxB;;;AAIXqI,QAAAA,SAAAA,EAAW,CAACvJ,IAAAA,GAASA,IAAAA,CAAKN,IAAI,KAAK,MAAA;QACnC8J,kBAAAA,EAAoB,KAAA;QACpBC,MAAAA,EAAQxB,SAAAA;AACRyB,QAAAA,WAAAA,EAAa,IAAM;AACrB;AACF;;;;"}
1
+ {"version":3,"file":"Link.mjs","sources":["../../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, Button, Field, Flex, Popover } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport {\n BaseEditor,\n Editor,\n Element,\n Path,\n Point,\n Range,\n Transforms,\n Element as SlateElement,\n Node,\n} from 'slate';\nimport { type RenderElementProps, ReactEditor } from 'slate-react';\nimport { styled } from 'styled-components';\n\nimport { type BlocksStore, useBlocksEditorContext } from '../BlocksEditor';\nimport { type Block } from '../utils/types';\n\nimport type { Schema } from '@strapi/types';\n\nconst isLinkNode = (element: Element): element is Schema.Attribute.LinkInlineNode => {\n return element.type === 'link';\n};\n\nconst removeLink = (editor: Editor) => {\n Transforms.unwrapNodes(editor, {\n match: (node) => !Editor.isEditor(node) && SlateElement.isElement(node) && node.type === 'link',\n });\n};\n\nconst insertLink = (editor: Editor, { url }: { url: string }) => {\n if (editor.selection) {\n // We want to remove all link on the selection\n const linkNodes = Array.from(\n Editor.nodes(editor, {\n at: editor.selection,\n match: (node) => !Editor.isEditor(node) && node.type === 'link',\n })\n );\n\n linkNodes.forEach(([, path]) => {\n Transforms.unwrapNodes(editor, { at: path });\n });\n\n if (Range.isCollapsed(editor.selection)) {\n const link: Block<'link'> = {\n type: 'link',\n url: url ?? '',\n children: [{ type: 'text', text: url }],\n rel: '',\n target: '',\n };\n\n Transforms.insertNodes(editor, link);\n } else {\n Transforms.wrapNodes(editor, { type: 'link', url: url ?? '' } as Block<'link'>, {\n split: true,\n });\n }\n }\n};\n\nconst editLink = (\n editor: Editor,\n link: { url: string; text: string; rel: string; target: string }\n) => {\n const { url, text, rel, target } = link;\n\n if (!editor.selection) {\n return;\n }\n\n const linkEntry = Editor.above(editor, {\n match: (node) => !Editor.isEditor(node) && node.type === 'link',\n });\n\n if (linkEntry) {\n const [, linkPath] = linkEntry;\n Transforms.setNodes(editor, { url, rel, target }, { at: linkPath });\n\n // If link text is different, we remove the old text and insert the new one\n if (text !== '' && text !== Editor.string(editor, linkPath)) {\n const linkNodeChildrens = Array.from(Node.children(editor, linkPath, { reverse: true }));\n\n linkNodeChildrens.forEach(([, childPath]) => {\n Transforms.removeNodes(editor, { at: childPath });\n });\n\n Transforms.insertNodes(editor, [{ type: 'text', text }], { at: linkPath.concat(0) });\n }\n }\n};\n\nconst StyledLink = styled(Box)`\n text-decoration: none;\n`;\n\nconst RemoveButton = styled(Button)<{ $visible: boolean }>`\n visibility: ${(props) => (props.$visible ? 'visible' : 'hidden')};\n`;\n\ninterface LinkContentProps extends RenderElementProps {\n link: Block<'link'>;\n}\n\nconst LinkContent = React.forwardRef<HTMLAnchorElement, LinkContentProps>(\n ({ link, children, attributes }, forwardedRef) => {\n const { formatMessage } = useIntl();\n const { editor } = useBlocksEditorContext('Link');\n const path = ReactEditor.findPath(editor, link);\n const [popoverOpen, setPopoverOpen] = React.useState(\n editor.lastInsertedLinkPath ? Path.equals(path, editor.lastInsertedLinkPath) : false\n );\n const elementText = link.children.map((child) => child.text).join('');\n const [linkText, setLinkText] = React.useState(elementText);\n const [linkUrl, setLinkUrl] = React.useState(link.url);\n const [linkRel, setLinRel] = React.useState(link.rel);\n const [linkTarget, setLinkTarget] = React.useState(link.target);\n const linkInputRef = React.useRef<HTMLInputElement>(null);\n const isLastInsertedLink = editor.lastInsertedLinkPath\n ? !Path.equals(path, editor.lastInsertedLinkPath)\n : true;\n const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);\n\n const onLinkChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setIsSaveDisabled(false);\n setLinkUrl(e.target.value);\n\n try {\n // eslint-disable-next-line no-new\n new URL(\n e.target.value?.startsWith('/') ? `https://strapi.io${e.target.value}` : e.target.value\n );\n } catch {\n setIsSaveDisabled(true);\n }\n };\n\n const onLinkRelChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setIsSaveDisabled(false);\n setLinRel(e.target.value);\n };\n\n const onLinkTargetChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setIsSaveDisabled(false);\n setLinkTarget(e.target.value);\n };\n\n const handleSave: React.FormEventHandler = (e) => {\n e.stopPropagation();\n\n // If the selection is collapsed, we select the parent node because we want all the link to be replaced)\n if (editor.selection && Range.isCollapsed(editor.selection)) {\n const [, parentPath] = Editor.parent(editor, editor.selection.focus?.path);\n Transforms.select(editor, parentPath);\n }\n\n editLink(editor, { url: linkUrl, text: linkText, rel: linkRel, target: linkTarget });\n setPopoverOpen(false);\n editor.lastInsertedLinkPath = null;\n ReactEditor.focus(editor);\n };\n\n const handleClose = () => {\n if (link.url === '') {\n removeLink(editor);\n }\n\n setPopoverOpen(false);\n ReactEditor.focus(editor);\n };\n\n React.useEffect(() => {\n // Focus on the link input element when the popover opens\n if (popoverOpen) linkInputRef.current?.focus();\n }, [popoverOpen]);\n\n const inputNotDirty =\n !linkText ||\n !linkUrl ||\n (link.url &&\n link.url === linkUrl &&\n elementText &&\n elementText === linkText &&\n link.rel === linkRel &&\n link.target === linkTarget);\n\n return (\n <Popover.Root open={popoverOpen}>\n <Popover.Trigger>\n <StyledLink\n {...attributes}\n ref={forwardedRef}\n tag=\"a\"\n href={link.url}\n rel={link.rel}\n target={link.target}\n onClick={() => setPopoverOpen(true)}\n color=\"primary600\"\n >\n {children}\n </StyledLink>\n </Popover.Trigger>\n <Popover.Content onPointerDownOutside={handleClose}>\n <Flex padding={4} direction=\"column\" gap={4}>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.text',\n defaultMessage: 'Text',\n })}\n </Field.Label>\n <Field.Input\n name=\"text\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.text.placeholder',\n defaultMessage: 'Enter link text',\n })}\n value={linkText}\n onChange={(e) => {\n setLinkText(e.target.value);\n }}\n />\n </Flex>\n </Field.Root>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.link',\n defaultMessage: 'Link',\n })}\n </Field.Label>\n <Field.Input\n ref={linkInputRef}\n name=\"url\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.link.placeholder',\n defaultMessage: 'Paste link',\n })}\n value={linkUrl}\n onChange={onLinkChange}\n />\n </Flex>\n </Field.Root>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.link.rel',\n defaultMessage: 'Rel (optional)',\n })}\n </Field.Label>\n <Field.Input\n name=\"rel\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.link.rel.placeholder',\n defaultMessage: 'noopener, nofollow, noreferrer',\n })}\n value={linkRel}\n onChange={onLinkRelChange}\n />\n </Flex>\n </Field.Root>\n <Field.Root width={{ initial: '100%', medium: '368px' }}>\n <Flex direction=\"column\" gap={1} alignItems=\"stretch\">\n <Field.Label>\n {formatMessage({\n id: 'components.Blocks.popover.link.target',\n defaultMessage: 'Target (optional)',\n })}\n </Field.Label>\n <Field.Input\n name=\"target\"\n placeholder={formatMessage({\n id: 'components.Blocks.popover.link.target.placeholder',\n defaultMessage: '_blank, _self, _parent, _top',\n })}\n value={linkTarget}\n onChange={onLinkTargetChange}\n />\n </Flex>\n </Field.Root>\n <Flex justifyContent=\"space-between\" width={{ initial: '100%', medium: '368px' }}>\n <RemoveButton\n variant=\"danger-light\"\n onClick={() => removeLink(editor)}\n $visible={isLastInsertedLink}\n >\n {formatMessage({\n id: 'components.Blocks.popover.remove',\n defaultMessage: 'Remove',\n })}\n </RemoveButton>\n <Flex gap={2}>\n <Button variant=\"tertiary\" onClick={handleClose}>\n {formatMessage({\n id: 'global.cancel',\n defaultMessage: 'Cancel',\n })}\n </Button>\n <Button disabled={Boolean(inputNotDirty) || isSaveDisabled} onClick={handleSave}>\n {formatMessage({\n id: 'global.save',\n defaultMessage: 'Save',\n })}\n </Button>\n </Flex>\n </Flex>\n </Flex>\n </Popover.Content>\n </Popover.Root>\n );\n }\n);\n\nconst Link = React.forwardRef<HTMLAnchorElement, RenderElementProps>((props, forwardedRef) => {\n if (!isLinkNode(props.element)) {\n return null;\n }\n\n // LinkContent uses React hooks that rely on props.element being a link. If the type guard above\n // doesn't pass, those hooks would be called conditionnally, which is not allowed.\n // Hence the need for a separate component.\n return <LinkContent {...props} link={props.element} ref={forwardedRef} />;\n});\n\nconst withLinks = (editor: Editor) => {\n const { isInline, apply, insertText, insertData } = editor;\n\n // Links are inline elements, so we need to override the isInline method for slate\n editor.isInline = (element) => {\n return element.type === 'link' ? true : isInline(element);\n };\n\n // We keep a track of the last inserted link path\n // So we can show the popover on the link component if that link is the last one inserted\n editor.lastInsertedLinkPath = null;\n\n // We intercept the apply method, so everytime we insert a new link, we save its path\n editor.apply = (operation) => {\n if (operation.type === 'insert_node') {\n if (\n !Editor.isEditor(operation.node) &&\n operation.node.type === 'link' &&\n editor.shouldSaveLinkPath\n ) {\n editor.lastInsertedLinkPath = operation.path;\n }\n } else if (operation.type === 'move_node') {\n // We need to update the last inserted link path when link is moved\n // If link is the first word in the paragraph we dont need to update the path\n if (\n Path.hasPrevious(operation.path) &&\n editor.lastInsertedLinkPath &&\n editor.shouldSaveLinkPath\n ) {\n editor.lastInsertedLinkPath = Path.transform(editor.lastInsertedLinkPath, operation);\n }\n }\n\n apply(operation);\n };\n\n editor.insertText = (text) => {\n // When selection is at the end of a link and user types a space, we want to break the link\n if (editor.selection && Range.isCollapsed(editor.selection) && text === ' ') {\n const linksInSelection = Array.from(\n Editor.nodes(editor, {\n at: editor.selection,\n match: (node) => !Editor.isEditor(node) && node.type === 'link',\n })\n );\n\n const selectionIsInLink = editor.selection && linksInSelection.length > 0;\n const selectionIsAtEndOfLink =\n selectionIsInLink &&\n Point.equals(editor.selection.anchor, Editor.end(editor, linksInSelection[0][1]));\n\n if (selectionIsAtEndOfLink) {\n Transforms.insertNodes(\n editor,\n { text: ' ', type: 'text' },\n { at: Path.next(linksInSelection[0][1]), select: true }\n );\n\n return;\n }\n }\n\n insertText(text);\n };\n\n // Add data as a clickable link if its a valid URL\n editor.insertData = (data) => {\n const pastedText = data.getData('text/plain');\n\n if (pastedText) {\n try {\n // eslint-disable-next-line no-new\n new URL(pastedText);\n // Do not show link popup on copy-paste a link, so do not save its path\n editor.shouldSaveLinkPath = false;\n insertLink(editor, { url: pastedText });\n return;\n } catch {\n // continue normal data insertion\n }\n }\n\n insertData(data);\n };\n\n return editor;\n};\n\nconst linkBlocks: Pick<BlocksStore, 'link'> = {\n link: {\n renderElement: (props) => (\n <Link element={props.element} attributes={props.attributes}>\n {props.children}\n </Link>\n ),\n // No handleConvert here, links are created via the link button in the toolbar\n matchNode: (node) => node.type === 'link',\n isInBlocksSelector: false,\n plugin: withLinks,\n isDraggable: () => false,\n },\n};\n\nexport interface LinkEditor extends BaseEditor {\n lastInsertedLinkPath: Path | null;\n shouldSaveLinkPath: boolean;\n}\n\nexport { linkBlocks, insertLink };\n"],"names":["isLinkNode","element","type","removeLink","editor","Transforms","unwrapNodes","match","node","Editor","isEditor","SlateElement","isElement","insertLink","url","selection","linkNodes","Array","from","nodes","at","forEach","path","Range","isCollapsed","link","children","text","rel","target","insertNodes","wrapNodes","split","editLink","linkEntry","above","linkPath","setNodes","string","linkNodeChildrens","Node","reverse","childPath","removeNodes","concat","StyledLink","styled","Box","RemoveButton","Button","props","$visible","LinkContent","React","forwardRef","attributes","forwardedRef","formatMessage","useIntl","useBlocksEditorContext","ReactEditor","findPath","popoverOpen","setPopoverOpen","useState","lastInsertedLinkPath","Path","equals","elementText","map","child","join","linkText","setLinkText","linkUrl","setLinkUrl","linkRel","setLinRel","linkTarget","setLinkTarget","linkInputRef","useRef","isLastInsertedLink","isSaveDisabled","setIsSaveDisabled","onLinkChange","e","value","URL","startsWith","onLinkRelChange","onLinkTargetChange","handleSave","stopPropagation","parentPath","parent","focus","select","handleClose","useEffect","current","inputNotDirty","_jsxs","Popover","Root","open","_jsx","Trigger","ref","tag","href","onClick","color","Content","onPointerDownOutside","Flex","padding","direction","gap","Field","width","initial","medium","alignItems","Label","id","defaultMessage","Input","name","placeholder","onChange","justifyContent","variant","disabled","Boolean","Link","withLinks","isInline","apply","insertText","insertData","operation","shouldSaveLinkPath","hasPrevious","transform","linksInSelection","selectionIsInLink","length","selectionIsAtEndOfLink","Point","anchor","end","next","data","pastedText","getData","linkBlocks","renderElement","matchNode","isInBlocksSelector","plugin","isDraggable"],"mappings":";;;;;;;;;AAuBA,MAAMA,aAAa,CAACC,OAAAA,GAAAA;IAClB,OAAOA,OAAAA,CAAQC,IAAI,KAAK,MAAA;AAC1B,CAAA;AAEA,MAAMC,aAAa,CAACC,MAAAA,GAAAA;IAClBC,UAAAA,CAAWC,WAAW,CAACF,MAAAA,EAAQ;AAC7BG,QAAAA,KAAAA,EAAO,CAACC,IAAAA,GAAS,CAACC,MAAAA,CAAOC,QAAQ,CAACF,IAAAA,CAAAA,IAASG,O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AACF,YAAA;AACF,QAAA;QAEA0C,UAAAA,CAAWhH,IAAAA,CAAAA;AACb,IAAA,CAAA;;IAGAvB,MAAAA,CAAOwI,UAAU,GAAG,CAACa,IAAAA,GAAAA;QACnB,MAAMC,UAAAA,GAAaD,IAAAA,CAAKE,OAAO,CAAC,YAAA,CAAA;AAEhC,QAAA,IAAID,UAAAA,EAAY;YACd,IAAI;;AAEF,gBAAA,IAAIlE,GAAAA,CAAIkE,UAAAA,CAAAA;;AAERtJ,gBAAAA,MAAAA,CAAO0I,kBAAkB,GAAG,KAAA;AAC5BjI,gBAAAA,UAAAA,CAAWT,MAAAA,EAAQ;oBAAEU,GAAAA,EAAK4I;AAAW,iBAAA,CAAA;AACrC,gBAAA;AACF,YAAA,CAAA,CAAE,OAAM;;AAER,YAAA;AACF,QAAA;QAEAd,UAAAA,CAAWa,IAAAA,CAAAA;AACb,IAAA,CAAA;IAEA,OAAOrJ,MAAAA;AACT,CAAA;AAEA,MAAMwJ,UAAAA,GAAwC;IAC5CnI,IAAAA,EAAM;QACJoI,aAAAA,EAAe,CAAC3G,sBACdwD,GAAA,CAAC6B,IAAAA,EAAAA;AAAKtI,gBAAAA,OAAAA,EAASiD,MAAMjD,OAAO;AAAEsD,gBAAAA,UAAAA,EAAYL,MAAMK,UAAU;AACvDL,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMxB;;;AAIXoI,QAAAA,SAAAA,EAAW,CAACtJ,IAAAA,GAASA,IAAAA,CAAKN,IAAI,KAAK,MAAA;QACnC6J,kBAAAA,EAAoB,KAAA;QACpBC,MAAAA,EAAQxB,SAAAA;AACRyB,QAAAA,WAAAA,EAAa,IAAM;AACrB;AACF;;;;"}
@@ -350,7 +350,7 @@ const handleShiftTabOnList = (editor)=>{
350
350
  at: remainingListPath
351
351
  });
352
352
  }
353
- } catch (error) {
353
+ } catch {
354
354
  // The path might no longer exist if the structure changed, which is fine
355
355
  }
356
356
  }
@@ -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,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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,KA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351
- } catch (error) {
351
+ } catch {
352
352
  // The path might no longer exist if the structure changed, which is fine
353
353
  }
354
354
  }