message_view: Allow quoting selected message text, via hotkey and menu.

Whenever the user has text selected within a single message, and uses
the hotkey to quote and reply, this selection will be quoted. In case of
no selection or selection not within a single message, the entirety of
the currently focused message will be quoted like before.

Similarly, when the user selects text within a single message, opens
that message's actions menu, and clicks the "Quote and reply" option,
the selected text will be quoted. In case of no selection or selection
containing any other message/s, the entirety of the message whose menu
was opened will be quoted like before.

When partially quoting a message, it is the markdown version of the
selection that is quoted, hence preserving any formatting. Any other
elements of the message, outside of the content, selected presumably by
accident (like the timestamp or sender name), are ignored.

Fixes: #19712.
This commit is contained in:
N-Shar-ma
2024-02-01 23:53:17 +05:30
committed by Tim Abbott
parent c969e11d7b
commit f16208d9f1
4 changed files with 150 additions and 11 deletions

View File

@@ -355,6 +355,7 @@ test("reply_with_mention", ({override, override_rewire, mock_template}) => {
test("quote_and_reply", ({disallow, override, override_rewire}) => {
override_rewire(compose_recipient, "on_compose_select_recipient_update", noop);
override_rewire(compose_reply, "selection_within_message_id", () => undefined);
mock_banners();
mock_stream_header_colorblock();