From f7a25094053f81b8cac4522fea6aa7a966a7b236 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Sun, 14 Apr 2024 15:38:01 -0400 Subject: [PATCH] Exclude `:` from the autocomplete trigger --- shared/naturalcrit/codeEditor/autocomplete-emoji.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/shared/naturalcrit/codeEditor/autocomplete-emoji.js b/shared/naturalcrit/codeEditor/autocomplete-emoji.js index f62036e84..eeddb99a7 100644 --- a/shared/naturalcrit/codeEditor/autocomplete-emoji.js +++ b/shared/naturalcrit/codeEditor/autocomplete-emoji.js @@ -24,7 +24,6 @@ const showEmojiAutocomplete = function(CodeMirror, editor) { }).map(function(emoji) { return { text: emoji + ":", - //displayText: `${emoji} - `, render: function(element, self, data) { const div = document.createElement('div'); div.innerHTML = ` ${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); } });