From 59fd9e4d481a71f30b72b28ba010b96b1aaa26bb Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Sat, 18 Mar 2017 09:55:11 -0700 Subject: [PATCH] Add compose_actions.cancel() shim. --- static/js/click_handlers.js | 4 ++-- static/js/hotkey.js | 8 ++++---- static/js/narrow.js | 4 ++-- static/js/shim.js | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js index 603ee8c15f..6075cd4677 100644 --- a/static/js/click_handlers.js +++ b/static/js/click_handlers.js @@ -354,7 +354,7 @@ $(function () { $(".compose-content").click(handle_compose_click); $("#compose_close").click(function () { - compose.cancel(); + compose_actions.cancel(); }); $("#join_unsub_stream").click(function (e) { @@ -564,7 +564,7 @@ $(function () { ($(e.target).closest(".modal").length === 0) && window.getSelection().toString() === "" && ($(e.target).closest('#emoji_map').length === 0)) { - compose.cancel(); + compose_actions.cancel(); } }); diff --git a/static/js/hotkey.js b/static/js/hotkey.js index 5931509d0d..ac2668104a 100644 --- a/static/js/hotkey.js +++ b/static/js/hotkey.js @@ -219,7 +219,7 @@ exports.process_escape_key = function (e) { if (compose.composing()) { // If the user hit the escape key, cancel the current compose - compose.cancel(); + compose_actions.cancel(); return true; } @@ -236,7 +236,7 @@ exports.process_escape_key = function (e) { } if (compose.composing()) { - compose.cancel(); + compose_actions.cancel(); return true; } @@ -447,13 +447,13 @@ exports.process_hotkey = function (e, hotkey) { // we handle this in other functions. if (event_name === 'left_arrow' && focus_in_empty_compose()) { - compose.cancel(); + compose_actions.cancel(); message_edit.edit_last_sent_message(); return true; } if ((event_name === 'up_arrow' || event_name === 'down_arrow') && focus_in_empty_compose()) { - compose.cancel(); + compose_actions.cancel(); // don't return, as we still want it to be picked up by the code below } else if (event_name === "page_up") { $("#new_message_content").caret(0); diff --git a/static/js/narrow.js b/static/js/narrow.js index f95c5a95e3..b9f7e2c531 100644 --- a/static/js/narrow.js +++ b/static/js/narrow.js @@ -194,7 +194,7 @@ exports.activate = function (raw_operators, opts) { var had_message_content = compose.has_message_content(); if (!had_message_content) { - compose.cancel(); + compose_actions.cancel(); } else { compose_fade.update_message_list(); } @@ -454,7 +454,7 @@ exports.deactivate = function () { } if (!compose.has_message_content()) { - compose.cancel(); + compose_actions.cancel(); } current_filter = undefined; diff --git a/static/js/shim.js b/static/js/shim.js index 6e2292f1b7..ed3ffb5ebc 100644 --- a/static/js/shim.js +++ b/static/js/shim.js @@ -11,3 +11,4 @@ narrow_state.set_compose_defaults = narrow.set_compose_defaults; var compose_actions = {}; compose_actions.start = compose.start; +compose_actions.cancel = compose.cancel;