DarkGuy10 / BotClient

A discord botclient built with Electron, React and discord.js.
MIT License
182 stars 17 forks source link

feature: send multiline messages #44

Open EndasUP1 opened 2 years ago

EndasUP1 commented 2 years ago

In default discord you can just Shift + Enter to go into new line, but here can't. Any other way to do it?

DarkGuy10 commented 2 years ago

@Endass That's because the botclient uses an <input> tag whereas discord originally uses a content-editable div for input. You can't shift+enter in inputs, but making a proper working content-editable is a real pain.

Any other way to do it?

Sadly, there isn't any yet. I intend to replace the input tag with a content-editable div in future. It's even in our to-do!

lazuee commented 2 years ago

@Endass That's because the botclient uses an <input> tag whereas discord originally uses a content-editable div for input. You can't shift+enter in inputs, but making a proper working content-editable is a real pain.

Any other way to do it?

Sadly, there isn't any yet. I intend to replace the input tag with a content-editable div in future. It's even in our to-do!

This might be useful https://www.reddit.com/r/reactjs/comments/q3qcc9/anyone_ever_tried_creating_a_text_input_similar/

DarkGuy10 commented 2 years ago

This might be useful https://www.reddit.com/r/reactjs/comments/q3qcc9/anyone_ever_tried_creating_a_text_input_similar/

That's oddly specific. Anyways, as you can read in the comments, managing content-editable divs in react is painful, especially with the cursor jumping back to the beginning after each render. There are Slate.js and other libs for this sole purpose, but thanks for the lead!