bmcmahen / react-wysiwyg

retain some control over contenteditable input
169 stars 37 forks source link

Remove Editable Button #7

Closed JGSolutions closed 9 years ago

JGSolutions commented 9 years ago

Is there a way that the user can click or tap on the text and switches to the editable field instead of have a button to make it editable?

bmcmahen commented 9 years ago

Yeah, you could do something like that fairly easily. Just wrap the field in a div and listen for an onClick event handler. When the user clicks (or double clicks) the div, set the editing state to true. This will then transition the field into the editing mode.

JGSolutions commented 9 years ago

Ok i can try that. Can i do an onBlur? If the user exits the div it disables the field?

bmcmahen commented 9 years ago

I think so -- I haven't actually tried this myself, but I suspect it would work. Let me know how it goes.