mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 15:09:34 +00:00
compose: Disable unneeded control buttons in preview mode while editing.
This is a follow up to #26728, which disables buttons in preview mode for any message being edited. Care is taken to pass the correct preview state (compose vs the message row being edited) to the popover menu so the buttons in it too can be disabled as needed.
This commit is contained in:
@@ -361,6 +361,12 @@ export function initialize() {
|
||||
const $row = rows.get_closest_row(e.target);
|
||||
const $msg_edit_content = $row.find(".message_edit_content");
|
||||
const content = $msg_edit_content.val();
|
||||
|
||||
// Disable unneeded compose_control_buttons as we don't
|
||||
// need them in preview mode.
|
||||
$row.addClass("preview_mode");
|
||||
$row.find(".preview_mode_disabled .compose_control_button").attr("tabindex", -1);
|
||||
|
||||
$msg_edit_content.hide();
|
||||
$row.find(".markdown_preview").hide();
|
||||
$row.find(".undo_markdown_preview").show();
|
||||
@@ -376,6 +382,12 @@ export function initialize() {
|
||||
$("body").on("click", ".message_edit_form .undo_markdown_preview", (e) => {
|
||||
e.preventDefault();
|
||||
const $row = rows.get_closest_row(e.target);
|
||||
|
||||
// While in preview mode we disable unneeded compose_control_buttons,
|
||||
// so here we are re-enabling those compose_control_buttons
|
||||
$row.removeClass("preview_mode");
|
||||
$row.find(".preview_mode_disabled .compose_control_button").attr("tabindex", 0);
|
||||
|
||||
$row.find(".message_edit_content").show();
|
||||
$row.find(".undo_markdown_preview").hide();
|
||||
$row.find(".preview_message_area").hide();
|
||||
|
||||
Reference in New Issue
Block a user