mdx-editor / mdx-editor/editor
[BUG] missing import statements when adding a jsx element inside a nested editor
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 307
- Avg merge
- 14h 22m
- Merged PRs (30d)
- 5
Description
- I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- I have read the documentation and cannot find an answer.
Describe the bug
When a jsx component is added from inside a nested lexical editor, the import statement is ignored. The issue comes from the NestedLexicalEditor which prevents adding import statements when calling exportLexicalTreeToMdast with addImportStatements=false. It makes sense to not import directly inside the nested editor, but the import statement on the primary root seems not to be added.
Reproduction
See PR #734 where this issue is mentioned. The user story story=jsx--import-statements-nested can be used to reproduce the issue by focusing the admonition content and then clicking inside the toolbar Zazz. The inserted component does not trigger an import statement. Is this enough or do you need an explicit repro? :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with NestedLexicalEditor and the exportLexicalTreeToMdast call described in the issue. Reproduce using story=jsx--import-statements-nested: focus the admonition content and click Zazz in the toolbar. Done means the inserted JSX component causes the primary root editor to include its import statement while nested export still avoids adding imports locally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- markdown, react, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100