message-editing: Add support for dynamic elements in edit-history.

Edit history of message was rendered directly without passing
it through rendered_markdown.js. Due to this several visual
features for dynamic elements like time, spoilers, mentions
etc were not available.

To fix above issues we pass the content of edit-history
through rendered_markdown before showing edit history modal.

Fixes: #16029.
This commit is contained in:
Purushottam Tiwari
2022-02-22 15:05:06 +05:30
committed by Tim Abbott
parent 16687d4c74
commit 3984df88bb
3 changed files with 48 additions and 21 deletions

View File

@@ -11,6 +11,7 @@ import * as message_lists from "./message_lists";
import {page_params} from "./page_params";
import * as people from "./people";
import * as popovers from "./popovers";
import * as rendered_markdown from "./rendered_markdown";
import * as rows from "./rows";
import * as stream_data from "./stream_data";
import * as sub_store from "./sub_store";
@@ -125,6 +126,13 @@ export function fetch_and_render_message_history(message) {
edited_messages: content_edit_history,
}),
);
// Pass the history through rendered_markdown.js
// to update dynamic_elements in the content.
$("#message-history")
.find(".rendered_markdown")
.each(function () {
rendered_markdown.update_elements($(this));
});
},
error(xhr) {
ui_report.error(