mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-05 12:22:44 +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
|
// Get the text from the start of the line to the cursor
|
||||||
const textToCursor = line.slice(0, cursor.ch);
|
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'
|
// 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