This commit introduces the use of createSingleton from the Tippy.js
library to group the tooltips of compose box formatting buttons. The
main benefit is that the hover delay only applies when you move the
cursor into the group for the first time — after that, tooltips show up
instantly as you move between buttons. It makes the whole experience
feel a lot smoother.
We store the singleton instance in a variable to avoid creating multiple
instances unnecessarily. Before initializing a new singleton, we destroy
the previous one to prevent memory leaks and ensure correct behavior.
Previously, each formatting button had its own independent tooltip with
separate delays, which made the experience feel sluggish and disjointed
when hovering across buttons.
Now, by sharing a delay timer across the grouped tooltips, the
transition feels more natural.
Fixes: #24825.
Co-authored-by: Sayam Samal <sayam@zulip.com>
Instead of relying on different functions to get error messages,
we use `validate` to get the error message for the current compose
state.
This fixes a bug where compose tooltip was not defined when
compose state was not valid.
When I adjusted 4fbf91c135 to no longer
do a full re-validation on every character typed, that unmasked bugs
in how the compose_setup handler code and compose_validate split
responsibility for validating 0-length messages.
The user-facing result was the send button not enabling properly when
starting to type.
Fix this by moving the 0-length message validation into
compose_validate, where we already handle issues of too-long messages,
sharing the same basic logic for determining when to do a full
validate() call.
A benefit of this reworking is now all of the logic for handling the
`invalid` class is in one place in validate, rather than split with
the compose_setup module.
Compose send tooltip was not correctly displayed when the compose
box was in an invalid state.
We significanlty improve the logic for displaying the tooltip here
to provide a more robust experience to the user.
Use a more instructive placeholder instead of "Topic" when
topic is not mandatory in a realm.
Updated placeholder:
'Enter a topic (skip for general chat)'.
Added `enable_guest_user_dm_warning` setting to decide whether
clients should show a warning when a user is composing to a guest
user in the organization.
Fixes#30078.
Co-authored-by: adnan-td <generaladnan139@gmail.com>
This commit changes the code in such a way that the
"Start new conversation" button open the compose box with the channel
picker open, as we do when no channels is selected.
Fixes#28410.
Co-authored-by: Kunal Sharma <v.shm.kunal@gmail.com>
Forward message starts a new message with the quoted context
(message or selection).
The compose box opens with then channel picker open and no topic.
Also added documentation about this feature in the help center.
Fixes part 2 of #31953
Adds a message length limit indicator similar to the one in the compose box.
The tooltip message for the disabled save button now appears dynamically
based on whether the message exceeds the length limit or the editing time
has expired.
Fixes#25271.
Refactors `check_overflow_text` and `validate_message_length` functions.
This commit ensures that there won't be any change in the existing UI
of the compose box with the refactoring of the above functions.