mirror of https://github.com/zulip/zulip.git
message_edit: Extract clear_preview_area from click_handlers.
We want to able to use the clear_preview_area in other places than click_handlers and that's why it has been moved to message_edit.js. The name was chosen to be consistent with a similar function in compose.js.
This commit is contained in:
parent
f4704f0419
commit
78bb2a4c9b
|
@ -367,18 +367,7 @@ 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();
|
||||
$row.find(".preview_content").empty();
|
||||
$row.find(".markdown_preview").show();
|
||||
message_edit.clear_preview_area(e.target);
|
||||
});
|
||||
|
||||
// RESOLVED TOPICS
|
||||
|
|
|
@ -1442,3 +1442,18 @@ export function show_preview_area($element) {
|
|||
content,
|
||||
);
|
||||
}
|
||||
|
||||
export function clear_preview_area($element) {
|
||||
const $row = rows.get_closest_row($element);
|
||||
|
||||
// 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();
|
||||
$row.find(".preview_content").empty();
|
||||
$row.find(".markdown_preview").show();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue