0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-30 15:22:41 +00:00

Exclude : from the autocomplete trigger

This commit is contained in:
Trevor Buckner
2024-04-14 15:38:01 -04:00
parent b0c2521101
commit f7a2509405

View File

@@ -24,7 +24,6 @@ const showEmojiAutocomplete = function(CodeMirror, editor) {
}).map(function(emoji) {
return {
text: emoji + ":",
//displayText: `${emoji} - <i class="${emojis[emoji]}"></i>`,
render: function(element, self, data) {
const div = document.createElement('div');
div.innerHTML = `<i class="${emojis[emoji]}"></i> ${emoji}`;
@@ -50,7 +49,7 @@ const showEmojiAutocomplete = function(CodeMirror, editor) {
const textToCursor = line.slice(0, cursor.ch);
// Check if the text ends with ':xyz'
if (/:\S+$/.test(textToCursor)) {
if (/:[^\s:]+$/.test(textToCursor)) {
CodeMirror.commands.autocomplete(editor);
}
});