@payloadcms/richtext-lexical 3.0.0-beta.48 → 3.0.0-beta.49
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/README.md +1 -1
- package/dist/cell/index.d.ts +1 -1
- package/dist/cell/index.d.ts.map +1 -1
- package/dist/cell/index.js +1 -2
- package/dist/cell/index.js.map +1 -1
- package/dist/exports/client/Component-6AVANNNR.js +2 -0
- package/dist/exports/client/Component-6AVANNNR.js.map +7 -0
- package/dist/exports/client/Component-SZVAYRJX.js +2 -0
- package/dist/exports/client/Component-SZVAYRJX.js.map +7 -0
- package/dist/exports/client/Field-U5PHZTST.js +2 -0
- package/dist/exports/client/Field-U5PHZTST.js.map +7 -0
- package/dist/exports/client/RelationshipComponent-FGUPLCD2.js +2 -0
- package/dist/exports/client/RelationshipComponent-FGUPLCD2.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -0
- package/dist/exports/client/chunk-33ZTAHVL.js +2 -0
- package/dist/exports/client/chunk-33ZTAHVL.js.map +7 -0
- package/dist/exports/client/chunk-35NZOHAF.js +2 -0
- package/dist/exports/client/chunk-35NZOHAF.js.map +7 -0
- package/dist/exports/client/chunk-3PZ2ZFQG.js +3 -0
- package/dist/exports/client/chunk-3PZ2ZFQG.js.map +7 -0
- package/dist/exports/client/chunk-FSTRW2TI.js +2 -0
- package/dist/exports/client/chunk-FSTRW2TI.js.map +7 -0
- package/dist/exports/client/chunk-Y5455JF3.js +2 -0
- package/dist/exports/client/chunk-Y5455JF3.js.map +7 -0
- package/dist/exports/client/component-FFLILIUZ.js +2 -0
- package/dist/exports/client/component-FFLILIUZ.js.map +7 -0
- package/dist/exports/client/component-GR6KYTLO.js +2 -0
- package/dist/exports/client/component-GR6KYTLO.js.map +7 -0
- package/dist/exports/client/component-RAVN56DE.js +2 -0
- package/dist/exports/client/component-RAVN56DE.js.map +7 -0
- package/dist/exports/client/index.d.ts +52 -0
- package/dist/exports/client/index.d.ts.map +1 -0
- package/dist/exports/client/index.js +36 -0
- package/dist/exports/client/index.js.map +7 -0
- package/dist/field/Field.d.ts +1 -0
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +2 -7
- package/dist/field/Field.js.map +1 -1
- package/dist/field/bundled.css +0 -0
- package/dist/field/features/align/feature.server.d.ts.map +1 -1
- package/dist/field/features/align/feature.server.js +2 -1
- package/dist/field/features/align/feature.server.js.map +1 -1
- package/dist/field/features/blockquote/feature.server.d.ts.map +1 -1
- package/dist/field/features/blockquote/feature.server.js +2 -1
- package/dist/field/features/blockquote/feature.server.js.map +1 -1
- package/dist/field/features/blocks/component/BlockContent.js +1 -9
- package/dist/field/features/blocks/component/BlockContent.js.map +1 -1
- package/dist/field/features/blocks/component/FormSavePlugin.d.ts +1 -2
- package/dist/field/features/blocks/component/FormSavePlugin.d.ts.map +1 -1
- package/dist/field/features/blocks/component/FormSavePlugin.js +2 -2
- package/dist/field/features/blocks/component/FormSavePlugin.js.map +1 -1
- package/dist/field/features/blocks/component/index.d.ts.map +1 -1
- package/dist/field/features/blocks/component/index.js +2 -12
- package/dist/field/features/blocks/component/index.js.map +1 -1
- package/dist/field/features/blocks/component/removeEmptyArrayValues.d.ts +1 -1
- package/dist/field/features/blocks/component/removeEmptyArrayValues.d.ts.map +1 -1
- package/dist/field/features/blocks/component/removeEmptyArrayValues.js.map +1 -1
- package/dist/field/features/blocks/drawer/index.d.ts.map +1 -1
- package/dist/field/features/blocks/drawer/index.js +1 -4
- package/dist/field/features/blocks/drawer/index.js.map +1 -1
- package/dist/field/features/blocks/feature.server.d.ts +1 -1
- package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
- package/dist/field/features/blocks/feature.server.js +3 -3
- package/dist/field/features/blocks/feature.server.js.map +1 -1
- package/dist/field/features/converters/html/field/index.d.ts +1 -1
- package/dist/field/features/converters/html/field/index.d.ts.map +1 -1
- package/dist/field/features/converters/html/field/index.js.map +1 -1
- package/dist/field/features/createFeaturePropComponent.d.ts.map +1 -1
- package/dist/field/features/createFeaturePropComponent.js +1 -3
- package/dist/field/features/createFeaturePropComponent.js.map +1 -1
- package/dist/field/features/debug/testRecorder/feature.server.d.ts.map +1 -1
- package/dist/field/features/debug/testRecorder/feature.server.js +2 -1
- package/dist/field/features/debug/testRecorder/feature.server.js.map +1 -1
- package/dist/field/features/debug/testRecorder/plugin/index.js +0 -1
- package/dist/field/features/debug/testRecorder/plugin/index.js.map +1 -1
- package/dist/field/features/debug/treeView/feature.server.d.ts.map +1 -1
- package/dist/field/features/debug/treeView/feature.server.js +2 -1
- package/dist/field/features/debug/treeView/feature.server.js.map +1 -1
- package/dist/field/features/debug/treeView/plugin/index.js +0 -1
- package/dist/field/features/debug/treeView/plugin/index.js.map +1 -1
- package/dist/field/features/format/bold/feature.server.d.ts.map +1 -1
- package/dist/field/features/format/bold/feature.server.js +2 -1
- package/dist/field/features/format/bold/feature.server.js.map +1 -1
- package/dist/field/features/format/inlineCode/feature.server.d.ts.map +1 -1
- package/dist/field/features/format/inlineCode/feature.server.js +2 -1
- package/dist/field/features/format/inlineCode/feature.server.js.map +1 -1
- package/dist/field/features/format/italic/feature.server.d.ts.map +1 -1
- package/dist/field/features/format/italic/feature.server.js +2 -1
- package/dist/field/features/format/italic/feature.server.js.map +1 -1
- package/dist/field/features/format/strikethrough/feature.server.d.ts.map +1 -1
- package/dist/field/features/format/strikethrough/feature.server.js +2 -1
- package/dist/field/features/format/strikethrough/feature.server.js.map +1 -1
- package/dist/field/features/format/subscript/feature.server.d.ts.map +1 -1
- package/dist/field/features/format/subscript/feature.server.js +2 -1
- package/dist/field/features/format/subscript/feature.server.js.map +1 -1
- package/dist/field/features/format/superscript/feature.server.d.ts.map +1 -1
- package/dist/field/features/format/superscript/feature.server.js +2 -1
- package/dist/field/features/format/superscript/feature.server.js.map +1 -1
- package/dist/field/features/format/underline/feature.server.d.ts.map +1 -1
- package/dist/field/features/format/underline/feature.server.js +2 -1
- package/dist/field/features/format/underline/feature.server.js.map +1 -1
- package/dist/field/features/heading/feature.client.d.ts.map +1 -1
- package/dist/field/features/heading/feature.client.js +1 -2
- package/dist/field/features/heading/feature.client.js.map +1 -1
- package/dist/field/features/heading/feature.server.d.ts.map +1 -1
- package/dist/field/features/heading/feature.server.js +2 -1
- package/dist/field/features/heading/feature.server.js.map +1 -1
- package/dist/field/features/horizontalRule/feature.server.d.ts.map +1 -1
- package/dist/field/features/horizontalRule/feature.server.js +2 -1
- package/dist/field/features/horizontalRule/feature.server.js.map +1 -1
- package/dist/field/features/horizontalRule/plugin/index.js +0 -1
- package/dist/field/features/horizontalRule/plugin/index.js.map +1 -1
- package/dist/field/features/indent/feature.server.d.ts.map +1 -1
- package/dist/field/features/indent/feature.server.js +2 -1
- package/dist/field/features/indent/feature.server.js.map +1 -1
- package/dist/field/features/link/drawer/baseFields.d.ts +1 -2
- package/dist/field/features/link/drawer/baseFields.d.ts.map +1 -1
- package/dist/field/features/link/drawer/baseFields.js.map +1 -1
- package/dist/field/features/link/drawer/index.d.ts.map +1 -1
- package/dist/field/features/link/drawer/index.js +2 -10
- package/dist/field/features/link/drawer/index.js.map +1 -1
- package/dist/field/features/link/drawer/types.d.ts +1 -1
- package/dist/field/features/link/drawer/types.d.ts.map +1 -1
- package/dist/field/features/link/drawer/types.js.map +1 -1
- package/dist/field/features/link/feature.server.d.ts +1 -2
- package/dist/field/features/link/feature.server.d.ts.map +1 -1
- package/dist/field/features/link/feature.server.js +5 -4
- package/dist/field/features/link/feature.server.js.map +1 -1
- package/dist/field/features/link/nodes/LinkNode.d.ts.map +1 -1
- package/dist/field/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/field/features/link/plugins/autoLink/index.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +3 -8
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/index.js +0 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/index.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts +1 -2
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js.map +1 -1
- package/dist/field/features/link/validate.d.ts +1 -1
- package/dist/field/features/link/validate.d.ts.map +1 -1
- package/dist/field/features/link/validate.js.map +1 -1
- package/dist/field/features/lists/checklist/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/feature.server.js +2 -1
- package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
- package/dist/field/features/lists/orderedList/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/orderedList/feature.server.js +2 -1
- package/dist/field/features/lists/orderedList/feature.server.js.map +1 -1
- package/dist/field/features/lists/unorderedList/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/unorderedList/feature.server.js +2 -1
- package/dist/field/features/lists/unorderedList/feature.server.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/feature.server.d.ts.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/feature.server.js +2 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/feature.server.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +0 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -2
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/feature.server.d.ts.map +1 -1
- package/dist/field/features/migrations/slateToLexical/feature.server.js +2 -1
- package/dist/field/features/migrations/slateToLexical/feature.server.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +0 -1
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -2
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/field/features/paragraph/feature.server.d.ts.map +1 -1
- package/dist/field/features/paragraph/feature.server.js +2 -1
- package/dist/field/features/paragraph/feature.server.js.map +1 -1
- package/dist/field/features/relationship/drawer/index.js +1 -1
- package/dist/field/features/relationship/drawer/index.js.map +1 -1
- package/dist/field/features/relationship/feature.server.d.ts.map +1 -1
- package/dist/field/features/relationship/feature.server.js +2 -1
- package/dist/field/features/relationship/feature.server.js.map +1 -1
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.js +2 -8
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
- package/dist/field/features/relationship/plugins/index.d.ts.map +1 -1
- package/dist/field/features/relationship/plugins/index.js +2 -3
- package/dist/field/features/relationship/plugins/index.js.map +1 -1
- package/dist/field/features/relationship/utils/EnabledRelationshipsCondition.d.ts.map +1 -1
- package/dist/field/features/relationship/utils/EnabledRelationshipsCondition.js +1 -3
- package/dist/field/features/relationship/utils/EnabledRelationshipsCondition.js.map +1 -1
- package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts.map +1 -1
- package/dist/field/features/toolbars/fixed/Toolbar/index.js +1 -3
- package/dist/field/features/toolbars/fixed/Toolbar/index.js.map +1 -1
- package/dist/field/features/toolbars/fixed/feature.server.d.ts.map +1 -1
- package/dist/field/features/toolbars/fixed/feature.server.js +2 -1
- package/dist/field/features/toolbars/fixed/feature.server.js.map +1 -1
- package/dist/field/features/toolbars/inline/Toolbar/index.js +0 -1
- package/dist/field/features/toolbars/inline/Toolbar/index.js.map +1 -1
- package/dist/field/features/toolbars/inline/feature.server.d.ts.map +1 -1
- package/dist/field/features/toolbars/inline/feature.server.js +2 -1
- package/dist/field/features/toolbars/inline/feature.server.js.map +1 -1
- package/dist/field/features/toolbars/shared/ToolbarButton/index.js +0 -1
- package/dist/field/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +1 -2
- package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
- package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js +1 -2
- package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js +1 -2
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/field/features/types.d.ts +1 -3
- package/dist/field/features/types.d.ts.map +1 -1
- package/dist/field/features/types.js.map +1 -1
- package/dist/field/features/upload/component/ExtraFieldsDrawer/index.d.ts +1 -1
- package/dist/field/features/upload/component/ExtraFieldsDrawer/index.d.ts.map +1 -1
- package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js +3 -10
- package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js.map +1 -1
- package/dist/field/features/upload/component/index.d.ts.map +1 -1
- package/dist/field/features/upload/component/index.js +1 -9
- package/dist/field/features/upload/component/index.js.map +1 -1
- package/dist/field/features/upload/drawer/index.js +1 -1
- package/dist/field/features/upload/drawer/index.js.map +1 -1
- package/dist/field/features/upload/feature.server.d.ts +1 -1
- package/dist/field/features/upload/feature.server.d.ts.map +1 -1
- package/dist/field/features/upload/feature.server.js +3 -2
- package/dist/field/features/upload/feature.server.js.map +1 -1
- package/dist/field/features/upload/nodes/UploadNode.d.ts +1 -2
- package/dist/field/features/upload/nodes/UploadNode.d.ts.map +1 -1
- package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
- package/dist/field/features/upload/plugin/index.js +1 -1
- package/dist/field/features/upload/plugin/index.js.map +1 -1
- package/dist/field/features/upload/validate.js +1 -1
- package/dist/field/features/upload/validate.js.map +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +35 -99
- package/dist/field/index.js.map +1 -1
- package/dist/field/lexical/LexicalEditor.js +1 -2
- package/dist/field/lexical/LexicalEditor.js.map +1 -1
- package/dist/field/lexical/LexicalProvider.d.ts +1 -2
- package/dist/field/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/field/lexical/LexicalProvider.js +1 -1
- package/dist/field/lexical/LexicalProvider.js.map +1 -1
- package/dist/field/lexical/config/server/loader.d.ts +1 -1
- package/dist/field/lexical/config/server/loader.d.ts.map +1 -1
- package/dist/field/lexical/config/server/loader.js.map +1 -1
- package/dist/field/lexical/config/server/sanitize.d.ts +1 -1
- package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/field/lexical/config/server/sanitize.js.map +1 -1
- package/dist/field/lexical/nodes/index.d.ts.map +1 -1
- package/dist/field/lexical/nodes/index.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/index.js +2 -3
- package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js +0 -1
- package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js +0 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/field/lexical/theme/EditorTheme.js +0 -1
- package/dist/field/lexical/theme/EditorTheme.js.map +1 -1
- package/dist/field/lexical/ui/ContentEditable.js +0 -1
- package/dist/field/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/generateComponentMap.d.ts +1 -1
- package/dist/generateComponentMap.d.ts.map +1 -1
- package/dist/generateComponentMap.js.map +1 -1
- package/dist/generateSchemaMap.d.ts +1 -1
- package/dist/generateSchemaMap.d.ts.map +1 -1
- package/dist/generateSchemaMap.js.map +1 -1
- package/dist/index.d.ts +0 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -22
- package/dist/index.js.map +1 -1
- package/dist/populateGraphQL/populate.d.ts +1 -1
- package/dist/populateGraphQL/populate.d.ts.map +1 -1
- package/dist/populateGraphQL/populate.js +1 -1
- package/dist/populateGraphQL/populate.js.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts +1 -2
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js +1 -1
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js.map +1 -1
- package/dist/types.d.ts +1 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/useLexicalFeature.d.ts.map +1 -1
- package/dist/useLexicalFeature.js +1 -3
- package/dist/useLexicalFeature.js.map +1 -1
- package/dist/validate/index.d.ts +1 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/validateNodes.d.ts +1 -1
- package/dist/validate/validateNodes.d.ts.map +1 -1
- package/dist/validate/validateNodes.js.map +1 -1
- package/package.json +22 -22
- package/components.d.ts +0 -6
- package/components.js +0 -7
- package/dist/exports/components.d.ts +0 -11
- package/dist/exports/components.d.ts.map +0 -1
- package/dist/exports/components.js +0 -12
- package/dist/exports/components.js.map +0 -1
- package/dist/field/features/blocks/component/index.scss +0 -149
- package/dist/field/features/debug/testRecorder/plugin/index.scss +0 -49
- package/dist/field/features/debug/treeView/plugin/index.scss +0 -78
- package/dist/field/features/horizontalRule/plugin/index.scss +0 -20
- package/dist/field/features/link/drawer/index.scss +0 -50
- package/dist/field/features/link/plugins/floatingLinkEditor/index.scss +0 -86
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.scss +0 -14
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.scss +0 -14
- package/dist/field/features/relationship/nodes/components/index.scss +0 -97
- package/dist/field/features/toolbars/fixed/Toolbar/index.scss +0 -119
- package/dist/field/features/toolbars/inline/Toolbar/index.scss +0 -53
- package/dist/field/features/toolbars/shared/ToolbarButton/index.scss +0 -39
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.scss +0 -112
- package/dist/field/features/upload/component/index.scss +0 -152
- package/dist/field/index.scss +0 -25
- package/dist/field/lexical/LexicalEditor.scss +0 -49
- package/dist/field/lexical/plugins/SlashMenu/index.scss +0 -61
- package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.scss +0 -31
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.scss +0 -72
- package/dist/field/lexical/theme/EditorTheme.scss +0 -509
- package/dist/field/lexical/ui/ContentEditable.scss +0 -76
- package/dist/scss/app.scss +0 -208
- package/dist/scss/colors.scss +0 -269
- package/dist/scss/queries.scss +0 -27
- package/dist/scss/resets.scss +0 -17
- package/dist/scss/styles.scss +0 -11
- package/dist/scss/svg.scss +0 -10
- package/dist/scss/toasts.scss +0 -111
- package/dist/scss/type.scss +0 -117
- package/dist/scss/vars.scss +0 -213
- package/dist/scss/z-index.scss +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/field/features/converters/html/field/index.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { Field, FieldAffectingData, RichTextField } from 'payload/types'\n\nimport type { AdapterProps, LexicalRichTextAdapter } from '../../../../../types.js'\nimport type { SanitizedServerEditorConfig } from '../../../../lexical/config/types.js'\nimport type { HTMLConverter } from '../converter/types.js'\nimport type { HTMLConverterFeatureProps } from '../feature.server.js'\n\nimport { defaultHTMLConverters } from '../converter/defaultConverters.js'\nimport { convertLexicalToHTML } from '../converter/index.js'\n\ntype Props = {\n /**\n * Whether the lexicalHTML field should be hidden in the admin panel\n *\n * @default true\n */\n hidden?: boolean\n name: string\n /**\n * Whether the HTML should be stored in the database\n *\n * @default false\n */\n storeInDB?: boolean\n}\n\n/**\n * Combines the default HTML converters with HTML converters found in the features, and with HTML converters configured in the htmlConverter feature.\n *\n * @param editorConfig\n */\nexport const consolidateHTMLConverters = ({\n editorConfig,\n}: {\n editorConfig: SanitizedServerEditorConfig\n}): HTMLConverter[] => {\n const htmlConverterFeature = editorConfig.resolvedFeatureMap.get('htmlConverter')\n const htmlConverterFeatureProps: HTMLConverterFeatureProps =\n htmlConverterFeature?.serverFeatureProps\n\n const defaultConvertersWithConvertersFromFeatures = [...defaultHTMLConverters]\n\n for (const converter of editorConfig.features.converters.html) {\n defaultConvertersWithConvertersFromFeatures.push(converter)\n }\n\n const finalConverters =\n htmlConverterFeatureProps?.converters &&\n typeof htmlConverterFeatureProps?.converters === 'function'\n ? htmlConverterFeatureProps.converters({\n defaultConverters: defaultConvertersWithConvertersFromFeatures,\n })\n : (htmlConverterFeatureProps?.converters as HTMLConverter[]) ||\n defaultConvertersWithConvertersFromFeatures\n\n // filter converters by nodeTypes. The last converter in the list wins. If there are multiple converters for the same nodeType, the last one will be used and the node types will be removed from\n // previous converters. If previous converters do not have any nodeTypes left, they will be removed from the list.\n // This guarantees that user-added converters which are added after the default ones will always have precedence\n const foundNodeTypes: string[] = []\n const filteredConverters: HTMLConverter[] = []\n for (const converter of finalConverters.reverse()) {\n if (!converter.nodeTypes?.length) {\n continue\n }\n const newConverter: HTMLConverter = {\n converter: converter.converter,\n nodeTypes: [...converter.nodeTypes],\n }\n newConverter.nodeTypes = newConverter.nodeTypes.filter((nodeType) => {\n if (foundNodeTypes.includes(nodeType)) {\n return false\n }\n foundNodeTypes.push(nodeType)\n return true\n })\n\n if (newConverter.nodeTypes.length) {\n filteredConverters.push(newConverter)\n }\n }\n\n return filteredConverters\n}\n\n// find the path of this field, as well as its sibling fields, by looking for this `field` in fields and traversing it recursively\nfunction findFieldPathAndSiblingFields(\n fields: Field[],\n path: string[],\n field: FieldAffectingData,\n): {\n path: string[]\n siblingFields: Field[]\n} {\n for (const curField of fields) {\n if (curField === field) {\n return {\n path: [...path, curField.name],\n siblingFields: fields,\n }\n }\n\n if ('fields' in curField) {\n const result = findFieldPathAndSiblingFields(\n curField.fields,\n 'name' in curField ? [...path, curField.name] : [...path],\n field,\n )\n if (result) {\n return result\n }\n } else if ('tabs' in curField) {\n for (const tab of curField.tabs) {\n const result = findFieldPathAndSiblingFields(\n tab.fields,\n 'name' in tab ? [...path, tab.name] : [...path],\n field,\n )\n if (result) {\n return result\n }\n }\n } else if ('blocks' in curField) {\n for (const block of curField.blocks) {\n if (block?.fields?.length) {\n const result = findFieldPathAndSiblingFields(\n block.fields,\n [...path, curField.name, block.slug],\n field,\n )\n if (result) {\n return result\n }\n }\n }\n }\n }\n\n return null\n}\n\nexport const lexicalHTML: (\n /**\n * A string which matches the lexical field name you want to convert to HTML.\n *\n * This has to be a SIBLING field of this lexicalHTML field - otherwise, it won't be able to find the lexical field.\n **/\n lexicalFieldName: string,\n props: Props,\n) => Field = (lexicalFieldName, props) => {\n const { name = 'lexicalHTML', hidden = true, storeInDB = false } = props\n return {\n name,\n type: 'code',\n admin: {\n editorOptions: {\n language: 'html',\n },\n hidden,\n },\n hooks: {\n afterRead: [\n async ({ collection, field, global, req, siblingData }) => {\n const fields = collection ? collection.fields : global.fields\n\n const foundSiblingFields = findFieldPathAndSiblingFields(fields, [], field)\n\n if (!foundSiblingFields)\n throw new Error(\n `Could not find sibling fields of current lexicalHTML field with name ${field?.name}`,\n )\n\n const { siblingFields } = foundSiblingFields\n const lexicalField: RichTextField<SerializedEditorState, AdapterProps> =\n siblingFields.find(\n (field) => 'name' in field && field.name === lexicalFieldName,\n ) as RichTextField<SerializedEditorState, AdapterProps>\n\n const lexicalFieldData: SerializedEditorState = siblingData[lexicalFieldName]\n\n if (!lexicalFieldData) {\n return ''\n }\n\n if (!lexicalField) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the referenced lexical field was not found',\n )\n }\n\n const config = (lexicalField?.editor as LexicalRichTextAdapter)?.editorConfig\n\n if (!config) {\n throw new Error(\n 'The linked lexical field does not have an editorConfig. This is needed for the lexicalHTML field.',\n )\n }\n\n if (!config?.resolvedFeatureMap?.has('htmlConverter')) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the linked lexical field does not have a HTMLConverterFeature',\n )\n }\n\n const finalConverters = consolidateHTMLConverters({\n editorConfig: config,\n })\n\n return await convertLexicalToHTML({\n converters: finalConverters,\n data: lexicalFieldData,\n payload: req.payload,\n })\n },\n ],\n beforeChange: [\n ({ siblingData, value }) => {\n if (storeInDB) {\n return value\n }\n delete siblingData[name]\n return null\n },\n ],\n },\n }\n}\n"],"names":["defaultHTMLConverters","convertLexicalToHTML","consolidateHTMLConverters","editorConfig","htmlConverterFeature","resolvedFeatureMap","get","htmlConverterFeatureProps","serverFeatureProps","defaultConvertersWithConvertersFromFeatures","converter","features","converters","html","push","finalConverters","defaultConverters","foundNodeTypes","filteredConverters","reverse","nodeTypes","length","newConverter","filter","nodeType","includes","findFieldPathAndSiblingFields","fields","path","field","curField","name","siblingFields","result","tab","tabs","block","blocks","slug","lexicalHTML","lexicalFieldName","props","hidden","storeInDB","type","admin","editorOptions","language","hooks","afterRead","collection","global","req","siblingData","foundSiblingFields","Error","lexicalField","find","lexicalFieldData","config","editor","has","data","payload","beforeChange","value"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAQA,SAASA,qBAAqB,QAAQ,oCAAmC;AACz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oBACH,MAAM,IAAIC,MACR,CAAC,qEAAqE,EAAE1B,OAAOE,KAAK,CAAC;oBAGzF,MAAM,EAAEC,aAAa,EAAE,GAAGsB;oBAC1B,MAAME,eACJxB,cAAcyB,IAAI,CAChB,CAAC5B,QAAU,UAAUA,SAASA,MAAME,IAAI,KAAKS;oBAGjD,MAAMkB,mBAA0CL,WAAW,CAACb,iBAAiB;oBAE7E,IAAI,CAACkB,kBAAkB;wBACrB,OAAO;oBACT;oBAEA,IAAI,CAACF,cAAc;wBACjB,MAAM,IAAID,MACR;oBAEJ;oBAEA,MAAMI,SAAUH,cAAcI,QAAmCzD;oBAEjE,IAAI,CAACwD,QAAQ;wBACX,MAAM,IAAIJ,MACR;oBAEJ;oBAEA,IAAI,CAACI,QAAQtD,oBAAoBwD,IAAI,kBAAkB;wBACrD,MAAM,IAAIN,MACR;oBAEJ;oBAEA,MAAMxC,kBAAkBb,0BAA0B;wBAChDC,cAAcwD;oBAChB;oBAEA,OAAO,MAAM1D,qBAAqB;wBAChCW,YAAYG;wBACZ+C,MAAMJ;wBACNK,SAASX,IAAIW,OAAO;oBACtB;gBACF;aACD;YACDC,cAAc;gBACZ,CAAC,EAAEX,WAAW,EAAEY,KAAK,EAAE;oBACrB,IAAItB,WAAW;wBACb,OAAOsB;oBACT;oBACA,OAAOZ,WAAW,CAACtB,KAAK;oBACxB,OAAO;gBACT;aACD;QACH;IACF;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/field/features/converters/html/field/index.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { Field, FieldAffectingData, RichTextField } from 'payload'\n\nimport type { AdapterProps, LexicalRichTextAdapter } from '../../../../../types.js'\nimport type { SanitizedServerEditorConfig } from '../../../../lexical/config/types.js'\nimport type { HTMLConverter } from '../converter/types.js'\nimport type { HTMLConverterFeatureProps } from '../feature.server.js'\n\nimport { defaultHTMLConverters } from '../converter/defaultConverters.js'\nimport { convertLexicalToHTML } from '../converter/index.js'\n\ntype Props = {\n /**\n * Whether the lexicalHTML field should be hidden in the admin panel\n *\n * @default true\n */\n hidden?: boolean\n name: string\n /**\n * Whether the HTML should be stored in the database\n *\n * @default false\n */\n storeInDB?: boolean\n}\n\n/**\n * Combines the default HTML converters with HTML converters found in the features, and with HTML converters configured in the htmlConverter feature.\n *\n * @param editorConfig\n */\nexport const consolidateHTMLConverters = ({\n editorConfig,\n}: {\n editorConfig: SanitizedServerEditorConfig\n}): HTMLConverter[] => {\n const htmlConverterFeature = editorConfig.resolvedFeatureMap.get('htmlConverter')\n const htmlConverterFeatureProps: HTMLConverterFeatureProps =\n htmlConverterFeature?.serverFeatureProps\n\n const defaultConvertersWithConvertersFromFeatures = [...defaultHTMLConverters]\n\n for (const converter of editorConfig.features.converters.html) {\n defaultConvertersWithConvertersFromFeatures.push(converter)\n }\n\n const finalConverters =\n htmlConverterFeatureProps?.converters &&\n typeof htmlConverterFeatureProps?.converters === 'function'\n ? htmlConverterFeatureProps.converters({\n defaultConverters: defaultConvertersWithConvertersFromFeatures,\n })\n : (htmlConverterFeatureProps?.converters as HTMLConverter[]) ||\n defaultConvertersWithConvertersFromFeatures\n\n // filter converters by nodeTypes. The last converter in the list wins. If there are multiple converters for the same nodeType, the last one will be used and the node types will be removed from\n // previous converters. If previous converters do not have any nodeTypes left, they will be removed from the list.\n // This guarantees that user-added converters which are added after the default ones will always have precedence\n const foundNodeTypes: string[] = []\n const filteredConverters: HTMLConverter[] = []\n for (const converter of finalConverters.reverse()) {\n if (!converter.nodeTypes?.length) {\n continue\n }\n const newConverter: HTMLConverter = {\n converter: converter.converter,\n nodeTypes: [...converter.nodeTypes],\n }\n newConverter.nodeTypes = newConverter.nodeTypes.filter((nodeType) => {\n if (foundNodeTypes.includes(nodeType)) {\n return false\n }\n foundNodeTypes.push(nodeType)\n return true\n })\n\n if (newConverter.nodeTypes.length) {\n filteredConverters.push(newConverter)\n }\n }\n\n return filteredConverters\n}\n\n// find the path of this field, as well as its sibling fields, by looking for this `field` in fields and traversing it recursively\nfunction findFieldPathAndSiblingFields(\n fields: Field[],\n path: string[],\n field: FieldAffectingData,\n): {\n path: string[]\n siblingFields: Field[]\n} {\n for (const curField of fields) {\n if (curField === field) {\n return {\n path: [...path, curField.name],\n siblingFields: fields,\n }\n }\n\n if ('fields' in curField) {\n const result = findFieldPathAndSiblingFields(\n curField.fields,\n 'name' in curField ? [...path, curField.name] : [...path],\n field,\n )\n if (result) {\n return result\n }\n } else if ('tabs' in curField) {\n for (const tab of curField.tabs) {\n const result = findFieldPathAndSiblingFields(\n tab.fields,\n 'name' in tab ? [...path, tab.name] : [...path],\n field,\n )\n if (result) {\n return result\n }\n }\n } else if ('blocks' in curField) {\n for (const block of curField.blocks) {\n if (block?.fields?.length) {\n const result = findFieldPathAndSiblingFields(\n block.fields,\n [...path, curField.name, block.slug],\n field,\n )\n if (result) {\n return result\n }\n }\n }\n }\n }\n\n return null\n}\n\nexport const lexicalHTML: (\n /**\n * A string which matches the lexical field name you want to convert to HTML.\n *\n * This has to be a SIBLING field of this lexicalHTML field - otherwise, it won't be able to find the lexical field.\n **/\n lexicalFieldName: string,\n props: Props,\n) => Field = (lexicalFieldName, props) => {\n const { name = 'lexicalHTML', hidden = true, storeInDB = false } = props\n return {\n name,\n type: 'code',\n admin: {\n editorOptions: {\n language: 'html',\n },\n hidden,\n },\n hooks: {\n afterRead: [\n async ({ collection, field, global, req, siblingData }) => {\n const fields = collection ? collection.fields : global.fields\n\n const foundSiblingFields = findFieldPathAndSiblingFields(fields, [], field)\n\n if (!foundSiblingFields)\n throw new Error(\n `Could not find sibling fields of current lexicalHTML field with name ${field?.name}`,\n )\n\n const { siblingFields } = foundSiblingFields\n const lexicalField: RichTextField<SerializedEditorState, AdapterProps> =\n siblingFields.find(\n (field) => 'name' in field && field.name === lexicalFieldName,\n ) as RichTextField<SerializedEditorState, AdapterProps>\n\n const lexicalFieldData: SerializedEditorState = siblingData[lexicalFieldName]\n\n if (!lexicalFieldData) {\n return ''\n }\n\n if (!lexicalField) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the referenced lexical field was not found',\n )\n }\n\n const config = (lexicalField?.editor as LexicalRichTextAdapter)?.editorConfig\n\n if (!config) {\n throw new Error(\n 'The linked lexical field does not have an editorConfig. This is needed for the lexicalHTML field.',\n )\n }\n\n if (!config?.resolvedFeatureMap?.has('htmlConverter')) {\n throw new Error(\n 'You cannot use the lexicalHTML field because the linked lexical field does not have a HTMLConverterFeature',\n )\n }\n\n const finalConverters = consolidateHTMLConverters({\n editorConfig: config,\n })\n\n return await convertLexicalToHTML({\n converters: finalConverters,\n data: lexicalFieldData,\n payload: req.payload,\n })\n },\n ],\n beforeChange: [\n ({ siblingData, value }) => {\n if (storeInDB) {\n return value\n }\n delete siblingData[name]\n return null\n },\n ],\n },\n }\n}\n"],"names":["defaultHTMLConverters","convertLexicalToHTML","consolidateHTMLConverters","editorConfig","htmlConverterFeature","resolvedFeatureMap","get","htmlConverterFeatureProps","serverFeatureProps","defaultConvertersWithConvertersFromFeatures","converter","features","converters","html","push","finalConverters","defaultConverters","foundNodeTypes","filteredConverters","reverse","nodeTypes","length","newConverter","filter","nodeType","includes","findFieldPathAndSiblingFields","fields","path","field","curField","name","siblingFields","result","tab","tabs","block","blocks","slug","lexicalHTML","lexicalFieldName","props","hidden","storeInDB","type","admin","editorOptions","language","hooks","afterRead","collection","global","req","siblingData","foundSiblingFields","Error","lexicalField","find","lexicalFieldData","config","editor","has","data","payload","beforeChange","value"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAQA,SAASA,qBAAqB,QAAQ,oCAAmC;AACzE,SAASC,oBAAoB,QAAQ,wBAAuB;AAkB5D;;;;CAIC,GACD,OAAO,MAAMC,4B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zF,MAAM,EAAEC,aAAa,EAAE,GAAGsB;oBAC1B,MAAME,eACJxB,cAAcyB,IAAI,CAChB,CAAC5B,QAAU,UAAUA,SAASA,MAAME,IAAI,KAAKS;oBAGjD,MAAMkB,mBAA0CL,WAAW,CAACb,iBAAiB;oBAE7E,IAAI,CAACkB,kBAAkB;wBACrB,OAAO;oBACT;oBAEA,IAAI,CAACF,cAAc;wBACjB,MAAM,IAAID,MACR;oBAEJ;oBAEA,MAAMI,SAAUH,cAAcI,QAAmCzD;oBAEjE,IAAI,CAACwD,QAAQ;wBACX,MAAM,IAAIJ,MACR;oBAEJ;oBAEA,IAAI,CAACI,QAAQtD,oBAAoBwD,IAAI,kBAAkB;wBACrD,MAAM,IAAIN,MACR;oBAEJ;oBAEA,MAAMxC,kBAAkBb,0BAA0B;wBAChDC,cAAcwD;oBAChB;oBAEA,OAAO,MAAM1D,qBAAqB;wBAChCW,YAAYG;wBACZ+C,MAAMJ;wBACNK,SAASX,IAAIW,OAAO;oBACtB;gBACF;aACD;YACDC,cAAc;gBACZ,CAAC,EAAEX,WAAW,EAAEY,KAAK,EAAE;oBACrB,IAAItB,WAAW;wBACb,OAAOsB;oBACT;oBACA,OAAOZ,WAAW,CAACtB,KAAK;oBACxB,OAAO;gBACT;aACD;QACH;IACF;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFeaturePropComponent.d.ts","sourceRoot":"","sources":["../../../src/field/features/createFeaturePropComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"createFeaturePropComponent.d.ts","sourceRoot":"","sources":["../../../src/field/features/createFeaturePropComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAkB9B,eAAO,MAAM,0BAA0B,sBAC/B,CAAC,KACN,MAAM,EAAE,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAKvD,CAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useTableCell } from '@payloadcms/ui/
|
|
3
|
-
import { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider';
|
|
4
|
-
import { useAddClientFunction } from '@payloadcms/ui/providers/ClientFunction';
|
|
2
|
+
import { useAddClientFunction, useFieldProps, useTableCell } from '@payloadcms/ui/client';
|
|
5
3
|
const useLexicalFeatureProp = (featureKey, componentKey, prop)=>{
|
|
6
4
|
const { schemaPath: schemaPathFromFieldProps } = useFieldProps();
|
|
7
5
|
const tableCell = useTableCell();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/field/features/createFeaturePropComponent.tsx"],"sourcesContent":["'use client'\n\nimport type React from 'react'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/field/features/createFeaturePropComponent.tsx"],"sourcesContent":["'use client'\n\nimport type React from 'react'\n\nimport { useAddClientFunction, useFieldProps, useTableCell } from '@payloadcms/ui/client'\n\nconst useLexicalFeatureProp = <T,>(featureKey: string, componentKey: string, prop: T) => {\n const { schemaPath: schemaPathFromFieldProps } = useFieldProps()\n const tableCell = useTableCell()\n\n const schemaPathFromCellProps = tableCell?.cellProps?.schemaPath\n\n const schemaPath = schemaPathFromCellProps || schemaPathFromFieldProps // schemaPathFromCellProps needs to have priority, as there can be cells within fields (e.g. list drawers) and the cell schemaPath needs to be used there - not the parent field schemaPath. There cannot be fields within cells.\n\n useAddClientFunction(\n `lexicalFeature.${schemaPath}.${featureKey}.components.${componentKey}`,\n prop,\n )\n}\n\nexport const createFeaturePropComponent = <T = unknown,>(\n prop: T,\n): React.FC<{ componentKey: string; featureKey: string }> => {\n return (props) => {\n useLexicalFeatureProp(props.featureKey, props.componentKey, prop)\n return null\n }\n}\n"],"names":["useAddClientFunction","useFieldProps","useTableCell","useLexicalFeatureProp","featureKey","componentKey","prop","schemaPath","schemaPathFromFieldProps","tableCell","schemaPathFromCellProps","cellProps","createFeaturePropComponent","props"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,oBAAoB,EAAEC,aAAa,EAAEC,YAAY,QAAQ,wBAAuB;AAEzF,MAAMC,wBAAwB,CAAKC,YAAoBC,cAAsBC;IAC3E,MAAM,EAAEC,YAAYC,wBAAwB,EAAE,GAAGP;IACjD,MAAMQ,YAAYP;IAElB,MAAMQ,0BAA0BD,WAAWE,WAAWJ;IAEtD,MAAMA,aAAaG,2BAA2BF,yBAAyB,iOAAiO;;IAExSR,qBACE,CAAC,eAAe,EAAEO,WAAW,CAAC,EAAEH,WAAW,YAAY,EAAEC,aAAa,CAAC,EACvEC;AAEJ;AAEA,OAAO,MAAMM,6BAA6B,CACxCN;IAEA,OAAO,CAACO;QACNV,sBAAsBU,MAAMT,UAAU,EAAES,MAAMR,YAAY,EAAEC;QAC5D,OAAO;IACT;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/testRecorder/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/testRecorder/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAKnE,eAAO,MAAM,mBAAmB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAWnF,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir
|
|
2
|
+
import { TestRecorderFeatureClientComponent } from '../../../../exports/client/index.js';
|
|
2
3
|
export const TestRecorderFeature = (props)=>{
|
|
3
4
|
return {
|
|
4
5
|
feature: ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/debug/testRecorder/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { TestRecorderFeatureClientComponent } from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/debug/testRecorder/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { TestRecorderFeatureClientComponent } from '../../../../exports/client/index.js'\n\nexport const TestRecorderFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: TestRecorderFeatureClientComponent,\n serverFeatureProps: props,\n }\n },\n key: 'testRecorder',\n serverFeatureProps: props,\n }\n}\n"],"names":["TestRecorderFeatureClientComponent","TestRecorderFeature","props","feature","ClientComponent","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAEA,+DAA+D;AAC/D,SAASA,kCAAkC,QAAQ,sCAAqC;AAExF,OAAO,MAAMC,sBAA2E,CAACC;IACvF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoBH;YACtB;QACF;QACAI,KAAK;QACLD,oBAAoBH;IACtB;AACF,EAAC"}
|
|
@@ -5,7 +5,6 @@ import { $createParagraphNode, $createTextNode, $getRoot } from 'lexical';
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
7
7
|
import { IS_APPLE } from '../../../../lexical/utils/environment.js';
|
|
8
|
-
import './index.scss';
|
|
9
8
|
const copy = (text)=>{
|
|
10
9
|
const textArea = document.createElement('textarea');
|
|
11
10
|
textArea.value = text || '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/field/features/debug/testRecorder/plugin/index.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection, LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $createParagraphNode, $createTextNode, $getRoot } from 'lexical'\nimport * as React from 'react'\nimport { type JSX, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\n\nimport type { PluginComponent } from '../../../types.js'\n\nimport { IS_APPLE } from '../../../../lexical/utils/environment.js'\nimport './index.scss'\n\nconst copy = (text: null | string) => {\n const textArea = document.createElement('textarea')\n textArea.value = text || ''\n textArea.style.position = 'absolute'\n textArea.style.opacity = '0'\n document.body?.appendChild(textArea)\n textArea.focus()\n textArea.select()\n try {\n const result = document.execCommand('copy')\n // eslint-disable-next-line no-console\n console.log(result)\n } catch (error) {\n console.error(error)\n }\n document.body?.removeChild(textArea)\n}\n\nconst download = (filename: string, text: null | string) => {\n const a = document.createElement('a')\n a.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text || ''))\n a.setAttribute('download', filename)\n a.style.display = 'none'\n document.body?.appendChild(a)\n a.click()\n document.body?.removeChild(a)\n}\n\nconst formatStep = (step: Step) => {\n const formatOneStep = (name: string, value: Step['value']) => {\n switch (name) {\n case 'click': {\n return ` await page.mouse.click(${value.x}, ${value.y});`\n }\n case 'press': {\n return ` await page.keyboard.press('${value}');`\n }\n case 'keydown': {\n return ` await page.keyboard.keydown('${value}');`\n }\n case 'keyup': {\n return ` await page.keyboard.keyup('${value}');`\n }\n case 'type': {\n return ` await page.keyboard.type('${value}');`\n }\n case 'selectAll': {\n return ` await selectAll(page);`\n }\n case 'snapshot': {\n return ` await assertHTMLSnapshot(page);\n await assertSelection(page, {\n anchorPath: [${value.anchorPath.toString()}],\n anchorOffset: ${value.anchorOffset},\n focusPath: [${value.focusPath.toString()}],\n focusOffset: ${value.focusOffset},\n });\n`\n }\n default:\n return ``\n }\n }\n const formattedStep = formatOneStep(step.name, step.value)\n switch (step.count) {\n case 1:\n return formattedStep\n case 2:\n return [formattedStep, formattedStep].join(`\\n`)\n default:\n return ` await repeat(${step.count}, async () => {\n ${formattedStep}\n );`\n }\n}\n\nexport function isSelectAll(event: KeyboardEvent): boolean {\n return event.key.toLowerCase() === 'a' && (IS_APPLE ? event.metaKey : event.ctrlKey)\n}\n\n// stolen from LexicalSelection-test\nfunction sanitizeSelection(selection: Selection) {\n const { anchorNode, focusNode } = selection\n let { anchorOffset, focusOffset } = selection\n if (anchorOffset !== 0) {\n anchorOffset--\n }\n if (focusOffset !== 0) {\n focusOffset--\n }\n return { anchorNode, anchorOffset, focusNode, focusOffset }\n}\n\nfunction getPathFromNodeToEditor(node: Node, rootElement: HTMLElement | null) {\n let currentNode: Node | null | undefined = node\n const path = []\n while (currentNode !== rootElement) {\n if (currentNode !== null && currentNode !== undefined) {\n path.unshift(\n Array.from(currentNode?.parentNode?.childNodes ?? []).indexOf(currentNode as ChildNode),\n )\n }\n currentNode = currentNode?.parentNode\n }\n return path\n}\n\nconst keyPresses = new Set([\n 'Enter',\n 'Backspace',\n 'Delete',\n 'Escape',\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n])\n\ntype Step = {\n count: number\n name: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any\n}\n\ntype Steps = Step[]\n\nfunction useTestRecorder(editor: LexicalEditor): [JSX.Element, JSX.Element | null] {\n const [steps, setSteps] = useState<Steps>([])\n const [isRecording, setIsRecording] = useState(false)\n const [, setCurrentInnerHTML] = useState('')\n const [templatedTest, setTemplatedTest] = useState('')\n const previousSelectionRef = useRef<BaseSelection | null>(null)\n const skipNextSelectionChangeRef = useRef(false)\n const preRef = useRef<HTMLPreElement>(null)\n\n const getCurrentEditor = useCallback(() => {\n return editor\n }, [editor])\n\n const generateTestContent = useCallback(() => {\n const rootElement = editor.getRootElement()\n const browserSelection = window.getSelection()\n\n if (\n rootElement == null ||\n browserSelection == null ||\n browserSelection.anchorNode == null ||\n browserSelection.focusNode == null ||\n !rootElement.contains(browserSelection.anchorNode) ||\n !rootElement.contains(browserSelection.focusNode)\n ) {\n return null\n }\n\n return `\nimport {\n initializeE2E,\n assertHTMLSnapshot,\n assertSelection,\n repeat,\n} from '../utils';\nimport {selectAll} from '../keyboardShortcuts';\nimport { RangeSelection } from 'lexical';\nimport { NodeSelection } from 'lexical';\n\ndescribe('Test case', () => {\n initializeE2E((e2e) => {\n it('Should pass this test', async () => {\n const {page} = e2e;\n\n await page.focus('div[contenteditable=\"true\"]');\n${steps.map(formatStep).join(`\\n`)}\n });\n});\n `\n }, [editor, steps])\n\n // just a wrapper around inserting new actions so that we can\n // coalesce some actions like insertText/moveNativeSelection\n const pushStep = useCallback(\n (name: string, value: Step['value']) => {\n setSteps((currentSteps) => {\n // trying to group steps\n const currentIndex = steps.length - 1\n const lastStep = steps[currentIndex]\n if (lastStep) {\n if (lastStep.name === name) {\n if (name === 'type') {\n // for typing events we just append the text\n return [\n ...steps.slice(0, currentIndex),\n { ...lastStep, value: lastStep.value + value },\n ]\n } else {\n // for other events we bump the counter if their values are the same\n if (lastStep.value === value) {\n return [...steps.slice(0, currentIndex), { ...lastStep, count: lastStep.count + 1 }]\n }\n }\n }\n }\n // could not group, just append a new one\n return [...currentSteps, { name, count: 1, value }]\n })\n },\n [steps, setSteps],\n )\n\n useLayoutEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (!isRecording) {\n return\n }\n const key = event.key\n if (isSelectAll(event)) {\n pushStep('selectAll', '')\n } else if (keyPresses.has(key)) {\n pushStep('press', event.key)\n } else if ([...key].length > 1) {\n pushStep('keydown', event.key)\n } else {\n pushStep('type', event.key)\n }\n }\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!isRecording) {\n return\n }\n const key = event.key\n if (!keyPresses.has(key) && [...key].length > 1) {\n pushStep('keyup', event.key)\n }\n }\n\n return editor.registerRootListener(\n (rootElement: HTMLElement | null, prevRootElement: HTMLElement | null) => {\n if (prevRootElement !== null) {\n prevRootElement.removeEventListener('keydown', onKeyDown)\n prevRootElement.removeEventListener('keyup', onKeyUp)\n }\n if (rootElement !== null) {\n rootElement.addEventListener('keydown', onKeyDown)\n rootElement.addEventListener('keyup', onKeyUp)\n }\n },\n )\n }, [editor, isRecording, pushStep])\n\n useLayoutEffect(() => {\n if (preRef.current) {\n preRef.current.scrollTo(0, preRef.current.scrollHeight)\n }\n }, [generateTestContent])\n\n useEffect(() => {\n if (steps) {\n const testContent = generateTestContent()\n if (testContent !== null) {\n setTemplatedTest(testContent)\n }\n if (preRef.current) {\n preRef.current.scrollTo(0, preRef.current.scrollHeight)\n }\n }\n }, [generateTestContent, steps])\n\n useEffect(() => {\n const removeUpdateListener = editor.registerUpdateListener(\n ({ dirtyElements, dirtyLeaves, editorState }) => {\n if (!isRecording) {\n return\n }\n const currentSelection = editorState._selection\n const previousSelection = previousSelectionRef.current\n const skipNextSelectionChange = skipNextSelectionChangeRef.current\n if (previousSelection !== currentSelection) {\n if (dirtyLeaves.size === 0 && dirtyElements.size === 0 && !skipNextSelectionChange) {\n const browserSelection = window.getSelection()\n if (\n browserSelection &&\n (browserSelection.anchorNode == null || browserSelection.focusNode == null)\n ) {\n return\n }\n }\n previousSelectionRef.current = currentSelection\n }\n skipNextSelectionChangeRef.current = false\n const testContent = generateTestContent()\n if (testContent !== null) {\n setTemplatedTest(testContent)\n }\n },\n )\n return removeUpdateListener\n }, [editor, generateTestContent, isRecording, pushStep])\n\n // save innerHTML\n useEffect(() => {\n if (!isRecording) {\n return\n }\n const removeUpdateListener = editor.registerUpdateListener(() => {\n const rootElement = editor.getRootElement()\n if (rootElement !== null) {\n setCurrentInnerHTML(rootElement?.innerHTML)\n }\n })\n return removeUpdateListener\n }, [editor, isRecording])\n\n // clear editor and start recording\n const toggleEditorSelection = useCallback(\n (currentEditor: LexicalEditor) => {\n if (!isRecording) {\n currentEditor.update(() => {\n const root = $getRoot()\n root.clear()\n const text = $createTextNode()\n root.append($createParagraphNode().append(text))\n text.select()\n })\n setSteps([])\n }\n setIsRecording((currentIsRecording) => !currentIsRecording)\n },\n [isRecording],\n )\n\n const onSnapshotClick = useCallback(() => {\n if (!isRecording) {\n return\n }\n const browserSelection = window.getSelection()\n if (\n browserSelection === null ||\n browserSelection.anchorNode == null ||\n browserSelection.focusNode == null\n ) {\n return\n }\n const { anchorNode, anchorOffset, focusNode, focusOffset } = sanitizeSelection(browserSelection)\n const rootElement = getCurrentEditor().getRootElement()\n let anchorPath\n if (anchorNode !== null) {\n anchorPath = getPathFromNodeToEditor(anchorNode, rootElement)\n }\n let focusPath\n if (focusNode !== null) {\n focusPath = getPathFromNodeToEditor(focusNode, rootElement)\n }\n pushStep('snapshot', {\n anchorNode,\n anchorOffset,\n anchorPath,\n focusNode,\n focusOffset,\n focusPath,\n })\n }, [pushStep, isRecording, getCurrentEditor])\n\n const onCopyClick = useCallback(() => {\n copy(generateTestContent())\n }, [generateTestContent])\n\n const onDownloadClick = useCallback(() => {\n download('test.js', generateTestContent())\n }, [generateTestContent])\n\n const button = (\n <button\n className={`editor-dev-button ${isRecording ? 'active' : ''}`}\n id=\"test-recorder-button\"\n onClick={(e) => {\n toggleEditorSelection(getCurrentEditor())\n e.preventDefault()\n }}\n title={isRecording ? 'Disable test recorder' : 'Enable test recorder'}\n type=\"button\"\n >\n {isRecording ? 'Disable test recorder' : 'Enable test recorder'}\n </button>\n )\n const output = isRecording ? (\n <div className=\"test-recorder-output\">\n <div className=\"test-recorder-toolbar\">\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-snapshot\"\n onClick={(e) => {\n onSnapshotClick()\n e.preventDefault()\n }}\n title=\"Insert snapshot\"\n type=\"button\"\n >\n Insert Snapshot\n </button>\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-copy\"\n onClick={(e) => {\n onCopyClick()\n e.preventDefault()\n }}\n title=\"Copy to clipboard\"\n type=\"button\"\n >\n Copy\n </button>\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-download\"\n onClick={(e) => {\n onDownloadClick()\n e.preventDefault()\n }}\n title=\"Download as a file\"\n type=\"button\"\n >\n Download\n </button>\n </div>\n <pre id=\"test-recorder\" ref={preRef}>\n {templatedTest}\n </pre>\n </div>\n ) : null\n\n return [button, output]\n}\nexport const TestRecorderPlugin: PluginComponent<undefined> = () => {\n const [editor] = useLexicalComposerContext()\n const [testRecorderButton, testRecorderOutput] = useTestRecorder(editor)\n\n return (\n <React.Fragment>\n <p>HI</p>\n {testRecorderButton}\n {testRecorderOutput}\n <p>DONE</p>\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","$createParagraphNode","$createTextNode","$getRoot","React","useCallback","useEffect","useLayoutEffect","useRef","useState","IS_APPLE","copy","text","textArea","document","createElement","value","style","position","opacity","body","appendChild","focus","select","result","execCommand","console","log","error","removeChild","download","filename","a","setAttribute","encodeURIComponent","display","click","formatStep","step","formatOneStep","name","x","y","anchorPath","toString","anchorOffset","focusPath","focusOffset","formattedStep","count","join","isSelectAll","event","key","toLowerCase","metaKey","ctrlKey","sanitizeSelection","selection","anchorNode","focusNode","getPathFromNodeToEditor","node","rootElement","currentNode","path","undefined","unshift","Array","from","parentNode","childNodes","indexOf","keyPresses","Set","useTestRecorder","editor","steps","setSteps","isRecording","setIsRecording","setCurrentInnerHTML","templatedTest","setTemplatedTest","previousSelectionRef","skipNextSelectionChangeRef","preRef","getCurrentEditor","generateTestContent","getRootElement","browserSelection","window","getSelection","contains","map","pushStep","currentSteps","currentIndex","length","lastStep","slice","onKeyDown","has","onKeyUp","registerRootListener","prevRootElement","removeEventListener","addEventListener","current","scrollTo","scrollHeight","testContent","removeUpdateListener","registerUpdateListener","dirtyElements","dirtyLeaves","editorState","currentSelection","_selection","previousSelection","skipNextSelectionChange","size","innerHTML","toggleEditorSelection","currentEditor","update","root","clear","append","currentIsRecording","onSnapshotClick","onCopyClick","onDownloadClick","button","className","id","onClick","e","preventDefault","title","type","output","div","pre","ref","TestRecorderPlugin","testRecorderButton","testRecorderOutput","Fragment","p"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;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D;IACtB,GAAG;QAACA;KAAoB;IAExB,MAAM6C,uBACJ,KAACA;QACCC,WAAW,CAAC,kBAAkB,EAAEvD,cAAc,WAAW,GAAG,CAAC;QAC7DwD,IAAG;QACHC,SAAS,CAACC;YACRd,sBAAsBpC;YACtBkD,EAAEC,cAAc;QAClB;QACAC,OAAO5D,cAAc,0BAA0B;QAC/C6D,MAAK;kBAEJ7D,cAAc,0BAA0B;;IAG7C,MAAM8D,SAAS9D,4BACb,MAAC+D;QAAIR,WAAU;;0BACb,MAACQ;gBAAIR,WAAU;;kCACb,KAACD;wBACCC,WAAU;wBACVC,IAAG;wBACHC,SAAS,CAACC;4BACRP;4BACAO,EAAEC,cAAc;wBAClB;wBACAC,OAAM;wBACNC,MAAK;kCACN;;kCAGD,KAACP;wBACCC,WAAU;wBACVC,IAAG;wBACHC,SAAS,CAACC;4BACRN;4BACAM,EAAEC,cAAc;wBAClB;wBACAC,OAAM;wBACNC,MAAK;kCACN;;kCAGD,KAACP;wBACCC,WAAU;wBACVC,IAAG;wBACHC,SAAS,CAACC;4BACRL;4BACAK,EAAEC,cAAc;wBAClB;wBACAC,OAAM;wBACNC,MAAK;kCACN;;;;0BAIH,KAACG;gBAAIR,IAAG;gBAAgBS,KAAK1D;0BAC1BJ;;;SAGH;IAEJ,OAAO;QAACmD;QAAQQ;KAAO;AACzB;AACA,OAAO,MAAMI,qBAAiD;IAC5D,MAAM,CAACrE,OAAO,GAAG5E;IACjB,MAAM,CAACkJ,oBAAoBC,mBAAmB,GAAGxE,gBAAgBC;IAEjE,qBACE,MAACxE,MAAMgJ,QAAQ;;0BACb,KAACC;0BAAE;;YACFH;YACAC;0BACD,KAACE;0BAAE;;;;AAGT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/field/features/debug/testRecorder/plugin/index.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection, LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $createParagraphNode, $createTextNode, $getRoot } from 'lexical'\nimport * as React from 'react'\nimport { type JSX, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\n\nimport type { PluginComponent } from '../../../types.js'\n\nimport { IS_APPLE } from '../../../../lexical/utils/environment.js'\nimport './index.scss'\n\nconst copy = (text: null | string) => {\n const textArea = document.createElement('textarea')\n textArea.value = text || ''\n textArea.style.position = 'absolute'\n textArea.style.opacity = '0'\n document.body?.appendChild(textArea)\n textArea.focus()\n textArea.select()\n try {\n const result = document.execCommand('copy')\n // eslint-disable-next-line no-console\n console.log(result)\n } catch (error) {\n console.error(error)\n }\n document.body?.removeChild(textArea)\n}\n\nconst download = (filename: string, text: null | string) => {\n const a = document.createElement('a')\n a.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text || ''))\n a.setAttribute('download', filename)\n a.style.display = 'none'\n document.body?.appendChild(a)\n a.click()\n document.body?.removeChild(a)\n}\n\nconst formatStep = (step: Step) => {\n const formatOneStep = (name: string, value: Step['value']) => {\n switch (name) {\n case 'click': {\n return ` await page.mouse.click(${value.x}, ${value.y});`\n }\n case 'press': {\n return ` await page.keyboard.press('${value}');`\n }\n case 'keydown': {\n return ` await page.keyboard.keydown('${value}');`\n }\n case 'keyup': {\n return ` await page.keyboard.keyup('${value}');`\n }\n case 'type': {\n return ` await page.keyboard.type('${value}');`\n }\n case 'selectAll': {\n return ` await selectAll(page);`\n }\n case 'snapshot': {\n return ` await assertHTMLSnapshot(page);\n await assertSelection(page, {\n anchorPath: [${value.anchorPath.toString()}],\n anchorOffset: ${value.anchorOffset},\n focusPath: [${value.focusPath.toString()}],\n focusOffset: ${value.focusOffset},\n });\n`\n }\n default:\n return ``\n }\n }\n const formattedStep = formatOneStep(step.name, step.value)\n switch (step.count) {\n case 1:\n return formattedStep\n case 2:\n return [formattedStep, formattedStep].join(`\\n`)\n default:\n return ` await repeat(${step.count}, async () => {\n ${formattedStep}\n );`\n }\n}\n\nexport function isSelectAll(event: KeyboardEvent): boolean {\n return event.key.toLowerCase() === 'a' && (IS_APPLE ? event.metaKey : event.ctrlKey)\n}\n\n// stolen from LexicalSelection-test\nfunction sanitizeSelection(selection: Selection) {\n const { anchorNode, focusNode } = selection\n let { anchorOffset, focusOffset } = selection\n if (anchorOffset !== 0) {\n anchorOffset--\n }\n if (focusOffset !== 0) {\n focusOffset--\n }\n return { anchorNode, anchorOffset, focusNode, focusOffset }\n}\n\nfunction getPathFromNodeToEditor(node: Node, rootElement: HTMLElement | null) {\n let currentNode: Node | null | undefined = node\n const path = []\n while (currentNode !== rootElement) {\n if (currentNode !== null && currentNode !== undefined) {\n path.unshift(\n Array.from(currentNode?.parentNode?.childNodes ?? []).indexOf(currentNode as ChildNode),\n )\n }\n currentNode = currentNode?.parentNode\n }\n return path\n}\n\nconst keyPresses = new Set([\n 'Enter',\n 'Backspace',\n 'Delete',\n 'Escape',\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n])\n\ntype Step = {\n count: number\n name: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any\n}\n\ntype Steps = Step[]\n\nfunction useTestRecorder(editor: LexicalEditor): [JSX.Element, JSX.Element | null] {\n const [steps, setSteps] = useState<Steps>([])\n const [isRecording, setIsRecording] = useState(false)\n const [, setCurrentInnerHTML] = useState('')\n const [templatedTest, setTemplatedTest] = useState('')\n const previousSelectionRef = useRef<BaseSelection | null>(null)\n const skipNextSelectionChangeRef = useRef(false)\n const preRef = useRef<HTMLPreElement>(null)\n\n const getCurrentEditor = useCallback(() => {\n return editor\n }, [editor])\n\n const generateTestContent = useCallback(() => {\n const rootElement = editor.getRootElement()\n const browserSelection = window.getSelection()\n\n if (\n rootElement == null ||\n browserSelection == null ||\n browserSelection.anchorNode == null ||\n browserSelection.focusNode == null ||\n !rootElement.contains(browserSelection.anchorNode) ||\n !rootElement.contains(browserSelection.focusNode)\n ) {\n return null\n }\n\n return `\nimport {\n initializeE2E,\n assertHTMLSnapshot,\n assertSelection,\n repeat,\n} from '../utils';\nimport {selectAll} from '../keyboardShortcuts';\nimport { RangeSelection } from 'lexical';\nimport { NodeSelection } from 'lexical';\n\ndescribe('Test case', () => {\n initializeE2E((e2e) => {\n it('Should pass this test', async () => {\n const {page} = e2e;\n\n await page.focus('div[contenteditable=\"true\"]');\n${steps.map(formatStep).join(`\\n`)}\n });\n});\n `\n }, [editor, steps])\n\n // just a wrapper around inserting new actions so that we can\n // coalesce some actions like insertText/moveNativeSelection\n const pushStep = useCallback(\n (name: string, value: Step['value']) => {\n setSteps((currentSteps) => {\n // trying to group steps\n const currentIndex = steps.length - 1\n const lastStep = steps[currentIndex]\n if (lastStep) {\n if (lastStep.name === name) {\n if (name === 'type') {\n // for typing events we just append the text\n return [\n ...steps.slice(0, currentIndex),\n { ...lastStep, value: lastStep.value + value },\n ]\n } else {\n // for other events we bump the counter if their values are the same\n if (lastStep.value === value) {\n return [...steps.slice(0, currentIndex), { ...lastStep, count: lastStep.count + 1 }]\n }\n }\n }\n }\n // could not group, just append a new one\n return [...currentSteps, { name, count: 1, value }]\n })\n },\n [steps, setSteps],\n )\n\n useLayoutEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (!isRecording) {\n return\n }\n const key = event.key\n if (isSelectAll(event)) {\n pushStep('selectAll', '')\n } else if (keyPresses.has(key)) {\n pushStep('press', event.key)\n } else if ([...key].length > 1) {\n pushStep('keydown', event.key)\n } else {\n pushStep('type', event.key)\n }\n }\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!isRecording) {\n return\n }\n const key = event.key\n if (!keyPresses.has(key) && [...key].length > 1) {\n pushStep('keyup', event.key)\n }\n }\n\n return editor.registerRootListener(\n (rootElement: HTMLElement | null, prevRootElement: HTMLElement | null) => {\n if (prevRootElement !== null) {\n prevRootElement.removeEventListener('keydown', onKeyDown)\n prevRootElement.removeEventListener('keyup', onKeyUp)\n }\n if (rootElement !== null) {\n rootElement.addEventListener('keydown', onKeyDown)\n rootElement.addEventListener('keyup', onKeyUp)\n }\n },\n )\n }, [editor, isRecording, pushStep])\n\n useLayoutEffect(() => {\n if (preRef.current) {\n preRef.current.scrollTo(0, preRef.current.scrollHeight)\n }\n }, [generateTestContent])\n\n useEffect(() => {\n if (steps) {\n const testContent = generateTestContent()\n if (testContent !== null) {\n setTemplatedTest(testContent)\n }\n if (preRef.current) {\n preRef.current.scrollTo(0, preRef.current.scrollHeight)\n }\n }\n }, [generateTestContent, steps])\n\n useEffect(() => {\n const removeUpdateListener = editor.registerUpdateListener(\n ({ dirtyElements, dirtyLeaves, editorState }) => {\n if (!isRecording) {\n return\n }\n const currentSelection = editorState._selection\n const previousSelection = previousSelectionRef.current\n const skipNextSelectionChange = skipNextSelectionChangeRef.current\n if (previousSelection !== currentSelection) {\n if (dirtyLeaves.size === 0 && dirtyElements.size === 0 && !skipNextSelectionChange) {\n const browserSelection = window.getSelection()\n if (\n browserSelection &&\n (browserSelection.anchorNode == null || browserSelection.focusNode == null)\n ) {\n return\n }\n }\n previousSelectionRef.current = currentSelection\n }\n skipNextSelectionChangeRef.current = false\n const testContent = generateTestContent()\n if (testContent !== null) {\n setTemplatedTest(testContent)\n }\n },\n )\n return removeUpdateListener\n }, [editor, generateTestContent, isRecording, pushStep])\n\n // save innerHTML\n useEffect(() => {\n if (!isRecording) {\n return\n }\n const removeUpdateListener = editor.registerUpdateListener(() => {\n const rootElement = editor.getRootElement()\n if (rootElement !== null) {\n setCurrentInnerHTML(rootElement?.innerHTML)\n }\n })\n return removeUpdateListener\n }, [editor, isRecording])\n\n // clear editor and start recording\n const toggleEditorSelection = useCallback(\n (currentEditor: LexicalEditor) => {\n if (!isRecording) {\n currentEditor.update(() => {\n const root = $getRoot()\n root.clear()\n const text = $createTextNode()\n root.append($createParagraphNode().append(text))\n text.select()\n })\n setSteps([])\n }\n setIsRecording((currentIsRecording) => !currentIsRecording)\n },\n [isRecording],\n )\n\n const onSnapshotClick = useCallback(() => {\n if (!isRecording) {\n return\n }\n const browserSelection = window.getSelection()\n if (\n browserSelection === null ||\n browserSelection.anchorNode == null ||\n browserSelection.focusNode == null\n ) {\n return\n }\n const { anchorNode, anchorOffset, focusNode, focusOffset } = sanitizeSelection(browserSelection)\n const rootElement = getCurrentEditor().getRootElement()\n let anchorPath\n if (anchorNode !== null) {\n anchorPath = getPathFromNodeToEditor(anchorNode, rootElement)\n }\n let focusPath\n if (focusNode !== null) {\n focusPath = getPathFromNodeToEditor(focusNode, rootElement)\n }\n pushStep('snapshot', {\n anchorNode,\n anchorOffset,\n anchorPath,\n focusNode,\n focusOffset,\n focusPath,\n })\n }, [pushStep, isRecording, getCurrentEditor])\n\n const onCopyClick = useCallback(() => {\n copy(generateTestContent())\n }, [generateTestContent])\n\n const onDownloadClick = useCallback(() => {\n download('test.js', generateTestContent())\n }, [generateTestContent])\n\n const button = (\n <button\n className={`editor-dev-button ${isRecording ? 'active' : ''}`}\n id=\"test-recorder-button\"\n onClick={(e) => {\n toggleEditorSelection(getCurrentEditor())\n e.preventDefault()\n }}\n title={isRecording ? 'Disable test recorder' : 'Enable test recorder'}\n type=\"button\"\n >\n {isRecording ? 'Disable test recorder' : 'Enable test recorder'}\n </button>\n )\n const output = isRecording ? (\n <div className=\"test-recorder-output\">\n <div className=\"test-recorder-toolbar\">\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-snapshot\"\n onClick={(e) => {\n onSnapshotClick()\n e.preventDefault()\n }}\n title=\"Insert snapshot\"\n type=\"button\"\n >\n Insert Snapshot\n </button>\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-copy\"\n onClick={(e) => {\n onCopyClick()\n e.preventDefault()\n }}\n title=\"Copy to clipboard\"\n type=\"button\"\n >\n Copy\n </button>\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-download\"\n onClick={(e) => {\n onDownloadClick()\n e.preventDefault()\n }}\n title=\"Download as a file\"\n type=\"button\"\n >\n Download\n </button>\n </div>\n <pre id=\"test-recorder\" ref={preRef}>\n {templatedTest}\n </pre>\n </div>\n ) : null\n\n return [button, output]\n}\nexport const TestRecorderPlugin: PluginComponent<undefined> = () => {\n const [editor] = useLexicalComposerContext()\n const [testRecorderButton, testRecorderOutput] = useTestRecorder(editor)\n\n return (\n <React.Fragment>\n <p>HI</p>\n {testRecorderButton}\n {testRecorderOutput}\n <p>DONE</p>\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","$createParagraphNode","$createTextNode","$getRoot","React","useCallback","useEffect","useLayoutEffect","useRef","useState","IS_APPLE","copy","text","textArea","document","createElement","value","style","position","opacity","body","appendChild","focus","select","result","execCommand","console","log","error","removeChild","download","filename","a","setAttribute","encodeURIComponent","display","click","formatStep","step","formatOneStep","name","x","y","anchorPath","toString","anchorOffset","focusPath","focusOffset","formattedStep","count","join","isSelectAll","event","key","toLowerCase","metaKey","ctrlKey","sanitizeSelection","selection","anchorNode","focusNode","getPathFromNodeToEditor","node","rootElement","currentNode","path","undefined","unshift","Array","from","parentNode","childNodes","indexOf","keyPresses","Set","useTestRecorder","editor","steps","setSteps","isRecording","setIsRecording","setCurrentInnerHTML","templatedTest","setTemplatedTest","previousSelectionRef","skipNextSelectionChangeRef","preRef","getCurrentEditor","generateTestContent","getRootElement","browserSelection","window","getSelection","contains","map","pushStep","currentSteps","currentIndex","length","lastStep","slice","onKeyDown","has","onKeyUp","registerRootListener","prevRootElement","removeEventListener","addEventListener","current","scrollTo","scrollHeight","testContent","removeUpdateListener","registerUpdateListener","dirtyElements","dirtyLeaves","editorState","currentSelection","_selection","previousSelection","skipNextSelectionChange","size","innerHTML","toggleEditorSelection","currentEditor","update","root","clear","append","currentIsRecording","onSnapshotClick","onCopyClick","onDownloadClick","button","className","id","onClick","e","preventDefault","title","type","output","div","pre","ref","TestRecorderPlugin","testRecorderButton","testRecorderOutput","Fragment","p"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EvD,cAAc,WAAW,GAAG,CAAC;QAC7DwD,IAAG;QACHC,SAAS,CAACC;YACRd,sBAAsBpC;YACtBkD,EAAEC,cAAc;QAClB;QACAC,OAAO5D,cAAc,0BAA0B;QAC/C6D,MAAK;kBAEJ7D,cAAc,0BAA0B;;IAG7C,MAAM8D,SAAS9D,4BACb,MAAC+D;QAAIR,WAAU;;0BACb,MAACQ;gBAAIR,WAAU;;kCACb,KAACD;wBACCC,WAAU;wBACVC,IAAG;wBACHC,SAAS,CAACC;4BACRP;4BACAO,EAAEC,cAAc;wBAClB;wBACAC,OAAM;wBACNC,MAAK;kCACN;;kCAGD,KAACP;wBACCC,WAAU;wBACVC,IAAG;wBACHC,SAAS,CAACC;4BACRN;4BACAM,EAAEC,cAAc;wBAClB;wBACAC,OAAM;wBACNC,MAAK;kCACN;;kCAGD,KAACP;wBACCC,WAAU;wBACVC,IAAG;wBACHC,SAAS,CAACC;4BACRL;4BACAK,EAAEC,cAAc;wBAClB;wBACAC,OAAM;wBACNC,MAAK;kCACN;;;;0BAIH,KAACG;gBAAIR,IAAG;gBAAgBS,KAAK1D;0BAC1BJ;;;SAGH;IAEJ,OAAO;QAACmD;QAAQQ;KAAO;AACzB;AACA,OAAO,MAAMI,qBAAiD;IAC5D,MAAM,CAACrE,OAAO,GAAG5E;IACjB,MAAM,CAACkJ,oBAAoBC,mBAAmB,GAAGxE,gBAAgBC;IAEjE,qBACE,MAACxE,MAAMgJ,QAAQ;;0BACb,KAACC;0BAAE;;YACFH;YACAC;0BACD,KAACE;0BAAE;;;;AAGT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/treeView/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/debug/treeView/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAKnE,eAAO,MAAM,eAAe,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAW/E,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir
|
|
2
|
+
import { TreeViewFeatureClientComponent } from '../../../../exports/client/index.js';
|
|
2
3
|
export const TreeViewFeature = (props)=>{
|
|
3
4
|
return {
|
|
4
5
|
feature: ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/debug/treeView/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { TreeViewFeatureClientComponent } from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/debug/treeView/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { TreeViewFeatureClientComponent } from '../../../../exports/client/index.js'\n\nexport const TreeViewFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: TreeViewFeatureClientComponent,\n serverFeatureProps: props,\n }\n },\n key: 'treeView',\n serverFeatureProps: props,\n }\n}\n"],"names":["TreeViewFeatureClientComponent","TreeViewFeature","props","feature","ClientComponent","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAEA,+DAA+D;AAC/D,SAASA,8BAA8B,QAAQ,sCAAqC;AAEpF,OAAO,MAAMC,kBAAuE,CAACC;IACnF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoBH;YACtB;QACF;QACAI,KAAK;QACLD,oBAAoBH;IACtB;AACF,EAAC"}
|
|
@@ -3,7 +3,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
4
4
|
import { TreeView } from '@lexical/react/LexicalTreeView.js';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import './index.scss';
|
|
7
6
|
export const TreeViewPlugin = ()=>{
|
|
8
7
|
const [editor] = useLexicalComposerContext();
|
|
9
8
|
return /*#__PURE__*/ _jsx(TreeView, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/field/features/debug/treeView/plugin/index.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { TreeView } from '@lexical/react/LexicalTreeView.js'\nimport * as React from 'react'\n\nimport type { PluginComponent } from '../../../types.js'\n\nimport './index.scss'\n\nexport const TreeViewPlugin: PluginComponent<undefined> = () => {\n const [editor] = useLexicalComposerContext()\n return (\n <TreeView\n editor={editor}\n timeTravelButtonClassName=\"debug-timetravel-button\"\n timeTravelPanelButtonClassName=\"debug-timetravel-panel-button\"\n timeTravelPanelClassName=\"debug-timetravel-panel\"\n timeTravelPanelSliderClassName=\"debug-timetravel-panel-slider\"\n treeTypeButtonClassName=\"debug-treetype-button\"\n viewClassName=\"tree-view-output\"\n />\n )\n}\n"],"names":["useLexicalComposerContext","TreeView","React","TreeViewPlugin","editor","timeTravelButtonClassName","timeTravelPanelButtonClassName","timeTravelPanelClassName","timeTravelPanelSliderClassName","treeTypeButtonClassName","viewClassName"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/field/features/debug/treeView/plugin/index.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { TreeView } from '@lexical/react/LexicalTreeView.js'\nimport * as React from 'react'\n\nimport type { PluginComponent } from '../../../types.js'\n\nimport './index.scss'\n\nexport const TreeViewPlugin: PluginComponent<undefined> = () => {\n const [editor] = useLexicalComposerContext()\n return (\n <TreeView\n editor={editor}\n timeTravelButtonClassName=\"debug-timetravel-button\"\n timeTravelPanelButtonClassName=\"debug-timetravel-panel-button\"\n timeTravelPanelClassName=\"debug-timetravel-panel\"\n timeTravelPanelSliderClassName=\"debug-timetravel-panel-slider\"\n treeTypeButtonClassName=\"debug-treetype-button\"\n viewClassName=\"tree-view-output\"\n />\n )\n}\n"],"names":["useLexicalComposerContext","TreeView","React","TreeViewPlugin","editor","timeTravelButtonClassName","timeTravelPanelButtonClassName","timeTravelPanelClassName","timeTravelPanelSliderClassName","treeTypeButtonClassName","viewClassName"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,QAAQ,QAAQ,oCAAmC;AAC5D,YAAYC,WAAW,QAAO;AAM9B,OAAO,MAAMC,iBAA6C;IACxD,MAAM,CAACC,OAAO,GAAGJ;IACjB,qBACE,KAACC;QACCG,QAAQA;QACRC,2BAA0B;QAC1BC,gCAA+B;QAC/BC,0BAAyB;QACzBC,gCAA+B;QAC/BC,yBAAwB;QACxBC,eAAc;;AAGpB,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/bold/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/bold/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAWnE,eAAO,MAAM,WAAW,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAkB3E,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir
|
|
2
|
+
import { BoldFeatureClientComponent } from '../../../../exports/client/index.js';
|
|
2
3
|
import { BOLD_ITALIC_STAR, BOLD_ITALIC_UNDERSCORE, BOLD_STAR, BOLD_UNDERSCORE } from './markdownTransformers.js';
|
|
3
4
|
export const BoldFeature = (props)=>{
|
|
4
5
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/format/bold/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { BoldFeatureClientComponent } from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/format/bold/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { BoldFeatureClientComponent } from '../../../../exports/client/index.js'\nimport {\n BOLD_ITALIC_STAR,\n BOLD_ITALIC_UNDERSCORE,\n BOLD_STAR,\n BOLD_UNDERSCORE,\n} from './markdownTransformers.js'\n\nexport const BoldFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n dependenciesSoft: ['italic'],\n feature: ({ featureProviderMap }) => {\n const markdownTransformers = [BOLD_STAR, BOLD_UNDERSCORE]\n if (featureProviderMap.get('italic')) {\n markdownTransformers.push(BOLD_ITALIC_UNDERSCORE, BOLD_ITALIC_STAR)\n }\n\n return {\n ClientComponent: BoldFeatureClientComponent,\n markdownTransformers,\n serverFeatureProps: props,\n }\n },\n key: 'bold',\n serverFeatureProps: props,\n }\n}\n"],"names":["BoldFeatureClientComponent","BOLD_ITALIC_STAR","BOLD_ITALIC_UNDERSCORE","BOLD_STAR","BOLD_UNDERSCORE","BoldFeature","props","dependenciesSoft","feature","featureProviderMap","markdownTransformers","get","push","ClientComponent","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,+DAA+D;AAC/D,SAASA,0BAA0B,QAAQ,sCAAqC;AAChF,SACEC,gBAAgB,EAChBC,sBAAsB,EACtBC,SAAS,EACTC,eAAe,QACV,4BAA2B;AAElC,OAAO,MAAMC,cAAmE,CAACC;IAC/E,OAAO;QACLC,kBAAkB;YAAC;SAAS;QAC5BC,SAAS,CAAC,EAAEC,kBAAkB,EAAE;YAC9B,MAAMC,uBAAuB;gBAACP;gBAAWC;aAAgB;YACzD,IAAIK,mBAAmBE,GAAG,CAAC,WAAW;gBACpCD,qBAAqBE,IAAI,CAACV,wBAAwBD;YACpD;YAEA,OAAO;gBACLY,iBAAiBb;gBACjBU;gBACAI,oBAAoBR;YACtB;QACF;QACAS,KAAK;QACLD,oBAAoBR;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/inlineCode/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/inlineCode/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAMnE,eAAO,MAAM,iBAAiB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAYjF,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir
|
|
2
|
+
import { InlineCodeFeatureClientComponent } from '../../../../exports/client/index.js';
|
|
2
3
|
import { INLINE_CODE } from './markdownTransformers.js';
|
|
3
4
|
export const InlineCodeFeature = (props)=>{
|
|
4
5
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/format/inlineCode/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { InlineCodeFeatureClientComponent } from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/format/inlineCode/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { InlineCodeFeatureClientComponent } from '../../../../exports/client/index.js'\nimport { INLINE_CODE } from './markdownTransformers.js'\n\nexport const InlineCodeFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: InlineCodeFeatureClientComponent,\n markdownTransformers: [INLINE_CODE],\n serverFeatureProps: props,\n }\n },\n key: 'inlineCode',\n serverFeatureProps: props,\n }\n}\n"],"names":["InlineCodeFeatureClientComponent","INLINE_CODE","InlineCodeFeature","props","feature","ClientComponent","markdownTransformers","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAEA,+DAA+D;AAC/D,SAASA,gCAAgC,QAAQ,sCAAqC;AACtF,SAASC,WAAW,QAAQ,4BAA2B;AAEvD,OAAO,MAAMC,oBAAyE,CAACC;IACrF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBL;gBACjBM,sBAAsB;oBAACL;iBAAY;gBACnCM,oBAAoBJ;YACtB;QACF;QACAK,KAAK;QACLD,oBAAoBJ;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/italic/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/italic/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAMnE,eAAO,MAAM,aAAa,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAY7E,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir
|
|
2
|
+
import { ItalicFeatureClientComponent } from '../../../../exports/client/index.js';
|
|
2
3
|
import { ITALIC_STAR, ITALIC_UNDERSCORE } from './markdownTransformers.js';
|
|
3
4
|
export const ItalicFeature = (props)=>{
|
|
4
5
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/format/italic/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { ItalicFeatureClientComponent } from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/format/italic/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { ItalicFeatureClientComponent } from '../../../../exports/client/index.js'\nimport { ITALIC_STAR, ITALIC_UNDERSCORE } from './markdownTransformers.js'\n\nexport const ItalicFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: ItalicFeatureClientComponent,\n markdownTransformers: [ITALIC_STAR, ITALIC_UNDERSCORE],\n serverFeatureProps: props,\n }\n },\n key: 'italic',\n serverFeatureProps: props,\n }\n}\n"],"names":["ItalicFeatureClientComponent","ITALIC_STAR","ITALIC_UNDERSCORE","ItalicFeature","props","feature","ClientComponent","markdownTransformers","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAEA,+DAA+D;AAC/D,SAASA,4BAA4B,QAAQ,sCAAqC;AAClF,SAASC,WAAW,EAAEC,iBAAiB,QAAQ,4BAA2B;AAE1E,OAAO,MAAMC,gBAAqE,CAACC;IACjF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBN;gBACjBO,sBAAsB;oBAACN;oBAAaC;iBAAkB;gBACtDM,oBAAoBJ;YACtB;QACF;QACAK,KAAK;QACLD,oBAAoBJ;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/strikethrough/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/strikethrough/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAMnE,eAAO,MAAM,oBAAoB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAepF,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir
|
|
2
|
+
import { StrikethroughFeatureClientComponent } from '../../../../exports/client/index.js';
|
|
2
3
|
import { STRIKETHROUGH } from './markdownTransformers.js';
|
|
3
4
|
export const StrikethroughFeature = (props)=>{
|
|
4
5
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/format/strikethrough/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { StrikethroughFeatureClientComponent } from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/format/strikethrough/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { StrikethroughFeatureClientComponent } from '../../../../exports/client/index.js'\nimport { STRIKETHROUGH } from './markdownTransformers.js'\n\nexport const StrikethroughFeature: FeatureProviderProviderServer<undefined, undefined> = (\n props,\n) => {\n return {\n feature: () => {\n return {\n ClientComponent: StrikethroughFeatureClientComponent,\n\n markdownTransformers: [STRIKETHROUGH],\n serverFeatureProps: props,\n }\n },\n key: 'strikethrough',\n serverFeatureProps: props,\n }\n}\n"],"names":["StrikethroughFeatureClientComponent","STRIKETHROUGH","StrikethroughFeature","props","feature","ClientComponent","markdownTransformers","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAEA,+DAA+D;AAC/D,SAASA,mCAAmC,QAAQ,sCAAqC;AACzF,SAASC,aAAa,QAAQ,4BAA2B;AAEzD,OAAO,MAAMC,uBAA4E,CACvFC;IAEA,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBL;gBAEjBM,sBAAsB;oBAACL;iBAAc;gBACrCM,oBAAoBJ;YACtB;QACF;QACAK,KAAK;QACLD,oBAAoBJ;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/subscript/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/subscript/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAKnE,eAAO,MAAM,gBAAgB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAWhF,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir
|
|
2
|
+
import { SubscriptFeatureClientComponent } from '../../../../exports/client/index.js';
|
|
2
3
|
export const SubscriptFeature = (props)=>{
|
|
3
4
|
return {
|
|
4
5
|
feature: ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/format/subscript/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { SubscriptFeatureClientComponent } from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/format/subscript/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { SubscriptFeatureClientComponent } from '../../../../exports/client/index.js'\n\nexport const SubscriptFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: SubscriptFeatureClientComponent,\n serverFeatureProps: props,\n }\n },\n key: 'subscript',\n serverFeatureProps: props,\n }\n}\n"],"names":["SubscriptFeatureClientComponent","SubscriptFeature","props","feature","ClientComponent","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAEA,+DAA+D;AAC/D,SAASA,+BAA+B,QAAQ,sCAAqC;AAErF,OAAO,MAAMC,mBAAwE,CAACC;IACpF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoBH;YACtB;QACF;QACAI,KAAK;QACLD,oBAAoBH;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/superscript/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/superscript/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAKnE,eAAO,MAAM,kBAAkB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAWlF,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir
|
|
2
|
+
import { SuperscriptFeatureClientComponent } from '../../../../exports/client/index.js';
|
|
2
3
|
export const SuperscriptFeature = (props)=>{
|
|
3
4
|
return {
|
|
4
5
|
feature: ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/format/superscript/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { SuperscriptFeatureClientComponent } from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/format/superscript/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { SuperscriptFeatureClientComponent } from '../../../../exports/client/index.js'\n\nexport const SuperscriptFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: SuperscriptFeatureClientComponent,\n serverFeatureProps: props,\n }\n },\n key: 'superscript',\n serverFeatureProps: props,\n }\n}\n"],"names":["SuperscriptFeatureClientComponent","SuperscriptFeature","props","feature","ClientComponent","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAEA,+DAA+D;AAC/D,SAASA,iCAAiC,QAAQ,sCAAqC;AAEvF,OAAO,MAAMC,qBAA0E,CAACC;IACtF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoBH;YACtB;QACF;QACAI,KAAK;QACLD,oBAAoBH;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/underline/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/format/underline/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAKnE,eAAO,MAAM,gBAAgB,EAAE,6BAA6B,CAAC,SAAS,EAAE,SAAS,CAWhF,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir
|
|
2
|
+
import { UnderlineFeatureClientComponent } from '../../../../exports/client/index.js';
|
|
2
3
|
export const UnderlineFeature = (props)=>{
|
|
3
4
|
return {
|
|
4
5
|
feature: ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/format/underline/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\nimport { UnderlineFeatureClientComponent } from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/format/underline/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { UnderlineFeatureClientComponent } from '../../../../exports/client/index.js'\n\nexport const UnderlineFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: UnderlineFeatureClientComponent,\n serverFeatureProps: props,\n }\n },\n key: 'underline',\n serverFeatureProps: props,\n }\n}\n"],"names":["UnderlineFeatureClientComponent","UnderlineFeature","props","feature","ClientComponent","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAEA,+DAA+D;AAC/D,SAASA,+BAA+B,QAAQ,sCAAqC;AAErF,OAAO,MAAMC,mBAAwE,CAACC;IACpF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBJ;gBACjBK,oBAAoBH;YACtB;QACF;QACAI,KAAK;QACLD,oBAAoBH;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/heading/feature.client.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/heading/feature.client.tsx"],"names":[],"mappings":";AAUA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AA+G9D,eAAO,MAAM,6BAA6B;;;wBAA8C,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { $isHeadingNode } from '@lexical/rich-text';
|
|
3
|
-
import { $createHeadingNode, HeadingNode } from '@lexical/rich-text';
|
|
2
|
+
import { $createHeadingNode, $isHeadingNode, HeadingNode } from '@lexical/rich-text';
|
|
4
3
|
import { $setBlocksType } from '@lexical/selection';
|
|
5
4
|
import { $getSelection, $isRangeSelection } from 'lexical';
|
|
6
5
|
import { H1Icon } from '../../lexical/ui/icons/H1/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/heading/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { HeadingTagType } from '@lexical/rich-text'\n\nimport { $
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/heading/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { HeadingTagType } from '@lexical/rich-text'\n\nimport { $createHeadingNode, $isHeadingNode, HeadingNode } from '@lexical/rich-text'\nimport { $setBlocksType } from '@lexical/selection'\nimport { $getSelection, $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../types.js'\nimport type { HeadingFeatureProps } from './feature.server.js'\n\nimport { H1Icon } from '../../lexical/ui/icons/H1/index.js'\nimport { H2Icon } from '../../lexical/ui/icons/H2/index.js'\nimport { H3Icon } from '../../lexical/ui/icons/H3/index.js'\nimport { H4Icon } from '../../lexical/ui/icons/H4/index.js'\nimport { H5Icon } from '../../lexical/ui/icons/H5/index.js'\nimport { H6Icon } from '../../lexical/ui/icons/H6/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { slashMenuBasicGroupWithItems } from '../shared/slashMenu/basicGroup.js'\nimport { toolbarTextDropdownGroupWithItems } from '../shared/toolbar/textDropdownGroup.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nconst $setHeading = (headingSize: HeadingTagType) => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createHeadingNode(headingSize))\n}\n\nconst iconImports = {\n h1: H1Icon,\n h2: H2Icon,\n h3: H3Icon,\n h4: H4Icon,\n h5: H5Icon,\n h6: H6Icon,\n}\n\nconst HeadingFeatureClient: FeatureProviderProviderClient<HeadingFeatureProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => {\n const { enabledHeadingSizes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] } = props\n\n const toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems(\n enabledHeadingSizes.map((headingSize, i) => {\n return {\n ChildComponent: iconImports[headingSize],\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isHeadingNode(node) && node.getTag() === headingSize) {\n continue\n }\n\n const parent = node.getParent()\n if ($isHeadingNode(parent) && parent.getTag() === headingSize) {\n continue\n }\n\n return false\n }\n return true\n },\n key: headingSize,\n label: ({ i18n }) => {\n return i18n.t('lexical:heading:label', { headingLevel: headingSize.charAt(1) })\n },\n onSelect: ({ editor }) => {\n editor.update(() => {\n $setHeading(headingSize)\n })\n },\n order: i + 2,\n }\n }),\n ),\n ]\n\n return {\n clientFeatureProps: props,\n markdownTransformers: [MarkdownTransformer(enabledHeadingSizes)],\n nodes: [HeadingNode],\n slashMenu: {\n groups: enabledHeadingSizes?.length\n ? [\n slashMenuBasicGroupWithItems(\n enabledHeadingSizes.map((headingSize) => {\n return {\n Icon: iconImports[headingSize],\n key: `heading-${headingSize.charAt(1)}`,\n keywords: ['heading', headingSize],\n label: ({ i18n }) => {\n return i18n.t('lexical:heading:label', {\n headingLevel: headingSize.charAt(1),\n })\n },\n onSelect: ({ editor }) => {\n editor.update(() => {\n $setHeading(headingSize)\n })\n },\n }\n }),\n ),\n ]\n : [],\n },\n toolbarFixed: {\n groups: enabledHeadingSizes?.length ? toolbarGroups : [],\n },\n toolbarInline: {\n groups: enabledHeadingSizes?.length ? toolbarGroups : [],\n },\n }\n },\n }\n}\n\nexport const HeadingFeatureClientComponent = createClientComponent(HeadingFeatureClient)\n"],"names":["$createHeadingNode","$isHeadingNode","HeadingNode","$setBlocksType","$getSelection","$isRangeSelection","H1Icon","H2Icon","H3Icon","H4Icon","H5Icon","H6Icon","createClientComponent","slashMenuBasicGroupWithItems","toolbarTextDropdownGroupWithItems","MarkdownTransformer","$setHeading","headingSize","selection","iconImports","h1","h2","h3","h4","h5","h6","HeadingFeatureClient","props","clientFeatureProps","feature","enabledHeadingSizes","toolbarGroups","map","i","ChildComponent","isActive","node","getNodes","getTag","parent","getParent","key","label","i18n","t","headingLevel","charAt","onSelect","editor","update","order","markdownTransformers","nodes","slashMenu","groups","length","Icon","keywords","toolbarFixed","toolbarInline","HeadingFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,kBAAkB,EAAEC,cAAc,EAAEC,WAAW,QAAQ,qBAAoB;AACpF,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,UAAS;AAM1D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,MAAM,QAAQ,qCAAoC;AAC3D,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,4BAA4B,QAAQ,oCAAmC;AAChF,SAASC,iCAAiC,QAAQ,yCAAwC;AAC1F,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,MAAMC,cAAc,CAACC;IACnB,MAAMC,YAAYd;IAClBD,eAAee,WAAW,IAAMlB,mBAAmBiB;AACrD;AAEA,MAAME,cAAc;IAClBC,IAAId;IACJe,IAAId;IACJe,IAAId;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AC,QAAQ,EAAExB,YAAY6B,MAAM,CAAC,GAAG,CAAC;gCACvCW,UAAU;oCAAC;oCAAWxC;iCAAY;gCAClCyB,OAAO,CAAC,EAAEC,IAAI,EAAE;oCACd,OAAOA,KAAKC,CAAC,CAAC,yBAAyB;wCACrCC,cAAc5B,YAAY6B,MAAM,CAAC;oCACnC;gCACF;gCACAC,UAAU,CAAC,EAAEC,MAAM,EAAE;oCACnBA,OAAOC,MAAM,CAAC;wCACZjC,YAAYC;oCACd;gCACF;4BACF;wBACF;qBAEH,GACD,EAAE;gBACR;gBACAyC,cAAc;oBACZJ,QAAQxB,qBAAqByB,SAASxB,gBAAgB,EAAE;gBAC1D;gBACA4B,eAAe;oBACbL,QAAQxB,qBAAqByB,SAASxB,gBAAgB,EAAE;gBAC1D;YACF;QACF;IACF;AACF;AAEA,OAAO,MAAM6B,gCAAgChD,sBAAsBc,sBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/heading/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAIxD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/heading/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAIxD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAShE,MAAM,MAAM,mBAAmB,GAAG;IAChC,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,6BAA6B,CACxD,mBAAmB,EACnB,mBAAmB,CA4CpB,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { HeadingNode } from '@lexical/rich-text';
|
|
2
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir
|
|
3
|
+
import { HeadingFeatureClientComponent } from '../../../exports/client/index.js';
|
|
2
4
|
import { convertLexicalNodesToHTML } from '../converters/html/converter/index.js';
|
|
3
5
|
import { createNode } from '../typeUtilities.js';
|
|
4
|
-
import { HeadingFeatureClientComponent } from './feature.client.js';
|
|
5
6
|
import { i18n } from './i18n.js';
|
|
6
7
|
import { MarkdownTransformer } from './markdownTransformer.js';
|
|
7
8
|
export const HeadingFeature = (props)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/heading/feature.server.ts"],"sourcesContent":["import type { HeadingTagType } from '@lexical/rich-text'\n\nimport { HeadingNode } from '@lexical/rich-text'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/heading/feature.server.ts"],"sourcesContent":["import type { HeadingTagType } from '@lexical/rich-text'\n\nimport { HeadingNode } from '@lexical/rich-text'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { HeadingFeatureClientComponent } from '../../../exports/client/index.js'\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { createNode } from '../typeUtilities.js'\nimport { i18n } from './i18n.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nexport type HeadingFeatureProps = {\n enabledHeadingSizes?: HeadingTagType[]\n}\n\nexport const HeadingFeature: FeatureProviderProviderServer<\n HeadingFeatureProps,\n HeadingFeatureProps\n> = (props) => {\n if (!props) {\n props = {}\n }\n\n const { enabledHeadingSizes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] } = props\n\n return {\n feature: () => {\n return {\n ClientComponent: HeadingFeatureClientComponent,\n clientFeatureProps: props,\n i18n,\n markdownTransformers: [MarkdownTransformer(enabledHeadingSizes)],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n return '<' + node?.tag + '>' + childrenText + '</' + node?.tag + '>'\n },\n nodeTypes: [HeadingNode.getType()],\n },\n },\n node: HeadingNode,\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'heading',\n serverFeatureProps: props,\n }\n}\n"],"names":["HeadingNode","HeadingFeatureClientComponent","convertLexicalNodesToHTML","createNode","i18n","MarkdownTransformer","HeadingFeature","props","enabledHeadingSizes","feature","ClientComponent","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","tag","nodeTypes","getType","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,QAAQ,qBAAoB;AAIhD,+DAA+D;AAC/D,SAASC,6BAA6B,QAAQ,mCAAkC;AAChF,SAASC,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,UAAU,QAAQ,sBAAqB;AAChD,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,mBAAmB,QAAQ,2BAA0B;AAM9D,OAAO,MAAMC,iBAGT,CAACC;IACH,IAAI,CAACA,OAAO;QACVA,QAAQ,CAAC;IACX;IAEA,MAAM,EAAEC,sBAAsB;QAAC;QAAM;QAAM;QAAM;QAAM;QAAM;KAAK,EAAE,GAAGD;IAEvE,OAAO;QACLE,SAAS;YACP,OAAO;gBACLC,iBAAiBT;gBACjBU,oBAAoBJ;gBACpBH;gBACAQ,sBAAsB;oBAACP,oBAAoBG;iBAAqB;gBAChEK,OAAO;oBACLV,WAAW;wBACTW,YAAY;4BACVC,MAAM;gCACJC,WAAW,OAAO,EAAEF,UAAU,EAAEG,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE;oCACrD,MAAMC,eAAe,MAAMlB,0BAA0B;wCACnDY;wCACAO,cAAcJ,KAAKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,OAAO,MAAMF,MAAMM,MAAM,MAAMH,eAAe,OAAOH,MAAMM,MAAM;gCACnE;gCACAC,WAAW;oCAACxB,YAAYyB,OAAO;iCAAG;4BACpC;wBACF;wBACAR,MAAMjB;oBACR;iBACD;gBACD0B,oBAAoBnB;YACtB;QACF;QACAoB,KAAK;QACLD,oBAAoBnB;IACtB;AACF,EAAC"}
|