mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 18:32:41 +00:00
Prevent autosuggest inside curly span/div properties
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user