mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
compose: Fix bug in undo operation
This fixes compose.test_video_link_compose_clicked to just use a stub for compose_ui.insert_syntax_and_focus. It also adds direct tests for compose_ui.insert_syntax_and_focus. Fixes #6362
This commit is contained in:
@@ -27,8 +27,15 @@ exports.smart_insert = function (textarea, syntax) {
|
||||
}
|
||||
}
|
||||
|
||||
textarea.caret(syntax);
|
||||
textarea.focus();
|
||||
|
||||
// We prefer to use insertText, which supports things like undo better
|
||||
// for rich-text editing features like inserting links. But we fall
|
||||
// back to textarea.caret if the browser doesn't support insertText.
|
||||
if (!document.execCommand("insertText", false, syntax)) {
|
||||
textarea.caret(syntax);
|
||||
}
|
||||
|
||||
// This should just call exports.autosize_textarea, but it's a bit
|
||||
// annoying for the unit tests, so we don't do that.
|
||||
textarea.trigger("autosize.resize");
|
||||
|
||||
Reference in New Issue
Block a user