mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-16 14:42:45 +00:00
Exclude : from the autocomplete trigger
This commit is contained in:
@@ -24,7 +24,6 @@ const showEmojiAutocomplete = function(CodeMirror, editor) {
|
|||||||
}).map(function(emoji) {
|
}).map(function(emoji) {
|
||||||
return {
|
return {
|
||||||
text: emoji + ":",
|
text: emoji + ":",
|
||||||
//displayText: `${emoji} - <i class="${emojis[emoji]}"></i>`,
|
|
||||||
render: function(element, self, data) {
|
render: function(element, self, data) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.innerHTML = `<i class="${emojis[emoji]}"></i> ${emoji}`;
|
div.innerHTML = `<i class="${emojis[emoji]}"></i> ${emoji}`;
|
||||||
@@ -50,7 +49,7 @@ const showEmojiAutocomplete = function(CodeMirror, editor) {
|
|||||||
const textToCursor = line.slice(0, cursor.ch);
|
const textToCursor = line.slice(0, cursor.ch);
|
||||||
|
|
||||||
// Check if the text ends with ':xyz'
|
// Check if the text ends with ':xyz'
|
||||||
if (/:\S+$/.test(textToCursor)) {
|
if (/:[^\s:]+$/.test(textToCursor)) {
|
||||||
CodeMirror.commands.autocomplete(editor);
|
CodeMirror.commands.autocomplete(editor);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user