From a4def8d4099b3954c2534c01ceb229bd8ed60e53 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 9 Apr 2018 22:08:26 -0700 Subject: [PATCH] copy_and_paste: Re-disable copy-paste handler in production. This reverts commit 6e048c5d3fedffcfcd23b1d8df47ed1e2d524b39. See #8963 for the main issue we need to fix before re-enabling this; basically, some combination of toMarkdown and the way text/html gets written was introducing a lot of bonus/bogus whitespace, both in the form of newlines and spaces converted to ` `. --- frontend_tests/node_tests/copy_and_paste.js | 4 ++++ static/js/copy_and_paste.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend_tests/node_tests/copy_and_paste.js b/frontend_tests/node_tests/copy_and_paste.js index 282b88c442..06a9557572 100644 --- a/frontend_tests/node_tests/copy_and_paste.js +++ b/frontend_tests/node_tests/copy_and_paste.js @@ -1,5 +1,9 @@ global.stub_out_jquery(); +set_global('page_params', { + development: true, +}); + var jsdom = require("jsdom"); global.document = jsdom.jsdom('

Hello world

'); var window = jsdom.jsdom().defaultView; diff --git a/static/js/copy_and_paste.js b/static/js/copy_and_paste.js index 7ad3251ae0..2e79aa16e4 100644 --- a/static/js/copy_and_paste.js +++ b/static/js/copy_and_paste.js @@ -224,7 +224,7 @@ exports.paste_handler = function (event) { if (clipboardData.getData) { var paste_html = clipboardData.getData('text/html'); - if (paste_html) { + if (paste_html && page_params.development_environment) { event.preventDefault(); var text = exports.paste_handler_converter(paste_html); compose_ui.insert_syntax_and_focus(text);