Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose: Do not paste formatted markdown when inside a code block.

N-Shar-ma602d1d732360
diff --git a/web/src/copy_and_paste.js b/web/src/copy_and_paste.js
index 8de867d9cf0..490c13c488f 100644
--- a/web/src/copy_and_paste.js
+++ b/web/src/copy_and_paste.js
@@ -543,10 +543,16 @@ export function paste_handler(event) {
return;
}
+ // We do not paste formatted markdoown when inside a code block.
// 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) {
+ if (
+ !compose_ui.cursor_inside_code_block($textarea) &&
+ paste_html &&
+ !compose_ui.shift_pressed &&
+ page_params.development_environment
+ ) {
event.preventDefault();
event.stopPropagation();
const text = paste_handler_converter(paste_html);