compose: Enable mention syntax when editing messages.

We had been waiting on doing this for a long time to make sure the
feature actually did what it was supposed to (completed last week);
this change adds the typeahead to ensure it actually works.

While we're fixing this, we remove the split between the edit and
compose code paths for typeahead, which is good, because we'd already
accidentally added the syntax-highlighting feature in only one place.

Fixes #195.
This commit is contained in:
Tim Abbott 2017-10-12 18:05:31 -07:00
parent 1d314c3bf4
commit 9ae506ac0e
2 changed files with 9 additions and 5 deletions

View File

@ -445,9 +445,13 @@ exports.compose_matches_sorter = function (matches) {
} }
}; };
exports.initialize_compose_typeahead = function (selector, completions) { exports.initialize_compose_typeahead = function (selector) {
completions = $.extend( var completions = {
{mention: false, emoji: false, stream: false, syntax: false}, completions); mention: true,
emoji: true,
stream: true,
syntax: true,
};
$(selector).typeahead({ $(selector).typeahead({
items: 5, items: 5,
@ -574,7 +578,7 @@ exports.initialize = function () {
stopAdvance: true, // Do not advance to the next field on a tab or enter stopAdvance: true, // Do not advance to the next field on a tab or enter
}); });
exports.initialize_compose_typeahead("#new_message_content", {mention: true, emoji: true, stream: true, syntax: true}); exports.initialize_compose_typeahead("#new_message_content");
$("#private_message_recipient").blur(function () { $("#private_message_recipient").blur(function () {
var val = $(this).val(); var val = $(this).val();

View File

@ -227,7 +227,7 @@ function edit_message(row, raw_content) {
if (listeners) { if (listeners) {
currently_editing_messages[rows.id(row)].listeners = listeners; currently_editing_messages[rows.id(row)].listeners = listeners;
} }
composebox_typeahead.initialize_compose_typeahead(edit_id, {emoji: true, stream: true}); composebox_typeahead.initialize_compose_typeahead(edit_id);
} }
// Add tooltip // Add tooltip