megahertz / react-simple-wysiwyg

Simple and lightweight React WYSIWYG editor
https://megahertz.github.io/react-simple-wysiwyg/
MIT License
119 stars 21 forks source link

Adding custom indentation button #23

Closed duhmojo closed 1 year ago

duhmojo commented 1 year ago

Ok, I've opened and closed 2 issues today alone but I promise this is good one. :)

Is it possible to add a custom button to indent a text line/block? Whether it results in a div with a fixed width, or a series of spaces? I know there isn't an existing "tab" or "indent" element but I'd like to avoid someone having to inconsistently hit space a bunch of times to simulate an intend. Thanks!

megahertz commented 1 year ago

You can try using the indent command to create such a button https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand#indent

duhmojo commented 1 year ago

Ohhh... I wasn't aware of these browser commands. I didn't pick up on the execCommand options. I don't run in WYSIWYG circles. Thanks!