Alex-D / Trumbowyg

A lightweight and amazing WYSIWYG JavaScript editor under 10kB
https://alex-d.github.io/Trumbowyg
MIT License
4k stars 614 forks source link

Hard to click for focus on empty editor #1470

Closed themikegreider closed 2 months ago

themikegreider commented 3 months ago

We upgraded from v2.23.0 to v2.27.3, and the behavior for entering into the editor is changed. Previously, you could click anywhere in the editor and the focus would start at the top left and you could begin typing. On v2.27.3, you have to click up in the top row now. Clicking elsewhere will not add focus into the edit.

In this screenshot, only in the upper corner would a mouse click add focus. Everywhere else with the red X would not.

image

This appears cross browser, but definitely Chrome and Firefox.

You can reproduce by going to any of the public demos on the Trumbowyg homepage. Delete the text, remove focus, then try to click back into the editor. In this screenshot, one the text is removed and the focus is gone, you have to click in the green section. Clicking anywhere in the red won't work.

image

Is there a way to revert that behavior or to add a custom listener that will put focus if anywhere is clicked?

zymbth commented 3 months ago

You could try one of these ways:

  1. Fix the height of trumbowyg box, e.g., .trumbowyg{height:300px}
  2. Set the min-height of trumbowyg editor, e.g, .trumbowyg-box .trumbowyg-editor{min-height:260px}
themikegreider commented 2 months ago

Thank you for the comment. Example 1 did the trick for me. Example 2 increased the editor size, but didn't fix my issue above. But by matching the box with the editor size, that fixed my issue.

themikegreider commented 2 months ago

Marking closed as fixed