mdx-editor / editor

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

[BUG] I believe an update bugged the position of element class _contentEditable_11eqz_352 _placeholder_11eqz_1034 #356

Closed hahhen closed 7 months ago

hahhen commented 7 months ago

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

Describe the bug A clear and concise description of what the bug is.

When the editor has no content, the element of class _contentEditable_11eqz_352 _placeholder_11eqz_1034 causes an overflow on some websites due to its position

To Reproduce

  1. Go to https://mdxeditor.dev/editor/demo
  2. Press F12 or inspect element
  3. Clear the editor
  4. Select the inside of the editor with Ctrl+Shift+C
  5. The element should be the second div inside element class mdxeditor-root-contenteditable
  6. Observe that there is a rectangle on the top that shouldn't be there. image

Expected behavior That element should be cointained inside the editor, as in a previous version of the editor (the version of the picture is 2.3.4, I believe)

image

How to solve

I discovered the reason why this is happening: The element in question has position absolute top 0, throwing it to the top of the page. The reason it was working in a previous version was that the class for the element (current version) mdxeditor-root-contenteditable was _rootContentEditableWrapper_11eqz_1047 (previous version). The last one has a position: relative css rule, making the element ._contentEditable_11eqz_352 _placeholder_11eqz_1034 be contained inside the editor.

Current version image

Previous version image

As I imagined, as soon as I replaced the new class for the old one, the div returned to its position. Should be an easy fix, perhaps what happened was that when using the class in form of a variable (as the editor uses when creating elements), the variable mdxeditor-root-contenteditable was not converted into its value: _rootContentEditableWrapper_11eqz_1047.

github-actions[bot] commented 7 months ago

:tada: This issue has been resolved in version 2.8.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

hahhen commented 7 months ago

Thank you!