0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00

Prevent autosuggest inside curly span/div properties

This commit is contained in:
Trevor Buckner
2024-04-28 18:37:03 -04:00
parent cd35e91ea2
commit babe1f30a2

View File

@@ -60,7 +60,16 @@ const showEmojiAutocomplete = function(CodeMirror, editor) {
// Get the text from the start of the line to the cursor
const textToCursor = line.slice(0, cursor.ch);
// Do not autosuggest emojis in curly span/div properties
if(line.includes('{{')) {
const curlyToCursor = textToCursor.slice(textToCursor.indexOf(`{{`));
const curlySpanRegex = /{{(?=((?:[:=](?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':={}\s]*)*))\1$/g;
if (regex.test(curlyToCursor))
return;
}
// Check if the text ends with ':xyz'
if (/:[^\s:]+$/.test(textToCursor)) {
CodeMirror.commands.autocomplete(editor);