Merge pull request #121 from vanpav/escaped-char
Escape Suggestion trigger char
This commit is contained in:
@@ -11,11 +11,12 @@ function triggerCharacter({
|
|||||||
|
|
||||||
return $position => {
|
return $position => {
|
||||||
// Matching expressions used for later
|
// Matching expressions used for later
|
||||||
const suffix = new RegExp(`\\s${char}$`)
|
const escapedChar = `\\${char}`
|
||||||
|
const suffix = new RegExp(`\\s${escapedChar}$`)
|
||||||
const prefix = startOfLine ? '^' : ''
|
const prefix = startOfLine ? '^' : ''
|
||||||
const regexp = allowSpaces
|
const regexp = allowSpaces
|
||||||
? new RegExp(`${prefix}${char}.*?(?=\\s${char}|$)`, 'gm')
|
? new RegExp(`${prefix}${escapedChar}.*?(?=\\s${escapedChar}|$)`, 'gm')
|
||||||
: new RegExp(`${prefix}(?:^)?${char}[^\\s${char}]*`, 'gm')
|
: new RegExp(`${prefix}(?:^)?${escapedChar}[^\\s${escapedChar}]*`, 'gm')
|
||||||
|
|
||||||
// Lookup the boundaries of the current node
|
// Lookup the boundaries of the current node
|
||||||
const textFrom = $position.before()
|
const textFrom = $position.before()
|
||||||
|
|||||||
Reference in New Issue
Block a user