Vencord / plugin-requests

Vencord plugin requests. Open the link below to create a request
https://github.com/Vencord/plugin-requests/issues/new?template=request.yml
28 stars 4 forks source link

Compose Mode - toggle ctrl+enter to send via chat bar button #352

Open vrad-exe opened 4 months ago

vrad-exe commented 4 months ago

Plugin Description

A long time ago, a project which I'm involved with used a platform called Gitter for chat.

Gitter had a very useful feature called Compose Mode. This mode could be toggled by clicking a button in the message box, and made a very simple but useful change while active - pressing enter would make a new line instead of sending the message, with send instead being mapped to ctrl+enter. This made it possible to type long multi-line messages without having to worry about pressing shift before each new line, but also allowed quickly switching it on or off for when you want to go back to casual conversation with shorter messages.

Eventually the aforementioned project moved over to using Discord for chat, and later Gitter as a whole was converted into a Matrix instance, losing the quick compose mode toggle (you now have to go in settings to enable/disable it). Even after all these years though, I still find myself missing the feature. There have been many times where I've been typing a long message, accidentally missed apostrophe and hit enter and ended up sending the message early. I've always wished someone would make a client plugin to add Compose Mode to Discord (I have basically zero javascript/web dev knowledge to add it myself), but no one ever has as far as I'm aware. It would be really cool if Vencord could include a plugin that implements this feature.

On Gitter, I recall the compose mode button icon was a keyboard, but since Silent Typing already uses that for its toggle button, it should probably be something different. Perhaps a pen.

Existing Plugin for other mod

None to my knowledge

Request Agreement

Sqaaakoi commented 4 months ago

The mobile web client already implements this behaviour for compatibility with virtual keyboards. This will probably just require a few patches to override these checks.

Vendicated commented 4 months ago

there is a discord setting for this. can't you just use that?

Sqaaakoi commented 4 months ago

there is a discord setting for this. can't you just use that?

???? no there isn't, why did you mark my note about how to implement it as spam? if you're thinking of the "show send message button" option, this doesn't do that

Vendicated commented 4 months ago

i could have sworn there was, but you are right there isn't

in any case, mobile web is likely of little relevance because it completely disables most slate features, like slash commands. this is similar to enabling legacy chatinput in accessibility settings. hence why i marked your reply as "spam" (because github has no better option)

Sqaaakoi commented 4 months ago

i could have sworn there was, but you are right there isn't

in any case, mobile web is likely of little relevance because it completely disables most slate features, like slash commands. this is similar to enabling legacy chatinput in accessibility settings. hence why i marked your reply as "spam" (because github has no better option)

i mentioned mobile web because i actually have some experience with removing those "limitations" from mobile web (albeit at the cost of.... instability with text input)

reminder that mobile web really is just the same as the desktop client, just with a user-agent check. i am not suggesting to add a "mobile web mode" to vencord, instead I was thinking patch the (likely) single isMobile check for if shift+enter is required to make a new line to be true

Sqaaakoi commented 4 months ago

i could have sworn there was, but you are right there isn't in any case, mobile web is likely of little relevance because it completely disables most slate features, like slash commands. this is similar to enabling legacy chatinput in accessibility settings. hence why i marked your reply as "spam" (because github has no better option)

i mentioned mobile web because i actually have some experience with removing those "limitations" from mobile web (albeit at the cost of.... instability with text input)

reminder that mobile web really is just the same as the desktop client, just with a user-agent check. i am not suggesting to add a "mobile web mode" to vencord, instead I was thinking patch the (likely) single isMobile check for if shift+enter is required to make a new line to be true

update: I have found how this works. Take a look at ChatInputTypes where you will find a lot of {submit:{disableEnterToSubmit:boolean}} often those are just set to the isMobile variable would patching these somehow be a good idea @Vendicated?

Vendicated commented 4 months ago

try it and see :p if it works it works

Sqaaakoi commented 4 months ago

try it and see :p if it works it works

it works Sqaaakoi-17-04-2024-01-54-07

Sqaaakoi commented 4 months ago

i need a new icon for this (i stole most of the silenttyping code to make this so-far) also, would a context menu option be appreciated too?

too many chat bar buttons

Sqaaakoi commented 4 months ago

nope i need a getter for this (maybe?)

or i could patch where this is actually referenced from instead

Sqaaakoi commented 4 months ago

I confess.

I actually did make this plugin entirely already and I just forgot about it because I need a unique icon in the chatbar and I am not creative enough to make one myself. Can someone suggest or make one?

vrad-exe commented 4 months ago

Maybe like a pen or "script" looking icon?

vrad-exe commented 4 months ago

Could have an icon with both a chat bubble and keyboard (representing short chat messages vs. longer paragraphs), and when you click it swaps which one is "in front" based on the selected mode.

Or you could make it representative of the Enter key itself, perhaps just like a square with the arrow commonly seen on enter keys, and then the whole icon gets crossed out when the mode is disabled.

vrad-exe commented 3 months ago

Since Vencord now has a plugin which allows remapping send to ctrl-enter, this suggestion is specifically for adding the ability to toggle it with a chat bar button.