mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
Move insert_syntax_and_focus() to compose_ui.js.
This change also removes a couple lines of test code that weren't really testing anything.
This commit is contained in:
@@ -621,10 +621,6 @@ function test_raw_file_drop(raw_drop_func) {
|
||||
assert(compose_actions_start_checked);
|
||||
assert.equal($("#new_message_content").val(), 'Old content new contents');
|
||||
assert(compose_ui_autosize_textarea_checked);
|
||||
|
||||
// Now test the insert syntax code
|
||||
$('#new_message_content').caret = noop;
|
||||
compose_state.insert_syntax_and_focus('funtimes');
|
||||
}
|
||||
|
||||
(function test_initialize() {
|
||||
|
||||
@@ -656,7 +656,7 @@ exports.initialize = function () {
|
||||
var video_call_id = util.random_int(100000000000000, 999999999999999);
|
||||
var video_call_link = 'https://meet.jit.si/' + video_call_id;
|
||||
var video_call_link_text = '[' + _('Click to join video call') + '](' + video_call_link + ')';
|
||||
compose_state.insert_syntax_and_focus(video_call_link_text);
|
||||
compose_ui.insert_syntax_and_focus(video_call_link_text);
|
||||
});
|
||||
|
||||
$("#compose").on("click", "#markdown_preview", function (e) {
|
||||
|
||||
@@ -51,15 +51,6 @@ exports.has_message_content = function () {
|
||||
return exports.message_content() !== "";
|
||||
};
|
||||
|
||||
exports.insert_syntax_and_focus = function (syntax) {
|
||||
// Generic helper for inserting syntax into the main compose box
|
||||
// where the cursor was and focusing the area. Mostly a thin
|
||||
// wrapper around $.caret.
|
||||
var textarea = $('#new_message_content');
|
||||
textarea.caret(syntax);
|
||||
textarea.focus();
|
||||
};
|
||||
|
||||
return exports;
|
||||
}());
|
||||
|
||||
|
||||
@@ -6,6 +6,15 @@ exports.autosize_textarea = function () {
|
||||
$("#new_message_content").trigger("autosize.resize");
|
||||
};
|
||||
|
||||
exports.insert_syntax_and_focus = function (syntax) {
|
||||
// Generic helper for inserting syntax into the main compose box
|
||||
// where the cursor was and focusing the area. Mostly a thin
|
||||
// wrapper around $.caret.
|
||||
var textarea = $('#new_message_content');
|
||||
textarea.caret(syntax);
|
||||
textarea.focus();
|
||||
};
|
||||
|
||||
return exports;
|
||||
|
||||
}());
|
||||
|
||||
@@ -678,7 +678,7 @@ exports.register_click_handlers = function () {
|
||||
$(document).on('click', '.emoji-popover-emoji.composition', function (e) {
|
||||
var emoji_name = $(this).data("emoji-name");
|
||||
var emoji_text = ':' + emoji_name + ':';
|
||||
compose_state.insert_syntax_and_focus(emoji_text);
|
||||
compose_ui.insert_syntax_and_focus(emoji_text);
|
||||
e.stopPropagation();
|
||||
emoji_picker.hide_emoji_popover();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user