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.

message_edit: Fix missing convert pasted text to file banner.

Sayam Samala9be18e03fb1
diff --git a/web/src/compose_banner.ts b/web/src/compose_banner.ts
index eeb87033c1b..74dbe6f9576 100644
--- a/web/src/compose_banner.ts
+++ b/web/src/compose_banner.ts
@@ -297,12 +297,15 @@ export function show_convert_pasted_text_to_file_banner({
show_paste_button,
convert_to_file_cb,
paste_to_compose_cb,
+ $textarea,
}: {
show_paste_button: boolean;
convert_to_file_cb: () => void;
paste_to_compose_cb: () => void;
+ $textarea: JQuery<HTMLTextAreaElement>;
}): JQuery {
- $(`#compose_banners .${CSS.escape(CLASSNAMES.convert_pasted_text_to_file)}`).remove();
+ const $banner_container = get_compose_banner_container($textarea);
+ $banner_container.find(CSS.escape(CLASSNAMES.convert_pasted_text_to_file)).remove();
const $new_row = $(
render_long_paste_options({
banner_type: INFO,
@@ -312,6 +315,6 @@ export function show_convert_pasted_text_to_file_banner({
);
$new_row.on("click", ".main-view-banner-action-button.convert-to-file", convert_to_file_cb);
$new_row.on("click", ".main-view-banner-action-button.paste-to-compose", paste_to_compose_cb);
- append_compose_banner_to_banner_list($new_row, $("#compose_banners"));
+ append_compose_banner_to_banner_list($new_row, $banner_container);
return $new_row;
}
diff --git a/web/src/compose_paste.ts b/web/src/compose_paste.ts
index e8f31485acc..80feebf2c75 100644
--- a/web/src/compose_paste.ts
+++ b/web/src/compose_paste.ts
@@ -763,9 +763,10 @@ export function paste_handler(
paste_to_compose_cb() {
do_paste_text(paste_html, paste_text, $textarea);
},
+ $textarea,
});
setTimeout(() => {
- $("textarea#compose-textarea").one("input", () => {
+ $textarea.one("input", () => {
// The banner only displays until the user does
// some further input. This is both reasonable UI
// and also is required for undo, see above.