@payloadcms/richtext-lexical 3.68.0-internal-debug.2eb12b9 → 3.68.0-internal-debug.dafc24d
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.
- package/dist/cell/rscEntry.js +13 -5
- package/dist/cell/rscEntry.js.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js +29 -9
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockCollapsible.js +7 -3
- package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockEditButton.js +6 -2
- package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockRemoveButton.js +6 -2
- package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
- package/dist/features/blocks/client/component/index.js +124 -43
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/component/index.scss +188 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +7 -3
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +6 -2
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +6 -2
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +6 -2
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +118 -37
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.scss +90 -0
- package/dist/features/blocks/client/getBlockImageComponent.js +7 -3
- package/dist/features/blocks/client/getBlockImageComponent.js.map +1 -1
- package/dist/features/blocks/client/markdown/markdownTransformer.js +1 -0
- package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js +7 -3
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js +7 -3
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js +88 -27
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js +7 -3
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +13 -4
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.scss +6 -0
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +19 -6
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.scss +29 -0
- package/dist/features/blocks/premade/CodeBlock/Component/index.scss +97 -0
- package/dist/features/blocks/server/markdown/markdownTransformer.js +1 -0
- package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/Component/index.js +9 -5
- package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js +7 -3
- package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +7 -3
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js +6 -2
- package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js +6 -2
- package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/link.js +13 -5
- package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/list.js +38 -14
- package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js +18 -6
- package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/table.js +31 -11
- package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/text.js +43 -15
- package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +31 -11
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/index.js +8 -4
- package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/index.js +14 -5
- package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/style.scss +12 -0
- package/dist/features/debug/testRecorder/client/plugin/index.js +62 -21
- package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
- package/dist/features/debug/testRecorder/client/plugin/index.scss +53 -0
- package/dist/features/debug/treeView/client/plugin/index.js +8 -3
- package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
- package/dist/features/debug/treeView/client/plugin/index.scss +80 -0
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +225 -72
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.scss +87 -0
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +32 -11
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.scss +11 -0
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +21 -9
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +26 -9
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.scss +233 -0
- package/dist/features/horizontalRule/client/plugin/index.js +1 -0
- package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
- package/dist/features/horizontalRule/client/plugin/index.scss +23 -0
- package/dist/features/indent/client/IndentPlugin.js +6 -2
- package/dist/features/indent/client/IndentPlugin.js.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.js +3 -0
- package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
- package/dist/features/link/client/plugins/clickableLink/index.js +6 -2
- package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +76 -24
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js +8 -3
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.scss +92 -0
- package/dist/features/link/server/baseFields.js +1 -0
- package/dist/features/link/server/baseFields.js.map +1 -1
- package/dist/features/lists/checklist/client/plugin/index.js +6 -2
- package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
- package/dist/features/lists/plugin/index.js +6 -2
- package/dist/features/lists/plugin/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +14 -5
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +7 -3
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.scss +16 -0
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +14 -5
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +7 -3
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.scss +16 -0
- package/dist/features/relationship/client/components/RelationshipComponent.js +56 -19
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/client/components/index.scss +95 -0
- package/dist/features/relationship/client/drawer/index.js +18 -6
- package/dist/features/relationship/client/drawer/index.js.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.js +7 -3
- package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +7 -3
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/textState/feature.client.js +18 -6
- package/dist/features/textState/feature.client.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +72 -23
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.scss +113 -0
- package/dist/features/toolbars/inline/client/Toolbar/index.js +72 -23
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.scss +58 -0
- package/dist/features/toolbars/shared/ToolbarButton/index.js +8 -3
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.scss +46 -0
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +60 -20
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +37 -12
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.scss +129 -0
- package/dist/features/upload/client/component/index.js +92 -31
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/component/index.scss +191 -0
- package/dist/features/upload/client/component/pending/index.js +14 -5
- package/dist/features/upload/client/component/pending/index.js.map +1 -1
- package/dist/features/upload/client/drawer/index.js +18 -6
- package/dist/features/upload/client/drawer/index.js.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.js +12 -4
- package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/client/plugin/index.js +7 -3
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/field/Diff/converters/listitem/index.js +37 -12
- package/dist/field/Diff/converters/listitem/index.js.map +1 -1
- package/dist/field/Diff/converters/listitem/index.scss +47 -0
- package/dist/field/Diff/converters/relationship/index.js +37 -12
- package/dist/field/Diff/converters/relationship/index.js.map +1 -1
- package/dist/field/Diff/converters/relationship/index.scss +73 -0
- package/dist/field/Diff/converters/unknown/index.js +31 -10
- package/dist/field/Diff/converters/unknown/index.js.map +1 -1
- package/dist/field/Diff/converters/unknown/index.scss +40 -0
- package/dist/field/Diff/converters/upload/index.js +60 -19
- package/dist/field/Diff/converters/upload/index.js.map +1 -1
- package/dist/field/Diff/converters/upload/index.scss +115 -0
- package/dist/field/Diff/index.js +8 -3
- package/dist/field/Diff/index.js.map +1 -1
- package/dist/field/Diff/index.scss +102 -0
- package/dist/field/Field.js +81 -27
- package/dist/field/Field.js.map +1 -1
- package/dist/field/RenderLexical/index.js +36 -12
- package/dist/field/RenderLexical/index.js.map +1 -1
- package/dist/field/index.js +19 -7
- package/dist/field/index.js.map +1 -1
- package/dist/field/index.scss +41 -0
- package/dist/field/rscEntry.js +7 -3
- package/dist/field/rscEntry.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lexical/EditorPlugin.js +13 -5
- package/dist/lexical/EditorPlugin.js.map +1 -1
- package/dist/lexical/LexicalEditor.js +163 -50
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/LexicalEditor.scss +54 -0
- package/dist/lexical/LexicalProvider.js +49 -17
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js +7 -3
- package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/lexical/plugins/DecoratorPlugin/index.js +1 -0
- package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/DecoratorPlugin/index.scss +13 -0
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +20 -7
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.scss +54 -0
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -0
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +7 -3
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js +50 -16
- package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.scss +68 -0
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +20 -7
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.scss +35 -0
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +32 -11
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.scss +80 -0
- package/dist/lexical/theme/EditorTheme.scss +357 -0
- package/dist/lexical/ui/ContentEditable.js +14 -5
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.scss +105 -0
- package/dist/lexical/ui/icons/AI/index.js +37 -13
- package/dist/lexical/ui/icons/AI/index.js.map +1 -1
- package/dist/lexical/ui/icons/Add/index.js +19 -7
- package/dist/lexical/ui/icons/Add/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignCenter/index.js +25 -9
- package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignJustify/index.js +25 -9
- package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignLeft/index.js +25 -9
- package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignRight/index.js +25 -9
- package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
- package/dist/lexical/ui/icons/Block/index.js +25 -9
- package/dist/lexical/ui/icons/Block/index.js.map +1 -1
- package/dist/lexical/ui/icons/Blockquote/index.js +13 -5
- package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
- package/dist/lexical/ui/icons/Bold/index.js +13 -5
- package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
- package/dist/lexical/ui/icons/Checklist/index.js +19 -7
- package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
- package/dist/lexical/ui/icons/Code/index.js +19 -7
- package/dist/lexical/ui/icons/Code/index.js.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.js +13 -5
- package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
- package/dist/lexical/ui/icons/Collapse/index.js +13 -5
- package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
- package/dist/lexical/ui/icons/H1/index.js +13 -5
- package/dist/lexical/ui/icons/H1/index.js.map +1 -1
- package/dist/lexical/ui/icons/H2/index.js +13 -5
- package/dist/lexical/ui/icons/H2/index.js.map +1 -1
- package/dist/lexical/ui/icons/H3/index.js +13 -5
- package/dist/lexical/ui/icons/H3/index.js.map +1 -1
- package/dist/lexical/ui/icons/H4/index.js +13 -5
- package/dist/lexical/ui/icons/H4/index.js.map +1 -1
- package/dist/lexical/ui/icons/H5/index.js +13 -5
- package/dist/lexical/ui/icons/H5/index.js.map +1 -1
- package/dist/lexical/ui/icons/H6/index.js +13 -5
- package/dist/lexical/ui/icons/H6/index.js.map +1 -1
- package/dist/lexical/ui/icons/HorizontalRule/index.js +13 -5
- package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentDecrease/index.js +31 -11
- package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentIncrease/index.js +31 -11
- package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/InlineBlocks/index.js +13 -5
- package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
- package/dist/lexical/ui/icons/Italic/index.js +13 -5
- package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
- package/dist/lexical/ui/icons/Link/index.js +13 -5
- package/dist/lexical/ui/icons/Link/index.js.map +1 -1
- package/dist/lexical/ui/icons/Meatballs/index.js +25 -9
- package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
- package/dist/lexical/ui/icons/OrderedList/index.js +37 -13
- package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Relationship/index.js +37 -13
- package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
- package/dist/lexical/ui/icons/Strikethrough/index.js +19 -7
- package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
- package/dist/lexical/ui/icons/Subscript/index.js +13 -5
- package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Superscript/index.js +13 -5
- package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Table/index.js +13 -5
- package/dist/lexical/ui/icons/Table/index.js.map +1 -1
- package/dist/lexical/ui/icons/Text/index.js +13 -5
- package/dist/lexical/ui/icons/Text/index.js.map +1 -1
- package/dist/lexical/ui/icons/TextState/index.js +7 -3
- package/dist/lexical/ui/icons/TextState/index.js.map +1 -1
- package/dist/lexical/ui/icons/Underline/index.js +19 -7
- package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
- package/dist/lexical/ui/icons/UnorderedList/index.js +43 -15
- package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Upload/index.js +25 -9
- package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
- package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +2 -0
- package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +1 -1
- package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +2 -0
- package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +1 -1
- package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +2 -0
- package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/Drawer.js +19 -7
- package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +19 -7
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +7 -3
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +7 -3
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +2 -0
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +2 -0
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
- package/package.json +8 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
3
|
import React from 'react';
|
|
4
|
-
export const UnorderedListIcon = ()=>/*#__PURE__*/
|
|
4
|
+
export const UnorderedListIcon = ()=>/*#__PURE__*/ _jsxDEV("svg", {
|
|
5
5
|
"aria-hidden": "true",
|
|
6
6
|
className: "icon",
|
|
7
7
|
fill: "none",
|
|
@@ -11,46 +11,74 @@ export const UnorderedListIcon = ()=>/*#__PURE__*/ _jsxs("svg", {
|
|
|
11
11
|
width: "20",
|
|
12
12
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13
13
|
children: [
|
|
14
|
-
/*#__PURE__*/
|
|
14
|
+
/*#__PURE__*/ _jsxDEV("circle", {
|
|
15
15
|
cx: "4",
|
|
16
16
|
cy: "5",
|
|
17
17
|
fill: "currentColor",
|
|
18
18
|
r: "1.15",
|
|
19
19
|
stroke: "currentColor",
|
|
20
20
|
strokeWidth: "0.3"
|
|
21
|
-
}
|
|
22
|
-
|
|
21
|
+
}, void 0, false, {
|
|
22
|
+
fileName: "src/lexical/ui/icons/UnorderedList/index.tsx",
|
|
23
|
+
lineNumber: 15,
|
|
24
|
+
columnNumber: 5
|
|
25
|
+
}, this),
|
|
26
|
+
/*#__PURE__*/ _jsxDEV("circle", {
|
|
23
27
|
cx: "4",
|
|
24
28
|
cy: "10",
|
|
25
29
|
fill: "currentColor",
|
|
26
30
|
r: "1.15",
|
|
27
31
|
stroke: "currentColor",
|
|
28
32
|
strokeWidth: "0.3"
|
|
29
|
-
}
|
|
30
|
-
|
|
33
|
+
}, void 0, false, {
|
|
34
|
+
fileName: "src/lexical/ui/icons/UnorderedList/index.tsx",
|
|
35
|
+
lineNumber: 16,
|
|
36
|
+
columnNumber: 5
|
|
37
|
+
}, this),
|
|
38
|
+
/*#__PURE__*/ _jsxDEV("circle", {
|
|
31
39
|
cx: "4",
|
|
32
40
|
cy: "15",
|
|
33
41
|
fill: "currentColor",
|
|
34
42
|
r: "1.15",
|
|
35
43
|
stroke: "currentColor",
|
|
36
44
|
strokeWidth: "0.3"
|
|
37
|
-
}
|
|
38
|
-
|
|
45
|
+
}, void 0, false, {
|
|
46
|
+
fileName: "src/lexical/ui/icons/UnorderedList/index.tsx",
|
|
47
|
+
lineNumber: 17,
|
|
48
|
+
columnNumber: 5
|
|
49
|
+
}, this),
|
|
50
|
+
/*#__PURE__*/ _jsxDEV("path", {
|
|
39
51
|
d: "M17 5H7",
|
|
40
52
|
stroke: "currentColor",
|
|
41
53
|
strokeWidth: "1.5"
|
|
42
|
-
}
|
|
43
|
-
|
|
54
|
+
}, void 0, false, {
|
|
55
|
+
fileName: "src/lexical/ui/icons/UnorderedList/index.tsx",
|
|
56
|
+
lineNumber: 18,
|
|
57
|
+
columnNumber: 5
|
|
58
|
+
}, this),
|
|
59
|
+
/*#__PURE__*/ _jsxDEV("path", {
|
|
44
60
|
d: "M17 10H7",
|
|
45
61
|
stroke: "currentColor",
|
|
46
62
|
strokeWidth: "1.5"
|
|
47
|
-
}
|
|
48
|
-
|
|
63
|
+
}, void 0, false, {
|
|
64
|
+
fileName: "src/lexical/ui/icons/UnorderedList/index.tsx",
|
|
65
|
+
lineNumber: 19,
|
|
66
|
+
columnNumber: 5
|
|
67
|
+
}, this),
|
|
68
|
+
/*#__PURE__*/ _jsxDEV("path", {
|
|
49
69
|
d: "M17 15H7",
|
|
50
70
|
stroke: "currentColor",
|
|
51
71
|
strokeWidth: "1.5"
|
|
52
|
-
}
|
|
72
|
+
}, void 0, false, {
|
|
73
|
+
fileName: "src/lexical/ui/icons/UnorderedList/index.tsx",
|
|
74
|
+
lineNumber: 20,
|
|
75
|
+
columnNumber: 5
|
|
76
|
+
}, this)
|
|
53
77
|
]
|
|
54
|
-
}
|
|
78
|
+
}, void 0, true, {
|
|
79
|
+
fileName: "src/lexical/ui/icons/UnorderedList/index.tsx",
|
|
80
|
+
lineNumber: 5,
|
|
81
|
+
columnNumber: 3
|
|
82
|
+
}, this);
|
|
55
83
|
|
|
56
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lexical/ui/icons/UnorderedList/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nexport const UnorderedListIcon: React.FC = () => (\n <svg\n aria-hidden=\"true\"\n className=\"icon\"\n fill=\"none\"\n focusable=\"false\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n width=\"20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"4\" cy=\"5\" fill=\"currentColor\" r=\"1.15\" stroke=\"currentColor\" strokeWidth=\"0.3\" />\n <circle cx=\"4\" cy=\"10\" fill=\"currentColor\" r=\"1.15\" stroke=\"currentColor\" strokeWidth=\"0.3\" />\n <circle cx=\"4\" cy=\"15\" fill=\"currentColor\" r=\"1.15\" stroke=\"currentColor\" strokeWidth=\"0.3\" />\n <path d=\"M17 5H7\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M17 10H7\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M17 15H7\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n </svg>\n)\n"],"names":["React","UnorderedListIcon","svg","aria-hidden","className","fill","focusable","height","viewBox","width","xmlns","circle","cx","cy","r","stroke","strokeWidth","path","d"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,OAAO,MAAMC,oBAA8B,kBACzC,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lexical/ui/icons/UnorderedList/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nexport const UnorderedListIcon: React.FC = () => (\n <svg\n aria-hidden=\"true\"\n className=\"icon\"\n fill=\"none\"\n focusable=\"false\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n width=\"20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"4\" cy=\"5\" fill=\"currentColor\" r=\"1.15\" stroke=\"currentColor\" strokeWidth=\"0.3\" />\n <circle cx=\"4\" cy=\"10\" fill=\"currentColor\" r=\"1.15\" stroke=\"currentColor\" strokeWidth=\"0.3\" />\n <circle cx=\"4\" cy=\"15\" fill=\"currentColor\" r=\"1.15\" stroke=\"currentColor\" strokeWidth=\"0.3\" />\n <path d=\"M17 5H7\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M17 10H7\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M17 15H7\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n </svg>\n)\n"],"names":["React","UnorderedListIcon","svg","aria-hidden","className","fill","focusable","height","viewBox","width","xmlns","circle","cx","cy","r","stroke","strokeWidth","path","d"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,OAAO,MAAMC,oBAA8B,kBACzC,QAACC;QACCC,eAAY;QACZC,WAAU;QACVC,MAAK;QACLC,WAAU;QACVC,QAAO;QACPC,SAAQ;QACRC,OAAM;QACNC,OAAM;;0BAEN,QAACC;gBAAOC,IAAG;gBAAIC,IAAG;gBAAIR,MAAK;gBAAeS,GAAE;gBAAOC,QAAO;gBAAeC,aAAY;;;;;;0BACrF,QAACL;gBAAOC,IAAG;gBAAIC,IAAG;gBAAKR,MAAK;gBAAeS,GAAE;gBAAOC,QAAO;gBAAeC,aAAY;;;;;;0BACtF,QAACL;gBAAOC,IAAG;gBAAIC,IAAG;gBAAKR,MAAK;gBAAeS,GAAE;gBAAOC,QAAO;gBAAeC,aAAY;;;;;;0BACtF,QAACC;gBAAKC,GAAE;gBAAUH,QAAO;gBAAeC,aAAY;;;;;;0BACpD,QAACC;gBAAKC,GAAE;gBAAWH,QAAO;gBAAeC,aAAY;;;;;;0BACrD,QAACC;gBAAKC,GAAE;gBAAWH,QAAO;gBAAeC,aAAY;;;;;;;;;;;aAExD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
3
|
import React from 'react';
|
|
4
|
-
export const UploadIcon = ()=>/*#__PURE__*/
|
|
4
|
+
export const UploadIcon = ()=>/*#__PURE__*/ _jsxDEV("svg", {
|
|
5
5
|
"aria-hidden": "true",
|
|
6
6
|
className: "icon",
|
|
7
7
|
fill: "none",
|
|
@@ -11,25 +11,41 @@ export const UploadIcon = ()=>/*#__PURE__*/ _jsxs("svg", {
|
|
|
11
11
|
width: "20",
|
|
12
12
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13
13
|
children: [
|
|
14
|
-
/*#__PURE__*/
|
|
14
|
+
/*#__PURE__*/ _jsxDEV("path", {
|
|
15
15
|
d: "M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",
|
|
16
16
|
stroke: "currentColor",
|
|
17
17
|
strokeLinecap: "round",
|
|
18
18
|
strokeLinejoin: "round"
|
|
19
|
-
}
|
|
20
|
-
|
|
19
|
+
}, void 0, false, {
|
|
20
|
+
fileName: "src/lexical/ui/icons/Upload/index.tsx",
|
|
21
|
+
lineNumber: 15,
|
|
22
|
+
columnNumber: 5
|
|
23
|
+
}, this),
|
|
24
|
+
/*#__PURE__*/ _jsxDEV("path", {
|
|
21
25
|
d: "M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",
|
|
22
26
|
stroke: "currentColor",
|
|
23
27
|
strokeLinecap: "round",
|
|
24
28
|
strokeLinejoin: "round"
|
|
25
|
-
}
|
|
26
|
-
|
|
29
|
+
}, void 0, false, {
|
|
30
|
+
fileName: "src/lexical/ui/icons/Upload/index.tsx",
|
|
31
|
+
lineNumber: 21,
|
|
32
|
+
columnNumber: 5
|
|
33
|
+
}, this),
|
|
34
|
+
/*#__PURE__*/ _jsxDEV("path", {
|
|
27
35
|
d: "M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",
|
|
28
36
|
stroke: "currentColor",
|
|
29
37
|
strokeLinecap: "round",
|
|
30
38
|
strokeLinejoin: "round"
|
|
31
|
-
}
|
|
39
|
+
}, void 0, false, {
|
|
40
|
+
fileName: "src/lexical/ui/icons/Upload/index.tsx",
|
|
41
|
+
lineNumber: 27,
|
|
42
|
+
columnNumber: 5
|
|
43
|
+
}, this)
|
|
32
44
|
]
|
|
33
|
-
}
|
|
45
|
+
}, void 0, true, {
|
|
46
|
+
fileName: "src/lexical/ui/icons/Upload/index.tsx",
|
|
47
|
+
lineNumber: 5,
|
|
48
|
+
columnNumber: 3
|
|
49
|
+
}, this);
|
|
34
50
|
|
|
35
51
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lexical/ui/icons/Upload/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nexport const UploadIcon: React.FC = () => (\n <svg\n aria-hidden=\"true\"\n className=\"icon\"\n fill=\"none\"\n focusable=\"false\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n width=\"20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n)\n"],"names":["React","UploadIcon","svg","aria-hidden","className","fill","focusable","height","viewBox","width","xmlns","path","d","stroke","strokeLinecap","strokeLinejoin"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,OAAO,MAAMC,aAAuB,kBAClC,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lexical/ui/icons/Upload/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nexport const UploadIcon: React.FC = () => (\n <svg\n aria-hidden=\"true\"\n className=\"icon\"\n fill=\"none\"\n focusable=\"false\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n width=\"20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n)\n"],"names":["React","UploadIcon","svg","aria-hidden","className","fill","focusable","height","viewBox","width","xmlns","path","d","stroke","strokeLinecap","strokeLinejoin"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,OAAO,MAAMC,aAAuB,kBAClC,QAACC;QACCC,eAAY;QACZC,WAAU;QACVC,MAAK;QACLC,WAAU;QACVC,QAAO;QACPC,SAAQ;QACRC,OAAM;QACNC,OAAM;;0BAEN,QAACC;gBACCC,GAAE;gBACFC,QAAO;gBACPC,eAAc;gBACdC,gBAAe;;;;;;0BAEjB,QAACJ;gBACCC,GAAE;gBACFC,QAAO;gBACPC,eAAc;gBACdC,gBAAe;;;;;;0BAEjB,QAACJ;gBACCC,GAAE;gBACFC,QAAO;gBACPC,eAAc;gBACdC,gBAAe;;;;;;;;;;;aAGpB"}
|
|
@@ -98,8 +98,10 @@ function runTextMatchTransformers(anchorNode, anchorOffset, transformersByTrigge
|
|
|
98
98
|
const endIndex = startIndex + match[0].length;
|
|
99
99
|
let replaceNode;
|
|
100
100
|
if (startIndex === 0) {
|
|
101
|
+
;
|
|
101
102
|
[replaceNode] = anchorNode.splitText(endIndex);
|
|
102
103
|
} else {
|
|
104
|
+
;
|
|
103
105
|
[, replaceNode] = anchorNode.splitText(startIndex, endIndex);
|
|
104
106
|
}
|
|
105
107
|
if (replaceNode) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/packages/@lexical/markdown/MarkdownShortcuts.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { ElementNode, LexicalEditor, TextNode } from 'lexical'\n\nimport {\n $createRangeSelection,\n $getSelection,\n $isLineBreakNode,\n $isRangeSelection,\n $isRootOrShadowRoot,\n $isTextNode,\n $setSelection,\n} from 'lexical'\n\nimport type {\n ElementTransformer,\n MultilineElementTransformer,\n TextFormatTransformer,\n TextMatchTransformer,\n Transformer,\n} from './MarkdownTransformers.js'\n\nimport { TRANSFORMERS } from './index.js'\nimport { indexBy, PUNCTUATION_OR_SPACE, transformersByType } from './utils.js'\n\nfunction runElementTransformers(\n parentNode: ElementNode,\n anchorNode: TextNode,\n anchorOffset: number,\n elementTransformers: ReadonlyArray<ElementTransformer>,\n): boolean {\n const grandParentNode = parentNode.getParent()\n\n if (!$isRootOrShadowRoot(grandParentNode) || parentNode.getFirstChild() !== anchorNode) {\n return false\n }\n\n const textContent = anchorNode.getTextContent()\n\n // Checking for anchorOffset position to prevent any checks for cases when caret is too far\n // from a line start to be a part of block-level markdown trigger.\n //\n // TODO:\n // Can have a quick check if caret is close enough to the beginning of the string (e.g. offset less than 10-20)\n // since otherwise it won't be a markdown shortcut, but tables are exception\n if (textContent[anchorOffset - 1] !== ' ') {\n return false\n }\n\n for (const { regExp, replace } of elementTransformers) {\n const match = textContent.match(regExp)\n\n if (match && match[0].length === (match[0].endsWith(' ') ? anchorOffset : anchorOffset - 1)) {\n const nextSiblings = anchorNode.getNextSiblings()\n const [leadingNode, remainderNode] = anchorNode.splitText(anchorOffset)\n leadingNode?.remove()\n const siblings = remainderNode ? [remainderNode, ...nextSiblings] : nextSiblings\n if (replace(parentNode, siblings, match, false) !== false) {\n return true\n }\n }\n }\n\n return false\n}\n\nfunction runMultilineElementTransformers(\n parentNode: ElementNode,\n anchorNode: TextNode,\n anchorOffset: number,\n elementTransformers: ReadonlyArray<MultilineElementTransformer>,\n): boolean {\n const grandParentNode = parentNode.getParent()\n\n if (!$isRootOrShadowRoot(grandParentNode) || parentNode.getFirstChild() !== anchorNode) {\n return false\n }\n\n const textContent = anchorNode.getTextContent()\n\n // Checking for anchorOffset position to prevent any checks for cases when caret is too far\n // from a line start to be a part of block-level markdown trigger.\n //\n // TODO:\n // Can have a quick check if caret is close enough to the beginning of the string (e.g. offset less than 10-20)\n // since otherwise it won't be a markdown shortcut, but tables are exception\n if (textContent[anchorOffset - 1] !== ' ') {\n return false\n }\n\n for (const { regExpEnd, regExpStart, replace } of elementTransformers) {\n if (\n (regExpEnd && !('optional' in regExpEnd)) ||\n (regExpEnd && 'optional' in regExpEnd && !regExpEnd.optional)\n ) {\n continue\n }\n\n const match = textContent.match(regExpStart)\n\n if (match && match[0].length === (match[0].endsWith(' ') ? anchorOffset : anchorOffset - 1)) {\n const nextSiblings = anchorNode.getNextSiblings()\n const [leadingNode, remainderNode] = anchorNode.splitText(anchorOffset)\n leadingNode?.remove()\n const siblings = remainderNode ? [remainderNode, ...nextSiblings] : nextSiblings\n\n if (replace(parentNode, siblings, match, null, null, false) !== false) {\n return true\n }\n }\n }\n\n return false\n}\n\nfunction runTextMatchTransformers(\n anchorNode: TextNode,\n anchorOffset: number,\n transformersByTrigger: Readonly<Record<string, Array<TextMatchTransformer>>>,\n): boolean {\n let textContent = anchorNode.getTextContent()\n const lastChar = textContent[anchorOffset - 1]!\n const transformers = transformersByTrigger[lastChar]\n\n if (transformers == null) {\n return false\n }\n\n // If typing in the middle of content, remove the tail to do\n // reg exp match up to a string end (caret position)\n if (anchorOffset < textContent.length) {\n textContent = textContent.slice(0, anchorOffset)\n }\n\n for (const transformer of transformers) {\n if (!transformer.replace || !transformer.regExp) {\n continue\n }\n const match = textContent.match(transformer.regExp)\n\n if (match === null) {\n continue\n }\n\n const startIndex = match.index || 0\n const endIndex = startIndex + match[0].length\n let replaceNode\n\n if (startIndex === 0) {\n ;[replaceNode] = anchorNode.splitText(endIndex)\n } else {\n ;[, replaceNode] = anchorNode.splitText(startIndex, endIndex)\n }\n if (replaceNode) {\n replaceNode.selectNext(0, 0)\n transformer.replace(replaceNode, match)\n }\n return true\n }\n\n return false\n}\n\nfunction $runTextFormatTransformers(\n anchorNode: TextNode,\n anchorOffset: number,\n textFormatTransformers: Readonly<Record<string, ReadonlyArray<TextFormatTransformer>>>,\n): boolean {\n const textContent = anchorNode.getTextContent()\n const closeTagEndIndex = anchorOffset - 1\n const closeChar = textContent[closeTagEndIndex]!\n // Quick check if we're possibly at the end of inline markdown style\n const matchers = textFormatTransformers[closeChar]\n\n if (!matchers) {\n return false\n }\n\n for (const matcher of matchers) {\n const { tag } = matcher\n const tagLength = tag.length\n const closeTagStartIndex = closeTagEndIndex - tagLength + 1\n\n // If tag is not single char check if rest of it matches with text content\n if (tagLength > 1) {\n if (!isEqualSubString(textContent, closeTagStartIndex, tag, 0, tagLength)) {\n continue\n }\n }\n\n // Space before closing tag cancels inline markdown\n if (textContent[closeTagStartIndex - 1] === ' ') {\n continue\n }\n\n // Some tags can not be used within words, hence should have newline/space/punctuation after it\n const afterCloseTagChar = textContent[closeTagEndIndex + 1]\n\n if (\n matcher.intraword === false &&\n afterCloseTagChar &&\n !PUNCTUATION_OR_SPACE.test(afterCloseTagChar)\n ) {\n continue\n }\n\n const closeNode = anchorNode\n let openNode = closeNode\n let openTagStartIndex = getOpenTagStartIndex(textContent, closeTagStartIndex, tag)\n\n // Go through text node siblings and search for opening tag\n // if haven't found it within the same text node as closing tag\n let sibling: null | TextNode = openNode\n\n while (openTagStartIndex < 0 && (sibling = sibling.getPreviousSibling<TextNode>())) {\n if ($isLineBreakNode(sibling)) {\n break\n }\n\n if ($isTextNode(sibling)) {\n const siblingTextContent = sibling.getTextContent()\n openNode = sibling\n openTagStartIndex = getOpenTagStartIndex(siblingTextContent, siblingTextContent.length, tag)\n }\n }\n\n // Opening tag is not found\n if (openTagStartIndex < 0) {\n continue\n }\n\n // No content between opening and closing tag\n if (openNode === closeNode && openTagStartIndex + tagLength === closeTagStartIndex) {\n continue\n }\n\n // Checking longer tags for repeating chars (e.g. *** vs **)\n const prevOpenNodeText = openNode.getTextContent()\n\n if (openTagStartIndex > 0 && prevOpenNodeText[openTagStartIndex - 1] === closeChar) {\n continue\n }\n\n // Some tags can not be used within words, hence should have newline/space/punctuation before it\n const beforeOpenTagChar = prevOpenNodeText[openTagStartIndex - 1]\n\n if (\n matcher.intraword === false &&\n beforeOpenTagChar &&\n !PUNCTUATION_OR_SPACE.test(beforeOpenTagChar)\n ) {\n continue\n }\n\n // Clean text from opening and closing tags (starting from closing tag\n // to prevent any offset shifts if we start from opening one)\n const prevCloseNodeText = closeNode.getTextContent()\n const closeNodeText =\n prevCloseNodeText.slice(0, closeTagStartIndex) + prevCloseNodeText.slice(closeTagEndIndex + 1)\n closeNode.setTextContent(closeNodeText)\n const openNodeText = openNode === closeNode ? closeNodeText : prevOpenNodeText\n openNode.setTextContent(\n openNodeText.slice(0, openTagStartIndex) + openNodeText.slice(openTagStartIndex + tagLength),\n )\n const selection = $getSelection()\n const nextSelection = $createRangeSelection()\n $setSelection(nextSelection)\n // Adjust offset based on deleted chars\n const newOffset = closeTagEndIndex - tagLength * (openNode === closeNode ? 2 : 1) + 1\n nextSelection.anchor.set(openNode.__key, openTagStartIndex, 'text')\n nextSelection.focus.set(closeNode.__key, newOffset, 'text')\n\n // Apply formatting to selected text\n for (const format of matcher.format) {\n if (!nextSelection.hasFormat(format)) {\n nextSelection.formatText(format)\n }\n }\n\n // Collapse selection up to the focus point\n nextSelection.anchor.set(\n nextSelection.focus.key,\n nextSelection.focus.offset,\n nextSelection.focus.type,\n )\n\n // Remove formatting from collapsed selection\n for (const format of matcher.format) {\n if (nextSelection.hasFormat(format)) {\n nextSelection.toggleFormat(format)\n }\n }\n\n if ($isRangeSelection(selection)) {\n nextSelection.format = selection.format\n }\n\n return true\n }\n\n return false\n}\n\nfunction getOpenTagStartIndex(string: string, maxIndex: number, tag: string): number {\n const tagLength = tag.length\n\n for (let i = maxIndex; i >= tagLength; i--) {\n const startIndex = i - tagLength\n\n if (\n isEqualSubString(string, startIndex, tag, 0, tagLength) && // Space after opening tag cancels transformation\n string[startIndex + tagLength] !== ' '\n ) {\n return startIndex\n }\n }\n\n return -1\n}\n\nfunction isEqualSubString(\n stringA: string,\n aStart: number,\n stringB: string,\n bStart: number,\n length: number,\n): boolean {\n for (let i = 0; i < length; i++) {\n if (stringA[aStart + i] !== stringB[bStart + i]) {\n return false\n }\n }\n\n return true\n}\n\nexport function registerMarkdownShortcuts(\n editor: LexicalEditor,\n transformers: Array<Transformer> = TRANSFORMERS,\n): () => void {\n const byType = transformersByType(transformers)\n const textFormatTransformersByTrigger = indexBy(\n byType.textFormat,\n ({ tag }) => tag[tag.length - 1],\n )\n const textMatchTransformersByTrigger = indexBy(byType.textMatch, ({ trigger }) => trigger)\n\n for (const transformer of transformers) {\n const type = transformer.type\n if (type === 'element' || type === 'text-match' || type === 'multiline-element') {\n const dependencies = transformer.dependencies\n for (const node of dependencies) {\n if (!editor.hasNode(node)) {\n throw new Error(\n 'MarkdownShortcuts: missing dependency %s for transformer. Ensure node dependency is included in editor initial config.' +\n node.getType(),\n )\n }\n }\n }\n }\n\n const $transform = (parentNode: ElementNode, anchorNode: TextNode, anchorOffset: number) => {\n if (runElementTransformers(parentNode, anchorNode, anchorOffset, byType.element)) {\n return\n }\n\n if (\n runMultilineElementTransformers(parentNode, anchorNode, anchorOffset, byType.multilineElement)\n ) {\n return\n }\n\n if (runTextMatchTransformers(anchorNode, anchorOffset, textMatchTransformersByTrigger)) {\n return\n }\n\n $runTextFormatTransformers(anchorNode, anchorOffset, textFormatTransformersByTrigger)\n }\n\n return editor.registerUpdateListener(({ dirtyLeaves, editorState, prevEditorState, tags }) => {\n // Ignore updates from collaboration and undo/redo (as changes already calculated)\n if (tags.has('collaboration') || tags.has('historic')) {\n return\n }\n\n // If editor is still composing (i.e. backticks) we must wait before the user confirms the key\n if (editor.isComposing()) {\n return\n }\n\n const selection = editorState.read($getSelection)\n const prevSelection = prevEditorState.read($getSelection)\n\n // We expect selection to be a collapsed range and not match previous one (as we want\n // to trigger transforms only as user types)\n if (\n !$isRangeSelection(prevSelection) ||\n !$isRangeSelection(selection) ||\n !selection.isCollapsed() ||\n selection.is(prevSelection)\n ) {\n return\n }\n\n const anchorKey = selection.anchor.key\n const anchorOffset = selection.anchor.offset\n\n const anchorNode = editorState._nodeMap.get(anchorKey)\n\n if (\n !$isTextNode(anchorNode) ||\n !dirtyLeaves.has(anchorKey) ||\n (anchorOffset !== 1 && anchorOffset > prevSelection.anchor.offset + 1)\n ) {\n return\n }\n\n editor.update(() => {\n // Markdown is not available inside code\n if (anchorNode.hasFormat('code')) {\n return\n }\n\n const parentNode = anchorNode.getParent()\n\n if (parentNode === null) {\n return\n }\n\n $transform(parentNode, anchorNode, selection.anchor.offset)\n })\n })\n}\n"],"names":["$createRangeSelection","$getSelection","$isLineBreakNode","$isRangeSelection","$isRootOrShadowRoot","$isTextNode","$setSelection","TRANSFORMERS","indexBy","PUNCTUATION_OR_SPACE","transformersByType","runElementTransformers","parentNode","anchorNode","anchorOffset","elementTransformers","grandParentNode","getParent","getFirstChild","textContent","getTextContent","regExp","replace","match","length","endsWith","nextSiblings","getNextSiblings","leadingNode","remainderNode","splitText","remove","siblings","runMultilineElementTransformers","regExpEnd","regExpStart","optional","runTextMatchTransformers","transformersByTrigger","lastChar","transformers","slice","transformer","startIndex","index","endIndex","replaceNode","selectNext","$runTextFormatTransformers","textFormatTransformers","closeTagEndIndex","closeChar","matchers","matcher","tag","tagLength","closeTagStartIndex","isEqualSubString","afterCloseTagChar","intraword","test","closeNode","openNode","openTagStartIndex","getOpenTagStartIndex","sibling","getPreviousSibling","siblingTextContent","prevOpenNodeText","beforeOpenTagChar","prevCloseNodeText","closeNodeText","setTextContent","openNodeText","selection","nextSelection","newOffset","anchor","set","__key","focus","format","hasFormat","formatText","key","offset","type","toggleFormat","string","maxIndex","i","stringA","aStart","stringB","bStart","registerMarkdownShortcuts","editor","byType","textFormatTransformersByTrigger","textFormat","textMatchTransformersByTrigger","textMatch","trigger","dependencies","node","hasNode","Error","getType","$transform","element","multilineElement","registerUpdateListener","dirtyLeaves","editorState","prevEditorState","tags","has","isComposing","read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,cAAcsF,iCAAiC;YACtF;QACF;QAEApD,2BAA2BnC,YAAYC,cAAcoF;IACvD;IAEA,OAAOF,OAAOe,sBAAsB,CAAC,CAAC,EAAEC,WAAW,EAAEC,WAAW,EAAEC,eAAe,EAAEC,IAAI,EAAE;QACvF,kFAAkF;QAClF,IAAIA,KAAKC,GAAG,CAAC,oBAAoBD,KAAKC,GAAG,CAAC,aAAa;YACrD;QACF;QAEA,8FAA8F;QAC9F,IAAIpB,OAAOqB,WAAW,IAAI;YACxB;QACF;QAEA,MAAM3C,YAAYuC,YAAYK,IAAI,CAACrH;QACnC,MAAMsH,gBAAgBL,gBAAgBI,IAAI,CAACrH;QAE3C,qFAAqF;QACrF,4CAA4C;QAC5C,IACE,CAACE,kBAAkBoH,kBACnB,CAACpH,kBAAkBuE,cACnB,CAACA,UAAU8C,WAAW,MACtB9C,UAAU+C,EAAE,CAACF,gBACb;YACA;QACF;QAEA,MAAMG,YAAYhD,UAAUG,MAAM,CAACO,GAAG;QACtC,MAAMtE,eAAe4D,UAAUG,MAAM,CAACQ,MAAM;QAE5C,MAAMxE,aAAaoG,YAAYU,QAAQ,CAACC,GAAG,CAACF;QAE5C,IACE,CAACrH,YAAYQ,eACb,CAACmG,YAAYI,GAAG,CAACM,cAChB5G,iBAAiB,KAAKA,eAAeyG,cAAc1C,MAAM,CAACQ,MAAM,GAAG,GACpE;YACA;QACF;QAEAW,OAAO6B,MAAM,CAAC;YACZ,wCAAwC;YACxC,IAAIhH,WAAWqE,SAAS,CAAC,SAAS;gBAChC;YACF;YAEA,MAAMtE,aAAaC,WAAWI,SAAS;YAEvC,IAAIL,eAAe,MAAM;gBACvB;YACF;YAEAgG,WAAWhG,YAAYC,YAAY6D,UAAUG,MAAM,CAACQ,MAAM;QAC5D;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/packages/@lexical/markdown/MarkdownShortcuts.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { ElementNode, LexicalEditor, TextNode } from 'lexical'\n\nimport {\n $createRangeSelection,\n $getSelection,\n $isLineBreakNode,\n $isRangeSelection,\n $isRootOrShadowRoot,\n $isTextNode,\n $setSelection,\n} from 'lexical'\n\nimport type {\n ElementTransformer,\n MultilineElementTransformer,\n TextFormatTransformer,\n TextMatchTransformer,\n Transformer,\n} from './MarkdownTransformers.js'\n\nimport { TRANSFORMERS } from './index.js'\nimport { indexBy, PUNCTUATION_OR_SPACE, transformersByType } from './utils.js'\n\nfunction runElementTransformers(\n parentNode: ElementNode,\n anchorNode: TextNode,\n anchorOffset: number,\n elementTransformers: ReadonlyArray<ElementTransformer>,\n): boolean {\n const grandParentNode = parentNode.getParent()\n\n if (!$isRootOrShadowRoot(grandParentNode) || parentNode.getFirstChild() !== anchorNode) {\n return false\n }\n\n const textContent = anchorNode.getTextContent()\n\n // Checking for anchorOffset position to prevent any checks for cases when caret is too far\n // from a line start to be a part of block-level markdown trigger.\n //\n // TODO:\n // Can have a quick check if caret is close enough to the beginning of the string (e.g. offset less than 10-20)\n // since otherwise it won't be a markdown shortcut, but tables are exception\n if (textContent[anchorOffset - 1] !== ' ') {\n return false\n }\n\n for (const { regExp, replace } of elementTransformers) {\n const match = textContent.match(regExp)\n\n if (match && match[0].length === (match[0].endsWith(' ') ? anchorOffset : anchorOffset - 1)) {\n const nextSiblings = anchorNode.getNextSiblings()\n const [leadingNode, remainderNode] = anchorNode.splitText(anchorOffset)\n leadingNode?.remove()\n const siblings = remainderNode ? [remainderNode, ...nextSiblings] : nextSiblings\n if (replace(parentNode, siblings, match, false) !== false) {\n return true\n }\n }\n }\n\n return false\n}\n\nfunction runMultilineElementTransformers(\n parentNode: ElementNode,\n anchorNode: TextNode,\n anchorOffset: number,\n elementTransformers: ReadonlyArray<MultilineElementTransformer>,\n): boolean {\n const grandParentNode = parentNode.getParent()\n\n if (!$isRootOrShadowRoot(grandParentNode) || parentNode.getFirstChild() !== anchorNode) {\n return false\n }\n\n const textContent = anchorNode.getTextContent()\n\n // Checking for anchorOffset position to prevent any checks for cases when caret is too far\n // from a line start to be a part of block-level markdown trigger.\n //\n // TODO:\n // Can have a quick check if caret is close enough to the beginning of the string (e.g. offset less than 10-20)\n // since otherwise it won't be a markdown shortcut, but tables are exception\n if (textContent[anchorOffset - 1] !== ' ') {\n return false\n }\n\n for (const { regExpEnd, regExpStart, replace } of elementTransformers) {\n if (\n (regExpEnd && !('optional' in regExpEnd)) ||\n (regExpEnd && 'optional' in regExpEnd && !regExpEnd.optional)\n ) {\n continue\n }\n\n const match = textContent.match(regExpStart)\n\n if (match && match[0].length === (match[0].endsWith(' ') ? anchorOffset : anchorOffset - 1)) {\n const nextSiblings = anchorNode.getNextSiblings()\n const [leadingNode, remainderNode] = anchorNode.splitText(anchorOffset)\n leadingNode?.remove()\n const siblings = remainderNode ? [remainderNode, ...nextSiblings] : nextSiblings\n\n if (replace(parentNode, siblings, match, null, null, false) !== false) {\n return true\n }\n }\n }\n\n return false\n}\n\nfunction runTextMatchTransformers(\n anchorNode: TextNode,\n anchorOffset: number,\n transformersByTrigger: Readonly<Record<string, Array<TextMatchTransformer>>>,\n): boolean {\n let textContent = anchorNode.getTextContent()\n const lastChar = textContent[anchorOffset - 1]!\n const transformers = transformersByTrigger[lastChar]\n\n if (transformers == null) {\n return false\n }\n\n // If typing in the middle of content, remove the tail to do\n // reg exp match up to a string end (caret position)\n if (anchorOffset < textContent.length) {\n textContent = textContent.slice(0, anchorOffset)\n }\n\n for (const transformer of transformers) {\n if (!transformer.replace || !transformer.regExp) {\n continue\n }\n const match = textContent.match(transformer.regExp)\n\n if (match === null) {\n continue\n }\n\n const startIndex = match.index || 0\n const endIndex = startIndex + match[0].length\n let replaceNode\n\n if (startIndex === 0) {\n ;[replaceNode] = anchorNode.splitText(endIndex)\n } else {\n ;[, replaceNode] = anchorNode.splitText(startIndex, endIndex)\n }\n if (replaceNode) {\n replaceNode.selectNext(0, 0)\n transformer.replace(replaceNode, match)\n }\n return true\n }\n\n return false\n}\n\nfunction $runTextFormatTransformers(\n anchorNode: TextNode,\n anchorOffset: number,\n textFormatTransformers: Readonly<Record<string, ReadonlyArray<TextFormatTransformer>>>,\n): boolean {\n const textContent = anchorNode.getTextContent()\n const closeTagEndIndex = anchorOffset - 1\n const closeChar = textContent[closeTagEndIndex]!\n // Quick check if we're possibly at the end of inline markdown style\n const matchers = textFormatTransformers[closeChar]\n\n if (!matchers) {\n return false\n }\n\n for (const matcher of matchers) {\n const { tag } = matcher\n const tagLength = tag.length\n const closeTagStartIndex = closeTagEndIndex - tagLength + 1\n\n // If tag is not single char check if rest of it matches with text content\n if (tagLength > 1) {\n if (!isEqualSubString(textContent, closeTagStartIndex, tag, 0, tagLength)) {\n continue\n }\n }\n\n // Space before closing tag cancels inline markdown\n if (textContent[closeTagStartIndex - 1] === ' ') {\n continue\n }\n\n // Some tags can not be used within words, hence should have newline/space/punctuation after it\n const afterCloseTagChar = textContent[closeTagEndIndex + 1]\n\n if (\n matcher.intraword === false &&\n afterCloseTagChar &&\n !PUNCTUATION_OR_SPACE.test(afterCloseTagChar)\n ) {\n continue\n }\n\n const closeNode = anchorNode\n let openNode = closeNode\n let openTagStartIndex = getOpenTagStartIndex(textContent, closeTagStartIndex, tag)\n\n // Go through text node siblings and search for opening tag\n // if haven't found it within the same text node as closing tag\n let sibling: null | TextNode = openNode\n\n while (openTagStartIndex < 0 && (sibling = sibling.getPreviousSibling<TextNode>())) {\n if ($isLineBreakNode(sibling)) {\n break\n }\n\n if ($isTextNode(sibling)) {\n const siblingTextContent = sibling.getTextContent()\n openNode = sibling\n openTagStartIndex = getOpenTagStartIndex(siblingTextContent, siblingTextContent.length, tag)\n }\n }\n\n // Opening tag is not found\n if (openTagStartIndex < 0) {\n continue\n }\n\n // No content between opening and closing tag\n if (openNode === closeNode && openTagStartIndex + tagLength === closeTagStartIndex) {\n continue\n }\n\n // Checking longer tags for repeating chars (e.g. *** vs **)\n const prevOpenNodeText = openNode.getTextContent()\n\n if (openTagStartIndex > 0 && prevOpenNodeText[openTagStartIndex - 1] === closeChar) {\n continue\n }\n\n // Some tags can not be used within words, hence should have newline/space/punctuation before it\n const beforeOpenTagChar = prevOpenNodeText[openTagStartIndex - 1]\n\n if (\n matcher.intraword === false &&\n beforeOpenTagChar &&\n !PUNCTUATION_OR_SPACE.test(beforeOpenTagChar)\n ) {\n continue\n }\n\n // Clean text from opening and closing tags (starting from closing tag\n // to prevent any offset shifts if we start from opening one)\n const prevCloseNodeText = closeNode.getTextContent()\n const closeNodeText =\n prevCloseNodeText.slice(0, closeTagStartIndex) + prevCloseNodeText.slice(closeTagEndIndex + 1)\n closeNode.setTextContent(closeNodeText)\n const openNodeText = openNode === closeNode ? closeNodeText : prevOpenNodeText\n openNode.setTextContent(\n openNodeText.slice(0, openTagStartIndex) + openNodeText.slice(openTagStartIndex + tagLength),\n )\n const selection = $getSelection()\n const nextSelection = $createRangeSelection()\n $setSelection(nextSelection)\n // Adjust offset based on deleted chars\n const newOffset = closeTagEndIndex - tagLength * (openNode === closeNode ? 2 : 1) + 1\n nextSelection.anchor.set(openNode.__key, openTagStartIndex, 'text')\n nextSelection.focus.set(closeNode.__key, newOffset, 'text')\n\n // Apply formatting to selected text\n for (const format of matcher.format) {\n if (!nextSelection.hasFormat(format)) {\n nextSelection.formatText(format)\n }\n }\n\n // Collapse selection up to the focus point\n nextSelection.anchor.set(\n nextSelection.focus.key,\n nextSelection.focus.offset,\n nextSelection.focus.type,\n )\n\n // Remove formatting from collapsed selection\n for (const format of matcher.format) {\n if (nextSelection.hasFormat(format)) {\n nextSelection.toggleFormat(format)\n }\n }\n\n if ($isRangeSelection(selection)) {\n nextSelection.format = selection.format\n }\n\n return true\n }\n\n return false\n}\n\nfunction getOpenTagStartIndex(string: string, maxIndex: number, tag: string): number {\n const tagLength = tag.length\n\n for (let i = maxIndex; i >= tagLength; i--) {\n const startIndex = i - tagLength\n\n if (\n isEqualSubString(string, startIndex, tag, 0, tagLength) && // Space after opening tag cancels transformation\n string[startIndex + tagLength] !== ' '\n ) {\n return startIndex\n }\n }\n\n return -1\n}\n\nfunction isEqualSubString(\n stringA: string,\n aStart: number,\n stringB: string,\n bStart: number,\n length: number,\n): boolean {\n for (let i = 0; i < length; i++) {\n if (stringA[aStart + i] !== stringB[bStart + i]) {\n return false\n }\n }\n\n return true\n}\n\nexport function registerMarkdownShortcuts(\n editor: LexicalEditor,\n transformers: Array<Transformer> = TRANSFORMERS,\n): () => void {\n const byType = transformersByType(transformers)\n const textFormatTransformersByTrigger = indexBy(\n byType.textFormat,\n ({ tag }) => tag[tag.length - 1],\n )\n const textMatchTransformersByTrigger = indexBy(byType.textMatch, ({ trigger }) => trigger)\n\n for (const transformer of transformers) {\n const type = transformer.type\n if (type === 'element' || type === 'text-match' || type === 'multiline-element') {\n const dependencies = transformer.dependencies\n for (const node of dependencies) {\n if (!editor.hasNode(node)) {\n throw new Error(\n 'MarkdownShortcuts: missing dependency %s for transformer. Ensure node dependency is included in editor initial config.' +\n node.getType(),\n )\n }\n }\n }\n }\n\n const $transform = (parentNode: ElementNode, anchorNode: TextNode, anchorOffset: number) => {\n if (runElementTransformers(parentNode, anchorNode, anchorOffset, byType.element)) {\n return\n }\n\n if (\n runMultilineElementTransformers(parentNode, anchorNode, anchorOffset, byType.multilineElement)\n ) {\n return\n }\n\n if (runTextMatchTransformers(anchorNode, anchorOffset, textMatchTransformersByTrigger)) {\n return\n }\n\n $runTextFormatTransformers(anchorNode, anchorOffset, textFormatTransformersByTrigger)\n }\n\n return editor.registerUpdateListener(({ dirtyLeaves, editorState, prevEditorState, tags }) => {\n // Ignore updates from collaboration and undo/redo (as changes already calculated)\n if (tags.has('collaboration') || tags.has('historic')) {\n return\n }\n\n // If editor is still composing (i.e. backticks) we must wait before the user confirms the key\n if (editor.isComposing()) {\n return\n }\n\n const selection = editorState.read($getSelection)\n const prevSelection = prevEditorState.read($getSelection)\n\n // We expect selection to be a collapsed range and not match previous one (as we want\n // to trigger transforms only as user types)\n if (\n !$isRangeSelection(prevSelection) ||\n !$isRangeSelection(selection) ||\n !selection.isCollapsed() ||\n selection.is(prevSelection)\n ) {\n return\n }\n\n const anchorKey = selection.anchor.key\n const anchorOffset = selection.anchor.offset\n\n const anchorNode = editorState._nodeMap.get(anchorKey)\n\n if (\n !$isTextNode(anchorNode) ||\n !dirtyLeaves.has(anchorKey) ||\n (anchorOffset !== 1 && anchorOffset > prevSelection.anchor.offset + 1)\n ) {\n return\n }\n\n editor.update(() => {\n // Markdown is not available inside code\n if (anchorNode.hasFormat('code')) {\n return\n }\n\n const parentNode = anchorNode.getParent()\n\n if (parentNode === null) {\n return\n }\n\n $transform(parentNode, anchorNode, selection.anchor.offset)\n })\n })\n}\n"],"names":["$createRangeSelection","$getSelection","$isLineBreakNode","$isRangeSelection","$isRootOrShadowRoot","$isTextNode","$setSelection","TRANSFORMERS","indexBy","PUNCTUATION_OR_SPACE","transformersByType","runElementTransformers","parentNode","anchorNode","anchorOffset","elementTransformers","grandParentNode","getParent","getFirstChild","textContent","getTextContent","regExp","replace","match","length","endsWith","nextSiblings","getNextSiblings","leadingNode","remainderNode","splitText","remove","siblings","runMultilineElementTransformers","regExpEnd","regExpStart","optional","runTextMatchTransformers","transformersByTrigger","lastChar","transformers","slice","transformer","startIndex","index","endIndex","replaceNode","selectNext","$runTextFormatTransformers","textFormatTransformers","closeTagEndIndex","closeChar","matchers","matcher","tag","tagLength","closeTagStartIndex","isEqualSubString","afterCloseTagChar","intraword","test","closeNode","openNode","openTagStartIndex","getOpenTagStartIndex","sibling","getPreviousSibling","siblingTextContent","prevOpenNodeText","beforeOpenTagChar","prevCloseNodeText","closeNodeText","setTextContent","openNodeText","selection","nextSelection","newOffset","anchor","set","__key","focus","format","hasFormat","formatText","key","offset","type","toggleFormat","string","maxIndex","i","stringA","aStart","stringB","bStart","registerMarkdownShortcuts","editor","byType","textFormatTransformersByTrigger","textFormat","textMatchTransformersByTrigger","textMatch","trigger","dependencies","node","hasNode","Error","getType","$transform","element","multilineElement","registerUpdateListener","dirtyLeaves","editorState","prevEditorState","tags","has","isComposing","read","prevSelection","isCollapsed","is","anchorKey","_nodeMap","get","update"],"mappings":"AAAA;;;;;;CAMC,GAID,SACEA,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,WAAW,EACXC,aAAa,QACR,UAAS;AAUhB,SAASC,YAAY,QAAQ,aAAY;AACzC,SAASC,OAAO,EAAEC,oBAAoB,EAAEC,kBAAkB,QAAQ,aAAY;AAE9E,SAASC,uBACPC,UAAuB,EACvBC,UAAoB,EACpBC,YAAoB,EACpBC,mBAAsD;IAEtD,MAAMC,kBAAkBJ,WAAWK,SAAS;IAE5C,IAAI,CAACb,oBAAoBY,oBAAoBJ,WAAWM,aAAa,OAAOL,YAAY;QACtF,OAAO;IACT;IAEA,MAAMM,cAAcN,WAAWO,cAAc;IAE7C,2FAA2F;IAC3F,kEAAkE;IAClE,EAAE;IACF,QAAQ;IACR,+GAA+G;IAC/G,4EAA4E;IAC5E,IAAID,WAAW,CAACL,eAAe,EAAE,KAAK,KAAK;QACzC,OAAO;IACT;IAEA,KAAK,MAAM,EAAEO,MAAM,EAAEC,OAAO,EAAE,IAAIP,oBAAqB;QACrD,MAAMQ,QAAQJ,YAAYI,KAAK,CAACF;QAEhC,IAAIE,SAASA,KAAK,CAAC,EAAE,CAACC,MAAM,KAAMD,CAAAA,KAAK,CAAC,EAAE,CAACE,QAAQ,CAAC,OAAOX,eAAeA,eAAe,CAAA,GAAI;YAC3F,MAAMY,eAAeb,WAAWc,eAAe;YAC/C,MAAM,CAACC,aAAaC,cAAc,GAAGhB,WAAWiB,SAAS,CAAChB;YAC1Dc,aAAaG;YACb,MAAMC,WAAWH,gBAAgB;gBAACA;mBAAkBH;aAAa,GAAGA;YACpE,IAAIJ,QAAQV,YAAYoB,UAAUT,OAAO,WAAW,OAAO;g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+69,10 @@ export function importTextFormatTransformer(textNode, startIndex, endIndex, tran
|
|
|
69
69
|
transformedNode = textNode;
|
|
70
70
|
} else {
|
|
71
71
|
if (startIndex === 0) {
|
|
72
|
+
;
|
|
72
73
|
[transformedNode, nodeAfter] = textNode.splitText(endIndex);
|
|
73
74
|
} else {
|
|
75
|
+
;
|
|
74
76
|
[nodeBefore, transformedNode, nodeAfter] = textNode.splitText(startIndex, endIndex);
|
|
75
77
|
}
|
|
76
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/packages/@lexical/markdown/importTextFormatTransformer.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { TextNode } from 'lexical'\n\nimport type { TextFormatTransformersIndex } from './MarkdownImport.js'\nimport type { TextFormatTransformer } from './MarkdownTransformers.js'\n\nimport { PUNCTUATION_OR_SPACE } from './utils.js'\n\nexport function findOutermostTextFormatTransformer(\n textNode: TextNode,\n textFormatTransformersIndex: TextFormatTransformersIndex,\n): {\n endIndex: number\n match: RegExpMatchArray\n startIndex: number\n transformer: TextFormatTransformer\n} | null {\n const textContent = textNode.getTextContent()\n const match = findOutermostMatch(textContent, textFormatTransformersIndex)\n\n if (!match) {\n return null\n }\n\n const textFormatMatchStart: number = match.index || 0\n const textFormatMatchEnd = textFormatMatchStart + match[0].length\n\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n const transformer: TextFormatTransformer = textFormatTransformersIndex.transformersByTag[match[1]]\n\n return {\n endIndex: textFormatMatchEnd,\n match,\n startIndex: textFormatMatchStart,\n transformer,\n }\n}\n\n// Finds first \"<tag>content<tag>\" match that is not nested into another tag\nfunction findOutermostMatch(\n textContent: string,\n textTransformersIndex: TextFormatTransformersIndex,\n): null | RegExpMatchArray {\n const openTagsMatch = textContent.match(textTransformersIndex.openTagsRegExp)\n\n if (openTagsMatch == null) {\n return null\n }\n\n for (const match of openTagsMatch) {\n // Open tags reg exp might capture leading space so removing it\n // before using match to find transformer\n const tag = match.replace(/^\\s/, '')\n const fullMatchRegExp = textTransformersIndex.fullMatchRegExpByTag[tag]\n if (fullMatchRegExp == null) {\n continue\n }\n\n const fullMatch = textContent.match(fullMatchRegExp)\n const transformer = textTransformersIndex.transformersByTag[tag]\n if (fullMatch != null && transformer != null) {\n if (transformer.intraword !== false) {\n return fullMatch\n }\n\n // For non-intraword transformers checking if it's within a word\n // or surrounded with space/punctuation/newline\n const { index = 0 } = fullMatch\n const beforeChar = textContent[index - 1]\n const afterChar = textContent[index + fullMatch[0].length]\n\n if (\n (!beforeChar || PUNCTUATION_OR_SPACE.test(beforeChar)) &&\n (!afterChar || PUNCTUATION_OR_SPACE.test(afterChar))\n ) {\n return fullMatch\n }\n }\n }\n\n return null\n}\n\nexport function importTextFormatTransformer(\n textNode: TextNode,\n startIndex: number,\n endIndex: number,\n transformer: TextFormatTransformer,\n match: RegExpMatchArray,\n): {\n nodeAfter: TextNode | undefined // If split\n nodeBefore: TextNode | undefined // If split\n transformedNode: TextNode\n} {\n const textContent = textNode.getTextContent()\n\n // No text matches - we can safely process the text format match\n let nodeAfter: TextNode | undefined\n let nodeBefore: TextNode | undefined\n let transformedNode: TextNode\n\n // If matching full content there's no need to run splitText and can reuse existing textNode\n // to update its content and apply format. E.g. for **_Hello_** string after applying bold\n // format (**) it will reuse the same text node to apply italic (_)\n if (match[0] === textContent) {\n transformedNode = textNode\n } else {\n if (startIndex === 0) {\n ;[transformedNode, nodeAfter] = textNode.splitText(endIndex) as [\n TextNode,\n TextNode | undefined,\n ]\n } else {\n ;[nodeBefore, transformedNode, nodeAfter] = textNode.splitText(startIndex, endIndex) as [\n TextNode,\n TextNode,\n TextNode | undefined,\n ]\n }\n }\n\n transformedNode.setTextContent(match[2]!)\n if (transformer) {\n for (const format of transformer.format) {\n if (!transformedNode.hasFormat(format)) {\n transformedNode.toggleFormat(format)\n }\n }\n }\n\n return {\n nodeAfter,\n nodeBefore,\n transformedNode,\n }\n}\n"],"names":["PUNCTUATION_OR_SPACE","findOutermostTextFormatTransformer","textNode","textFormatTransformersIndex","textContent","getTextContent","match","findOutermostMatch","textFormatMatchStart","index","textFormatMatchEnd","length","transformer","transformersByTag","endIndex","startIndex","textTransformersIndex","openTagsMatch","openTagsRegExp","tag","replace","fullMatchRegExp","fullMatchRegExpByTag","fullMatch","intraword","beforeChar","afterChar","test","importTextFormatTransformer","nodeAfter","nodeBefore","transformedNode","splitText","setTextContent","format","hasFormat","toggleFormat"],"mappings":"AAAA;;;;;;CAMC,GAOD,SAASA,oBAAoB,QAAQ,aAAY;AAEjD,OAAO,SAASC,mCACdC,QAAkB,EAClBC,2BAAwD;IAOxD,MAAMC,cAAcF,SAASG,cAAc;IAC3C,MAAMC,QAAQC,mBAAmBH,aAAaD;IAE9C,IAAI,CAACG,OAAO;QACV,OAAO;IACT;IAEA,MAAME,uBAA+BF,MAAMG,KAAK,IAAI;IACpD,MAAMC,qBAAqBF,uBAAuBF,KAAK,CAAC,EAAE,CAACK,MAAM;IAEjE,oFAAoF;IACpF,MAAMC,cAAqCT,4BAA4BU,iBAAiB,CAACP,KAAK,CAAC,EAAE,CAAC;IAElG,OAAO;QACLQ,UAAUJ;QACVJ;QACAS,YAAYP;QACZI;IACF;AACF;AAEA,4EAA4E;AAC5E,SAASL,mBACPH,WAAmB,EACnBY,qBAAkD;IAElD,MAAMC,gBAAgBb,YAAYE,KAAK,CAACU,sBAAsBE,cAAc;IAE5E,IAAID,iBAAiB,MAAM;QACzB,OAAO;IACT;IAEA,KAAK,MAAMX,SAASW,cAAe;QACjC,+DAA+D;QAC/D,yCAAyC;QACzC,MAAME,MAAMb,MAAMc,OAAO,CAAC,OAAO;QACjC,MAAMC,kBAAkBL,sBAAsBM,oBAAoB,CAACH,IAAI;QACvE,IAAIE,mBAAmB,MAAM;YAC3B;QACF;QAEA,MAAME,YAAYnB,YAAYE,KAAK,CAACe;QACpC,MAAMT,cAAcI,sBAAsBH,iBAAiB,CAACM,IAAI;QAChE,IAAII,aAAa,QAAQX,eAAe,MAAM;YAC5C,IAAIA,YAAYY,SAAS,KAAK,OAAO;gBACnC,OAAOD;YACT;YAEA,gEAAgE;YAChE,+CAA+C;YAC/C,MAAM,EAAEd,QAAQ,CAAC,EAAE,GAAGc;YACtB,MAAME,aAAarB,WAAW,CAACK,QAAQ,EAAE;YACzC,MAAMiB,YAAYtB,WAAW,CAACK,QAAQc,SAAS,CAAC,EAAE,CAACZ,MAAM,CAAC;YAE1D,IACE,AAAC,CAAA,CAACc,cAAczB,qBAAqB2B,IAAI,CAACF,WAAU,KACnD,CAAA,CAACC,aAAa1B,qBAAqB2B,IAAI,CAACD,UAAS,GAClD;gBACA,OAAOH;YACT;QACF;IACF;IAEA,OAAO;AACT;AAEA,OAAO,SAASK,4BACd1B,QAAkB,EAClBa,UAAkB,EAClBD,QAAgB,EAChBF,WAAkC,EAClCN,KAAuB,EAES,WAAW;AACV,WAAW;;IAG5C,MAAMF,cAAcF,SAASG,cAAc;IAE3C,gEAAgE;IAChE,IAAIwB;IACJ,IAAIC;IACJ,IAAIC;IAEJ,4FAA4F;IAC5F,0FAA0F;IAC1F,mEAAmE;IACnE,IAAIzB,KAAK,CAAC,EAAE,KAAKF,aAAa;QAC5B2B,kBAAkB7B;IACpB,OAAO;QACL,IAAIa,eAAe,GAAG
|
|
1
|
+
{"version":3,"sources":["../../../../src/packages/@lexical/markdown/importTextFormatTransformer.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { TextNode } from 'lexical'\n\nimport type { TextFormatTransformersIndex } from './MarkdownImport.js'\nimport type { TextFormatTransformer } from './MarkdownTransformers.js'\n\nimport { PUNCTUATION_OR_SPACE } from './utils.js'\n\nexport function findOutermostTextFormatTransformer(\n textNode: TextNode,\n textFormatTransformersIndex: TextFormatTransformersIndex,\n): {\n endIndex: number\n match: RegExpMatchArray\n startIndex: number\n transformer: TextFormatTransformer\n} | null {\n const textContent = textNode.getTextContent()\n const match = findOutermostMatch(textContent, textFormatTransformersIndex)\n\n if (!match) {\n return null\n }\n\n const textFormatMatchStart: number = match.index || 0\n const textFormatMatchEnd = textFormatMatchStart + match[0].length\n\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n const transformer: TextFormatTransformer = textFormatTransformersIndex.transformersByTag[match[1]]\n\n return {\n endIndex: textFormatMatchEnd,\n match,\n startIndex: textFormatMatchStart,\n transformer,\n }\n}\n\n// Finds first \"<tag>content<tag>\" match that is not nested into another tag\nfunction findOutermostMatch(\n textContent: string,\n textTransformersIndex: TextFormatTransformersIndex,\n): null | RegExpMatchArray {\n const openTagsMatch = textContent.match(textTransformersIndex.openTagsRegExp)\n\n if (openTagsMatch == null) {\n return null\n }\n\n for (const match of openTagsMatch) {\n // Open tags reg exp might capture leading space so removing it\n // before using match to find transformer\n const tag = match.replace(/^\\s/, '')\n const fullMatchRegExp = textTransformersIndex.fullMatchRegExpByTag[tag]\n if (fullMatchRegExp == null) {\n continue\n }\n\n const fullMatch = textContent.match(fullMatchRegExp)\n const transformer = textTransformersIndex.transformersByTag[tag]\n if (fullMatch != null && transformer != null) {\n if (transformer.intraword !== false) {\n return fullMatch\n }\n\n // For non-intraword transformers checking if it's within a word\n // or surrounded with space/punctuation/newline\n const { index = 0 } = fullMatch\n const beforeChar = textContent[index - 1]\n const afterChar = textContent[index + fullMatch[0].length]\n\n if (\n (!beforeChar || PUNCTUATION_OR_SPACE.test(beforeChar)) &&\n (!afterChar || PUNCTUATION_OR_SPACE.test(afterChar))\n ) {\n return fullMatch\n }\n }\n }\n\n return null\n}\n\nexport function importTextFormatTransformer(\n textNode: TextNode,\n startIndex: number,\n endIndex: number,\n transformer: TextFormatTransformer,\n match: RegExpMatchArray,\n): {\n nodeAfter: TextNode | undefined // If split\n nodeBefore: TextNode | undefined // If split\n transformedNode: TextNode\n} {\n const textContent = textNode.getTextContent()\n\n // No text matches - we can safely process the text format match\n let nodeAfter: TextNode | undefined\n let nodeBefore: TextNode | undefined\n let transformedNode: TextNode\n\n // If matching full content there's no need to run splitText and can reuse existing textNode\n // to update its content and apply format. E.g. for **_Hello_** string after applying bold\n // format (**) it will reuse the same text node to apply italic (_)\n if (match[0] === textContent) {\n transformedNode = textNode\n } else {\n if (startIndex === 0) {\n ;[transformedNode, nodeAfter] = textNode.splitText(endIndex) as [\n TextNode,\n TextNode | undefined,\n ]\n } else {\n ;[nodeBefore, transformedNode, nodeAfter] = textNode.splitText(startIndex, endIndex) as [\n TextNode,\n TextNode,\n TextNode | undefined,\n ]\n }\n }\n\n transformedNode.setTextContent(match[2]!)\n if (transformer) {\n for (const format of transformer.format) {\n if (!transformedNode.hasFormat(format)) {\n transformedNode.toggleFormat(format)\n }\n }\n }\n\n return {\n nodeAfter,\n nodeBefore,\n transformedNode,\n }\n}\n"],"names":["PUNCTUATION_OR_SPACE","findOutermostTextFormatTransformer","textNode","textFormatTransformersIndex","textContent","getTextContent","match","findOutermostMatch","textFormatMatchStart","index","textFormatMatchEnd","length","transformer","transformersByTag","endIndex","startIndex","textTransformersIndex","openTagsMatch","openTagsRegExp","tag","replace","fullMatchRegExp","fullMatchRegExpByTag","fullMatch","intraword","beforeChar","afterChar","test","importTextFormatTransformer","nodeAfter","nodeBefore","transformedNode","splitText","setTextContent","format","hasFormat","toggleFormat"],"mappings":"AAAA;;;;;;CAMC,GAOD,SAASA,oBAAoB,QAAQ,aAAY;AAEjD,OAAO,SAASC,mCACdC,QAAkB,EAClBC,2BAAwD;IAOxD,MAAMC,cAAcF,SAASG,cAAc;IAC3C,MAAMC,QAAQC,mBAAmBH,aAAaD;IAE9C,IAAI,CAACG,OAAO;QACV,OAAO;IACT;IAEA,MAAME,uBAA+BF,MAAMG,KAAK,IAAI;IACpD,MAAMC,qBAAqBF,uBAAuBF,KAAK,CAA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c;IAE3C,gEAAgE;IAChE,IAAIwB;IACJ,IAAIC;IACJ,IAAIC;IAEJ,4FAA4F;IAC5F,0FAA0F;IAC1F,mEAAmE;IACnE,IAAIzB,KAAK,CAAC,EAAE,KAAKF,aAAa;QAC5B2B,kBAAkB7B;IACpB,OAAO;QACL,IAAIa,eAAe,GAAG;;YACnB,CAACgB,iBAAiBF,UAAU,GAAG3B,SAAS8B,SAAS,CAAClB;QAIrD,OAAO;;YACJ,CAACgB,YAAYC,iBAAiBF,UAAU,GAAG3B,SAAS8B,SAAS,CAACjB,YAAYD;QAK7E;IACF;IAEAiB,gBAAgBE,cAAc,CAAC3B,KAAK,CAAC,EAAE;IACvC,IAAIM,aAAa;QACf,KAAK,MAAMsB,UAAUtB,YAAYsB,MAAM,CAAE;YACvC,IAAI,CAACH,gBAAgBI,SAAS,CAACD,SAAS;gBACtCH,gBAAgBK,YAAY,CAACF;YAC/B;QACF;IACF;IAEA,OAAO;QACLL;QACAC;QACAC;IACF;AACF"}
|
|
@@ -45,8 +45,10 @@ export function importFoundTextMatchTransformer(textNode, startIndex, endIndex,
|
|
|
45
45
|
{
|
|
46
46
|
let nodeAfter, nodeBefore, transformedNode;
|
|
47
47
|
if (startIndex === 0) {
|
|
48
|
+
;
|
|
48
49
|
[transformedNode, nodeAfter] = textNode.splitText(endIndex);
|
|
49
50
|
} else {
|
|
51
|
+
;
|
|
50
52
|
[nodeBefore, transformedNode, nodeAfter] = textNode.splitText(startIndex, endIndex);
|
|
51
53
|
}
|
|
52
54
|
if (!transformer.replace) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/packages/@lexical/markdown/importTextMatchTransformer.ts"],"sourcesContent":["import { type TextNode } from 'lexical'\n\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport type { TextMatchTransformer } from './MarkdownTransformers.js'\n\nexport function findOutermostTextMatchTransformer(\n textNode_: TextNode,\n textMatchTransformers: Array<TextMatchTransformer>,\n): {\n endIndex: number\n match: RegExpMatchArray\n startIndex: number\n transformer: TextMatchTransformer\n} | null {\n const textNode = textNode_\n\n let foundMatchStartIndex: number | undefined = undefined\n let foundMatchEndIndex: number | undefined = undefined\n let foundMatchTransformer: TextMatchTransformer | undefined = undefined\n let foundMatch: RegExpMatchArray | undefined = undefined\n\n for (const transformer of textMatchTransformers) {\n if (!transformer.replace || !transformer.importRegExp) {\n continue\n }\n const match = textNode.getTextContent().match(transformer.importRegExp)\n\n if (!match) {\n continue\n }\n\n const startIndex = match.index || 0\n const endIndex = transformer.getEndIndex\n ? transformer.getEndIndex(textNode, match)\n : startIndex + match[0].length\n\n if (endIndex === false) {\n continue\n }\n\n if (\n foundMatchStartIndex === undefined ||\n foundMatchEndIndex === undefined ||\n (startIndex < foundMatchStartIndex && endIndex > foundMatchEndIndex)\n ) {\n foundMatchStartIndex = startIndex\n foundMatchEndIndex = endIndex\n foundMatchTransformer = transformer\n foundMatch = match\n }\n }\n\n if (\n foundMatchStartIndex === undefined ||\n foundMatchEndIndex === undefined ||\n foundMatchTransformer === undefined ||\n foundMatch === undefined\n ) {\n return null\n }\n\n return {\n endIndex: foundMatchEndIndex,\n match: foundMatch,\n startIndex: foundMatchStartIndex,\n transformer: foundMatchTransformer,\n }\n}\n\nexport function importFoundTextMatchTransformer(\n textNode: TextNode,\n startIndex: number,\n endIndex: number,\n transformer: TextMatchTransformer,\n match: RegExpMatchArray,\n): {\n nodeAfter: TextNode | undefined // If split\n nodeBefore: TextNode | undefined // If split\n transformedNode?: TextNode\n} | null {\n let nodeAfter, nodeBefore, transformedNode\n\n if (startIndex === 0) {\n ;[transformedNode, nodeAfter] = textNode.splitText(endIndex)\n } else {\n ;[nodeBefore, transformedNode, nodeAfter] = textNode.splitText(startIndex, endIndex)\n }\n\n if (!transformer.replace) {\n return null\n }\n const potentialTransformedNode = transformedNode\n ? transformer.replace(transformedNode, match)\n : undefined\n\n return {\n nodeAfter,\n nodeBefore,\n transformedNode: potentialTransformedNode || undefined,\n }\n}\n"],"names":["findOutermostTextMatchTransformer","textNode_","textMatchTransformers","textNode","foundMatchStartIndex","undefined","foundMatchEndIndex","foundMatchTransformer","foundMatch","transformer","replace","importRegExp","match","getTextContent","startIndex","index","endIndex","getEndIndex","length","importFoundTextMatchTransformer","nodeAfter","nodeBefore","transformedNode","splitText","potentialTransformedNode"],"mappings":"AAEA;;;;;;CAMC,GAGD,OAAO,SAASA,kCACdC,SAAmB,EACnBC,qBAAkD;IAOlD,MAAMC,WAAWF;IAEjB,IAAIG,uBAA2CC;IAC/C,IAAIC,qBAAyCD;IAC7C,IAAIE,wBAA0DF;IAC9D,IAAIG,aAA2CH;IAE/C,KAAK,MAAMI,eAAeP,sBAAuB;QAC/C,IAAI,CAACO,YAAYC,OAAO,IAAI,CAACD,YAAYE,YAAY,EAAE;YACrD;QACF;QACA,MAAMC,QAAQT,SAASU,cAAc,GAAGD,KAAK,CAACH,YAAYE,YAAY;QAEtE,IAAI,CAACC,OAAO;YACV;QACF;QAEA,MAAME,aAAaF,MAAMG,KAAK,IAAI;QAClC,MAAMC,WAAWP,YAAYQ,WAAW,GACpCR,YAAYQ,WAAW,CAACd,UAAUS,SAClCE,aAAaF,KAAK,CAAC,EAAE,CAACM,MAAM;QAEhC,IAAIF,aAAa,OAAO;YACtB;QACF;QAEA,IACEZ,yBAAyBC,aACzBC,uBAAuBD,aACtBS,aAAaV,wBAAwBY,WAAWV,oBACjD;YACAF,uBAAuBU;YACvBR,qBAAqBU;YACrBT,wBAAwBE;YACxBD,aAAaI;QACf;IACF;IAEA,IACER,yBAAyBC,aACzBC,uBAAuBD,aACvBE,0BAA0BF,aAC1BG,eAAeH,WACf;QACA,OAAO;IACT;IAEA,OAAO;QACLW,UAAUV;QACVM,OAAOJ;QACPM,YAAYV;QACZK,aAAaF;IACf;AACF;AAEA,OAAO,SAASY,gCACdhB,QAAkB,EAClBW,UAAkB,EAClBE,QAAgB,EAChBP,WAAiC,EACjCG,KAAuB,EAES,WAAW;AACV,WAAW;;IAG5C,IAAIQ,WAAWC,YAAYC;IAE3B,IAAIR,eAAe,GAAG
|
|
1
|
+
{"version":3,"sources":["../../../../src/packages/@lexical/markdown/importTextMatchTransformer.ts"],"sourcesContent":["import { type TextNode } from 'lexical'\n\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport type { TextMatchTransformer } from './MarkdownTransformers.js'\n\nexport function findOutermostTextMatchTransformer(\n textNode_: TextNode,\n textMatchTransformers: Array<TextMatchTransformer>,\n): {\n endIndex: number\n match: RegExpMatchArray\n startIndex: number\n transformer: TextMatchTransformer\n} | null {\n const textNode = textNode_\n\n let foundMatchStartIndex: number | undefined = undefined\n let foundMatchEndIndex: number | undefined = undefined\n let foundMatchTransformer: TextMatchTransformer | undefined = undefined\n let foundMatch: RegExpMatchArray | undefined = undefined\n\n for (const transformer of textMatchTransformers) {\n if (!transformer.replace || !transformer.importRegExp) {\n continue\n }\n const match = textNode.getTextContent().match(transformer.importRegExp)\n\n if (!match) {\n continue\n }\n\n const startIndex = match.index || 0\n const endIndex = transformer.getEndIndex\n ? transformer.getEndIndex(textNode, match)\n : startIndex + match[0].length\n\n if (endIndex === false) {\n continue\n }\n\n if (\n foundMatchStartIndex === undefined ||\n foundMatchEndIndex === undefined ||\n (startIndex < foundMatchStartIndex && endIndex > foundMatchEndIndex)\n ) {\n foundMatchStartIndex = startIndex\n foundMatchEndIndex = endIndex\n foundMatchTransformer = transformer\n foundMatch = match\n }\n }\n\n if (\n foundMatchStartIndex === undefined ||\n foundMatchEndIndex === undefined ||\n foundMatchTransformer === undefined ||\n foundMatch === undefined\n ) {\n return null\n }\n\n return {\n endIndex: foundMatchEndIndex,\n match: foundMatch,\n startIndex: foundMatchStartIndex,\n transformer: foundMatchTransformer,\n }\n}\n\nexport function importFoundTextMatchTransformer(\n textNode: TextNode,\n startIndex: number,\n endIndex: number,\n transformer: TextMatchTransformer,\n match: RegExpMatchArray,\n): {\n nodeAfter: TextNode | undefined // If split\n nodeBefore: TextNode | undefined // If split\n transformedNode?: TextNode\n} | null {\n let nodeAfter, nodeBefore, transformedNode\n\n if (startIndex === 0) {\n ;[transformedNode, nodeAfter] = textNode.splitText(endIndex)\n } else {\n ;[nodeBefore, transformedNode, nodeAfter] = textNode.splitText(startIndex, endIndex)\n }\n\n if (!transformer.replace) {\n return null\n }\n const potentialTransformedNode = transformedNode\n ? transformer.replace(transformedNode, match)\n : undefined\n\n return {\n nodeAfter,\n nodeBefore,\n transformedNode: potentialTransformedNode || undefined,\n }\n}\n"],"names":["findOutermostTextMatchTransformer","textNode_","textMatchTransformers","textNode","foundMatchStartIndex","undefined","foundMatchEndIndex","foundMatchTransformer","foundMatch","transformer","replace","importRegExp","match","getTextContent","startIndex","index","endIndex","getEndIndex","length","importFoundTextMatchTransformer","nodeAfter","nodeBefore","transformedNode","splitText","potentialTransformedNode"],"mappings":"AAEA;;;;;;CAMC,GAGD,OAAO,SAASA,kCACdC,SAAmB,EACnBC,qBAAkD;IAOlD,MAAMC,WAAWF;IAEjB,IAAIG,uBAA2CC;IAC/C,IAAIC,qBAAyCD;IAC7C,IAAIE,wBAA0DF;IAC9D,IAAIG,aAA2CH;IAE/C,KAAK,MAAMI,eAAeP,sBAAuB;QAC/C,IAAI,CAACO,YAAYC,OAAO,IAAI,CAACD,YAAYE,YAAY,EAAE;YACrD;QACF;QACA,MAAMC,QAAQT,SAASU,cAAc,GAAGD,KAAK,CAACH,YAAYE,YAAY;QAEtE,IAAI,CAACC,OAAO;YACV;QACF;QAEA,MAAME,aAAaF,MAAMG,KAAK,IAAI;QAClC,MAAMC,WAAWP,YAAYQ,WAAW,GACpCR,YAAYQ,WAAW,CAACd,UAAUS,SAClCE,aAAaF,KAAK,CAAC,EAAE,CAACM,MAAM;QAEhC,IAAIF,aAAa,OAAO;YACtB;QACF;QAEA,IACEZ,yBAAyBC,aACzBC,uBAAuBD,aACtBS,aAAaV,wBAAwBY,WAAWV,oBACjD;YACAF,uBAAuBU;YACvBR,qBAAqBU;YACrBT,wBAAwBE;YACxBD,aAAaI;QACf;IACF;IAEA,IACER,yBAAyBC,aACzBC,uBAAuBD,aACvBE,0BAA0BF,aAC1BG,eAAeH,WACf;QACA,OAAO;IACT;IAEA,OAAO;QACLW,UAAUV;QACVM,OAAOJ;QACPM,YAAYV;QACZK,aAAaF;IACf;AACF;AAEA,OAAO,SAASY,gCACdhB,QAAkB,EAClBW,UAAkB,EAClBE,QAAgB,EAChBP,WAAiC,EACjCG,KAAuB,EAES,WAAW;AACV,WAAW;;IAG5C,IAAIQ,WAAWC,YAAYC;IAE3B,IAAIR,eAAe,GAAG;;QACnB,CAACQ,iBAAiBF,UAAU,GAAGjB,SAASoB,SAAS,CAACP;IACrD,OAAO;;QACJ,CAACK,YAAYC,iBAAiBF,UAAU,GAAGjB,SAASoB,SAAS,CAACT,YAAYE;IAC7E;IAEA,IAAI,CAACP,YAAYC,OAAO,EAAE;QACxB,OAAO;IACT;IACA,MAAMc,2BAA2BF,kBAC7Bb,YAAYC,OAAO,CAACY,iBAAiBV,SACrCP;IAEJ,OAAO;QACLe;QACAC;QACAC,iBAAiBE,4BAA4BnB;IAC/C;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
3
|
import { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { DrawerContent } from './DrawerContent.js';
|
|
@@ -11,12 +11,12 @@ import { DrawerContent } from './DrawerContent.js';
|
|
|
11
11
|
const { closeModal } = useModal();
|
|
12
12
|
// The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content
|
|
13
13
|
// to DrawerContent, this should be faster
|
|
14
|
-
return /*#__PURE__*/
|
|
15
|
-
children: /*#__PURE__*/
|
|
14
|
+
return /*#__PURE__*/ _jsxDEV(EditDepthProvider, {
|
|
15
|
+
children: /*#__PURE__*/ _jsxDEV(Drawer, {
|
|
16
16
|
className: className,
|
|
17
17
|
slug: drawerSlug,
|
|
18
18
|
title: drawerTitle ?? '',
|
|
19
|
-
children: /*#__PURE__*/
|
|
19
|
+
children: /*#__PURE__*/ _jsxDEV(DrawerContent, {
|
|
20
20
|
data: data,
|
|
21
21
|
featureKey: featureKey,
|
|
22
22
|
fieldMapOverride: fieldMapOverride,
|
|
@@ -35,9 +35,21 @@ import { DrawerContent } from './DrawerContent.js';
|
|
|
35
35
|
schemaFieldsPathOverride: schemaFieldsPathOverride,
|
|
36
36
|
schemaPath: schemaPath,
|
|
37
37
|
schemaPathSuffix: schemaPathSuffix
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
}, void 0, false, {
|
|
39
|
+
fileName: "src/utilities/fieldsDrawer/Drawer.tsx",
|
|
40
|
+
lineNumber: 45,
|
|
41
|
+
columnNumber: 9
|
|
42
|
+
}, this)
|
|
43
|
+
}, void 0, false, {
|
|
44
|
+
fileName: "src/utilities/fieldsDrawer/Drawer.tsx",
|
|
45
|
+
lineNumber: 44,
|
|
46
|
+
columnNumber: 7
|
|
47
|
+
}, this)
|
|
48
|
+
}, void 0, false, {
|
|
49
|
+
fileName: "src/utilities/fieldsDrawer/Drawer.tsx",
|
|
50
|
+
lineNumber: 43,
|
|
51
|
+
columnNumber: 5
|
|
52
|
+
}, this);
|
|
41
53
|
};
|
|
42
54
|
|
|
43
55
|
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utilities/fieldsDrawer/Drawer.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n"],"names":["Drawer","EditDepthProvider","useModal","React","DrawerContent","FieldsDrawer","className","data","drawerSlug","drawerTitle","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","closeModal","slug","title","args","args2","setTimeout"],"mappings":"AAAA;;AAGA,SAASA,MAAM,EAAEC,iBAAiB,EAAEC,QAAQ,QAAQ,iBAAgB;AACpE,OAAOC,WAAW,QAAO;AAEzB,SAASC,aAAa,QAAQ,qBAAoB;AAelD;;;;CAIC,GACD,OAAO,MAAMC,eAA4C,CAAC,EACxDC,SAAS,EACTC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,gBAAgB,EAChBC,kBAAkB,EAClBC,wBAAwB,EACxBC,UAAU,EACVC,gBAAgB,EACjB;IACC,MAAM,EAAEC,UAAU,EAAE,GAAGd;IACvB,uGAAuG;IACvG,0CAA0C;IAC1C,qBACE,
|
|
1
|
+
{"version":3,"sources":["../../../src/utilities/fieldsDrawer/Drawer.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n"],"names":["Drawer","EditDepthProvider","useModal","React","DrawerContent","FieldsDrawer","className","data","drawerSlug","drawerTitle","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","closeModal","slug","title","args","args2","setTimeout"],"mappings":"AAAA;;AAGA,SAASA,MAAM,EAAEC,iBAAiB,EAAEC,QAAQ,QAAQ,iBAAgB;AACpE,OAAOC,WAAW,QAAO;AAEzB,SAASC,aAAa,QAAQ,qBAAoB;AAelD;;;;CAIC,GACD,OAAO,MAAMC,eAA4C,CAAC,EACxDC,SAAS,EACTC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,gBAAgB,EAChBC,kBAAkB,EAClBC,wBAAwB,EACxBC,UAAU,EACVC,gBAAgB,EACjB;IACC,MAAM,EAAEC,UAAU,EAAE,GAAGd;IACvB,uGAAuG;IACvG,0CAA0C;IAC1C,qBACE,QAACD;kBACC,cAAA,QAACD;YAAOM,WAAWA;YAAWW,MAAMT;YAAYU,OAAOT,eAAe;sBACpE,cAAA,QAACL;gBACCG,MAAMA;gBACNG,YAAYA;gBACZC,kBAAkBA;gBAClBC,oBAAoB,CAACO,MAAMC;oBACzB,4EAA4E;oBAC5E,sGAAsG;oBACtGJ,WAAWR;oBAEX,+EAA+E;oBAC/E,oFAAoF;oBACpF,2FAA2F;oBAC3F,wCAAwC;oBACxCa,WAAW;wBACTT,mBAAmBO,MAAMC;oBAC3B,GAAG;gBACL;gBACAP,0BAA0BA;gBAC1BC,YAAYA;gBACZC,kBAAkBA;;;;;;;;;;;;;;;;AAK5B,EAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
3
|
import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
4
4
|
import { Form, FormSubmit, RenderFields, useDocumentForm, useDocumentInfo, useServerFunctions, useTranslation } from '@payloadcms/ui';
|
|
5
5
|
import { abortAndIgnore } from '@payloadcms/ui/shared';
|
|
@@ -99,7 +99,7 @@ export const DrawerContent = ({ data, featureKey, fieldMapOverride, handleDrawer
|
|
|
99
99
|
if (initialState === false) {
|
|
100
100
|
return null;
|
|
101
101
|
}
|
|
102
|
-
return /*#__PURE__*/
|
|
102
|
+
return /*#__PURE__*/ _jsxDEV(Form, {
|
|
103
103
|
beforeSubmit: [
|
|
104
104
|
onChange
|
|
105
105
|
],
|
|
@@ -112,7 +112,7 @@ export const DrawerContent = ({ data, featureKey, fieldMapOverride, handleDrawer
|
|
|
112
112
|
onSubmit: handleDrawerSubmit,
|
|
113
113
|
uuid: uuid(),
|
|
114
114
|
children: [
|
|
115
|
-
/*#__PURE__*/
|
|
115
|
+
/*#__PURE__*/ _jsxDEV(RenderFields, {
|
|
116
116
|
fields: Array.isArray(fields) ? fields : [],
|
|
117
117
|
forceRender: true,
|
|
118
118
|
parentIndexPath: "",
|
|
@@ -121,12 +121,24 @@ export const DrawerContent = ({ data, featureKey, fieldMapOverride, handleDrawer
|
|
|
121
121
|
parentSchemaPath: schemaFieldsPath,
|
|
122
122
|
permissions: true,
|
|
123
123
|
readOnly: !isEditable
|
|
124
|
-
}
|
|
125
|
-
|
|
124
|
+
}, void 0, false, {
|
|
125
|
+
fileName: "src/utilities/fieldsDrawer/DrawerContent.tsx",
|
|
126
|
+
lineNumber: 158,
|
|
127
|
+
columnNumber: 7
|
|
128
|
+
}, this),
|
|
129
|
+
/*#__PURE__*/ _jsxDEV(FormSubmit, {
|
|
126
130
|
children: t('fields:saveChanges')
|
|
127
|
-
}
|
|
131
|
+
}, void 0, false, {
|
|
132
|
+
fileName: "src/utilities/fieldsDrawer/DrawerContent.tsx",
|
|
133
|
+
lineNumber: 167,
|
|
134
|
+
columnNumber: 7
|
|
135
|
+
}, this)
|
|
128
136
|
]
|
|
129
|
-
}
|
|
137
|
+
}, void 0, true, {
|
|
138
|
+
fileName: "src/utilities/fieldsDrawer/DrawerContent.tsx",
|
|
139
|
+
lineNumber: 149,
|
|
140
|
+
columnNumber: 5
|
|
141
|
+
}, this);
|
|
130
142
|
};
|
|
131
143
|
|
|
132
144
|
//# sourceMappingURL=DrawerContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useDocumentForm,\n useDocumentInfo,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { FieldsDrawerProps } from './Drawer.js'\n\nimport { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { t } = useTranslation()\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { fields: parentDocumentFields } = useDocumentForm()\n const isEditable = useLexicalEditable()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap },\n } = useEditorConfigContext()\n\n const { getFormState } = useServerFunctions()\n\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema\n\n useEffect(() => {\n const controller = new AbortController()\n\n const awaitInitialState = async () => {\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: data ?? {},\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: data,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n\n return () => {\n abortAndIgnore(controller)\n }\n }, [\n schemaFieldsPath,\n id,\n data,\n getFormState,\n collectionSlug,\n isEditable,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }: { formState: FormState }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [\n getFormState,\n id,\n isEditable,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n schemaFieldsPath,\n ],\n )\n\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fields) ? fields : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleDrawerSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fields={Array.isArray(fields) ? fields : []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )\n}\n"],"names":["useLexicalEditable","Form","FormSubmit","RenderFields","useDocumentForm","useDocumentInfo","useServerFunctions","useTranslation","abortAndIgnore","deepCopyObjectSimpleWithoutReactComponents","React","useCallback","useEffect","useRef","useState","v4","uuid","useEditorConfigContext","DrawerContent","data","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","t","id","collectionSlug","getDocPreferences","globalSlug","fields","parentDocumentFields","isEditable","onChangeAbortControllerRef","AbortController","initialState","setInitialState","fieldProps","featureClientSchemaMap","getFormState","schemaFieldsPath","controller","awaitInitialState","state","docPermissions","docPreferences","documentFormState","initialBlockData","operation","readOnly","renderAllFields","signal","onChange","formState","prevFormState","current","initialBlockFormState","beforeSubmit","disableValidationOnSubmit","Array","isArray","onSubmit","forceRender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AEC,KAAK,EAAE,GAAG,MAAMJ,aAAa;gBACnCb;gBACAC;gBACAT,MAAMA,QAAQ,CAAC;gBACf0B,gBAAgB;oBACdd,QAAQ;gBACV;gBACAe,gBAAgB,MAAMjB;gBACtBkB,mBAAmBtC,2CAA2CuB;gBAC9DF;gBACAkB,kBAAkB7B;gBAClB8B,WAAW;gBACXC,UAAU,CAACjB;gBACXkB,iBAAiB;gBACjB3B,YAAYiB;gBACZW,QAAQV,WAAWU,MAAM;YAC3B;YAEAf,gBAAgBO;QAClB;QAEA,KAAKD;QAEL,OAAO;YACLnC,eAAekC;QACjB;IACF,GAAG;QACDD;QACAd;QACAR;QACAqB;QACAZ;QACAK;QACAH;QACAD;QACAG;KACD;IAED,MAAMqB,WAAW1C,YACf,OAAO,EAAE2C,WAAWC,aAAa,EAA4B;QAC3D/C,eAAe0B,2BAA2BsB,OAAO;QAEjD,MAAMd,aAAa,IAAIP;QACvBD,2BAA2BsB,OAAO,GAAGd;QAErC,MAAM,EAAEE,KAAK,EAAE,GAAG,MAAMJ,aAAa;YACnCb;YACAC;YACAiB,gBAAgB;gBACdd,QAAQ;YACV;YACAe,gBAAgB,MAAMjB;YACtBkB,mBAAmBtC,2CAA2CuB;YAC9DsB,WAAWC;YACXzB;YACA2B,uBAAuBF;YACvBN,WAAW;YACXC,UAAU,CAACjB;YACXT,YAAYiB;YACZW,QAAQV,WAAWU,MAAM;QAC3B;QAEA,IAAI,CAACR,OAAO;YACV,OAAOW;QACT;QAEA,OAAOX;IACT,GACA;QACEJ;QACAb;QACAM;QACAL;QACAC;QACAG;QACAF;QACAW;KACD;IAGH,iBAAiB;IACjB7B,UAAU;QACR,OAAO;YACLJ,eAAe0B,2BAA2BsB,OAAO;QACnD;IACF,GAAG,EAAE;IAEL,IAAIpB,iBAAiB,OAAO;QAC1B,OAAO;IACT;IAEA,qBACE,
|
|
1
|
+
{"version":3,"sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useDocumentForm,\n useDocumentInfo,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { FieldsDrawerProps } from './Drawer.js'\n\nimport { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { t } = useTranslation()\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { fields: parentDocumentFields } = useDocumentForm()\n const isEditable = useLexicalEditable()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap },\n } = useEditorConfigContext()\n\n const { getFormState } = useServerFunctions()\n\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema\n\n useEffect(() => {\n const controller = new AbortController()\n\n const awaitInitialState = async () => {\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: data ?? {},\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: data,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n\n return () => {\n abortAndIgnore(controller)\n }\n }, [\n schemaFieldsPath,\n id,\n data,\n getFormState,\n collectionSlug,\n isEditable,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }: { formState: FormState }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [\n getFormState,\n id,\n isEditable,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n schemaFieldsPath,\n ],\n )\n\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fields) ? fields : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleDrawerSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fields={Array.isArray(fields) ? fields : []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )\n}\n"],"names":["useLexicalEditable","Form","FormSubmit","RenderFields","useDocumentForm","useDocumentInfo","useServerFunctions","useTranslation","abortAndIgnore","deepCopyObjectSimpleWithoutReactComponents","React","useCallback","useEffect","useRef","useState","v4","uuid","useEditorConfigContext","DrawerContent","data","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","t","id","collectionSlug","getDocPreferences","globalSlug","fields","parentDocumentFields","isEditable","onChangeAbortControllerRef","AbortController","initialState","setInitialState","fieldProps","featureClientSchemaMap","getFormState","schemaFieldsPath","controller","awaitInitialState","state","docPermissions","docPreferences","documentFormState","initialBlockData","operation","readOnly","renderAllFields","signal","onChange","formState","prevFormState","current","initialBlockFormState","beforeSubmit","disableValidationOnSubmit","Array","isArray","onSubmit","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions"],"mappings":"AAAA;;AAGA,SAASA,kBAAkB,QAAQ,oCAAmC;AACtE,SACEC,IAAI,EACJC,UAAU,EACVC,YAAY,EACZC,eAAe,EACfC,eAAe,EACfC,kBAAkB,EAClBC,cAAc,QACT,iBAAgB;AACvB,SAASC,cAAc,QAAQ,wBAAuB;AACtD,SAASC,0CAA0C,QAAQ,iBAAgB;AAC3E,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AACvE,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAIjC,SAASC,sBAAsB,QAAQ,sDAAqD;AAE5F,OAAO,MAAMC,gBAAiF,CAAC,EAC7FC,IAAI,EACJC,UAAU,EACVC,gBAAgB,EAChBC,kBAAkB,EAClBC,wBAAwB,EACxBC,UAAU,EACVC,gBAAgB,EACjB;IACC,MAAM,EAAEC,CAAC,EAAE,GAAGnB;IACd,MAAM,EAAEoB,EAAE,EAAEC,cAAc,EAAEC,iBAAiB,EAAEC,UAAU,EAAE,GAAGzB;IAC9D,MAAM,EAAE0B,QAAQC,oBAAoB,EAAE,GAAG5B;IACzC,MAAM6B,aAAajC;IAEnB,MAAMkC,6BAA6BrB,OAAO,IAAIsB;IAE9C,MAAM,CAACC,cAAcC,gBAAgB,GAAGvB,SAAwC;IAEhF,MAAM,EACJwB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U,MAAM;QAC3B;QAEA,IAAI,CAACR,OAAO;YACV,OAAOW;QACT;QAEA,OAAOX;IACT,GACA;QACEJ;QACAb;QACAM;QACAL;QACAC;QACAG;QACAF;QACAW;KACD;IAGH,iBAAiB;IACjB7B,UAAU;QACR,OAAO;YACLJ,eAAe0B,2BAA2BsB,OAAO;QACnD;IACF,GAAG,EAAE;IAEL,IAAIpB,iBAAiB,OAAO;QAC1B,OAAO;IACT;IAEA,qBACE,QAACnC;QACCyD,cAAc;YAACL;SAAS;QACxBM,yBAAyB;QACzB5B,QAAQ6B,MAAMC,OAAO,CAAC9B,UAAUA,SAAS,EAAE;QAC3CK,cAAcA;QACdiB,UAAU;YAACA;SAAS;QACpBS,UAAUxC;QACVN,MAAMA;;0BAEN,QAACb;gBACC4B,QAAQ6B,MAAMC,OAAO,CAAC9B,UAAUA,SAAS,EAAE;gBAC3CgC,WAAW;gBACXC,iBAAgB;gBAChBC,YAAW;gBAAG,+DAA+D;gBAC7EC,kBAAkBzB;gBAClB0B,aAAa;gBACbjB,UAAU,CAACjB;;;;;;0BAEb,QAAC/B;0BAAYwB,EAAE;;;;;;;;;;;;AAGrB,EAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
3
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
4
4
|
import { useDocumentDrawer, useModal } from '@payloadcms/ui';
|
|
5
5
|
import { $getPreviousSelection, $getSelection, $setSelection } from 'lexical';
|
|
@@ -64,10 +64,14 @@ import { useCallback, useEffect, useState } from 'react';
|
|
|
64
64
|
closeDocumentDrawer,
|
|
65
65
|
DocumentDrawer,
|
|
66
66
|
documentDrawerSlug,
|
|
67
|
-
DocumentDrawerToggler: (props)=>/*#__PURE__*/
|
|
67
|
+
DocumentDrawerToggler: (props)=>/*#__PURE__*/ _jsxDEV(DocumentDrawerToggler, {
|
|
68
68
|
...props,
|
|
69
69
|
onClick: storeSelection
|
|
70
|
-
}
|
|
70
|
+
}, void 0, false, {
|
|
71
|
+
fileName: "src/utilities/fieldsDrawer/useLexicalDocumentDrawer.tsx",
|
|
72
|
+
lineNumber: 79,
|
|
73
|
+
columnNumber: 39
|
|
74
|
+
}, this)
|
|
71
75
|
};
|
|
72
76
|
};
|
|
73
77
|
|