Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose: Use calendarContainer to check if flatpickr is open.

Aman Agrawala8c488bc565b
diff --git a/static/js/compose.js b/static/js/compose.js
index 68ecda625f2..22f7f53cf1a 100644
--- a/static/js/compose.js
+++ b/static/js/compose.js
@@ -628,7 +628,7 @@ export function initialize() {
}
});
- let instance = null;
+ let instance = {};
$("body").on("click", ".time_pick", (e) => {
e.preventDefault();
e.stopPropagation();
@@ -640,11 +640,10 @@ export function initialize() {
target_textarea = $(`#edit_form_${CSS.escape(edit_message_id)} .message_edit_content`);
}
- if (instance === null) {
+ if (!instance.calendarContainer) {
const on_timestamp_selection = (val) => {
const timestr = `<time:${val}> `;
compose_ui.insert_syntax_and_focus(timestr, target_textarea);
- instance = null;
};
instance = composebox_typeahead.show_flatpickr(
@@ -656,16 +655,11 @@ export function initialize() {
position: "above center",
},
);
-
- $(document).one("compose_canceled.zulip compose_finished.zulip", () => {
- instance = null;
- });
return;
}
instance.close();
instance.destroy();
- instance = null;
});
$("#compose").on("click", ".markdown_preview", (e) => {