mdx-editor / editor

A rich text editor React component for markdown
https://mdxeditor.dev
MIT License
1.63k stars 131 forks source link

[BUG]: Nested Admonitions #428

Closed lebalz closed 3 months ago

lebalz commented 3 months ago

If you want to ask for support or request features, sponsor the project and contact me over email.

Describe the bug A valid MDX with nested Admonitions is displayed correctly, but it can not be created over the toolbar - no option to insert a new admonition when the focus is already inside a admonition.

Reproduction Start from https://codesandbox.io/p/sandbox/mdx-editor-base-q8s7zr?file=/src/App.tsx to reproduce the problem so that I can observe the issue on my side and make sure that the fix reliably addresses it.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://mdxeditor.dev/editor/demo
  2. Go to the diff' viewer
  3. Insert a nested admonition, e.g. the one from here https://docusaurus.io/docs/markdown-features/admonitions#nested-admonitions
  4. Switch back to the Richt Text Mode and see that it works
  5. Focus inside an Admonition
  6. Bug: the toolbar does not show the option to insert another admonition

Expected behavior A clear and concise description of what you expected to happen.

Step 6: Would be wonderful to insert nested admonitions :)

Screenshots

image

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

petyosi commented 3 months ago

This is an intentional design of the toolbar item; a nested admonition UI can easily get messy. You can easily do a toolbar item that does what you describe if you want to, just follow the source of the current one.