@payloadcms/richtext-lexical 3.0.0-beta.134 → 3.0.0-beta.135
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/exports/client/Field-KKSJXHR7.js +2 -0
- package/dist/exports/client/Field-KKSJXHR7.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-QPPOQTHD.js +2 -0
- package/dist/exports/client/{chunk-OOBB5GCO.js.map → chunk-QPPOQTHD.js.map} +3 -3
- package/dist/exports/client/index.js +15 -13
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/server/ast/mdx.d.ts +7 -0
- package/dist/exports/server/ast/mdx.d.ts.map +1 -0
- package/dist/exports/server/ast/mdx.js +37 -0
- package/dist/exports/server/ast/mdx.js.map +1 -0
- package/dist/exports/shared.d.ts +4 -0
- package/dist/exports/shared.d.ts.map +1 -0
- package/dist/exports/shared.js +4 -0
- package/dist/exports/shared.js.map +1 -0
- package/dist/features/blocks/client/index.d.ts +1 -5
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +138 -154
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/client/markdownTransformer.d.ts +16 -0
- package/dist/features/blocks/client/markdownTransformer.d.ts.map +1 -0
- package/dist/features/blocks/client/markdownTransformer.js +144 -0
- package/dist/features/blocks/client/markdownTransformer.js.map +1 -0
- package/dist/features/blocks/client/plugin/index.d.ts +1 -2
- package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/index.js.map +1 -1
- package/dist/features/blocks/server/index.d.ts +1 -2
- package/dist/features/blocks/server/index.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +5 -8
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts +22 -0
- package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts.map +1 -0
- package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js +136 -0
- package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js.map +1 -0
- package/dist/features/blocks/server/markdownTransformer.d.ts +22 -0
- package/dist/features/blocks/server/markdownTransformer.d.ts.map +1 -0
- package/dist/features/blocks/server/markdownTransformer.js +400 -0
- package/dist/features/blocks/server/markdownTransformer.js.map +1 -0
- package/dist/features/experimental_table/client/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/index.js +2 -0
- package/dist/features/experimental_table/client/index.js.map +1 -1
- package/dist/features/experimental_table/markdownTransformer.d.ts +5 -0
- package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -0
- package/dist/features/experimental_table/markdownTransformer.js +127 -0
- package/dist/features/experimental_table/markdownTransformer.js.map +1 -0
- package/dist/features/experimental_table/server/index.d.ts.map +1 -1
- package/dist/features/experimental_table/server/index.js +2 -0
- package/dist/features/experimental_table/server/index.js.map +1 -1
- package/dist/features/typesClient.d.ts +11 -2
- package/dist/features/typesClient.d.ts.map +1 -1
- package/dist/features/typesClient.js.map +1 -1
- package/dist/features/typesServer.d.ts +6 -2
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +68 -164
- package/dist/field/Field.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +23 -14
- package/dist/field/index.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/config/client/loader.d.ts +6 -1
- package/dist/lexical/config/client/loader.d.ts.map +1 -1
- package/dist/lexical/config/client/loader.js +6 -0
- package/dist/lexical/config/client/loader.js.map +1 -1
- package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/client/sanitize.js +15 -2
- package/dist/lexical/config/client/sanitize.js.map +1 -1
- package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/server/sanitize.js +15 -2
- package/dist/lexical/config/server/sanitize.js.map +1 -1
- package/dist/lexical/nodes/index.d.ts +4 -0
- package/dist/lexical/nodes/index.d.ts.map +1 -1
- package/dist/lexical/nodes/index.js +8 -1
- package/dist/lexical/nodes/index.js.map +1 -1
- package/dist/lexical-proxy/@lexical-headless.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-headless.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-headless.js +2 -0
- package/dist/lexical-proxy/@lexical-headless.js.map +1 -0
- package/dist/lexical-proxy/@lexical-link.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-link.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-link.js +2 -0
- package/dist/lexical-proxy/@lexical-link.js.map +1 -0
- package/dist/lexical-proxy/@lexical-list.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-list.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-list.js +2 -0
- package/dist/lexical-proxy/@lexical-list.js.map +1 -0
- package/dist/lexical-proxy/@lexical-mark.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-mark.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-mark.js +2 -0
- package/dist/lexical-proxy/@lexical-mark.js.map +1 -0
- package/dist/lexical-proxy/@lexical-markdown.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-markdown.js +2 -0
- package/dist/lexical-proxy/@lexical-markdown.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalAutoEmbedPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalAutoFocusPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalAutoLinkPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalBlockWithAlignableContents.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCharacterLimitPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCheckListPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalClearEditorPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalClickableLinkPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCollaborationContext.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalCollaborationPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalComposer.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalComposer.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalComposer.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalComposer.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalComposerContext.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalContentEditable.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalDecoratorBlockNode.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalDraggableBlockPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalEditorRefPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalErrorBoundary.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHashtagPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHistoryPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRuleNode.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalHorizontalRulePlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalLinkPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalListPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalMarkdownShortcutPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNestedComposer.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNodeEventPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalNodeMenuPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalOnChangePlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalPlainTextPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalRichTextPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTabIndentationPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTableOfContentsPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTablePlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTreeView.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTreeView.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTreeView.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTreeView.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.js +2 -0
- package/dist/lexical-proxy/@lexical-react/LexicalTypeaheadMenuPlugin.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalEditable.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalEditable.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalEditable.js +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalEditable.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.js +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalIsTextContentEmpty.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.js +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalNodeSelection.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.js +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalSubscription.js.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.js +2 -0
- package/dist/lexical-proxy/@lexical-react/useLexicalTextEntity.js.map +1 -0
- package/dist/lexical-proxy/@lexical-rich-text.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-rich-text.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-rich-text.js +2 -0
- package/dist/lexical-proxy/@lexical-rich-text.js.map +1 -0
- package/dist/lexical-proxy/@lexical-selection.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-selection.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-selection.js +2 -0
- package/dist/lexical-proxy/@lexical-selection.js.map +1 -0
- package/dist/lexical-proxy/@lexical-utils.d.ts +2 -0
- package/dist/lexical-proxy/@lexical-utils.d.ts.map +1 -0
- package/dist/lexical-proxy/@lexical-utils.js +2 -0
- package/dist/lexical-proxy/@lexical-utils.js.map +1 -0
- package/dist/lexical-proxy/lexical.d.ts +2 -0
- package/dist/lexical-proxy/lexical.d.ts.map +1 -0
- package/dist/lexical-proxy/lexical.js +2 -0
- package/dist/lexical-proxy/lexical.js.map +1 -0
- package/dist/utilities/createClientFeature.d.ts +5 -0
- package/dist/utilities/createClientFeature.d.ts.map +1 -1
- package/dist/utilities/createClientFeature.js +6 -0
- package/dist/utilities/createClientFeature.js.map +1 -1
- package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
- package/dist/utilities/initLexicalFeatures.js +3 -2
- package/dist/utilities/initLexicalFeatures.js.map +1 -1
- package/dist/utilities/jsx/collectTopLevelJSXInLines.d.ts +52 -0
- package/dist/utilities/jsx/collectTopLevelJSXInLines.d.ts.map +1 -0
- package/dist/utilities/jsx/collectTopLevelJSXInLines.js +79 -0
- package/dist/utilities/jsx/collectTopLevelJSXInLines.js.map +1 -0
- package/dist/utilities/jsx/extractPropsFromJSXPropsString.d.ts +12 -0
- package/dist/utilities/jsx/extractPropsFromJSXPropsString.d.ts.map +1 -0
- package/dist/utilities/jsx/extractPropsFromJSXPropsString.js +125 -0
- package/dist/utilities/jsx/extractPropsFromJSXPropsString.js.map +1 -0
- package/dist/utilities/jsx/jsx.d.ts +26 -0
- package/dist/utilities/jsx/jsx.d.ts.map +1 -0
- package/dist/utilities/jsx/jsx.js +105 -0
- package/dist/utilities/jsx/jsx.js.map +1 -0
- package/dist/utilities/jsx/jsx.spec.d.ts +2 -0
- package/dist/utilities/jsx/jsx.spec.d.ts.map +1 -0
- package/dist/utilities/jsx/jsx.spec.js +142 -0
- package/dist/utilities/jsx/jsx.spec.js.map +1 -0
- package/dist/utilities/jsx/lexicalMarkdownCopy.d.ts +11 -0
- package/dist/utilities/jsx/lexicalMarkdownCopy.d.ts.map +1 -0
- package/dist/utilities/jsx/lexicalMarkdownCopy.js +61 -0
- package/dist/utilities/jsx/lexicalMarkdownCopy.js.map +1 -0
- package/package.json +284 -7
- package/dist/exports/client/Field-S5G27AVI.js +0 -2
- package/dist/exports/client/Field-S5G27AVI.js.map +0 -7
- package/dist/exports/client/chunk-OOBB5GCO.js +0 -2
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { fromMarkdown } from 'mdast-util-from-markdown';
|
|
2
|
+
export type AST = ReturnType<typeof fromMarkdown>;
|
|
3
|
+
export declare function parseJSXToAST({ jsxString, keepPositions, }: {
|
|
4
|
+
jsxString: string;
|
|
5
|
+
keepPositions?: boolean;
|
|
6
|
+
}): AST;
|
|
7
|
+
//# sourceMappingURL=mdx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../../../../src/exports/server/ast/mdx.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIvD,MAAM,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA;AAEjD,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,aAAa,GACd,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,GAAG,GAAG,CA6BN"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as acorn from 'acorn';
|
|
2
|
+
import { fromMarkdown } from 'mdast-util-from-markdown';
|
|
3
|
+
import { mdxJsxFromMarkdown } from 'mdast-util-mdx-jsx';
|
|
4
|
+
import { mdxJsx } from 'micromark-extension-mdx-jsx';
|
|
5
|
+
export function parseJSXToAST({
|
|
6
|
+
jsxString,
|
|
7
|
+
keepPositions
|
|
8
|
+
}) {
|
|
9
|
+
const treeComplex = fromMarkdown(jsxString, {
|
|
10
|
+
// @ts-expect-error
|
|
11
|
+
extensions: [mdxJsx({
|
|
12
|
+
acorn,
|
|
13
|
+
addResult: false
|
|
14
|
+
})],
|
|
15
|
+
mdastExtensions: [mdxJsxFromMarkdown()]
|
|
16
|
+
});
|
|
17
|
+
// Remove "position" keys
|
|
18
|
+
const parseTree = tree => {
|
|
19
|
+
for (const key in tree) {
|
|
20
|
+
if (key === 'position' && tree[key].start && tree[key].end) {
|
|
21
|
+
delete tree[key];
|
|
22
|
+
} else if (typeof tree[key] === 'object') {
|
|
23
|
+
parseTree(tree[key]);
|
|
24
|
+
} else if (Array.isArray(tree[key])) {
|
|
25
|
+
for (const item of tree[key]) {
|
|
26
|
+
parseTree(item);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const tree = treeComplex;
|
|
32
|
+
if (keepPositions !== true) {
|
|
33
|
+
parseTree(tree);
|
|
34
|
+
}
|
|
35
|
+
return tree;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=mdx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx.js","names":["acorn","fromMarkdown","mdxJsxFromMarkdown","mdxJsx","parseJSXToAST","jsxString","keepPositions","treeComplex","extensions","addResult","mdastExtensions","parseTree","tree","key","start","end","Array","isArray","item"],"sources":["../../../../src/exports/server/ast/mdx.ts"],"sourcesContent":["import * as acorn from 'acorn'\nimport { fromMarkdown } from 'mdast-util-from-markdown'\nimport { mdxJsxFromMarkdown } from 'mdast-util-mdx-jsx'\nimport { mdxJsx } from 'micromark-extension-mdx-jsx'\n\nexport type AST = ReturnType<typeof fromMarkdown>\n\nexport function parseJSXToAST({\n jsxString,\n keepPositions,\n}: {\n jsxString: string\n keepPositions?: boolean\n}): AST {\n const treeComplex: AST = fromMarkdown(jsxString, {\n // @ts-expect-error\n extensions: [mdxJsx({ acorn, addResult: false })],\n mdastExtensions: [mdxJsxFromMarkdown()],\n })\n\n // Remove \"position\" keys\n const parseTree = (tree: object) => {\n for (const key in tree) {\n if (key === 'position' && tree[key].start && tree[key].end) {\n delete tree[key]\n } else if (typeof tree[key] === 'object') {\n parseTree(tree[key])\n } else if (Array.isArray(tree[key])) {\n for (const item of tree[key]) {\n parseTree(item)\n }\n }\n }\n }\n\n const tree: AST = treeComplex\n\n if (keepPositions !== true) {\n parseTree(tree)\n }\n\n return tree\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,YAAY,QAAQ;AAC7B,SAASC,kBAAkB,QAAQ;AACnC,SAASC,MAAM,QAAQ;AAIvB,OAAO,SAASC,cAAc;EAC5BC,SAAS;EACTC;AAAa,CAId;EACC,MAAMC,WAAA,GAAmBN,YAAA,CAAaI,SAAA,EAAW;IAC/C;IACAG,UAAA,EAAY,CAACL,MAAA,CAAO;MAAEH,KAAA;MAAOS,SAAA,EAAW;IAAM,GAAG;IACjDC,eAAA,EAAiB,CAACR,kBAAA;EACpB;EAEA;EACA,MAAMS,SAAA,GAAaC,IAAA;IACjB,KAAK,MAAMC,GAAA,IAAOD,IAAA,EAAM;MACtB,IAAIC,GAAA,KAAQ,cAAcD,IAAI,CAACC,GAAA,CAAI,CAACC,KAAK,IAAIF,IAAI,CAACC,GAAA,CAAI,CAACE,GAAG,EAAE;QAC1D,OAAOH,IAAI,CAACC,GAAA,CAAI;MAClB,OAAO,IAAI,OAAOD,IAAI,CAACC,GAAA,CAAI,KAAK,UAAU;QACxCF,SAAA,CAAUC,IAAI,CAACC,GAAA,CAAI;MACrB,OAAO,IAAIG,KAAA,CAAMC,OAAO,CAACL,IAAI,CAACC,GAAA,CAAI,GAAG;QACnC,KAAK,MAAMK,IAAA,IAAQN,IAAI,CAACC,GAAA,CAAI,EAAE;UAC5BF,SAAA,CAAUO,IAAA;QACZ;MACF;IACF;EACF;EAEA,MAAMN,IAAA,GAAYL,WAAA;EAElB,IAAID,aAAA,KAAkB,MAAM;IAC1BK,SAAA,CAAUC,IAAA;EACZ;EAEA,OAAOA,IAAA;AACT","ignoreList":[]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { collectTopLevelJSXInLines } from '../utilities/jsx/collectTopLevelJSXInLines.js';
|
|
2
|
+
export { extractPropsFromJSXPropsString } from '../utilities/jsx/extractPropsFromJSXPropsString.js';
|
|
3
|
+
export { extractFrontmatter, frontmatterToObject, objectToFrontmatter, propsToJSXString, } from '../utilities/jsx/jsx.js';
|
|
4
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/exports/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAA;AAEzF,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAA;AACnG,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { collectTopLevelJSXInLines } from '../utilities/jsx/collectTopLevelJSXInLines.js';
|
|
2
|
+
export { extractPropsFromJSXPropsString } from '../utilities/jsx/extractPropsFromJSXPropsString.js';
|
|
3
|
+
export { extractFrontmatter, frontmatterToObject, objectToFrontmatter, propsToJSXString } from '../utilities/jsx/jsx.js';
|
|
4
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","names":["collectTopLevelJSXInLines","extractPropsFromJSXPropsString","extractFrontmatter","frontmatterToObject","objectToFrontmatter","propsToJSXString"],"sources":["../../src/exports/shared.ts"],"sourcesContent":["export { collectTopLevelJSXInLines } from '../utilities/jsx/collectTopLevelJSXInLines.js'\n\nexport { extractPropsFromJSXPropsString } from '../utilities/jsx/extractPropsFromJSXPropsString.js'\nexport {\n extractFrontmatter,\n frontmatterToObject,\n objectToFrontmatter,\n propsToJSXString,\n} from '../utilities/jsx/jsx.js'\n"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ;AAE1C,SAASC,8BAA8B,QAAQ;AAC/C,SACEC,kBAAkB,EAClBC,mBAAmB,EACnBC,mBAAmB,EACnBC,gBAAgB,QACX","ignoreList":[]}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
clientBlockSlugs: string[];
|
|
3
|
-
clientInlineBlockSlugs: string[];
|
|
4
|
-
};
|
|
5
|
-
export declare const BlocksFeatureClient: import("../../typesClient.js").FeatureProviderProviderClient<BlocksFeatureClientProps, UnSanitizedClientProps>;
|
|
1
|
+
export declare const BlocksFeatureClient: import("../../typesClient.js").FeatureProviderProviderClient<undefined, any>;
|
|
6
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/blocks/client/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/blocks/client/index.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,mBAAmB,8EAmK/B,CAAA"}
|
|
@@ -8,161 +8,145 @@ import { BlockNode } from './nodes/BlocksNode.js';
|
|
|
8
8
|
import { InlineBlockNode } from './nodes/InlineBlocksNode.js';
|
|
9
9
|
import { INSERT_BLOCK_COMMAND, INSERT_INLINE_BLOCK_COMMAND } from './plugin/commands.js';
|
|
10
10
|
import { BlocksPlugin } from './plugin/index.js';
|
|
11
|
-
// @ts-expect-error - TODO: fix this
|
|
12
11
|
export const BlocksFeatureClient = createClientFeature(({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
featureClientSchemaMap,
|
|
13
|
+
props,
|
|
14
|
+
schemaPath
|
|
15
|
+
}) => {
|
|
16
|
+
const schemaMapRenderedBlockPathPrefix = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks`;
|
|
17
|
+
const schemaMapRenderedInlineBlockPathPrefix = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks`;
|
|
18
|
+
const clientSchema = featureClientSchemaMap['blocks'];
|
|
19
|
+
const blocksFields = Object.entries(clientSchema).filter(([key]) => key.startsWith(schemaMapRenderedBlockPathPrefix + '.') && !key.replace(schemaMapRenderedBlockPathPrefix + '.', '').includes('.')).map(([key, value]) => value[0]);
|
|
20
|
+
const inlineBlocksFields = Object.entries(clientSchema).filter(([key]) => key.startsWith(schemaMapRenderedInlineBlockPathPrefix + '.') && !key.replace(schemaMapRenderedInlineBlockPathPrefix + '.', '').includes('.')).map(([key, value]) => value[0]);
|
|
21
|
+
const clientBlocks = blocksFields.map(field => {
|
|
22
|
+
return field.blocks[0];
|
|
23
|
+
});
|
|
24
|
+
const clientInlineBlocks = inlineBlocksFields.map(field => {
|
|
25
|
+
return field.blocks[0];
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
nodes: [BlockNode, InlineBlockNode],
|
|
29
|
+
plugins: [{
|
|
30
|
+
Component: BlocksPlugin,
|
|
31
|
+
position: 'normal'
|
|
32
|
+
}],
|
|
33
|
+
sanitizedClientFeatureProps: props,
|
|
34
|
+
slashMenu: {
|
|
35
|
+
groups: [clientBlocks?.length ? {
|
|
36
|
+
items: clientBlocks.map(block => {
|
|
37
|
+
return {
|
|
38
|
+
Icon: BlockIcon,
|
|
39
|
+
key: 'block-' + block.slug,
|
|
40
|
+
keywords: ['block', 'blocks', block.slug],
|
|
41
|
+
label: ({
|
|
42
|
+
i18n
|
|
43
|
+
}) => {
|
|
44
|
+
const blockDisplayName = block?.labels?.singular ? getTranslation(block.labels.singular, i18n) : block?.slug;
|
|
45
|
+
return blockDisplayName;
|
|
46
|
+
},
|
|
47
|
+
onSelect: ({
|
|
48
|
+
editor
|
|
49
|
+
}) => {
|
|
50
|
+
editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
|
|
51
|
+
blockName: '',
|
|
52
|
+
blockType: block.slug
|
|
53
|
+
});
|
|
35
54
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
key: 'inlineBlocks-' + inlineBlockSlug,
|
|
64
|
-
keywords: ['inlineBlock', 'inline block', inlineBlockSlug],
|
|
65
|
-
label: ({
|
|
66
|
-
featureClientSchemaMap,
|
|
67
|
-
i18n,
|
|
68
|
-
schemaPath
|
|
69
|
-
}) => {
|
|
70
|
-
const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${inlineBlockSlug}`;
|
|
71
|
-
const clientSchemaMap = featureClientSchemaMap['blocks'];
|
|
72
|
-
const blocksField = clientSchemaMap[componentMapRenderedBlockPath][0];
|
|
73
|
-
const clientBlock = blocksField.blocks[0];
|
|
74
|
-
const blockDisplayName = clientBlock?.labels?.singular ? getTranslation(clientBlock.labels.singular, i18n) : clientBlock?.slug;
|
|
75
|
-
return blockDisplayName;
|
|
76
|
-
},
|
|
77
|
-
onSelect: ({
|
|
78
|
-
editor
|
|
79
|
-
}) => {
|
|
80
|
-
editor.dispatchCommand(INSERT_INLINE_BLOCK_COMMAND, {
|
|
81
|
-
blockName: '',
|
|
82
|
-
blockType: inlineBlockSlug
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}),
|
|
87
|
-
key: 'inlineBlocks',
|
|
88
|
-
label: ({
|
|
89
|
-
i18n
|
|
90
|
-
}) => {
|
|
91
|
-
return i18n.t('lexical:blocks:inlineBlocks:label');
|
|
92
|
-
}
|
|
93
|
-
} : null].filter(Boolean)
|
|
94
|
-
},
|
|
95
|
-
toolbarFixed: {
|
|
96
|
-
groups: [props.clientBlockSlugs?.length ? {
|
|
97
|
-
type: 'dropdown',
|
|
98
|
-
ChildComponent: BlockIcon,
|
|
99
|
-
items: props.clientBlockSlugs.map((blockSlug, index) => {
|
|
100
|
-
return {
|
|
101
|
-
ChildComponent: BlockIcon,
|
|
102
|
-
isActive: undefined,
|
|
103
|
-
key: 'block-' + blockSlug,
|
|
104
|
-
label: ({
|
|
105
|
-
featureClientSchemaMap,
|
|
106
|
-
i18n,
|
|
107
|
-
schemaPath
|
|
108
|
-
}) => {
|
|
109
|
-
const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockSlug}`;
|
|
110
|
-
const clientSchemaMap = featureClientSchemaMap['blocks'];
|
|
111
|
-
const blocksField = clientSchemaMap[componentMapRenderedBlockPath][0];
|
|
112
|
-
const clientBlock = blocksField.blocks[0];
|
|
113
|
-
const blockDisplayName = clientBlock?.labels?.singular ? getTranslation(clientBlock.labels.singular, i18n) : clientBlock?.slug;
|
|
114
|
-
return blockDisplayName;
|
|
115
|
-
},
|
|
116
|
-
onSelect: ({
|
|
117
|
-
editor
|
|
118
|
-
}) => {
|
|
119
|
-
editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
|
|
120
|
-
blockName: '',
|
|
121
|
-
blockType: blockSlug
|
|
122
|
-
});
|
|
123
|
-
},
|
|
124
|
-
order: index
|
|
125
|
-
};
|
|
126
|
-
}),
|
|
127
|
-
key: 'blocks',
|
|
128
|
-
order: 20
|
|
129
|
-
} : null, props.clientInlineBlockSlugs?.length ? {
|
|
130
|
-
type: 'dropdown',
|
|
131
|
-
ChildComponent: InlineBlocksIcon,
|
|
132
|
-
items: props.clientInlineBlockSlugs.map((inlineBlockSlug, index) => {
|
|
133
|
-
return {
|
|
134
|
-
ChildComponent: InlineBlocksIcon,
|
|
135
|
-
isActive: undefined,
|
|
136
|
-
key: 'inlineBlock-' + inlineBlockSlug,
|
|
137
|
-
label: ({
|
|
138
|
-
featureClientSchemaMap,
|
|
139
|
-
i18n,
|
|
140
|
-
schemaPath
|
|
141
|
-
}) => {
|
|
142
|
-
if (!featureClientSchemaMap) {
|
|
143
|
-
return inlineBlockSlug;
|
|
55
|
+
};
|
|
56
|
+
}),
|
|
57
|
+
key: 'blocks',
|
|
58
|
+
label: ({
|
|
59
|
+
i18n
|
|
60
|
+
}) => {
|
|
61
|
+
return i18n.t('lexical:blocks:label');
|
|
62
|
+
}
|
|
63
|
+
} : null, clientInlineBlocks?.length ? {
|
|
64
|
+
items: clientInlineBlocks.map(inlineBlock => {
|
|
65
|
+
return {
|
|
66
|
+
Icon: InlineBlocksIcon,
|
|
67
|
+
key: 'inlineBlocks-' + inlineBlock.slug,
|
|
68
|
+
keywords: ['inlineBlock', 'inline block', inlineBlock.slug],
|
|
69
|
+
label: ({
|
|
70
|
+
i18n
|
|
71
|
+
}) => {
|
|
72
|
+
const blockDisplayName = inlineBlock?.labels?.singular ? getTranslation(inlineBlock.labels.singular, i18n) : inlineBlock?.slug;
|
|
73
|
+
return blockDisplayName;
|
|
74
|
+
},
|
|
75
|
+
onSelect: ({
|
|
76
|
+
editor
|
|
77
|
+
}) => {
|
|
78
|
+
editor.dispatchCommand(INSERT_INLINE_BLOCK_COMMAND, {
|
|
79
|
+
blockName: '',
|
|
80
|
+
blockType: inlineBlock.slug
|
|
81
|
+
});
|
|
144
82
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
83
|
+
};
|
|
84
|
+
}),
|
|
85
|
+
key: 'inlineBlocks',
|
|
86
|
+
label: ({
|
|
87
|
+
i18n
|
|
88
|
+
}) => {
|
|
89
|
+
return i18n.t('lexical:blocks:inlineBlocks:label');
|
|
90
|
+
}
|
|
91
|
+
} : null].filter(Boolean)
|
|
92
|
+
},
|
|
93
|
+
toolbarFixed: {
|
|
94
|
+
groups: [clientBlocks.length ? {
|
|
95
|
+
type: 'dropdown',
|
|
96
|
+
ChildComponent: BlockIcon,
|
|
97
|
+
items: clientBlocks.map((block, index) => {
|
|
98
|
+
return {
|
|
99
|
+
ChildComponent: BlockIcon,
|
|
100
|
+
isActive: undefined,
|
|
101
|
+
key: 'block-' + block.slug,
|
|
102
|
+
label: ({
|
|
103
|
+
i18n
|
|
104
|
+
}) => {
|
|
105
|
+
const blockDisplayName = block?.labels?.singular ? getTranslation(block.labels.singular, i18n) : block?.slug;
|
|
106
|
+
return blockDisplayName;
|
|
107
|
+
},
|
|
108
|
+
onSelect: ({
|
|
109
|
+
editor
|
|
110
|
+
}) => {
|
|
111
|
+
editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
|
|
112
|
+
blockName: '',
|
|
113
|
+
blockType: block.slug
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
order: index
|
|
117
|
+
};
|
|
118
|
+
}),
|
|
119
|
+
key: 'blocks',
|
|
120
|
+
order: 20
|
|
121
|
+
} : null, clientInlineBlocks?.length ? {
|
|
122
|
+
type: 'dropdown',
|
|
123
|
+
ChildComponent: InlineBlocksIcon,
|
|
124
|
+
items: clientInlineBlocks.map((inlineBlock, index) => {
|
|
125
|
+
return {
|
|
126
|
+
ChildComponent: InlineBlocksIcon,
|
|
127
|
+
isActive: undefined,
|
|
128
|
+
key: 'inlineBlock-' + inlineBlock.slug,
|
|
129
|
+
label: ({
|
|
130
|
+
i18n
|
|
131
|
+
}) => {
|
|
132
|
+
const blockDisplayName = inlineBlock?.labels?.singular ? getTranslation(inlineBlock.labels.singular, i18n) : inlineBlock?.slug;
|
|
133
|
+
return blockDisplayName;
|
|
134
|
+
},
|
|
135
|
+
onSelect: ({
|
|
136
|
+
editor
|
|
137
|
+
}) => {
|
|
138
|
+
editor.dispatchCommand(INSERT_INLINE_BLOCK_COMMAND, {
|
|
139
|
+
blockName: '',
|
|
140
|
+
blockType: inlineBlock.slug
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
order: index
|
|
144
|
+
};
|
|
145
|
+
}),
|
|
146
|
+
key: 'inlineBlocks',
|
|
147
|
+
order: 25
|
|
148
|
+
} : null].filter(Boolean)
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
});
|
|
168
152
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","BlockIcon","InlineBlocksIcon","createClientFeature","BlockNode","InlineBlockNode","INSERT_BLOCK_COMMAND","INSERT_INLINE_BLOCK_COMMAND","BlocksPlugin","BlocksFeatureClient","props","nodes","plugins","Component","position","sanitizedClientFeatureProps","slashMenu","groups","clientBlockSlugs","length","items","map","blockSlug","Icon","key","keywords","label","featureClientSchemaMap","i18n","schemaPath","componentMapRenderedBlockPath","clientSchemaMap","blocksField","clientBlock","blocks","blockDisplayName","labels","singular","slug","onSelect","editor","dispatchCommand","blockName","blockType","t","clientInlineBlockSlugs","inlineBlockSlug","filter","Boolean","toolbarFixed","type","ChildComponent","index","isActive","undefined","order"],"sources":["../../../../src/features/blocks/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlocksFieldClient } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { SlashMenuItem } from '../../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport type { ToolbarGroup, ToolbarGroupItem } from '../../toolbars/types.js'\n\nimport { BlockIcon } from '../../../lexical/ui/icons/Block/index.js'\nimport { InlineBlocksIcon } from '../../../lexical/ui/icons/InlineBlocks/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { InlineBlockNode } from './nodes/InlineBlocksNode.js'\nimport { INSERT_BLOCK_COMMAND, INSERT_INLINE_BLOCK_COMMAND } from './plugin/commands.js'\nimport { BlocksPlugin } from './plugin/index.js'\n\nexport type BlocksFeatureClientProps = {\n clientBlockSlugs: string[]\n clientInlineBlockSlugs: string[]\n}\n// @ts-expect-error - TODO: fix this\nexport const BlocksFeatureClient = createClientFeature<BlocksFeatureClientProps>(({ props }) => ({\n nodes: [BlockNode, InlineBlockNode],\n plugins: [\n {\n Component: BlocksPlugin,\n position: 'normal',\n },\n ],\n sanitizedClientFeatureProps: props,\n slashMenu: {\n groups: [\n props.clientBlockSlugs?.length\n ? {\n items: props.clientBlockSlugs.map((blockSlug) => {\n return {\n Icon: BlockIcon,\n key: 'block-' + blockSlug,\n keywords: ['block', 'blocks', blockSlug],\n label: ({ featureClientSchemaMap, i18n, schemaPath }) => {\n if (!featureClientSchemaMap) {\n return blockSlug\n }\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockSlug}`\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap[\n componentMapRenderedBlockPath\n ][0] as BlocksFieldClient\n\n const clientBlock = blocksField.blocks[0]\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n blockName: '',\n blockType: blockSlug,\n })\n },\n } as SlashMenuItem\n }),\n key: 'blocks',\n label: ({ i18n }) => {\n return i18n.t('lexical:blocks:label')\n },\n }\n : null,\n props.clientInlineBlockSlugs?.length\n ? {\n items: props.clientInlineBlockSlugs.map((inlineBlockSlug) => {\n return {\n Icon: InlineBlocksIcon,\n key: 'inlineBlocks-' + inlineBlockSlug,\n keywords: ['inlineBlock', 'inline block', inlineBlockSlug],\n label: ({ featureClientSchemaMap, i18n, schemaPath }) => {\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${inlineBlockSlug}`\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap[\n componentMapRenderedBlockPath\n ][0] as BlocksFieldClient\n\n const clientBlock = blocksField.blocks[0]\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_INLINE_BLOCK_COMMAND, {\n blockName: '',\n blockType: inlineBlockSlug,\n })\n },\n } as SlashMenuItem\n }),\n key: 'inlineBlocks',\n label: ({ i18n }) => {\n return i18n.t('lexical:blocks:inlineBlocks:label')\n },\n }\n : null,\n ].filter(Boolean),\n },\n toolbarFixed: {\n groups: [\n props.clientBlockSlugs?.length\n ? {\n type: 'dropdown',\n ChildComponent: BlockIcon,\n items: props.clientBlockSlugs.map((blockSlug, index) => {\n return {\n ChildComponent: BlockIcon,\n isActive: undefined, // At this point, we would be inside a sub-richtext-editor. And at this point this will be run against the focused sub-editor, not the parent editor which has the actual block. Thus, no point in running this\n key: 'block-' + blockSlug,\n label: ({ featureClientSchemaMap, i18n, schemaPath }) => {\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockSlug}`\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap[\n componentMapRenderedBlockPath\n ][0] as BlocksFieldClient\n\n const clientBlock = blocksField.blocks[0]\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n blockName: '',\n blockType: blockSlug,\n })\n },\n order: index,\n } as ToolbarGroupItem\n }),\n key: 'blocks',\n order: 20,\n }\n : null,\n props.clientInlineBlockSlugs?.length\n ? {\n type: 'dropdown',\n ChildComponent: InlineBlocksIcon,\n items: props.clientInlineBlockSlugs.map((inlineBlockSlug, index) => {\n return {\n ChildComponent: InlineBlocksIcon,\n isActive: undefined,\n key: 'inlineBlock-' + inlineBlockSlug,\n label: ({ featureClientSchemaMap, i18n, schemaPath }) => {\n if (!featureClientSchemaMap) {\n return inlineBlockSlug\n }\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${inlineBlockSlug}`\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap[\n componentMapRenderedBlockPath\n ][0] as BlocksFieldClient\n\n const clientBlock = blocksField.blocks[0]\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_INLINE_BLOCK_COMMAND, {\n blockName: '',\n blockType: inlineBlockSlug,\n })\n },\n order: index,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
{"version":3,"file":"index.js","names":["getTranslation","BlockIcon","InlineBlocksIcon","createClientFeature","BlockNode","InlineBlockNode","INSERT_BLOCK_COMMAND","INSERT_INLINE_BLOCK_COMMAND","BlocksPlugin","BlocksFeatureClient","featureClientSchemaMap","props","schemaPath","schemaMapRenderedBlockPathPrefix","schemaMapRenderedInlineBlockPathPrefix","clientSchema","blocksFields","Object","entries","filter","key","startsWith","replace","includes","map","value","inlineBlocksFields","clientBlocks","field","blocks","clientInlineBlocks","nodes","plugins","Component","position","sanitizedClientFeatureProps","slashMenu","groups","length","items","block","Icon","slug","keywords","label","i18n","blockDisplayName","labels","singular","onSelect","editor","dispatchCommand","blockName","blockType","t","inlineBlock","Boolean","toolbarFixed","type","ChildComponent","index","isActive","undefined","order"],"sources":["../../../../src/features/blocks/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlocksFieldClient, ClientBlock } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type {\n SlashMenuGroup,\n SlashMenuItem,\n} from '../../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport type { ToolbarGroup, ToolbarGroupItem } from '../../toolbars/types.js'\n\nimport { BlockIcon } from '../../../lexical/ui/icons/Block/index.js'\nimport { InlineBlocksIcon } from '../../../lexical/ui/icons/InlineBlocks/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { InlineBlockNode } from './nodes/InlineBlocksNode.js'\nimport { INSERT_BLOCK_COMMAND, INSERT_INLINE_BLOCK_COMMAND } from './plugin/commands.js'\nimport { BlocksPlugin } from './plugin/index.js'\n\nexport const BlocksFeatureClient = createClientFeature(\n ({ featureClientSchemaMap, props, schemaPath }) => {\n const schemaMapRenderedBlockPathPrefix = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks`\n const schemaMapRenderedInlineBlockPathPrefix = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks`\n const clientSchema = featureClientSchemaMap['blocks']\n\n const blocksFields: BlocksFieldClient[] = Object.entries(clientSchema)\n .filter(\n ([key]) =>\n key.startsWith(schemaMapRenderedBlockPathPrefix + '.') &&\n !key.replace(schemaMapRenderedBlockPathPrefix + '.', '').includes('.'),\n )\n .map(([key, value]) => value[0] as BlocksFieldClient)\n\n const inlineBlocksFields: BlocksFieldClient[] = Object.entries(clientSchema)\n .filter(\n ([key]) =>\n key.startsWith(schemaMapRenderedInlineBlockPathPrefix + '.') &&\n !key.replace(schemaMapRenderedInlineBlockPathPrefix + '.', '').includes('.'),\n )\n .map(([key, value]) => value[0] as BlocksFieldClient)\n\n const clientBlocks: ClientBlock[] = blocksFields.map((field) => {\n return field.blocks[0]\n })\n\n const clientInlineBlocks: ClientBlock[] = inlineBlocksFields.map((field) => {\n return field.blocks[0]\n })\n\n return {\n nodes: [BlockNode, InlineBlockNode],\n plugins: [\n {\n Component: BlocksPlugin,\n position: 'normal',\n },\n ],\n sanitizedClientFeatureProps: props,\n slashMenu: {\n groups: [\n clientBlocks?.length\n ? {\n items: clientBlocks.map((block) => {\n return {\n Icon: BlockIcon,\n key: 'block-' + block.slug,\n keywords: ['block', 'blocks', block.slug],\n label: ({ i18n }) => {\n const blockDisplayName = block?.labels?.singular\n ? getTranslation(block.labels.singular, i18n)\n : block?.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n blockName: '',\n blockType: block.slug,\n })\n },\n } as SlashMenuItem\n }),\n key: 'blocks',\n label: ({ i18n }) => {\n return i18n.t('lexical:blocks:label')\n },\n }\n : null,\n clientInlineBlocks?.length\n ? {\n items: clientInlineBlocks.map((inlineBlock) => {\n return {\n Icon: InlineBlocksIcon,\n key: 'inlineBlocks-' + inlineBlock.slug,\n keywords: ['inlineBlock', 'inline block', inlineBlock.slug],\n label: ({ i18n }) => {\n const blockDisplayName = inlineBlock?.labels?.singular\n ? getTranslation(inlineBlock.labels.singular, i18n)\n : inlineBlock?.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_INLINE_BLOCK_COMMAND, {\n blockName: '',\n blockType: inlineBlock.slug,\n })\n },\n } as SlashMenuItem\n }),\n key: 'inlineBlocks',\n label: ({ i18n }) => {\n return i18n.t('lexical:blocks:inlineBlocks:label')\n },\n }\n : null,\n ].filter(Boolean) as SlashMenuGroup[],\n },\n toolbarFixed: {\n groups: [\n clientBlocks.length\n ? {\n type: 'dropdown',\n ChildComponent: BlockIcon,\n items: clientBlocks.map((block, index) => {\n return {\n ChildComponent: BlockIcon,\n isActive: undefined, // At this point, we would be inside a sub-richtext-editor. And at this point this will be run against the focused sub-editor, not the parent editor which has the actual block. Thus, no point in running this\n key: 'block-' + block.slug,\n label: ({ i18n }) => {\n const blockDisplayName = block?.labels?.singular\n ? getTranslation(block.labels.singular, i18n)\n : block?.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n blockName: '',\n blockType: block.slug,\n })\n },\n order: index,\n } as ToolbarGroupItem\n }),\n key: 'blocks',\n order: 20,\n }\n : null,\n clientInlineBlocks?.length\n ? {\n type: 'dropdown',\n ChildComponent: InlineBlocksIcon,\n items: clientInlineBlocks.map((inlineBlock, index) => {\n return {\n ChildComponent: InlineBlocksIcon,\n isActive: undefined,\n key: 'inlineBlock-' + inlineBlock.slug,\n label: ({ i18n }) => {\n const blockDisplayName = inlineBlock?.labels?.singular\n ? getTranslation(inlineBlock.labels.singular, i18n)\n : inlineBlock?.slug\n\n return blockDisplayName\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_INLINE_BLOCK_COMMAND, {\n blockName: '',\n blockType: inlineBlock.slug,\n })\n },\n order: index,\n } as ToolbarGroupItem\n }),\n key: 'inlineBlocks',\n order: 25,\n }\n : null,\n ].filter(Boolean) as ToolbarGroup[],\n },\n }\n },\n)\n"],"mappings":"AAAA;;AAIA,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AA,EAAsB;gBAC3C8C,SAAA,EAAW;gBACXC,SAAA,EAAWb,KAAA,CAAME;cACnB;YACF;YACAqB,KAAA,EAAOH;UACT;QACF;QACAxC,GAAA,EAAK;QACL2C,KAAA,EAAO;MACT,IACA,MACJjC,kBAAA,EAAoBQ,MAAA,GAChB;QACEoB,IAAA,EAAM;QACNC,cAAA,EAAgBzD,gBAAA;QAChBqC,KAAA,EAAOT,kBAAA,CAAmBN,GAAG,CAAC,CAAC+B,WAAA,EAAaK,KAAA;UAC1C,OAAO;YACLD,cAAA,EAAgBzD,gBAAA;YAChB2D,QAAA,EAAUC,SAAA;YACV1C,GAAA,EAAK,iBAAiBmC,WAAA,CAAYb,IAAI;YACtCE,KAAA,EAAOA,CAAC;cAAEC;YAAI,CAAE;cACd,MAAMC,gBAAA,GAAmBS,WAAA,EAAaR,MAAA,EAAQC,QAAA,GAC1ChD,cAAA,CAAeuD,WAAA,CAAYR,MAAM,CAACC,QAAQ,EAAEH,IAAA,IAC5CU,WAAA,EAAab,IAAA;cAEjB,OAAOI,gBAAA;YACT;YACAG,QAAA,EAAUA,CAAC;cAAEC;YAAM,CAAE;cACnBA,MAAA,CAAOC,eAAe,CAAC5C,2BAAA,EAA6B;gBAClD6C,SAAA,EAAW;gBACXC,SAAA,EAAWE,WAAA,CAAYb;cACzB;YACF;YACAqB,KAAA,EAAOH;UACT;QACF;QACAxC,GAAA,EAAK;QACL2C,KAAA,EAAO;MACT,IACA,KACL,CAAC5C,MAAM,CAACqC,OAAA;IACX;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MultilineElementTransformer, Transformer } from '@lexical/markdown';
|
|
2
|
+
import type { Klass, LexicalNode, LexicalNodeReplacement, SerializedEditorState } from 'lexical';
|
|
3
|
+
import type { ClientBlock } from 'payload';
|
|
4
|
+
export declare const getBlockMarkdownTransformers: ({ blocks, }: {
|
|
5
|
+
blocks: ClientBlock[];
|
|
6
|
+
}) => ((props: {
|
|
7
|
+
allNodes: Array<Klass<LexicalNode> | LexicalNodeReplacement>;
|
|
8
|
+
allTransformers: Transformer[];
|
|
9
|
+
}) => MultilineElementTransformer)[];
|
|
10
|
+
export declare function getMarkdownToLexical(allNodes: Array<Klass<LexicalNode> | LexicalNodeReplacement>, allTransformers: Transformer[]): (args: {
|
|
11
|
+
markdown: string;
|
|
12
|
+
}) => SerializedEditorState;
|
|
13
|
+
export declare function getLexicalToMarkdown(allNodes: Array<Klass<LexicalNode> | LexicalNodeReplacement>, allTransformers: Transformer[]): (args: {
|
|
14
|
+
editorState: Record<string, any>;
|
|
15
|
+
}) => string;
|
|
16
|
+
//# sourceMappingURL=markdownTransformer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../../src/features/blocks/client/markdownTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAgB1C,eAAO,MAAM,4BAA4B,gBAEtC;IACD,MAAM,EAAE,WAAW,EAAE,CAAA;CACtB,KAAG,CAAC,CAAC,KAAK,EAAE;IACX,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,CAAA;IAC5D,eAAe,EAAE,WAAW,EAAE,CAAA;CAC/B,KAAK,2BAA2B,CAAC,EAqGjC,CAAA;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,EAC5D,eAAe,EAAE,WAAW,EAAE,GAC7B,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,KAAK,qBAAqB,CAkBvD;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,EAC5D,eAAe,EAAE,WAAW,EAAE,GAC7B,CAAC,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,KAAK,MAAM,CAoBxD"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { createHeadlessEditor } from '@lexical/headless';
|
|
2
|
+
import { $convertFromMarkdownString, $convertToMarkdownString } from '@lexical/markdown';
|
|
3
|
+
import { extractPropsFromJSXPropsString } from '../../../utilities/jsx/extractPropsFromJSXPropsString.js';
|
|
4
|
+
import { propsToJSXString } from '../../../utilities/jsx/jsx.js';
|
|
5
|
+
import { $createBlockNode, $isBlockNode, BlockNode } from './nodes/BlocksNode.js';
|
|
6
|
+
function createTagRegexes(tagName) {
|
|
7
|
+
const escapedTagName = tagName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
8
|
+
return {
|
|
9
|
+
regExpEnd: new RegExp(`</(${escapedTagName})\\s*>|<${escapedTagName}[^>]*?/>`, 'i'),
|
|
10
|
+
regExpStart: new RegExp(`<(${escapedTagName})([^>]*?)\\s*(/?)>`, 'i')
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export const getBlockMarkdownTransformers = ({
|
|
14
|
+
blocks
|
|
15
|
+
}) => {
|
|
16
|
+
if (!blocks?.length) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
const transformers = [];
|
|
20
|
+
for (const block of blocks) {
|
|
21
|
+
if (!block.jsx) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const regex = createTagRegexes(block.slug);
|
|
25
|
+
transformers.push(({
|
|
26
|
+
allNodes,
|
|
27
|
+
allTransformers
|
|
28
|
+
}) => ({
|
|
29
|
+
type: 'multiline-element',
|
|
30
|
+
dependencies: [BlockNode],
|
|
31
|
+
export: node => {
|
|
32
|
+
if (!$isBlockNode(node)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
if (node.getFields()?.blockType?.toLowerCase() !== block.slug.toLowerCase()) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const nodeFields = node.getFields();
|
|
39
|
+
const lexicalToMarkdown = getLexicalToMarkdown(allNodes, allTransformers);
|
|
40
|
+
const exportResult = block.jsx.export({
|
|
41
|
+
fields: nodeFields,
|
|
42
|
+
lexicalToMarkdown
|
|
43
|
+
});
|
|
44
|
+
if (exportResult === false) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
if (typeof exportResult === 'string') {
|
|
48
|
+
return exportResult;
|
|
49
|
+
}
|
|
50
|
+
if (exportResult?.children?.length) {
|
|
51
|
+
return `<${nodeFields.blockType}${exportResult.props ? ' ' + propsToJSXString({
|
|
52
|
+
props: exportResult.props
|
|
53
|
+
}) : ''}>\n ${exportResult.children}\n</${nodeFields.blockType}>`;
|
|
54
|
+
}
|
|
55
|
+
return `<${nodeFields.blockType}${exportResult.props ? ' ' + propsToJSXString({
|
|
56
|
+
props: exportResult.props
|
|
57
|
+
}) : ''}/>`;
|
|
58
|
+
},
|
|
59
|
+
regExpEnd: block.jsx?.customEndRegex ?? regex.regExpEnd,
|
|
60
|
+
regExpStart: block.jsx?.customStartRegex ?? regex.regExpStart,
|
|
61
|
+
replace: (rootNode, children, openMatch, closeMatch, linesInBetween) => {
|
|
62
|
+
if (block?.jsx?.import) {
|
|
63
|
+
if (!linesInBetween) {
|
|
64
|
+
// convert children to linesInBetween
|
|
65
|
+
let line = '';
|
|
66
|
+
if (children) {
|
|
67
|
+
for (const child of children) {
|
|
68
|
+
line += child.getTextContent();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
linesInBetween = [line];
|
|
72
|
+
}
|
|
73
|
+
const childrenString = linesInBetween.join('\n').trim();
|
|
74
|
+
const propsString = openMatch?.length > 2 ? openMatch[2]?.trim() : null;
|
|
75
|
+
const markdownToLexical = getMarkdownToLexical(allNodes, allTransformers);
|
|
76
|
+
const blockFields = block.jsx.import({
|
|
77
|
+
children: childrenString,
|
|
78
|
+
closeMatch: closeMatch,
|
|
79
|
+
htmlToLexical: null,
|
|
80
|
+
markdownToLexical,
|
|
81
|
+
openMatch: openMatch,
|
|
82
|
+
props: propsString ? extractPropsFromJSXPropsString({
|
|
83
|
+
propsString
|
|
84
|
+
}) : {}
|
|
85
|
+
});
|
|
86
|
+
if (blockFields === false) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const node = $createBlockNode({
|
|
90
|
+
blockType: block.slug,
|
|
91
|
+
...blockFields,
|
|
92
|
+
blockName: blockFields.blockName || ''
|
|
93
|
+
});
|
|
94
|
+
if (node) {
|
|
95
|
+
rootNode.append(node);
|
|
96
|
+
}
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
return false // Run next transformer
|
|
100
|
+
;
|
|
101
|
+
}
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
return transformers;
|
|
105
|
+
};
|
|
106
|
+
export function getMarkdownToLexical(allNodes, allTransformers) {
|
|
107
|
+
const markdownToLexical = ({
|
|
108
|
+
markdown
|
|
109
|
+
}) => {
|
|
110
|
+
const headlessEditor = createHeadlessEditor({
|
|
111
|
+
nodes: allNodes
|
|
112
|
+
});
|
|
113
|
+
headlessEditor.update(() => {
|
|
114
|
+
$convertFromMarkdownString(markdown, allTransformers);
|
|
115
|
+
}, {
|
|
116
|
+
discrete: true
|
|
117
|
+
});
|
|
118
|
+
const editorJSON = headlessEditor.getEditorState().toJSON();
|
|
119
|
+
return editorJSON;
|
|
120
|
+
};
|
|
121
|
+
return markdownToLexical;
|
|
122
|
+
}
|
|
123
|
+
export function getLexicalToMarkdown(allNodes, allTransformers) {
|
|
124
|
+
const lexicalToMarkdown = ({
|
|
125
|
+
editorState
|
|
126
|
+
}) => {
|
|
127
|
+
const headlessEditor = createHeadlessEditor({
|
|
128
|
+
nodes: allNodes
|
|
129
|
+
});
|
|
130
|
+
try {
|
|
131
|
+
headlessEditor.setEditorState(headlessEditor.parseEditorState(editorState)) // This should commit the editor state immediately
|
|
132
|
+
;
|
|
133
|
+
} catch (e) {
|
|
134
|
+
console.error('getLexicalToMarkdown: ERROR parsing editor state', e);
|
|
135
|
+
}
|
|
136
|
+
let markdown = '';
|
|
137
|
+
headlessEditor.getEditorState().read(() => {
|
|
138
|
+
markdown = $convertToMarkdownString(allTransformers);
|
|
139
|
+
});
|
|
140
|
+
return markdown;
|
|
141
|
+
};
|
|
142
|
+
return lexicalToMarkdown;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=markdownTransformer.js.map
|