@payloadcms/richtext-lexical 3.0.0-beta.85 → 3.0.0-beta.86
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/index.js +117 -127
- package/dist/cell/index.js.map +1 -1
- package/dist/exports/client/Component-DOSSWC76.js +2 -0
- package/dist/exports/client/Component-DOSSWC76.js.map +7 -0
- package/dist/exports/client/Component-MBLHTKDK.js +2 -0
- package/dist/exports/client/Component-MBLHTKDK.js.map +7 -0
- package/dist/exports/client/Field-KUSPHC7Q.js +2 -0
- package/dist/exports/client/Field-KUSPHC7Q.js.map +7 -0
- package/dist/exports/client/RelationshipComponent-3QWBV4GT.js +2 -0
- package/dist/exports/client/RelationshipComponent-3QWBV4GT.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-G5DTIOPI.js +2 -0
- package/dist/exports/client/chunk-G5DTIOPI.js.map +7 -0
- package/dist/exports/client/chunk-LGUXX2QH.js +2 -0
- package/dist/exports/client/chunk-LGUXX2QH.js.map +7 -0
- package/dist/exports/client/chunk-NI6Z4GBD.js +2 -0
- package/dist/exports/client/{chunk-SQHN3N6E.js.map → chunk-NI6Z4GBD.js.map} +2 -2
- package/dist/exports/client/chunk-OKMIHD2R.js +2 -0
- package/dist/exports/client/chunk-OKMIHD2R.js.map +7 -0
- package/dist/exports/client/chunk-TO2W7Q2G.js +2 -0
- package/dist/exports/client/chunk-TO2W7Q2G.js.map +7 -0
- package/dist/exports/client/chunk-V2LKLT2F.js +3 -0
- package/dist/exports/client/chunk-V2LKLT2F.js.map +7 -0
- package/dist/exports/client/component-3OFD6Q4Z.js +2 -0
- package/dist/exports/client/component-3OFD6Q4Z.js.map +7 -0
- package/dist/exports/client/component-LCAAX56T.js +2 -0
- package/dist/exports/client/component-LCAAX56T.js.map +7 -0
- package/dist/exports/client/component-LLWMZU6K.js +2 -0
- package/dist/exports/client/component-LLWMZU6K.js.map +7 -0
- package/dist/exports/client/componentInline-72VZAAHP.js +2 -0
- package/dist/exports/client/componentInline-72VZAAHP.js.map +7 -0
- package/dist/exports/client/index.js +9 -9
- package/dist/exports/client/index.js.map +3 -3
- package/dist/exports/server/migrate.js +0 -1
- package/dist/exports/server/migrate.js.map +1 -1
- package/dist/features/align/client/index.js +151 -134
- package/dist/features/align/client/index.js.map +1 -1
- package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
- package/dist/features/align/client/toolbarAlignGroup.js +10 -9
- package/dist/features/align/client/toolbarAlignGroup.js.map +1 -1
- package/dist/features/align/server/i18n.js +192 -193
- package/dist/features/align/server/i18n.js.map +1 -1
- package/dist/features/align/server/index.js +5 -6
- package/dist/features/align/server/index.js.map +1 -1
- package/dist/features/blockquote/client/index.js +60 -65
- package/dist/features/blockquote/client/index.js.map +1 -1
- package/dist/features/blockquote/markdownTransformer.js +28 -34
- package/dist/features/blockquote/markdownTransformer.js.map +1 -1
- package/dist/features/blockquote/server/i18n.js +96 -97
- package/dist/features/blockquote/server/i18n.js.map +1 -1
- package/dist/features/blockquote/server/index.js +38 -37
- package/dist/features/blockquote/server/index.js.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js +166 -172
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/FormSavePlugin.d.ts.map +1 -1
- package/dist/features/blocks/client/component/FormSavePlugin.js +46 -22
- package/dist/features/blocks/client/component/FormSavePlugin.js.map +1 -1
- package/dist/features/blocks/client/component/index.js +130 -142
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts.map +1 -1
- package/dist/features/blocks/client/component/removeEmptyArrayValues.js +12 -8
- package/dist/features/blocks/client/component/removeEmptyArrayValues.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +106 -122
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/index.js +149 -142
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js +41 -40
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js +31 -30
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/client/plugin/commands.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/commands.js +2 -1
- package/dist/features/blocks/client/plugin/commands.js.map +1 -1
- package/dist/features/blocks/client/plugin/index.js +179 -106
- package/dist/features/blocks/client/plugin/index.js.map +1 -1
- package/dist/features/blocks/server/graphQLPopulationPromise.js +41 -28
- package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/blocks/server/i18n.js +288 -289
- package/dist/features/blocks/server/i18n.js.map +1 -1
- package/dist/features/blocks/server/index.js +149 -151
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.js +76 -73
- package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js +78 -76
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/server/validate.js +45 -34
- package/dist/features/blocks/server/validate.js.map +1 -1
- package/dist/features/converters/html/converter/converters/linebreak.js +4 -7
- package/dist/features/converters/html/converter/converters/linebreak.js.map +1 -1
- package/dist/features/converters/html/converter/converters/paragraph.js +24 -19
- package/dist/features/converters/html/converter/converters/paragraph.js.map +1 -1
- package/dist/features/converters/html/converter/converters/text.js +28 -29
- package/dist/features/converters/html/converter/converters/text.js.map +1 -1
- package/dist/features/converters/html/converter/defaultConverters.js +1 -6
- package/dist/features/converters/html/converter/defaultConverters.js.map +1 -1
- package/dist/features/converters/html/converter/index.js +66 -51
- package/dist/features/converters/html/converter/index.js.map +1 -1
- package/dist/features/converters/html/converter/types.js +1 -2
- package/dist/features/converters/html/converter/types.js.map +1 -1
- package/dist/features/converters/html/field/index.js +134 -139
- package/dist/features/converters/html/field/index.js.map +1 -1
- package/dist/features/converters/html/index.js +2 -3
- package/dist/features/converters/html/index.js.map +1 -1
- package/dist/features/createClientComponent.js +7 -6
- package/dist/features/createClientComponent.js.map +1 -1
- package/dist/features/createFeaturePropComponent.js +14 -13
- package/dist/features/createFeaturePropComponent.js.map +1 -1
- package/dist/features/debug/testRecorder/client/index.js +5 -7
- package/dist/features/debug/testRecorder/client/index.js.map +1 -1
- package/dist/features/debug/testRecorder/client/plugin/index.js +518 -402
- package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
- package/dist/features/debug/testRecorder/server/index.js +4 -5
- package/dist/features/debug/testRecorder/server/index.js.map +1 -1
- package/dist/features/debug/treeView/client/index.js +5 -7
- package/dist/features/debug/treeView/client/index.js.map +1 -1
- package/dist/features/debug/treeView/client/plugin/index.js +21 -11
- package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
- package/dist/features/debug/treeView/server/index.js +4 -5
- package/dist/features/debug/treeView/server/index.js.map +1 -1
- package/dist/features/experimental_table/client/index.js +41 -58
- package/dist/features/experimental_table/client/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +714 -560
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +295 -301
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -7
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +228 -159
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +129 -82
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/utils/debounce.d.ts.map +1 -1
- package/dist/features/experimental_table/client/utils/debounce.js +108 -89
- package/dist/features/experimental_table/client/utils/debounce.js.map +1 -1
- package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +1 -1
- package/dist/features/experimental_table/client/utils/useDebounce.js +11 -13
- package/dist/features/experimental_table/client/utils/useDebounce.js.map +1 -1
- package/dist/features/experimental_table/server/index.js +127 -114
- package/dist/features/experimental_table/server/index.js.map +1 -1
- package/dist/features/format/bold/feature.client.js +34 -35
- package/dist/features/format/bold/feature.client.js.map +1 -1
- package/dist/features/format/bold/feature.server.js +14 -18
- package/dist/features/format/bold/feature.server.js.map +1 -1
- package/dist/features/format/bold/markdownTransformers.js +14 -25
- package/dist/features/format/bold/markdownTransformers.js.map +1 -1
- package/dist/features/format/inlineCode/feature.client.js +26 -28
- package/dist/features/format/inlineCode/feature.client.js.map +1 -1
- package/dist/features/format/inlineCode/feature.server.js +5 -8
- package/dist/features/format/inlineCode/feature.server.js.map +1 -1
- package/dist/features/format/inlineCode/markdownTransformers.js +3 -6
- package/dist/features/format/inlineCode/markdownTransformers.js.map +1 -1
- package/dist/features/format/italic/feature.client.js +26 -29
- package/dist/features/format/italic/feature.client.js.map +1 -1
- package/dist/features/format/italic/feature.server.js +5 -9
- package/dist/features/format/italic/feature.server.js.map +1 -1
- package/dist/features/format/italic/markdownTransformers.js +7 -12
- package/dist/features/format/italic/markdownTransformers.js.map +1 -1
- package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
- package/dist/features/format/shared/toolbarFormatGroup.js +9 -8
- package/dist/features/format/shared/toolbarFormatGroup.js.map +1 -1
- package/dist/features/format/strikethrough/feature.client.js +26 -28
- package/dist/features/format/strikethrough/feature.client.js.map +1 -1
- package/dist/features/format/strikethrough/feature.server.js +5 -8
- package/dist/features/format/strikethrough/feature.server.js.map +1 -1
- package/dist/features/format/strikethrough/markdownTransformers.js +3 -6
- package/dist/features/format/strikethrough/markdownTransformers.js.map +1 -1
- package/dist/features/format/subscript/feature.client.js +25 -25
- package/dist/features/format/subscript/feature.client.js.map +1 -1
- package/dist/features/format/subscript/feature.server.js +4 -5
- package/dist/features/format/subscript/feature.server.js.map +1 -1
- package/dist/features/format/superscript/feature.client.js +25 -25
- package/dist/features/format/superscript/feature.client.js.map +1 -1
- package/dist/features/format/superscript/feature.server.js +4 -5
- package/dist/features/format/superscript/feature.server.js.map +1 -1
- package/dist/features/format/underline/feature.client.js +25 -25
- package/dist/features/format/underline/feature.client.js.map +1 -1
- package/dist/features/format/underline/feature.server.js +4 -5
- package/dist/features/format/underline/feature.server.js.map +1 -1
- package/dist/features/heading/client/index.js +86 -90
- package/dist/features/heading/client/index.js.map +1 -1
- package/dist/features/heading/markdownTransformer.js +22 -25
- package/dist/features/heading/markdownTransformer.js.map +1 -1
- package/dist/features/heading/server/i18n.js +96 -97
- package/dist/features/heading/server/i18n.js.map +1 -1
- package/dist/features/heading/server/index.js +49 -51
- package/dist/features/heading/server/index.js.map +1 -1
- package/dist/features/horizontalRule/client/component/index.js +81 -51
- package/dist/features/horizontalRule/client/component/index.js.map +1 -1
- package/dist/features/horizontalRule/client/index.js +48 -57
- package/dist/features/horizontalRule/client/index.js.map +1 -1
- package/dist/features/horizontalRule/client/markdownTransformer.js +15 -18
- package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +33 -30
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/horizontalRule/client/plugin/index.js +31 -20
- package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
- package/dist/features/horizontalRule/server/i18n.js +96 -97
- package/dist/features/horizontalRule/server/i18n.js.map +1 -1
- package/dist/features/horizontalRule/server/index.js +17 -24
- package/dist/features/horizontalRule/server/index.js.map +1 -1
- package/dist/features/horizontalRule/server/markdownTransformer.js +15 -18
- package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +71 -66
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/indent/client/index.js +52 -47
- package/dist/features/indent/client/index.js.map +1 -1
- package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
- package/dist/features/indent/client/toolbarIndentGroup.js +9 -8
- package/dist/features/indent/client/toolbarIndentGroup.js.map +1 -1
- package/dist/features/indent/server/i18n.js +128 -129
- package/dist/features/indent/server/i18n.js.map +1 -1
- package/dist/features/indent/server/index.js +5 -6
- package/dist/features/indent/server/index.js.map +1 -1
- package/dist/features/link/client/index.js +78 -83
- package/dist/features/link/client/index.js.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.js +267 -271
- package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
- package/dist/features/link/client/plugins/clickableLink/index.js +3 -3
- package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/commands.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/commands.js +2 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/commands.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +254 -276
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js +8 -6
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/types.js +1 -2
- package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
- package/dist/features/link/client/plugins/link/index.js +50 -41
- package/dist/features/link/client/plugins/link/index.js.map +1 -1
- package/dist/features/link/markdownTransformer.js +38 -39
- package/dist/features/link/markdownTransformer.js.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.js +57 -56
- package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
- package/dist/features/link/nodes/LinkNode.js +277 -276
- package/dist/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/features/link/nodes/types.js +1 -2
- package/dist/features/link/nodes/types.js.map +1 -1
- package/dist/features/link/server/baseFields.js +118 -88
- package/dist/features/link/server/baseFields.js.map +1 -1
- package/dist/features/link/server/graphQLPopulationPromise.js +42 -28
- package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/link/server/i18n.js +96 -97
- package/dist/features/link/server/i18n.js.map +1 -1
- package/dist/features/link/server/index.js +120 -114
- package/dist/features/link/server/index.js.map +1 -1
- package/dist/features/link/server/transformExtraFields.js +15 -15
- package/dist/features/link/server/transformExtraFields.js.map +1 -1
- package/dist/features/link/server/validate.js +37 -26
- package/dist/features/link/server/validate.js.map +1 -1
- package/dist/features/lists/checklist/client/index.js +77 -85
- package/dist/features/lists/checklist/client/index.js.map +1 -1
- package/dist/features/lists/checklist/client/plugin/index.js +3 -3
- package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
- package/dist/features/lists/checklist/markdownTransformers.js +7 -11
- package/dist/features/lists/checklist/markdownTransformers.js.map +1 -1
- package/dist/features/lists/checklist/server/i18n.js +96 -97
- package/dist/features/lists/checklist/server/i18n.js.map +1 -1
- package/dist/features/lists/checklist/server/index.js +21 -25
- package/dist/features/lists/checklist/server/index.js.map +1 -1
- package/dist/features/lists/htmlConverter.js +54 -43
- package/dist/features/lists/htmlConverter.js.map +1 -1
- package/dist/features/lists/orderedList/client/index.js +71 -77
- package/dist/features/lists/orderedList/client/index.js.map +1 -1
- package/dist/features/lists/orderedList/markdownTransformer.js +7 -11
- package/dist/features/lists/orderedList/markdownTransformer.js.map +1 -1
- package/dist/features/lists/orderedList/server/i18n.js +96 -97
- package/dist/features/lists/orderedList/server/i18n.js.map +1 -1
- package/dist/features/lists/orderedList/server/index.js +21 -25
- package/dist/features/lists/orderedList/server/index.js.map +1 -1
- package/dist/features/lists/plugin/index.js +3 -3
- package/dist/features/lists/plugin/index.js.map +1 -1
- package/dist/features/lists/shared/markdown.js +48 -49
- package/dist/features/lists/shared/markdown.js.map +1 -1
- package/dist/features/lists/shared/slashMenuListGroup.js +9 -8
- package/dist/features/lists/shared/slashMenuListGroup.js.map +1 -1
- package/dist/features/lists/unorderedList/client/index.js +68 -76
- package/dist/features/lists/unorderedList/client/index.js.map +1 -1
- package/dist/features/lists/unorderedList/markdownTransformer.js +7 -11
- package/dist/features/lists/unorderedList/markdownTransformer.js.map +1 -1
- package/dist/features/lists/unorderedList/server/i18n.js +96 -97
- package/dist/features/lists/unorderedList/server/i18n.js.map +1 -1
- package/dist/features/lists/unorderedList/server/index.js +17 -23
- package/dist/features/lists/unorderedList/server/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js +18 -17
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js +30 -29
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js +21 -20
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js +21 -19
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js +18 -17
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js +24 -23
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js +20 -21
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js +1 -10
- package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.js +69 -61
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/types.js +1 -2
- package/dist/features/migrations/lexicalPluginToLexical/converter/types.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/feature.client.js +5 -7
- package/dist/features/migrations/lexicalPluginToLexical/feature.client.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/feature.server.js +42 -43
- package/dist/features/migrations/lexicalPluginToLexical/feature.server.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +11 -11
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +64 -59
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js +19 -19
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js +20 -25
- package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js +28 -30
- package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js +26 -26
- package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js +22 -21
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js +22 -22
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js +12 -13
- package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js +23 -23
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js +22 -22
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js +15 -16
- package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/defaultConverters.js +1 -13
- package/dist/features/migrations/slateToLexical/converter/defaultConverters.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/index.js +105 -98
- package/dist/features/migrations/slateToLexical/converter/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/types.js +1 -2
- package/dist/features/migrations/slateToLexical/converter/types.js.map +1 -1
- package/dist/features/migrations/slateToLexical/feature.client.js +7 -7
- package/dist/features/migrations/slateToLexical/feature.client.js.map +1 -1
- package/dist/features/migrations/slateToLexical/feature.server.js +43 -44
- package/dist/features/migrations/slateToLexical/feature.server.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +11 -11
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +64 -59
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/paragraph/client/index.js +58 -61
- package/dist/features/paragraph/client/index.js.map +1 -1
- package/dist/features/paragraph/server/i18n.js +128 -129
- package/dist/features/paragraph/server/i18n.js.map +1 -1
- package/dist/features/paragraph/server/index.js +6 -7
- package/dist/features/paragraph/server/index.js.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.js +141 -149
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/client/drawer/commands.js +0 -1
- package/dist/features/relationship/client/drawer/commands.js.map +1 -1
- package/dist/features/relationship/client/drawer/index.js +138 -67
- package/dist/features/relationship/client/drawer/index.js.map +1 -1
- package/dist/features/relationship/client/index.js +53 -59
- package/dist/features/relationship/client/index.js.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.js +60 -59
- package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +90 -35
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.d.ts.map +1 -1
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +97 -26
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +1 -1
- package/dist/features/relationship/server/graphQLPopulationPromise.js +34 -26
- package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/relationship/server/i18n.js +96 -97
- package/dist/features/relationship/server/i18n.js.map +1 -1
- package/dist/features/relationship/server/index.js +48 -44
- package/dist/features/relationship/server/index.js.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.js +90 -87
- package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/shared/slashMenu/basicGroup.js +9 -8
- package/dist/features/shared/slashMenu/basicGroup.js.map +1 -1
- package/dist/features/shared/toolbar/addDropdownGroup.js +8 -9
- package/dist/features/shared/toolbar/addDropdownGroup.js.map +1 -1
- package/dist/features/shared/toolbar/featureButtonsGroup.js +7 -8
- package/dist/features/shared/toolbar/featureButtonsGroup.js.map +1 -1
- package/dist/features/shared/toolbar/textDropdownGroup.js +8 -9
- package/dist/features/shared/toolbar/textDropdownGroup.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +264 -187
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/fixed/client/index.js +5 -7
- package/dist/features/toolbars/fixed/client/index.js.map +1 -1
- package/dist/features/toolbars/fixed/server/index.js +14 -13
- package/dist/features/toolbars/fixed/server/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +374 -286
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/index.js +5 -7
- package/dist/features/toolbars/inline/client/index.js.map +1 -1
- package/dist/features/toolbars/inline/server/index.js +4 -5
- package/dist/features/toolbars/inline/server/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.d.ts +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js +75 -97
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +190 -211
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +289 -124
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/features/toolbars/types.js +1 -2
- package/dist/features/toolbars/types.js.map +1 -1
- package/dist/features/typeUtilities.js +2 -3
- package/dist/features/typeUtilities.js.map +1 -1
- package/dist/features/typesClient.js +1 -2
- package/dist/features/typesClient.js.map +1 -1
- package/dist/features/typesServer.js +1 -2
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/client/component/index.js +208 -224
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/drawer/commands.js +1 -1
- package/dist/features/upload/client/drawer/commands.js.map +1 -1
- package/dist/features/upload/client/drawer/index.js +107 -58
- package/dist/features/upload/client/drawer/index.js.map +1 -1
- package/dist/features/upload/client/feature.client.js +51 -61
- package/dist/features/upload/client/feature.client.js.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.js +76 -73
- package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/client/plugin/index.js +67 -39
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/features/upload/server/feature.server.js +190 -171
- package/dist/features/upload/server/feature.server.js.map +1 -1
- package/dist/features/upload/server/graphQLPopulationPromise.js +60 -47
- package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/upload/server/i18n.js +96 -97
- package/dist/features/upload/server/i18n.js.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.js +113 -108
- package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/server/validate.js +53 -40
- package/dist/features/upload/server/validate.js.map +1 -1
- package/dist/field/Field.js +124 -105
- package/dist/field/Field.js.map +1 -1
- package/dist/field/bundled.css +1 -0
- package/dist/field/index.js +92 -36
- package/dist/field/index.js.map +1 -1
- package/dist/i18n.js +160 -161
- package/dist/i18n.js.map +1 -1
- package/dist/index.js +670 -623
- package/dist/index.js.map +1 -1
- package/dist/lexical/EditorPlugin.d.ts.map +1 -1
- package/dist/lexical/EditorPlugin.js +15 -10
- package/dist/lexical/EditorPlugin.js.map +1 -1
- package/dist/lexical/LexicalEditor.js +206 -161
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/LexicalProvider.js +83 -82
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js +76 -79
- package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/lexical/config/client/default.js +3 -3
- package/dist/lexical/config/client/default.js.map +1 -1
- package/dist/lexical/config/client/loader.js +42 -39
- package/dist/lexical/config/client/loader.js.map +1 -1
- package/dist/lexical/config/client/sanitize.js +165 -165
- package/dist/lexical/config/client/sanitize.js.map +1 -1
- package/dist/lexical/config/server/default.js +5 -27
- package/dist/lexical/config/server/default.js.map +1 -1
- package/dist/lexical/config/server/loader.js +103 -103
- package/dist/lexical/config/server/loader.js.map +1 -1
- package/dist/lexical/config/server/sanitize.js +98 -99
- package/dist/lexical/config/server/sanitize.js.map +1 -1
- package/dist/lexical/config/types.js +1 -2
- package/dist/lexical/config/types.js.map +1 -1
- package/dist/lexical/nodes/index.js +9 -8
- package/dist/lexical/nodes/index.js.map +1 -1
- package/dist/lexical/plugins/MarkdownShortcut/index.js +17 -5
- package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +384 -361
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +223 -160
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js +1 -2
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js +191 -179
- package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js +41 -26
- package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +164 -129
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js +11 -10
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js +11 -10
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.js +27 -23
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +331 -300
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +110 -97
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.js +23 -16
- package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js +18 -27
- package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/getCollapsedMargins.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/getCollapsedMargins.js +15 -11
- package/dist/lexical/plugins/handles/utils/getCollapsedMargins.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js +133 -118
- package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/getTopLevelNodeKeys.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/getTopLevelNodeKeys.js +3 -2
- package/dist/lexical/plugins/handles/utils/getTopLevelNodeKeys.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/isOnHandleElement.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/isOnHandleElement.js +3 -2
- package/dist/lexical/plugins/handles/utils/isOnHandleElement.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/setHandlePosition.js +26 -25
- package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
- package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
- package/dist/lexical/theme/EditorTheme.js +97 -102
- package/dist/lexical/theme/EditorTheme.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +27 -10
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/lexical/ui/icons/AI/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/AI/index.js +31 -33
- package/dist/lexical/ui/icons/AI/index.js.map +1 -1
- package/dist/lexical/ui/icons/Add/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Add/index.js +16 -18
- package/dist/lexical/ui/icons/Add/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignCenter/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/AlignCenter/index.js +25 -28
- package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignJustify/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/AlignJustify/index.js +25 -28
- package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignLeft/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/AlignLeft/index.js +25 -28
- package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignRight/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/AlignRight/index.js +25 -28
- package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
- package/dist/lexical/ui/icons/Block/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Block/index.js +34 -37
- package/dist/lexical/ui/icons/Block/index.js.map +1 -1
- package/dist/lexical/ui/icons/Blockquote/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Blockquote/index.js +16 -15
- package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
- package/dist/lexical/ui/icons/Bold/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Bold/index.js +16 -15
- package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
- package/dist/lexical/ui/icons/Checklist/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Checklist/index.js +24 -26
- package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
- package/dist/lexical/ui/icons/Code/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Code/index.js +19 -21
- package/dist/lexical/ui/icons/Code/index.js.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.js +19 -21
- package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
- package/dist/lexical/ui/icons/H1/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H1/index.js +16 -15
- package/dist/lexical/ui/icons/H1/index.js.map +1 -1
- package/dist/lexical/ui/icons/H2/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H2/index.js +16 -15
- package/dist/lexical/ui/icons/H2/index.js.map +1 -1
- package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H3/index.js +16 -15
- package/dist/lexical/ui/icons/H3/index.js.map +1 -1
- package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H4/index.js +16 -15
- package/dist/lexical/ui/icons/H4/index.js.map +1 -1
- package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H5/index.js +16 -15
- package/dist/lexical/ui/icons/H5/index.js.map +1 -1
- package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H6/index.js +16 -15
- package/dist/lexical/ui/icons/H6/index.js.map +1 -1
- package/dist/lexical/ui/icons/HorizontalRule/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/HorizontalRule/index.js +19 -18
- package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentDecrease/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/IndentDecrease/index.js +28 -32
- package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentIncrease/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/IndentIncrease/index.js +28 -32
- package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/InlineBlocks/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/InlineBlocks/index.js +18 -17
- package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
- package/dist/lexical/ui/icons/Italic/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Italic/index.js +16 -15
- package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
- package/dist/lexical/ui/icons/Link/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Link/index.js +17 -16
- package/dist/lexical/ui/icons/Link/index.js.map +1 -1
- package/dist/lexical/ui/icons/Meatballs/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Meatballs/index.js +19 -22
- package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
- package/dist/lexical/ui/icons/OrderedList/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/OrderedList/index.js +31 -36
- package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Relationship/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Relationship/index.js +31 -33
- package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
- package/dist/lexical/ui/icons/Strikethrough/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Strikethrough/index.js +19 -21
- package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
- package/dist/lexical/ui/icons/Subscript/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Subscript/index.js +16 -15
- package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Superscript/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Superscript/index.js +16 -15
- package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Table/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Table/index.js +17 -16
- package/dist/lexical/ui/icons/Table/index.js.map +1 -1
- package/dist/lexical/ui/icons/Text/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Text/index.js +16 -15
- package/dist/lexical/ui/icons/Text/index.js.map +1 -1
- package/dist/lexical/ui/icons/Underline/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Underline/index.js +19 -21
- package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
- package/dist/lexical/ui/icons/UnorderedList/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/UnorderedList/index.js +46 -52
- package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Upload/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Upload/index.js +28 -31
- package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
- package/dist/lexical/utils/canUseDOM.d.ts.map +1 -1
- package/dist/lexical/utils/canUseDOM.js +2 -1
- package/dist/lexical/utils/canUseDOM.js.map +1 -1
- package/dist/lexical/utils/environment.d.ts.map +1 -1
- package/dist/lexical/utils/environment.js +2 -1
- package/dist/lexical/utils/environment.js.map +1 -1
- package/dist/lexical/utils/getDOMRangeRect.d.ts.map +1 -1
- package/dist/lexical/utils/getDOMRangeRect.js +13 -12
- package/dist/lexical/utils/getDOMRangeRect.js.map +1 -1
- package/dist/lexical/utils/getSelectedNode.d.ts.map +1 -1
- package/dist/lexical/utils/getSelectedNode.js +18 -13
- package/dist/lexical/utils/getSelectedNode.js.map +1 -1
- package/dist/lexical/utils/guard.d.ts.map +1 -1
- package/dist/lexical/utils/guard.js +3 -2
- package/dist/lexical/utils/guard.js.map +1 -1
- package/dist/lexical/utils/joinClasses.d.ts.map +1 -1
- package/dist/lexical/utils/joinClasses.js +3 -2
- package/dist/lexical/utils/joinClasses.js.map +1 -1
- package/dist/lexical/utils/markdown/createBlockNode.js +9 -10
- package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
- package/dist/lexical/utils/nodeFormat.js +58 -59
- package/dist/lexical/utils/nodeFormat.js.map +1 -1
- package/dist/lexical/utils/point.d.ts.map +1 -1
- package/dist/lexical/utils/point.js +40 -32
- package/dist/lexical/utils/point.js.map +1 -1
- package/dist/lexical/utils/rect.d.ts.map +1 -1
- package/dist/lexical/utils/rect.js +167 -134
- package/dist/lexical/utils/rect.js.map +1 -1
- package/dist/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
- package/dist/lexical/utils/setFloatingElemPosition.js +56 -45
- package/dist/lexical/utils/setFloatingElemPosition.js.map +1 -1
- package/dist/lexical/utils/setFloatingElemPositionForLinkEditor.d.ts.map +1 -1
- package/dist/lexical/utils/setFloatingElemPositionForLinkEditor.js +23 -22
- package/dist/lexical/utils/setFloatingElemPositionForLinkEditor.js.map +1 -1
- package/dist/lexical/utils/swipe.d.ts.map +1 -1
- package/dist/lexical/utils/swipe.js +82 -83
- package/dist/lexical/utils/swipe.js.map +1 -1
- package/dist/lexical/utils/url.js +23 -22
- package/dist/lexical/utils/url.js.map +1 -1
- package/dist/nodeTypes.js +1 -2
- package/dist/nodeTypes.js.map +1 -1
- package/dist/populateGraphQL/defaultValue.js +24 -29
- package/dist/populateGraphQL/defaultValue.js.map +1 -1
- package/dist/populateGraphQL/populate.js +35 -25
- package/dist/populateGraphQL/populate.js.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.js +47 -32
- package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js +39 -25
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js.map +1 -1
- package/dist/types.js +1 -2
- package/dist/types.js.map +1 -1
- package/dist/utilities/createClientFeature.js +40 -36
- package/dist/utilities/createClientFeature.js.map +1 -1
- package/dist/utilities/createServerFeature.js +46 -35
- package/dist/utilities/createServerFeature.js.map +1 -1
- package/dist/utilities/fieldsDrawer/Drawer.js +28 -17
- package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +149 -78
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/forEachNodeRecursively.js +24 -19
- package/dist/utilities/forEachNodeRecursively.js.map +1 -1
- package/dist/utilities/generateComponentMap.js +90 -82
- package/dist/utilities/generateComponentMap.js.map +1 -1
- package/dist/utilities/generateImportMap.js +53 -47
- package/dist/utilities/generateImportMap.js.map +1 -1
- package/dist/utilities/generateSchemaMap.js +35 -30
- package/dist/utilities/generateSchemaMap.js.map +1 -1
- package/dist/utilities/migrateSlateToLexical/index.js +99 -86
- package/dist/utilities/migrateSlateToLexical/index.js.map +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +73 -66
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
- package/dist/utilities/recurseNodeTree.js +25 -22
- package/dist/utilities/recurseNodeTree.js.map +1 -1
- package/dist/utilities/upgradeLexicalData/index.js +99 -86
- package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +71 -66
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
- package/dist/utilities/useLexicalFeature.js +9 -8
- package/dist/utilities/useLexicalFeature.js.map +1 -1
- package/dist/validate/index.js +32 -26
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/validateNodes.js +31 -28
- package/dist/validate/validateNodes.js.map +1 -1
- package/package.json +22 -11
- package/dist/exports/client/Component-7HS6FEJS.js +0 -2
- package/dist/exports/client/Component-7HS6FEJS.js.map +0 -7
- package/dist/exports/client/Component-LAKSCIDX.js +0 -2
- package/dist/exports/client/Component-LAKSCIDX.js.map +0 -7
- package/dist/exports/client/Field-BYB3WX7J.js +0 -2
- package/dist/exports/client/Field-BYB3WX7J.js.map +0 -7
- package/dist/exports/client/RelationshipComponent-GYUTPDNG.js +0 -2
- package/dist/exports/client/RelationshipComponent-GYUTPDNG.js.map +0 -7
- package/dist/exports/client/chunk-4EX7W4UX.js +0 -2
- package/dist/exports/client/chunk-4EX7W4UX.js.map +0 -7
- package/dist/exports/client/chunk-E4HH5PS6.js +0 -2
- package/dist/exports/client/chunk-E4HH5PS6.js.map +0 -7
- package/dist/exports/client/chunk-EBB2CEB6.js +0 -2
- package/dist/exports/client/chunk-EBB2CEB6.js.map +0 -7
- package/dist/exports/client/chunk-LTR7V74A.js +0 -2
- package/dist/exports/client/chunk-LTR7V74A.js.map +0 -7
- package/dist/exports/client/chunk-SQHN3N6E.js +0 -2
- package/dist/exports/client/chunk-VMCQSR3T.js +0 -3
- package/dist/exports/client/chunk-VMCQSR3T.js.map +0 -7
- package/dist/exports/client/component-6C5JERGA.js +0 -2
- package/dist/exports/client/component-6C5JERGA.js.map +0 -7
- package/dist/exports/client/component-GUWIGB77.js +0 -2
- package/dist/exports/client/component-GUWIGB77.js.map +0 -7
- package/dist/exports/client/component-UQ2BKD5X.js +0 -2
- package/dist/exports/client/component-UQ2BKD5X.js.map +0 -7
- package/dist/exports/client/componentInline-C2XIK5VZ.js +0 -2
- package/dist/exports/client/componentInline-C2XIK5VZ.js.map +0 -7
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.d.ts +0 -12
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.js +0 -181
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/features/experimental_table/client/plugins/TableCellResizerPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TableCellNode, TableDOMCell, TableMapType, TableMapValueType } from '@lexical/table'\nimport type { LexicalEditor } from 'lexical'\nimport type { JSX, MouseEventHandler } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n $computeTableMapSkipCellCheck,\n $getTableNodeFromLexicalNodeOrThrow,\n $getTableRowIndexFromTableCellNode,\n $isTableCellNode,\n $isTableRowNode,\n getDOMCellFromTarget,\n} from '@lexical/table'\nimport { calculateZoomLevel } from '@lexical/utils'\nimport { $getNearestNodeFromDOMNode } from 'lexical'\nimport * as React from 'react'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\n\ntype MousePosition = {\n x: number\n y: number\n}\n\ntype MouseDraggingDirection = 'bottom' | 'right'\n\nconst MIN_ROW_HEIGHT = 33\nconst MIN_COLUMN_WIDTH = 50\n\nfunction TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element {\n const targetRef = useRef<HTMLElement | null>(null)\n const resizerRef = useRef<HTMLDivElement | null>(null)\n const tableRectRef = useRef<ClientRect | null>(null)\n const editorConfig = useEditorConfigContext()\n\n const mouseStartPosRef = useRef<MousePosition | null>(null)\n const [mouseCurrentPos, updateMouseCurrentPos] = useState<MousePosition | null>(null)\n\n const [activeCell, updateActiveCell] = useState<TableDOMCell | null>(null)\n const [isMouseDown, updateIsMouseDown] = useState<boolean>(false)\n const [draggingDirection, updateDraggingDirection] = useState<MouseDraggingDirection | null>(null)\n\n const resetState = useCallback(() => {\n updateActiveCell(null)\n targetRef.current = null\n updateDraggingDirection(null)\n mouseStartPosRef.current = null\n tableRectRef.current = null\n }, [])\n\n const isMouseDownOnEvent = (event: MouseEvent) => {\n return (event.buttons & 1) === 1\n }\n\n useEffect(() => {\n const onMouseMove = (event: MouseEvent) => {\n setTimeout(() => {\n const target = event.target\n\n if (draggingDirection) {\n updateMouseCurrentPos({\n x: event.clientX,\n y: event.clientY,\n })\n return\n }\n updateIsMouseDown(isMouseDownOnEvent(event))\n if (resizerRef.current && resizerRef.current.contains(target as Node)) {\n return\n }\n\n if (targetRef.current !== target) {\n targetRef.current = target as HTMLElement\n const cell = getDOMCellFromTarget(target as HTMLElement)\n\n if (cell && activeCell !== cell) {\n editor.update(() => {\n const tableCellNode = $getNearestNodeFromDOMNode(cell.elem)\n\n if (!tableCellNode) {\n throw new Error('TableCellResizer: Table cell node not found.')\n }\n\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n const tableElement = editor.getElementByKey(tableNode.getKey())\n\n if (!tableElement) {\n throw new Error('TableCellResizer: Table element not found.')\n }\n\n targetRef.current = target as HTMLElement\n tableRectRef.current = tableElement.getBoundingClientRect()\n updateActiveCell(cell)\n })\n } else if (cell == null) {\n resetState()\n }\n }\n }, 0)\n }\n\n const onMouseDown = (event: MouseEvent) => {\n setTimeout(() => {\n updateIsMouseDown(true)\n }, 0)\n }\n\n const onMouseUp = (event: MouseEvent) => {\n setTimeout(() => {\n updateIsMouseDown(false)\n }, 0)\n }\n\n const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {\n rootElement?.addEventListener('mousemove', onMouseMove)\n rootElement?.addEventListener('mousedown', onMouseDown)\n rootElement?.addEventListener('mouseup', onMouseUp)\n\n prevRootElement?.removeEventListener('mousemove', onMouseMove)\n prevRootElement?.removeEventListener('mousedown', onMouseDown)\n prevRootElement?.removeEventListener('mouseup', onMouseUp)\n })\n\n return () => {\n removeRootListener()\n }\n }, [activeCell, draggingDirection, editor, resetState])\n\n const isHeightChanging = (direction: MouseDraggingDirection) => {\n if (direction === 'bottom') {\n return true\n }\n return false\n }\n\n const updateRowHeight = useCallback(\n (heightChange: number) => {\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n\n editor.update(\n () => {\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem)\n if (!$isTableCellNode(tableCellNode)) {\n throw new Error('TableCellResizer: Table cell node not found.')\n }\n\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n\n const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode)\n\n const tableRows = tableNode.getChildren()\n\n if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {\n throw new Error('Expected table cell to be inside of table row.')\n }\n\n const tableRow = tableRows[tableRowIndex]\n\n if (!$isTableRowNode(tableRow)) {\n throw new Error('Expected table row')\n }\n\n let height = tableRow.getHeight()\n if (height === undefined) {\n const rowCells = tableRow.getChildren<TableCellNode>()\n height = Math.min(\n ...rowCells.map((cell) => getCellNodeHeight(cell, editor) ?? Infinity),\n )\n }\n\n const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT)\n tableRow.setHeight(newHeight)\n },\n { tag: 'skip-scroll-into-view' },\n )\n },\n [activeCell, editor],\n )\n\n const getCellNodeWidth = (\n cell: TableCellNode,\n activeEditor: LexicalEditor,\n ): number | undefined => {\n const width = cell.getWidth()\n if (width !== undefined) {\n return width\n }\n\n const domCellNode = activeEditor.getElementByKey(cell.getKey())\n if (domCellNode == null) {\n return undefined\n }\n const computedStyle = getComputedStyle(domCellNode)\n return (\n domCellNode.clientWidth -\n parseFloat(computedStyle.paddingLeft) -\n parseFloat(computedStyle.paddingRight)\n )\n }\n\n const getCellNodeHeight = (\n cell: TableCellNode,\n activeEditor: LexicalEditor,\n ): number | undefined => {\n const domCellNode = activeEditor.getElementByKey(cell.getKey())\n return domCellNode?.clientHeight\n }\n\n const getCellColumnIndex = (tableCellNode: TableCellNode, tableMap: TableMapType) => {\n for (let row = 0; row < tableMap.length; row++) {\n for (let column = 0; column < tableMap[row].length; column++) {\n if (tableMap[row][column].cell === tableCellNode) {\n return column\n }\n }\n }\n }\n\n const updateColumnWidth = useCallback(\n (widthChange: number) => {\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n editor.update(\n () => {\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem)\n if (!$isTableCellNode(tableCellNode)) {\n throw new Error('TableCellResizer: Table cell node not found.')\n }\n\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null)\n const columnIndex = getCellColumnIndex(tableCellNode, tableMap)\n if (columnIndex === undefined) {\n throw new Error('TableCellResizer: Table column not found.')\n }\n\n for (let row = 0; row < tableMap.length; row++) {\n const cell: TableMapValueType = tableMap[row][columnIndex]\n if (\n cell.startRow === row &&\n (columnIndex === tableMap[row].length - 1 ||\n tableMap[row][columnIndex].cell !== tableMap[row][columnIndex + 1].cell)\n ) {\n const width = getCellNodeWidth(cell.cell, editor)\n if (width === undefined) {\n continue\n }\n const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH)\n cell.cell.setWidth(newWidth)\n }\n }\n },\n { tag: 'skip-scroll-into-view' },\n )\n },\n [activeCell, editor],\n )\n\n const mouseUpHandler = useCallback(\n (direction: MouseDraggingDirection) => {\n const handler = (event: MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n\n if (mouseStartPosRef.current) {\n const { x, y } = mouseStartPosRef.current\n\n if (activeCell === null) {\n return\n }\n const zoom = calculateZoomLevel(event.target as Element)\n\n if (isHeightChanging(direction)) {\n const heightChange = (event.clientY - y) / zoom\n updateRowHeight(heightChange)\n } else {\n const widthChange = (event.clientX - x) / zoom\n updateColumnWidth(widthChange)\n }\n\n resetState()\n document.removeEventListener('mouseup', handler)\n }\n }\n return handler\n },\n [activeCell, resetState, updateColumnWidth, updateRowHeight],\n )\n\n const toggleResize = useCallback(\n (direction: MouseDraggingDirection): MouseEventHandler<HTMLDivElement> =>\n (event) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n\n mouseStartPosRef.current = {\n x: event.clientX,\n y: event.clientY,\n }\n updateMouseCurrentPos(mouseStartPosRef.current)\n updateDraggingDirection(direction)\n\n document.addEventListener('mouseup', mouseUpHandler(direction))\n },\n [activeCell, mouseUpHandler],\n )\n\n const getResizers = useCallback(() => {\n if (activeCell) {\n const { height, left, top, width } = activeCell.elem.getBoundingClientRect()\n const zoom = calculateZoomLevel(activeCell.elem)\n const zoneWidth = 10 // Pixel width of the zone where you can drag the edge\n const styles = {\n bottom: {\n backgroundColor: 'none',\n cursor: 'row-resize',\n height: `${zoneWidth}px`,\n left: `${window.pageXOffset + left}px`,\n top: `${window.pageYOffset + top + height - zoneWidth / 2}px`,\n width: `${width}px`,\n },\n right: {\n backgroundColor: 'none',\n cursor: 'col-resize',\n height: `${height}px`,\n left: `${window.pageXOffset + left + width - zoneWidth / 2}px`,\n top: `${window.pageYOffset + top}px`,\n width: `${zoneWidth}px`,\n },\n }\n\n const tableRect = tableRectRef.current\n\n if (draggingDirection && mouseCurrentPos && tableRect) {\n if (isHeightChanging(draggingDirection)) {\n styles[draggingDirection].left = `${window.pageXOffset + tableRect.left}px`\n styles[draggingDirection].top = `${window.pageYOffset + mouseCurrentPos.y / zoom}px`\n styles[draggingDirection].height = '3px'\n styles[draggingDirection].width = `${tableRect.width}px`\n } else {\n styles[draggingDirection].top = `${window.pageYOffset + tableRect.top}px`\n styles[draggingDirection].left = `${window.pageXOffset + mouseCurrentPos.x / zoom}px`\n styles[draggingDirection].width = '3px'\n styles[draggingDirection].height = `${tableRect.height}px`\n }\n\n styles[draggingDirection].backgroundColor = '#adf'\n }\n\n return styles\n }\n\n return {\n bottom: null,\n left: null,\n right: null,\n top: null,\n }\n }, [activeCell, draggingDirection, mouseCurrentPos])\n\n const resizerStyles = getResizers()\n\n return (\n <div ref={resizerRef}>\n {activeCell != null && !isMouseDown && (\n <React.Fragment>\n <div\n className={`${editorConfig.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`}\n onMouseDown={toggleResize('right')}\n style={resizerStyles.right || undefined}\n />\n <div\n className={`${editorConfig.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`}\n onMouseDown={toggleResize('bottom')}\n style={resizerStyles.bottom || undefined}\n />\n </React.Fragment>\n )}\n </div>\n )\n}\n\nexport const TableCellResizerPlugin: PluginComponent = () => {\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n return useMemo(\n () => (isEditable ? createPortal(<TableCellResizer editor={editor} />, document.body) : null),\n [editor, isEditable],\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","$computeTableMapSkipCellCheck","$getTableNodeFromLexicalNodeOrThrow","$getTableRowIndexFromTableCellNode","$isTableCellNode","$isTableRowNode","getDOMCellFromTarget","calculateZoomLevel","$getNearestNodeFromDOMNode","React","useCallback","useEffect","useMemo","useRef","useState","createPortal","useEditorConfigContext","MIN_ROW_HEIGHT","MIN_COLUMN_WIDTH","TableCellResizer","editor","targetRef","resizerRef","tableRectRef","editorConfig","mouseStartPosRef","mouseCurrentPos","updateMouseCurrentPos","activeCell","updateActiveCell","isMouseDown","updateIsMouseDown","draggingDirection","updateDraggingDirection","resetState","current","isMouseDownOnEvent","event","buttons","onMouseMove","setTimeout","target","x","clientX","y","clientY","contains","cell","update","tableCellNode","elem","Error","tableNode","tableElement","getElementByKey","getKey","getBoundingClientRect","onMouseDown","onMouseUp","removeRootListener","registerRootListener","rootElement","prevRootElement","addEventListener","removeEventListener","isHeightChanging","direction","updateRowHeight","heightChange","tableRowIndex","tableRows","getChildren","length","tableRow","height","getHeight","undefined","rowCells","Math","min","map","getCellNodeHeight","Infinity","newHeight","max","setHeight","tag","getCellNodeWidth","activeEditor","width","getWidth","domCellNode","computedStyle","getComputedStyle","clientWidth","parseFloat","paddingLeft","paddingRight","clientHeight","getCellColumnIndex","tableMap","row","column","updateColumnWidth","widthChange","columnIndex","startRow","newWidth","setWidth","mouseUpHandler","handler","preventDefault","stopPropagation","zoom","document","toggleResize","getResizers","left","top","zoneWidth","styles","bottom","backgroundColor","cursor","window","pageXOffset","pageYOffset","right","tableRect","resizerStyles","div","ref","Fragment","className","lexical","theme","tableCellResizer","style","TableCellResizerPlugin","isEditable","body"],"mappings":"AAAA;;AAMA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SACEC,6BAA6B,EAC7BC,mCAAmC,EACnCC,kCAAkC,EAClCC,gBAAgB,EAChBC,eAAe,EACfC,oBAAoB,QACf,iBAAgB;AACvB,SAASC,kBAAkB,QAAQ,iBAAgB;AACnD,SAASC,0BAA0B,QAAQ,UAAS;AACpD,YAAYC,WAAW,QAAO;AAC9B,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AACzE,SAASC,YAAY,QAAQ,YAAW;AAIxC,SAASC,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2BAAa5H,2BAAa,KAACI;YAAiBC,QAAQA;YAAY8F,SAAS0B,IAAI,IAAI,MACxF;QAACxH;QAAQuH;KAAW;AAExB,EAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useLexicalEditable","$computeTableMapSkipCellCheck","$getTableNodeFromLexicalNodeOrThrow","$getTableRowIndexFromTableCellNode","$isTableCellNode","$isTableRowNode","getDOMCellFromTarget","calculateZoomLevel","$getNearestNodeFromDOMNode","React","useCallback","useEffect","useMemo","useRef","useState","createPortal","useEditorConfigContext","MIN_ROW_HEIGHT","MIN_COLUMN_WIDTH","TableCellResizer","editor","targetRef","resizerRef","tableRectRef","editorConfig","mouseStartPosRef","mouseCurrentPos","updateMouseCurrentPos","activeCell","updateActiveCell","isMouseDown","updateIsMouseDown","draggingDirection","updateDraggingDirection","resetState","current","isMouseDownOnEvent","event","buttons","onMouseMove","setTimeout","target","x","clientX","y","clientY","contains","cell","update","tableCellNode","elem","Error","tableNode","tableElement","getElementByKey","getKey","getBoundingClientRect","onMouseDown","onMouseUp","removeRootListener","registerRootListener","rootElement","prevRootElement","addEventListener","removeEventListener","isHeightChanging","direction","updateRowHeight","heightChange","tableRowIndex","tableRows","getChildren","length","tableRow","height","getHeight","undefined","rowCells","Math","min","map","getCellNodeHeight","Infinity","newHeight","max","setHeight","tag","getCellNodeWidth","activeEditor","width","getWidth","domCellNode","computedStyle","getComputedStyle","clientWidth","parseFloat","paddingLeft","paddingRight","clientHeight","getCellColumnIndex","tableMap","row","column","updateColumnWidth","widthChange","columnIndex","startRow","newWidth","setWidth","mouseUpHandler","handler","preventDefault","stopPropagation","zoom","document","toggleResize","getResizers","left","top","zoneWidth","styles","bottom","backgroundColor","cursor","window","pageXOffset","pageYOffset","right","tableRect","resizerStyles","_jsx","ref","_jsxs","Fragment","className","lexical","theme","tableCellResizer","style","TableCellResizerPlugin","$","isEditable","t0","t1"],"sources":["../../../../../../src/features/experimental_table/client/plugins/TableCellResizerPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TableCellNode, TableDOMCell, TableMapType, TableMapValueType } from '@lexical/table'\nimport type { LexicalEditor } from 'lexical'\nimport type { JSX, MouseEventHandler } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n $computeTableMapSkipCellCheck,\n $getTableNodeFromLexicalNodeOrThrow,\n $getTableRowIndexFromTableCellNode,\n $isTableCellNode,\n $isTableRowNode,\n getDOMCellFromTarget,\n} from '@lexical/table'\nimport { calculateZoomLevel } from '@lexical/utils'\nimport { $getNearestNodeFromDOMNode } from 'lexical'\nimport * as React from 'react'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\n\ntype MousePosition = {\n x: number\n y: number\n}\n\ntype MouseDraggingDirection = 'bottom' | 'right'\n\nconst MIN_ROW_HEIGHT = 33\nconst MIN_COLUMN_WIDTH = 50\n\nfunction TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element {\n const targetRef = useRef<HTMLElement | null>(null)\n const resizerRef = useRef<HTMLDivElement | null>(null)\n const tableRectRef = useRef<ClientRect | null>(null)\n const editorConfig = useEditorConfigContext()\n\n const mouseStartPosRef = useRef<MousePosition | null>(null)\n const [mouseCurrentPos, updateMouseCurrentPos] = useState<MousePosition | null>(null)\n\n const [activeCell, updateActiveCell] = useState<TableDOMCell | null>(null)\n const [isMouseDown, updateIsMouseDown] = useState<boolean>(false)\n const [draggingDirection, updateDraggingDirection] = useState<MouseDraggingDirection | null>(null)\n\n const resetState = useCallback(() => {\n updateActiveCell(null)\n targetRef.current = null\n updateDraggingDirection(null)\n mouseStartPosRef.current = null\n tableRectRef.current = null\n }, [])\n\n const isMouseDownOnEvent = (event: MouseEvent) => {\n return (event.buttons & 1) === 1\n }\n\n useEffect(() => {\n const onMouseMove = (event: MouseEvent) => {\n setTimeout(() => {\n const target = event.target\n\n if (draggingDirection) {\n updateMouseCurrentPos({\n x: event.clientX,\n y: event.clientY,\n })\n return\n }\n updateIsMouseDown(isMouseDownOnEvent(event))\n if (resizerRef.current && resizerRef.current.contains(target as Node)) {\n return\n }\n\n if (targetRef.current !== target) {\n targetRef.current = target as HTMLElement\n const cell = getDOMCellFromTarget(target as HTMLElement)\n\n if (cell && activeCell !== cell) {\n editor.update(() => {\n const tableCellNode = $getNearestNodeFromDOMNode(cell.elem)\n\n if (!tableCellNode) {\n throw new Error('TableCellResizer: Table cell node not found.')\n }\n\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n const tableElement = editor.getElementByKey(tableNode.getKey())\n\n if (!tableElement) {\n throw new Error('TableCellResizer: Table element not found.')\n }\n\n targetRef.current = target as HTMLElement\n tableRectRef.current = tableElement.getBoundingClientRect()\n updateActiveCell(cell)\n })\n } else if (cell == null) {\n resetState()\n }\n }\n }, 0)\n }\n\n const onMouseDown = (event: MouseEvent) => {\n setTimeout(() => {\n updateIsMouseDown(true)\n }, 0)\n }\n\n const onMouseUp = (event: MouseEvent) => {\n setTimeout(() => {\n updateIsMouseDown(false)\n }, 0)\n }\n\n const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {\n rootElement?.addEventListener('mousemove', onMouseMove)\n rootElement?.addEventListener('mousedown', onMouseDown)\n rootElement?.addEventListener('mouseup', onMouseUp)\n\n prevRootElement?.removeEventListener('mousemove', onMouseMove)\n prevRootElement?.removeEventListener('mousedown', onMouseDown)\n prevRootElement?.removeEventListener('mouseup', onMouseUp)\n })\n\n return () => {\n removeRootListener()\n }\n }, [activeCell, draggingDirection, editor, resetState])\n\n const isHeightChanging = (direction: MouseDraggingDirection) => {\n if (direction === 'bottom') {\n return true\n }\n return false\n }\n\n const updateRowHeight = useCallback(\n (heightChange: number) => {\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n\n editor.update(\n () => {\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem)\n if (!$isTableCellNode(tableCellNode)) {\n throw new Error('TableCellResizer: Table cell node not found.')\n }\n\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n\n const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode)\n\n const tableRows = tableNode.getChildren()\n\n if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {\n throw new Error('Expected table cell to be inside of table row.')\n }\n\n const tableRow = tableRows[tableRowIndex]\n\n if (!$isTableRowNode(tableRow)) {\n throw new Error('Expected table row')\n }\n\n let height = tableRow.getHeight()\n if (height === undefined) {\n const rowCells = tableRow.getChildren<TableCellNode>()\n height = Math.min(\n ...rowCells.map((cell) => getCellNodeHeight(cell, editor) ?? Infinity),\n )\n }\n\n const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT)\n tableRow.setHeight(newHeight)\n },\n { tag: 'skip-scroll-into-view' },\n )\n },\n [activeCell, editor],\n )\n\n const getCellNodeWidth = (\n cell: TableCellNode,\n activeEditor: LexicalEditor,\n ): number | undefined => {\n const width = cell.getWidth()\n if (width !== undefined) {\n return width\n }\n\n const domCellNode = activeEditor.getElementByKey(cell.getKey())\n if (domCellNode == null) {\n return undefined\n }\n const computedStyle = getComputedStyle(domCellNode)\n return (\n domCellNode.clientWidth -\n parseFloat(computedStyle.paddingLeft) -\n parseFloat(computedStyle.paddingRight)\n )\n }\n\n const getCellNodeHeight = (\n cell: TableCellNode,\n activeEditor: LexicalEditor,\n ): number | undefined => {\n const domCellNode = activeEditor.getElementByKey(cell.getKey())\n return domCellNode?.clientHeight\n }\n\n const getCellColumnIndex = (tableCellNode: TableCellNode, tableMap: TableMapType) => {\n for (let row = 0; row < tableMap.length; row++) {\n for (let column = 0; column < tableMap[row].length; column++) {\n if (tableMap[row][column].cell === tableCellNode) {\n return column\n }\n }\n }\n }\n\n const updateColumnWidth = useCallback(\n (widthChange: number) => {\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n editor.update(\n () => {\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem)\n if (!$isTableCellNode(tableCellNode)) {\n throw new Error('TableCellResizer: Table cell node not found.')\n }\n\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null)\n const columnIndex = getCellColumnIndex(tableCellNode, tableMap)\n if (columnIndex === undefined) {\n throw new Error('TableCellResizer: Table column not found.')\n }\n\n for (let row = 0; row < tableMap.length; row++) {\n const cell: TableMapValueType = tableMap[row][columnIndex]\n if (\n cell.startRow === row &&\n (columnIndex === tableMap[row].length - 1 ||\n tableMap[row][columnIndex].cell !== tableMap[row][columnIndex + 1].cell)\n ) {\n const width = getCellNodeWidth(cell.cell, editor)\n if (width === undefined) {\n continue\n }\n const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH)\n cell.cell.setWidth(newWidth)\n }\n }\n },\n { tag: 'skip-scroll-into-view' },\n )\n },\n [activeCell, editor],\n )\n\n const mouseUpHandler = useCallback(\n (direction: MouseDraggingDirection) => {\n const handler = (event: MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n\n if (mouseStartPosRef.current) {\n const { x, y } = mouseStartPosRef.current\n\n if (activeCell === null) {\n return\n }\n const zoom = calculateZoomLevel(event.target as Element)\n\n if (isHeightChanging(direction)) {\n const heightChange = (event.clientY - y) / zoom\n updateRowHeight(heightChange)\n } else {\n const widthChange = (event.clientX - x) / zoom\n updateColumnWidth(widthChange)\n }\n\n resetState()\n document.removeEventListener('mouseup', handler)\n }\n }\n return handler\n },\n [activeCell, resetState, updateColumnWidth, updateRowHeight],\n )\n\n const toggleResize = useCallback(\n (direction: MouseDraggingDirection): MouseEventHandler<HTMLDivElement> =>\n (event) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n\n mouseStartPosRef.current = {\n x: event.clientX,\n y: event.clientY,\n }\n updateMouseCurrentPos(mouseStartPosRef.current)\n updateDraggingDirection(direction)\n\n document.addEventListener('mouseup', mouseUpHandler(direction))\n },\n [activeCell, mouseUpHandler],\n )\n\n const getResizers = useCallback(() => {\n if (activeCell) {\n const { height, left, top, width } = activeCell.elem.getBoundingClientRect()\n const zoom = calculateZoomLevel(activeCell.elem)\n const zoneWidth = 10 // Pixel width of the zone where you can drag the edge\n const styles = {\n bottom: {\n backgroundColor: 'none',\n cursor: 'row-resize',\n height: `${zoneWidth}px`,\n left: `${window.pageXOffset + left}px`,\n top: `${window.pageYOffset + top + height - zoneWidth / 2}px`,\n width: `${width}px`,\n },\n right: {\n backgroundColor: 'none',\n cursor: 'col-resize',\n height: `${height}px`,\n left: `${window.pageXOffset + left + width - zoneWidth / 2}px`,\n top: `${window.pageYOffset + top}px`,\n width: `${zoneWidth}px`,\n },\n }\n\n const tableRect = tableRectRef.current\n\n if (draggingDirection && mouseCurrentPos && tableRect) {\n if (isHeightChanging(draggingDirection)) {\n styles[draggingDirection].left = `${window.pageXOffset + tableRect.left}px`\n styles[draggingDirection].top = `${window.pageYOffset + mouseCurrentPos.y / zoom}px`\n styles[draggingDirection].height = '3px'\n styles[draggingDirection].width = `${tableRect.width}px`\n } else {\n styles[draggingDirection].top = `${window.pageYOffset + tableRect.top}px`\n styles[draggingDirection].left = `${window.pageXOffset + mouseCurrentPos.x / zoom}px`\n styles[draggingDirection].width = '3px'\n styles[draggingDirection].height = `${tableRect.height}px`\n }\n\n styles[draggingDirection].backgroundColor = '#adf'\n }\n\n return styles\n }\n\n return {\n bottom: null,\n left: null,\n right: null,\n top: null,\n }\n }, [activeCell, draggingDirection, mouseCurrentPos])\n\n const resizerStyles = getResizers()\n\n return (\n <div ref={resizerRef}>\n {activeCell != null && !isMouseDown && (\n <React.Fragment>\n <div\n className={`${editorConfig.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`}\n onMouseDown={toggleResize('right')}\n style={resizerStyles.right || undefined}\n />\n <div\n className={`${editorConfig.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`}\n onMouseDown={toggleResize('bottom')}\n style={resizerStyles.bottom || undefined}\n />\n </React.Fragment>\n )}\n </div>\n )\n}\n\nexport const TableCellResizerPlugin: PluginComponent = () => {\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n return useMemo(\n () => (isEditable ? createPortal(<TableCellResizer editor={editor} />, document.body) : null),\n [editor, isEditable],\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAMA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SACEC,6BAA6B,EAC7BC,mCAAmC,EACnCC,kCAAkC,EAClCC,gBAAgB,EAChBC,eAAe,EACfC,oBAAoB,QACf;AACP,SAASC,kBAAkB,QAAQ;AACnC,SAASC,0BAA0B,QAAQ;AAC3C,YAAYC,KAAA,MAAW;AACvB,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAClE,SAASC,YAAY,QAAQ;AAI7B,SAASC,sBAAsB,QAAQ;AASvC,MAAMC,cAAA,GAAiB;AACvB,MAAMC,gBAAA,GAAmB;AAEzB,SAASC,iBAAiB;EAAEC;AAAM,CAA6B;EAC7D,MAAMC,SAAA,GAAYR,MAAA,CAA2B;EAC7C,MAAMS,UAAA,GAAaT,MAAA,CAA8B;EACjD,MAAMU,YAAA,GAAeV,MAAA,CAA0B;EAC/C,MAAMW,YAAA,GAAeR,sBAAA;EAErB,MAAMS,gBAAA,GAAmBZ,MAAA,CAA6B;EACtD,MAAM,CAACa,eAAA,EAAiBC,qBAAA,CAAsB,GAAGb,QAAA,CAA+B;EAEhF,MAAM,CAACc,UAAA,EAAYC,gBAAA,CAAiB,GAAGf,QAAA,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,KAAA,EAAOT,aAAA,CAAcF,KAAK,IAAInD;uBAEhCsD,IAAA,CAAC;QACCI,SAAA,EAAW,GAAG9G,YAAA,CAAaA,YAAY,CAAC+G,OAAO,CAACC,KAAK,CAACC,gBAAgB,uBAAuB;QAC7FhF,WAAA,EAAa0D,YAAA,CAAa;QAC1BuB,KAAA,EAAOT,aAAA,CAAcR,MAAM,IAAI7C;;;;AAM3C;AAEA,OAAO,MAAM+D,sBAAA,GAA0CA,CAAA;EAAA,MAAAC,CAAA,GAAA9I,EAAA;EACrD,OAAAsB,MAAA,IAAiBrB,yBAAA;EACjB,MAAA8I,UAAA,GAAmB7I,kBAAA;EAAA,IAAA8I,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAH,CAAA,QAAAC,UAAA,IAAAD,CAAA,QAAAxH,MAAA;IAGV2H,EAAA,GAAAF,UAAA,GAAa9H,YAAA,CAAamH,IAAA,CAAA/G,gBAAA;MAAAC;IAAA,C,gBAAmD,QAAI;IAAAwH,CAAA,MAAAC,UAAA;IAAAD,CAAA,MAAAxH,MAAA;IAAAwH,CAAA,MAAAG,EAAA;EAAA;IAAAA,EAAA,GAAAH,CAAA;EAAA;EAAAE,EAAA,GAAjFC,EAAiF;EAAA,OADnFD,EAEe;AAAA,CAExB","ignoreList":[]}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
1
|
import * as React from 'react';
|
|
9
2
|
export declare function TableHoverActionsPlugin({ anchorElem, }: {
|
|
10
3
|
anchorElem?: HTMLElement;
|
package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAmN9B,wBAAgB,uBAAuB,CAAC,EACtC,UAA0B,GAC3B,EAAE;IACD,UAAU,CAAC,EAAE,WAAW,CAAA;CACzB,GAAG,KAAK,CAAC,WAAW,GAAG,IAAI,CAE3B"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
5
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
9
6
|
import { $getTableColumnIndexFromTableCellNode, $getTableRowIndexFromTableCellNode, $insertTableColumn__EXPERIMENTAL, $insertTableRow__EXPERIMENTAL, $isTableCellNode, $isTableNode, TableNode } from '@lexical/table';
|
|
10
7
|
import { $findMatchingParent, mergeRegister } from '@lexical/utils';
|
|
@@ -15,167 +12,239 @@ import { createPortal } from 'react-dom';
|
|
|
15
12
|
import { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js';
|
|
16
13
|
import { useDebounce } from '../../utils/useDebounce.js';
|
|
17
14
|
const BUTTON_WIDTH_PX = 20;
|
|
18
|
-
function TableHoverActionsContainer(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
15
|
+
function TableHoverActionsContainer(t0) {
|
|
16
|
+
const $ = _c(14);
|
|
17
|
+
const {
|
|
18
|
+
anchorElem
|
|
19
|
+
} = t0;
|
|
20
|
+
const [editor] = useLexicalComposerContext();
|
|
21
|
+
const editorConfig = useEditorConfigContext();
|
|
22
|
+
const [isShownRow, setShownRow] = useState(false);
|
|
23
|
+
const [isShownColumn, setShownColumn] = useState(false);
|
|
24
|
+
const [shouldListenMouseMove, setShouldListenMouseMove] = useState(false);
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
27
|
+
t1 = {};
|
|
28
|
+
$[0] = t1;
|
|
29
|
+
} else {
|
|
30
|
+
t1 = $[0];
|
|
31
|
+
}
|
|
32
|
+
const [position, setPosition] = useState(t1);
|
|
33
|
+
let t2;
|
|
34
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
35
|
+
t2 = new Set();
|
|
36
|
+
$[1] = t2;
|
|
37
|
+
} else {
|
|
38
|
+
t2 = $[1];
|
|
39
|
+
}
|
|
40
|
+
const codeSetRef = useRef(t2);
|
|
41
|
+
const tableDOMNodeRef = useRef(null);
|
|
42
|
+
const debouncedOnMouseMove = useDebounce(event => {
|
|
43
|
+
const {
|
|
44
|
+
isOutside,
|
|
45
|
+
tableDOMNode
|
|
46
|
+
} = getMouseInfo(event, editorConfig.editorConfig?.lexical);
|
|
47
|
+
if (isOutside) {
|
|
48
|
+
setShownRow(false);
|
|
49
|
+
setShownColumn(false);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!tableDOMNode) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
tableDOMNodeRef.current = tableDOMNode;
|
|
56
|
+
let hoveredRowNode;
|
|
57
|
+
hoveredRowNode = null;
|
|
58
|
+
let hoveredColumnNode;
|
|
59
|
+
hoveredColumnNode = null;
|
|
60
|
+
let tableDOMElement;
|
|
61
|
+
tableDOMElement = null;
|
|
62
|
+
editor.update(() => {
|
|
63
|
+
const maybeTableCell = $getNearestNodeFromDOMNode(tableDOMNode);
|
|
64
|
+
if ($isTableCellNode(maybeTableCell)) {
|
|
65
|
+
const table = $findMatchingParent(maybeTableCell, node => $isTableNode(node));
|
|
66
|
+
if (!$isTableNode(table)) {
|
|
67
|
+
return;
|
|
36
68
|
}
|
|
37
|
-
|
|
38
|
-
let hoveredRowNode = null;
|
|
39
|
-
let hoveredColumnNode = null;
|
|
40
|
-
let tableDOMElement = null;
|
|
41
|
-
editor.update(()=>{
|
|
42
|
-
const maybeTableCell = $getNearestNodeFromDOMNode(tableDOMNode);
|
|
43
|
-
if ($isTableCellNode(maybeTableCell)) {
|
|
44
|
-
const table = $findMatchingParent(maybeTableCell, (node)=>$isTableNode(node));
|
|
45
|
-
if (!$isTableNode(table)) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
tableDOMElement = editor.getElementByKey(table?.getKey());
|
|
49
|
-
if (tableDOMElement) {
|
|
50
|
-
const rowCount = table.getChildrenSize();
|
|
51
|
-
const colCount = // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
52
|
-
table.getChildAtIndex(0)?.getChildrenSize();
|
|
53
|
-
const rowIndex = $getTableRowIndexFromTableCellNode(maybeTableCell);
|
|
54
|
-
const colIndex = $getTableColumnIndexFromTableCellNode(maybeTableCell);
|
|
55
|
-
if (rowIndex === rowCount - 1) {
|
|
56
|
-
hoveredRowNode = maybeTableCell;
|
|
57
|
-
} else if (colIndex === colCount - 1) {
|
|
58
|
-
hoveredColumnNode = maybeTableCell;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
69
|
+
tableDOMElement = editor.getElementByKey(table?.getKey());
|
|
63
70
|
if (tableDOMElement) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
width: tableElemWidth
|
|
74
|
-
});
|
|
75
|
-
} else if (hoveredColumnNode) {
|
|
76
|
-
setShownColumn(true);
|
|
77
|
-
setShownRow(false);
|
|
78
|
-
setPosition({
|
|
79
|
-
height: tableElemHeight,
|
|
80
|
-
left: tableElemRight - editorElemLeft + 5,
|
|
81
|
-
top: tableElemY - editorElemY,
|
|
82
|
-
width: BUTTON_WIDTH_PX
|
|
83
|
-
});
|
|
71
|
+
const rowCount = table.getChildrenSize();
|
|
72
|
+
const colCount = table.getChildAtIndex(0)?.getChildrenSize();
|
|
73
|
+
const rowIndex = $getTableRowIndexFromTableCellNode(maybeTableCell);
|
|
74
|
+
const colIndex = $getTableColumnIndexFromTableCellNode(maybeTableCell);
|
|
75
|
+
if (rowIndex === rowCount - 1) {
|
|
76
|
+
hoveredRowNode = maybeTableCell;
|
|
77
|
+
} else {
|
|
78
|
+
if (colIndex === colCount - 1) {
|
|
79
|
+
hoveredColumnNode = maybeTableCell;
|
|
84
80
|
}
|
|
81
|
+
}
|
|
85
82
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
break;
|
|
110
|
-
case 'destroyed':
|
|
111
|
-
codeSetRef.current.delete(key);
|
|
112
|
-
setShouldListenMouseMove(codeSetRef.current.size > 0);
|
|
113
|
-
break;
|
|
114
|
-
default:
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}, {
|
|
120
|
-
skipInitialization: false
|
|
121
|
-
}));
|
|
122
|
-
}, [
|
|
123
|
-
editor
|
|
124
|
-
]);
|
|
125
|
-
const insertAction = (insertRow)=>{
|
|
126
|
-
editor.update(()=>{
|
|
127
|
-
if (tableDOMNodeRef.current) {
|
|
128
|
-
const maybeTableNode = $getNearestNodeFromDOMNode(tableDOMNodeRef.current);
|
|
129
|
-
maybeTableNode?.selectEnd();
|
|
130
|
-
if (insertRow) {
|
|
131
|
-
$insertTableRow__EXPERIMENTAL();
|
|
132
|
-
setShownRow(false);
|
|
133
|
-
} else {
|
|
134
|
-
$insertTableColumn__EXPERIMENTAL();
|
|
135
|
-
setShownColumn(false);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
if (tableDOMElement) {
|
|
86
|
+
const {
|
|
87
|
+
bottom: tableElemBottom,
|
|
88
|
+
height: tableElemHeight,
|
|
89
|
+
right: tableElemRight,
|
|
90
|
+
width: tableElemWidth,
|
|
91
|
+
x: tableElemX,
|
|
92
|
+
y: tableElemY
|
|
93
|
+
} = tableDOMElement.getBoundingClientRect();
|
|
94
|
+
const {
|
|
95
|
+
left: editorElemLeft,
|
|
96
|
+
y: editorElemY
|
|
97
|
+
} = anchorElem.getBoundingClientRect();
|
|
98
|
+
if (hoveredRowNode) {
|
|
99
|
+
setShownColumn(false);
|
|
100
|
+
setShownRow(true);
|
|
101
|
+
setPosition({
|
|
102
|
+
height: BUTTON_WIDTH_PX,
|
|
103
|
+
left: tableElemX - editorElemLeft,
|
|
104
|
+
top: tableElemBottom - editorElemY + 5,
|
|
105
|
+
width: tableElemWidth
|
|
138
106
|
});
|
|
107
|
+
} else {
|
|
108
|
+
if (hoveredColumnNode) {
|
|
109
|
+
setShownColumn(true);
|
|
110
|
+
setShownRow(false);
|
|
111
|
+
setPosition({
|
|
112
|
+
height: tableElemHeight,
|
|
113
|
+
left: tableElemRight - editorElemLeft + 5,
|
|
114
|
+
top: tableElemY - editorElemY,
|
|
115
|
+
width: BUTTON_WIDTH_PX
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, 50, 250);
|
|
121
|
+
let t3;
|
|
122
|
+
let t4;
|
|
123
|
+
if ($[2] !== shouldListenMouseMove || $[3] !== debouncedOnMouseMove) {
|
|
124
|
+
t3 = () => {
|
|
125
|
+
if (!shouldListenMouseMove) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
document.addEventListener("mousemove", debouncedOnMouseMove);
|
|
129
|
+
return () => {
|
|
130
|
+
setShownRow(false);
|
|
131
|
+
setShownColumn(false);
|
|
132
|
+
document.removeEventListener("mousemove", debouncedOnMouseMove);
|
|
133
|
+
};
|
|
139
134
|
};
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
135
|
+
t4 = [shouldListenMouseMove, debouncedOnMouseMove];
|
|
136
|
+
$[2] = shouldListenMouseMove;
|
|
137
|
+
$[3] = debouncedOnMouseMove;
|
|
138
|
+
$[4] = t3;
|
|
139
|
+
$[5] = t4;
|
|
140
|
+
} else {
|
|
141
|
+
t3 = $[4];
|
|
142
|
+
t4 = $[5];
|
|
143
|
+
}
|
|
144
|
+
useEffect(t3, t4);
|
|
145
|
+
let t5;
|
|
146
|
+
let t6;
|
|
147
|
+
if ($[6] !== editor) {
|
|
148
|
+
t5 = () => mergeRegister(editor.registerMutationListener(TableNode, mutations => {
|
|
149
|
+
editor.getEditorState().read(() => {
|
|
150
|
+
for (const [key, type] of mutations) {
|
|
151
|
+
bb61: switch (type) {
|
|
152
|
+
case "created":
|
|
153
|
+
{
|
|
154
|
+
codeSetRef.current.add(key);
|
|
155
|
+
setShouldListenMouseMove(codeSetRef.current.size > 0);
|
|
156
|
+
break bb61;
|
|
157
|
+
}
|
|
158
|
+
case "destroyed":
|
|
159
|
+
{
|
|
160
|
+
codeSetRef.current.delete(key);
|
|
161
|
+
setShouldListenMouseMove(codeSetRef.current.size > 0);
|
|
162
|
+
break bb61;
|
|
163
|
+
}
|
|
164
|
+
default:
|
|
165
|
+
{}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}, {
|
|
170
|
+
skipInitialization: false
|
|
171
|
+
}));
|
|
172
|
+
t6 = [editor];
|
|
173
|
+
$[6] = editor;
|
|
174
|
+
$[7] = t5;
|
|
175
|
+
$[8] = t6;
|
|
176
|
+
} else {
|
|
177
|
+
t5 = $[7];
|
|
178
|
+
t6 = $[8];
|
|
179
|
+
}
|
|
180
|
+
useEffect(t5, t6);
|
|
181
|
+
const insertAction = insertRow => {
|
|
182
|
+
editor.update(() => {
|
|
183
|
+
if (tableDOMNodeRef.current) {
|
|
184
|
+
const maybeTableNode = $getNearestNodeFromDOMNode(tableDOMNodeRef.current);
|
|
185
|
+
maybeTableNode?.selectEnd();
|
|
186
|
+
if (insertRow) {
|
|
187
|
+
$insertTableRow__EXPERIMENTAL();
|
|
188
|
+
setShownRow(false);
|
|
189
|
+
} else {
|
|
190
|
+
$insertTableColumn__EXPERIMENTAL();
|
|
191
|
+
setShownColumn(false);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
const t7 = _jsxs;
|
|
197
|
+
const t8 = _Fragment;
|
|
198
|
+
const t9 = isShownRow && _jsx("button", {
|
|
199
|
+
className: editorConfig.editorConfig.lexical.theme.tableAddRows,
|
|
200
|
+
onClick: () => insertAction(true),
|
|
201
|
+
style: {
|
|
202
|
+
...position
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
const t10 = isShownColumn && _jsx("button", {
|
|
206
|
+
className: editorConfig.editorConfig.lexical.theme.tableAddColumns,
|
|
207
|
+
onClick: () => insertAction(false),
|
|
208
|
+
style: {
|
|
209
|
+
...position
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
let t11;
|
|
213
|
+
if ($[9] !== t9 || $[10] !== t10 || $[11] !== t7 || $[12] !== t8) {
|
|
214
|
+
t11 = t7(t8, {
|
|
215
|
+
children: [t9, t10]
|
|
157
216
|
});
|
|
217
|
+
$[9] = t9;
|
|
218
|
+
$[10] = t10;
|
|
219
|
+
$[11] = t7;
|
|
220
|
+
$[12] = t8;
|
|
221
|
+
$[13] = t11;
|
|
222
|
+
} else {
|
|
223
|
+
t11 = $[13];
|
|
224
|
+
}
|
|
225
|
+
return t11;
|
|
158
226
|
}
|
|
159
227
|
function getMouseInfo(event, editorConfig) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
228
|
+
const target = event.target;
|
|
229
|
+
if (target && target instanceof HTMLElement) {
|
|
230
|
+
const tableDOMNode = target.closest(`td.${editorConfig.theme.tableCell}, th.${editorConfig.theme.tableCell}`);
|
|
231
|
+
const isOutside = !(tableDOMNode || target.closest(`button.${editorConfig.theme.tableAddRows}`) || target.closest(`button.${editorConfig.theme.tableAddColumns}`) || target.closest(`div.${editorConfig.theme.tableCellResizer}`));
|
|
232
|
+
return {
|
|
233
|
+
isOutside,
|
|
234
|
+
tableDOMNode
|
|
235
|
+
};
|
|
236
|
+
} else {
|
|
237
|
+
return {
|
|
238
|
+
isOutside: true,
|
|
239
|
+
tableDOMNode: null
|
|
240
|
+
};
|
|
241
|
+
}
|
|
174
242
|
}
|
|
175
|
-
export function TableHoverActionsPlugin({
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
243
|
+
export function TableHoverActionsPlugin({
|
|
244
|
+
anchorElem = document.body
|
|
245
|
+
}) {
|
|
246
|
+
return /*#__PURE__*/createPortal( /*#__PURE__*/_jsx(TableHoverActionsContainer, {
|
|
247
|
+
anchorElem: anchorElem
|
|
248
|
+
}), anchorElem);
|
|
179
249
|
}
|
|
180
|
-
|
|
181
250
|
//# sourceMappingURL=index.js.map
|
package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.tsx"],"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 { TableCellNode, TableRowNode } from '@lexical/table'\nimport type { EditorConfig, NodeKey } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport {\n $getTableColumnIndexFromTableCellNode,\n $getTableRowIndexFromTableCellNode,\n $insertTableColumn__EXPERIMENTAL,\n $insertTableRow__EXPERIMENTAL,\n $isTableCellNode,\n $isTableNode,\n TableNode,\n} from '@lexical/table'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport { $getNearestNodeFromDOMNode } from 'lexical'\nimport { useEffect, useRef, useState } from 'react'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useDebounce } from '../../utils/useDebounce.js'\n\nconst BUTTON_WIDTH_PX = 20\n\nfunction TableHoverActionsContainer({ anchorElem }: { anchorElem: HTMLElement }): JSX.Element {\n const [editor] = useLexicalComposerContext()\n const editorConfig = useEditorConfigContext()\n const [isShownRow, setShownRow] = useState<boolean>(false)\n const [isShownColumn, setShownColumn] = useState<boolean>(false)\n const [shouldListenMouseMove, setShouldListenMouseMove] = useState<boolean>(false)\n const [position, setPosition] = useState({})\n const codeSetRef = useRef<Set<NodeKey>>(new Set())\n const tableDOMNodeRef = useRef<HTMLElement | null>(null)\n\n const debouncedOnMouseMove = useDebounce(\n (event: MouseEvent) => {\n const { isOutside, tableDOMNode } = getMouseInfo(event, editorConfig.editorConfig?.lexical)\n\n if (isOutside) {\n setShownRow(false)\n setShownColumn(false)\n return\n }\n\n if (!tableDOMNode) {\n return\n }\n\n tableDOMNodeRef.current = tableDOMNode\n\n let hoveredRowNode: TableCellNode | null = null\n let hoveredColumnNode: TableCellNode | null = null\n let tableDOMElement: HTMLElement | null = null\n\n editor.update(() => {\n const maybeTableCell = $getNearestNodeFromDOMNode(tableDOMNode)\n\n if ($isTableCellNode(maybeTableCell)) {\n const table = $findMatchingParent(maybeTableCell, (node) => $isTableNode(node))\n if (!$isTableNode(table)) {\n return\n }\n\n tableDOMElement = editor.getElementByKey(table?.getKey())\n\n if (tableDOMElement) {\n const rowCount = table.getChildrenSize()\n const colCount =\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n ((table as TableNode).getChildAtIndex(0) as TableRowNode)?.getChildrenSize()\n\n const rowIndex = $getTableRowIndexFromTableCellNode(maybeTableCell)\n const colIndex = $getTableColumnIndexFromTableCellNode(maybeTableCell)\n\n if (rowIndex === rowCount - 1) {\n hoveredRowNode = maybeTableCell\n } else if (colIndex === colCount - 1) {\n hoveredColumnNode = maybeTableCell\n }\n }\n }\n })\n\n if (tableDOMElement) {\n const {\n bottom: tableElemBottom,\n height: tableElemHeight,\n right: tableElemRight,\n width: tableElemWidth,\n x: tableElemX,\n y: tableElemY,\n } = (tableDOMElement as HTMLTableElement).getBoundingClientRect()\n\n const { left: editorElemLeft, y: editorElemY } = anchorElem.getBoundingClientRect()\n\n if (hoveredRowNode) {\n setShownColumn(false)\n setShownRow(true)\n setPosition({\n height: BUTTON_WIDTH_PX,\n left: tableElemX - editorElemLeft,\n top: tableElemBottom - editorElemY + 5,\n width: tableElemWidth,\n })\n } else if (hoveredColumnNode) {\n setShownColumn(true)\n setShownRow(false)\n setPosition({\n height: tableElemHeight,\n left: tableElemRight - editorElemLeft + 5,\n top: tableElemY - editorElemY,\n width: BUTTON_WIDTH_PX,\n })\n }\n }\n },\n 50,\n 250,\n )\n\n useEffect(() => {\n if (!shouldListenMouseMove) {\n return\n }\n\n document.addEventListener('mousemove', debouncedOnMouseMove)\n\n return () => {\n setShownRow(false)\n setShownColumn(false)\n\n document.removeEventListener('mousemove', debouncedOnMouseMove)\n }\n }, [shouldListenMouseMove, debouncedOnMouseMove])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerMutationListener(\n TableNode,\n (mutations) => {\n editor.getEditorState().read(() => {\n for (const [key, type] of mutations) {\n switch (type) {\n case 'created':\n codeSetRef.current.add(key)\n setShouldListenMouseMove(codeSetRef.current.size > 0)\n break\n\n case 'destroyed':\n codeSetRef.current.delete(key)\n setShouldListenMouseMove(codeSetRef.current.size > 0)\n break\n\n default:\n break\n }\n }\n })\n },\n { skipInitialization: false },\n ),\n )\n }, [editor])\n\n const insertAction = (insertRow: boolean) => {\n editor.update(() => {\n if (tableDOMNodeRef.current) {\n const maybeTableNode = $getNearestNodeFromDOMNode(tableDOMNodeRef.current)\n maybeTableNode?.selectEnd()\n if (insertRow) {\n $insertTableRow__EXPERIMENTAL()\n setShownRow(false)\n } else {\n $insertTableColumn__EXPERIMENTAL()\n setShownColumn(false)\n }\n }\n })\n }\n\n return (\n <>\n {isShownRow && (\n <button\n className={editorConfig.editorConfig.lexical.theme.tableAddRows}\n onClick={() => insertAction(true)}\n style={{ ...position }}\n />\n )}\n {isShownColumn && (\n <button\n className={editorConfig.editorConfig.lexical.theme.tableAddColumns}\n onClick={() => insertAction(false)}\n style={{ ...position }}\n />\n )}\n </>\n )\n}\n\nfunction getMouseInfo(\n event: MouseEvent,\n editorConfig: EditorConfig,\n): {\n isOutside: boolean\n tableDOMNode: HTMLElement | null\n} {\n const target = event.target\n\n if (target && target instanceof HTMLElement) {\n const tableDOMNode = target.closest<HTMLElement>(\n `td.${editorConfig.theme.tableCell}, th.${editorConfig.theme.tableCell}`,\n )\n\n const isOutside = !(\n tableDOMNode ||\n target.closest<HTMLElement>(`button.${editorConfig.theme.tableAddRows}`) ||\n target.closest<HTMLElement>(`button.${editorConfig.theme.tableAddColumns}`) ||\n target.closest<HTMLElement>(`div.${editorConfig.theme.tableCellResizer}`)\n )\n\n return { isOutside, tableDOMNode }\n } else {\n return { isOutside: true, tableDOMNode: null }\n }\n}\n\nexport function TableHoverActionsPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactPortal | null {\n return createPortal(<TableHoverActionsContainer anchorElem={anchorElem} />, anchorElem)\n}\n"],"names":["useLexicalComposerContext","$getTableColumnIndexFromTableCellNode","$getTableRowIndexFromTableCellNode","$insertTableColumn__EXPERIMENTAL","$insertTableRow__EXPERIMENTAL","$isTableCellNode","$isTableNode","TableNode","$findMatchingParent","mergeRegister","$getNearestNodeFromDOMNode","useEffect","useRef","useState","React","createPortal","useEditorConfigContext","useDebounce","BUTTON_WIDTH_PX","TableHoverActionsContainer","anchorElem","editor","editorConfig","isShownRow","setShownRow","isShownColumn","setShownColumn","shouldListenMouseMove","setShouldListenMouseMove","position","setPosition","codeSetRef","Set","tableDOMNodeRef","debouncedOnMouseMove","event","isOutside","tableDOMNode","getMouseInfo","lexical","current","hoveredRowNode","hoveredColumnNode","tableDOMElement","update","maybeTableCell","table","node","getElementByKey","getKey","rowCount","getChildrenSize","colCount","getChildAtIndex","rowIndex","colIndex","bottom","tableElemBottom","height","tableElemHeight","right","tableElemRight","width","tableElemWidth","x","tableElemX","y","tableElemY","getBoundingClientRect","left","editorElemLeft","editorElemY","top","document","addEventListener","removeEventListener","registerMutationListener","mutations","getEditorState","read","key","type","add","size","delete","skipInitialization","insertAction","insertRow","maybeTableNode","selectEnd","button","className","theme","tableAddRows","onClick","style","tableAddColumns","target","HTMLElement","closest","tableCell","tableCellResizer","TableHoverActionsPlugin","body"],"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AASS,aACPH,KAAiB,EACjBb,YAA0B;IAK1B,MAAM2E,SAAS9D,MAAM8D,MAAM;IAE3B,IAAIA,UAAUA,kBAAkBC,aAAa;QAC3C,MAAM7D,eAAe4D,OAAOE,OAAO,CACjC,CAAC,GAAG,EAAE7E,aAAasE,KAAK,CAACQ,SAAS,CAAC,KAAK,EAAE9E,aAAasE,KAAK,CAACQ,SAAS,CAAC,CAAC;QAG1E,MAAMhE,YAAY,CAChBC,CAAAA,gBACA4D,OAAOE,OAAO,CAAc,CAAC,OAAO,EAAE7E,aAAasE,KAAK,CAACC,YAAY,CAAC,CAAC,KACvEI,OAAOE,OAAO,CAAc,CAAC,OAAO,EAAE7E,aAAasE,KAAK,CAACI,eAAe,CAAC,CAAC,KAC1EC,OAAOE,OAAO,CAAc,CAAC,IAAI,EAAE7E,aAAasE,KAAK,CAACS,gBAAgB,CAAC,CAAC,CAAA;QAG1E,OAAO;YAAEjE;YAAWC;QAAa;IACnC,OAAO;QACL,OAAO;YAAED,WAAW;YAAMC,cAAc;QAAK;IAC/C;AACF;AAEA,OAAO,SAASiE,wBAAwB,EACtClF,aAAaqD,SAAS8B,IAAI,EAG3B;IACC,qBAAOxF,2BAAa,KAACI;QAA2BC,YAAYA;QAAgBA;AAC9E"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$getTableColumnIndexFromTableCellNode","$getTableRowIndexFromTableCellNode","$insertTableColumn__EXPERIMENTAL","$insertTableRow__EXPERIMENTAL","$isTableCellNode","$isTableNode","TableNode","$findMatchingParent","mergeRegister","$getNearestNodeFromDOMNode","useEffect","useRef","useState","React","createPortal","useEditorConfigContext","useDebounce","BUTTON_WIDTH_PX","TableHoverActionsContainer","t0","$","anchorElem","editor","editorConfig","isShownRow","setShownRow","isShownColumn","setShownColumn","shouldListenMouseMove","setShouldListenMouseMove","t1","Symbol","for","position","setPosition","t2","Set","codeSetRef","tableDOMNodeRef","debouncedOnMouseMove","event","isOutside","tableDOMNode","getMouseInfo","lexical","current","hoveredRowNode","hoveredColumnNode","tableDOMElement","update","maybeTableCell","table","node","getElementByKey","getKey","rowCount","getChildrenSize","colCount","getChildAtIndex","rowIndex","colIndex","bottom","tableElemBottom","height","tableElemHeight","right","tableElemRight","width","tableElemWidth","x","tableElemX","y","tableElemY","getBoundingClientRect","left","editorElemLeft","editorElemY","top","t3","t4","document","addEventListener","removeEventListener","t5","t6","registerMutationListener","mutations","getEditorState","read","key","type","bb61","add","size","delete","skipInitialization","insertAction","insertRow","maybeTableNode","selectEnd","_jsxs","_Fragment","t9","_jsx","className","theme","tableAddRows","onClick","style","t10","tableAddColumns","t11","children","target","HTMLElement","closest","tableCell","tableCellResizer","TableHoverActionsPlugin","body"],"sources":["../../../../../../src/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TableCellNode, TableRowNode } from '@lexical/table'\nimport type { EditorConfig, NodeKey } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport {\n $getTableColumnIndexFromTableCellNode,\n $getTableRowIndexFromTableCellNode,\n $insertTableColumn__EXPERIMENTAL,\n $insertTableRow__EXPERIMENTAL,\n $isTableCellNode,\n $isTableNode,\n TableNode,\n} from '@lexical/table'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport { $getNearestNodeFromDOMNode } from 'lexical'\nimport { useEffect, useRef, useState } from 'react'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useDebounce } from '../../utils/useDebounce.js'\n\nconst BUTTON_WIDTH_PX = 20\n\nfunction TableHoverActionsContainer({ anchorElem }: { anchorElem: HTMLElement }): JSX.Element {\n const [editor] = useLexicalComposerContext()\n const editorConfig = useEditorConfigContext()\n const [isShownRow, setShownRow] = useState<boolean>(false)\n const [isShownColumn, setShownColumn] = useState<boolean>(false)\n const [shouldListenMouseMove, setShouldListenMouseMove] = useState<boolean>(false)\n const [position, setPosition] = useState({})\n const codeSetRef = useRef<Set<NodeKey>>(new Set())\n const tableDOMNodeRef = useRef<HTMLElement | null>(null)\n\n const debouncedOnMouseMove = useDebounce(\n (event: MouseEvent) => {\n const { isOutside, tableDOMNode } = getMouseInfo(event, editorConfig.editorConfig?.lexical)\n\n if (isOutside) {\n setShownRow(false)\n setShownColumn(false)\n return\n }\n\n if (!tableDOMNode) {\n return\n }\n\n tableDOMNodeRef.current = tableDOMNode\n\n let hoveredRowNode: TableCellNode | null = null\n let hoveredColumnNode: TableCellNode | null = null\n let tableDOMElement: HTMLElement | null = null\n\n editor.update(() => {\n const maybeTableCell = $getNearestNodeFromDOMNode(tableDOMNode)\n\n if ($isTableCellNode(maybeTableCell)) {\n const table = $findMatchingParent(maybeTableCell, (node) => $isTableNode(node))\n if (!$isTableNode(table)) {\n return\n }\n\n tableDOMElement = editor.getElementByKey(table?.getKey())\n\n if (tableDOMElement) {\n const rowCount = table.getChildrenSize()\n const colCount =\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n ((table as TableNode).getChildAtIndex(0) as TableRowNode)?.getChildrenSize()\n\n const rowIndex = $getTableRowIndexFromTableCellNode(maybeTableCell)\n const colIndex = $getTableColumnIndexFromTableCellNode(maybeTableCell)\n\n if (rowIndex === rowCount - 1) {\n hoveredRowNode = maybeTableCell\n } else if (colIndex === colCount - 1) {\n hoveredColumnNode = maybeTableCell\n }\n }\n }\n })\n\n if (tableDOMElement) {\n const {\n bottom: tableElemBottom,\n height: tableElemHeight,\n right: tableElemRight,\n width: tableElemWidth,\n x: tableElemX,\n y: tableElemY,\n } = (tableDOMElement as HTMLTableElement).getBoundingClientRect()\n\n const { left: editorElemLeft, y: editorElemY } = anchorElem.getBoundingClientRect()\n\n if (hoveredRowNode) {\n setShownColumn(false)\n setShownRow(true)\n setPosition({\n height: BUTTON_WIDTH_PX,\n left: tableElemX - editorElemLeft,\n top: tableElemBottom - editorElemY + 5,\n width: tableElemWidth,\n })\n } else if (hoveredColumnNode) {\n setShownColumn(true)\n setShownRow(false)\n setPosition({\n height: tableElemHeight,\n left: tableElemRight - editorElemLeft + 5,\n top: tableElemY - editorElemY,\n width: BUTTON_WIDTH_PX,\n })\n }\n }\n },\n 50,\n 250,\n )\n\n useEffect(() => {\n if (!shouldListenMouseMove) {\n return\n }\n\n document.addEventListener('mousemove', debouncedOnMouseMove)\n\n return () => {\n setShownRow(false)\n setShownColumn(false)\n\n document.removeEventListener('mousemove', debouncedOnMouseMove)\n }\n }, [shouldListenMouseMove, debouncedOnMouseMove])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerMutationListener(\n TableNode,\n (mutations) => {\n editor.getEditorState().read(() => {\n for (const [key, type] of mutations) {\n switch (type) {\n case 'created':\n codeSetRef.current.add(key)\n setShouldListenMouseMove(codeSetRef.current.size > 0)\n break\n\n case 'destroyed':\n codeSetRef.current.delete(key)\n setShouldListenMouseMove(codeSetRef.current.size > 0)\n break\n\n default:\n break\n }\n }\n })\n },\n { skipInitialization: false },\n ),\n )\n }, [editor])\n\n const insertAction = (insertRow: boolean) => {\n editor.update(() => {\n if (tableDOMNodeRef.current) {\n const maybeTableNode = $getNearestNodeFromDOMNode(tableDOMNodeRef.current)\n maybeTableNode?.selectEnd()\n if (insertRow) {\n $insertTableRow__EXPERIMENTAL()\n setShownRow(false)\n } else {\n $insertTableColumn__EXPERIMENTAL()\n setShownColumn(false)\n }\n }\n })\n }\n\n return (\n <>\n {isShownRow && (\n <button\n className={editorConfig.editorConfig.lexical.theme.tableAddRows}\n onClick={() => insertAction(true)}\n style={{ ...position }}\n />\n )}\n {isShownColumn && (\n <button\n className={editorConfig.editorConfig.lexical.theme.tableAddColumns}\n onClick={() => insertAction(false)}\n style={{ ...position }}\n />\n )}\n </>\n )\n}\n\nfunction getMouseInfo(\n event: MouseEvent,\n editorConfig: EditorConfig,\n): {\n isOutside: boolean\n tableDOMNode: HTMLElement | null\n} {\n const target = event.target\n\n if (target && target instanceof HTMLElement) {\n const tableDOMNode = target.closest<HTMLElement>(\n `td.${editorConfig.theme.tableCell}, th.${editorConfig.theme.tableCell}`,\n )\n\n const isOutside = !(\n tableDOMNode ||\n target.closest<HTMLElement>(`button.${editorConfig.theme.tableAddRows}`) ||\n target.closest<HTMLElement>(`button.${editorConfig.theme.tableAddColumns}`) ||\n target.closest<HTMLElement>(`div.${editorConfig.theme.tableCellResizer}`)\n )\n\n return { isOutside, tableDOMNode }\n } else {\n return { isOutside: true, tableDOMNode: null }\n }\n}\n\nexport function TableHoverActionsPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactPortal | null {\n return createPortal(<TableHoverActionsContainer anchorElem={anchorElem} />, anchorElem)\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAMA,SAASC,yBAAyB,QAAQ;AAC1C,SACEC,qCAAqC,EACrCC,kCAAkC,EAClCC,gCAAgC,EAChCC,6BAA6B,EAC7BC,gBAAgB,EAChBC,YAAY,EACZC,SAAS,QACJ;AACP,SAASC,mBAAmB,EAAEC,aAAa,QAAQ;AACnD,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAC5C,YAAYC,KAAA,MAAW;AACvB,SAASC,YAAY,QAAQ;AAE7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,WAAW,QAAQ;AAE5B,MAAMC,eAAA,GAAkB;AAExB,SAAAC,2BAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAtB,EAAA;EAAoC;IAAAuB;EAAA,IAAAF,EAA2C;EAC7E,OAAAG,MAAA,IAAiBvB,yBAAA;EACjB,MAAAwB,YAAA,GAAqBR,sBAAA;EACrB,OAAAS,UAAA,EAAAC,WAAA,IAAkCb,QAAA,MAAkB;EACpD,OAAAc,aAAA,EAAAC,cAAA,IAAwCf,QAAA,MAAkB;EAC1D,OAAAgB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,EAAA,CAAAC,EAAA;MAAAW,QAAA,GACGV,E,EAOAO,G;;;;;;;;;;SARHE,G;;AAmBJ,SAASpE,aACPH,KAAiB,EACjBjB,YAA0B;EAK1B,MAAM0F,MAAA,GAASzE,KAAA,CAAMyE,MAAM;EAE3B,IAAIA,MAAA,IAAUA,MAAA,YAAkBC,WAAA,EAAa;IAC3C,MAAMxE,YAAA,GAAeuE,MAAA,CAAOE,OAAO,CACjC,MAAM5F,YAAA,CAAakF,KAAK,CAACW,SAAS,QAAQ7F,YAAA,CAAakF,KAAK,CAACW,SAAS,EAAE;IAG1E,MAAM3E,SAAA,GAAY,EAChBC,YAAA,IACAuE,MAAA,CAAOE,OAAO,CAAc,UAAU5F,YAAA,CAAakF,KAAK,CAACC,YAAY,EAAE,KACvEO,MAAA,CAAOE,OAAO,CAAc,UAAU5F,YAAA,CAAakF,KAAK,CAACK,eAAe,EAAE,KAC1EG,MAAA,CAAOE,OAAO,CAAc,OAAO5F,YAAA,CAAakF,KAAK,CAACY,gBAAgB,EAAE;IAG1E,OAAO;MAAE5E,SAAA;MAAWC;IAAa;EACnC,OAAO;IACL,OAAO;MAAED,SAAA,EAAW;MAAMC,YAAA,EAAc;IAAK;EAC/C;AACF;AAEA,OAAO,SAAS4E,wBAAwB;EACtCjG,UAAA,GAAa2D,QAAA,CAASuC;AAAI,CAG3B;EACC,oBAAOzG,YAAA,eAAayF,IAAA,CAACrF,0BAAA;IAA2BG,UAAA,EAAYA;MAAgBA,UAAA;AAC9E","ignoreList":[]}
|
|
@@ -19,6 +19,6 @@ export declare const OPEN_TABLE_DRAWER_COMMAND: LexicalCommand<{}>;
|
|
|
19
19
|
export declare const CellContext: React.Context<CellContextShape>;
|
|
20
20
|
export declare function TableContext({ children }: {
|
|
21
21
|
children: JSX.Element;
|
|
22
|
-
}):
|
|
22
|
+
}): JSX.Element;
|
|
23
23
|
export declare const TablePlugin: PluginComponent;
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|