Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose: Allow pasting plainly, when Shift is held down, for Firefox.
N-Shar-maff5e389e9b2f
diff --git a/web/src/compose_ui.js b/web/src/compose_ui.jsindex 6710088a3e0..b690a83c2e9 100644--- a/web/src/compose_ui.js+++ b/web/src/compose_ui.js@@ -16,6 +16,7 @@ import * as stream_data from "./stream_data";import * as user_status from "./user_status";export let compose_spinner_visible = false;+export let shift_pressed = false; // true or falselet full_size_status = false; // true or false// Some functions to handle the full size status explicitly@@ -325,6 +326,9 @@ export function make_compose_box_original_size() {}export function handle_keydown(event, $textarea) {+ if (event.key === "Shift") {+ shift_pressed = true;+ }// The event.key property will have uppercase letter if// the "Shift + <key>" combo was used or the Caps Lock// key was on. We turn to key to lowercase so the key bindings@@ -350,6 +354,9 @@ export function handle_keydown(event, $textarea) {}export function handle_keyup(_event, $textarea) {+ if (_event?.key === "Shift") {+ shift_pressed = false;+ }// Set the rtl class if the text has an rtl direction, remove it otherwisertl.set_rtl_class_for_textarea($textarea);}diff --git a/web/src/copy_and_paste.js b/web/src/copy_and_paste.jsindex 08e0a9c22e4..5ae49fb9797 100644--- a/web/src/copy_and_paste.js+++ b/web/src/copy_and_paste.js@@ -543,7 +543,10 @@ export function paste_handler(event) {return;}- if (paste_html && page_params.development_environment) {+ // Unlike Chrome, Firefox doesn't automatically paste plainly on using Ctrl+Shift+V,+ // hence we need to handle it ourselves, by checking if shift key is pressed, and only+ // if not, we proceed with the default formatted paste.+ if (paste_html && !compose_ui.shift_pressed && page_params.development_environment) {event.preventDefault();event.stopPropagation();const text = paste_handler_converter(paste_html);