diff --git a/web/src/compose.js b/web/src/compose.js index 70f5a85d52..0a4c8c0772 100644 --- a/web/src/compose.js +++ b/web/src/compose.js @@ -123,6 +123,11 @@ export function clear_preview_area() { $("#compose .preview_content").empty(); $("#compose .markdown_preview").show(); autosize.update($("#compose-textarea")); + + // While in preview mode we disable unneeded compose_control_buttons, + // so here we are re-enabling that compose_control_buttons + $("#compose").removeClass("preview_mode"); + $("#compose .preview_mode_disabled .compose_control_button").attr("tabindex", 0); } export function abort_xhr() { @@ -719,6 +724,11 @@ export function initialize() { e.preventDefault(); e.stopPropagation(); + // Disable unneeded compose_control_buttons as we don't + // need them in preview mode. + $("#compose").addClass("preview_mode"); + $("#compose .preview_mode_disabled .compose_control_button").attr("tabindex", -1); + const content = $("#compose-textarea").val(); $("#compose-textarea").hide(); $("#compose .markdown_preview").hide(); diff --git a/web/src/popover_menus.js b/web/src/popover_menus.js index 4ab708f1e8..2a4fc0103a 100644 --- a/web/src/popover_menus.js +++ b/web/src/popover_menus.js @@ -515,6 +515,7 @@ export function initialize() { parse_html( render_compose_control_buttons_popover({ giphy_enabled: giphy.is_giphy_enabled(), + preview_mode_on: $("#compose").hasClass("preview_mode"), }), ), ); diff --git a/web/styles/compose.css b/web/styles/compose.css index 69bfccc23c..ebb6fccd47 100644 --- a/web/styles/compose.css +++ b/web/styles/compose.css @@ -943,3 +943,14 @@ input.recipient_box { flex: 1; } } + +.preview_mode { + .preview_mode_disabled { + cursor: not-allowed; + opacity: 0.3; + + .compose_control_button { + pointer-events: none; + } + } +} diff --git a/web/templates/compose_control_buttons.hbs b/web/templates/compose_control_buttons.hbs index b02b8980b9..03ea9921a1 100644 --- a/web/templates/compose_control_buttons.hbs +++ b/web/templates/compose_control_buttons.hbs @@ -1,16 +1,22 @@