mdx-editor / editor

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

[BUG] Image toolbar moves outside of editor if image url is invalid #607

Open jgeppert opened 1 week ago

jgeppert commented 1 week ago

Describe the bug Image toolbar moves outside of the editor when image can't be loaded. This is especially annoying if the editor covers the whole width of the page, because then most of the toolbar is not inside the window.

To Reproduce Steps to reproduce the behavior:

  1. Open an editor instance with image plugin
  2. Insert image, use an invalid URL, e.g. /a.jpeg

Expected behavior Image toolbar is fully contained within the editor.

Screenshots

Screenshot 2024-10-14 at 12 11 01

Editor covering full width of the page:

Screenshot 2024-10-14 at 12 11 30

Desktop (please complete the following information):

jgeppert commented 1 week ago

A naive solution could be to just add a min-width with roughly the size of the toolbar to the parent element. The only drawback i can think of is that this might not look right for very tiny images, but I'm not sure if that's a problem.