diff --git a/zephyr/static/js/compose.js b/zephyr/static/js/compose.js index 22e82c610f..33da6982dc 100644 --- a/zephyr/static/js/compose.js +++ b/zephyr/static/js/compose.js @@ -232,10 +232,10 @@ function abort_xhr () { } exports.cancel = function () { + compose.clear(); compose.hide(); abort_xhr(); is_composing_message = false; - compose.clear(); if (message_snapshot !== undefined) { $('#restore-draft').show(); } @@ -381,7 +381,6 @@ $(function () { }); exports.hide = function () { - exports.snapshot_message(); $('.message_comp').find('input, textarea, button').blur(); $('#stream-message').hide(); $('#private-message').hide(); @@ -390,8 +389,10 @@ exports.hide = function () { }; exports.clear = function () { + exports.snapshot_message(); $("#compose").find('input[type=text], textarea').val(''); $("#new_message_content").trigger('autosize'); + $("#send-status").hide(0); }; // Set the mode of a compose already in progress. @@ -603,6 +604,11 @@ $(function () { var textbox = $("#new_message_content"), split_uri = response.uri.split("/"), filename = split_uri[split_uri.length - 1]; + // Urgh, yet another hack to make sure we're "composing" + // when text gets added into the composebox. + if (!compose.composing()) { + respond_to_message(); + } if (i === -1) { // This is a paste, so there's no filename. Show the image directly textbox.val(textbox.val() + "[pasted image](" + response.uri + ") "); @@ -617,6 +623,9 @@ $(function () { }, rawDrop: function (contents) { var textbox = $("#new_message_content"); + if (!compose.composing()) { + respond_to_message(); + } textbox.val(textbox.val() + contents); } }); diff --git a/zephyr/static/js/ui.js b/zephyr/static/js/ui.js index 0c2f7fd045..e7d2d0d400 100644 --- a/zephyr/static/js/ui.js +++ b/zephyr/static/js/ui.js @@ -1057,7 +1057,6 @@ $(function () { return false; }); - $('.composebox-close').click(function (e) { compose.cancel(); }); $('.compose_stream_button').click(function (e) { compose.set_mode('stream'); return false; @@ -1144,7 +1143,7 @@ $(function () { } // Unfocus our compose area if we click out of it. - if (compose.composing()) { + if (compose.composing() && !$(e.target).is("a")) { compose.cancel(); } }); @@ -1154,7 +1153,10 @@ $(function () { // "unfocusing" our compose -- in other words, e.g. // clicking "Press enter to send" should not // trigger the composebox-closing code above. - e.stopPropagation(); + // But do allow our formatting link. + if (!$(e.target).is("a")) { + e.stopPropagation(); + } }); // side-bar-related handlers diff --git a/zephyr/static/styles/zephyr.css b/zephyr/static/styles/zephyr.css index b5834761f9..fa928d2343 100644 --- a/zephyr/static/styles/zephyr.css +++ b/zephyr/static/styles/zephyr.css @@ -581,6 +581,7 @@ img.inline_profile_picture { width: 90%; padding: 8px 14px 8px 14px; line-height: 20px; + display: none; } /* Like .alert .close */