From 842b14b916c96e49c11cfe5c7da523a1f16725bd Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 10 Jun 2021 14:52:29 +0000 Subject: [PATCH] layout: Introduce a #compose-content div. This should make it more intuitive to add new elements to the compose box (such as banners), and it also makes it a bit more clear for styling purposes that the same geometry happens whether the compose box is open or the buttons are visible. I lifted the #compose_container div into the server template. It's not totally clear to me why we need both #compose and #compose_container, but there are some scary comments about 1400px that made me too timid to address that quirk. In passing I removed a clearly redundant click handler. --- static/js/click_handlers.js | 3 +-- static/js/compose.js | 5 ++--- static/js/scroll_bar.js | 4 ++-- static/styles/compose.css | 8 ++++---- static/styles/night_mode.css | 2 +- static/styles/zulip.css | 2 +- static/templates/compose.hbs | 6 +++--- templates/zerver/app/index.html | 4 +++- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js index 15f9f23a7c..5366103bf2 100644 --- a/static/js/click_handlers.js +++ b/static/js/click_handlers.js @@ -686,8 +686,7 @@ export function initialize() { popovers.hide_all(); } - $("body").on("click", "#compose_buttons", handle_compose_click); - $("body").on("click", ".compose-content", handle_compose_click); + $("body").on("click", "#compose-content", handle_compose_click); $("body").on("click", "#compose_close", () => { compose_actions.cancel(); diff --git a/static/js/compose.js b/static/js/compose.js index ad8e5e4851..3b5f5b1921 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -1091,10 +1091,9 @@ export function warn_if_mentioning_unsubscribed_user(mentioned) { } export function render_compose_box() { - const $compose = $("#compose"); - $compose.append( + $("#compose-container").append( render_compose({ - embedded: $compose.attr("data-embedded") === "", + embedded: $("#compose").attr("data-embedded") === "", file_upload_enabled: page_params.max_file_upload_size_mib > 0, giphy_enabled: giphy.is_giphy_enabled(), }), diff --git a/static/js/scroll_bar.js b/static/js/scroll_bar.js index fc0c2660d7..2031fa3b5d 100644 --- a/static/js/scroll_bar.js +++ b/static/js/scroll_bar.js @@ -59,13 +59,13 @@ export function initialize() { }); $("#compose").css("left", "-" + sbWidth + "px"); - $(".compose-content").css({left: sbWidth + "px", "margin-right": 7 + sbWidth + "px"}); + $("#compose-content").css({left: sbWidth + "px", "margin-right": 7 + sbWidth + "px"}); $("#keyboard-icon").css({"margin-right": sbWidth + "px"}); $("head").append( "