React-draft-wysiwyg: Is there a way to make react-draft-wysiwyg as a single line input?

Created on 26 Jan 2018  路  4Comments  路  Source: jpuri/react-draft-wysiwyg

We want to make our editor a single input (not multiline) and have an "onEnter" call that saves rather than inserts a newline. Is this possible?

Most helpful comment

@jpuri Thanks! I tried that but it wasn't preventing changes. For example:

                    handleReturn={() => {
                        console.log("HANDLE RETURN");
                        return false;
                    }}

I would get the log of "handle return" but the content would also get a newline.

All 4 comments

Hey @sontek passing handleReturn as prop to the editor should do it. Plz let me know know if you see any issues in doing that.

@jpuri Thanks! I tried that but it wasn't preventing changes. For example:

                    handleReturn={() => {
                        console.log("HANDLE RETURN");
                        return false;
                    }}

I would get the log of "handle return" but the content would also get a newline.

Hah, it needs to be return true

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jpuri picture jpuri  路  4Comments

DiegoGallegos4 picture DiegoGallegos4  路  4Comments

regisBafutwabo picture regisBafutwabo  路  3Comments

ananddodia picture ananddodia  路  4Comments

MaDejing picture MaDejing  路  3Comments