1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 02:36:36 +00:00

allow to expand snippets following $ character

This commit is contained in:
amedora
2019-05-09 10:55:31 +09:00
committed by Junyoung Choi
parent 377901606e
commit 12229a1719

View File

@@ -202,7 +202,7 @@ export default class CodeEditor extends React.Component {
} }
cm.execCommand('goLineEnd') cm.execCommand('goLineEnd')
} else if ( } else if (
!charBeforeCursor.match(/\t|\s|\r|\n/) && !charBeforeCursor.match(/\t|\s|\r|\n|\$/) &&
cursor.ch > 1 cursor.ch > 1
) { ) {
// text expansion on tab key if the char before is alphabet // text expansion on tab key if the char before is alphabet
@@ -489,7 +489,7 @@ export default class CodeEditor extends React.Component {
getWordBeforeCursor (line, lineNumber, cursorPosition) { getWordBeforeCursor (line, lineNumber, cursorPosition) {
let wordBeforeCursor = '' let wordBeforeCursor = ''
const originCursorPosition = cursorPosition const originCursorPosition = cursorPosition
const emptyChars = /\t|\s|\r|\n/ const emptyChars = /\t|\s|\r|\n|\$/
// to prevent the word is long that will crash the whole app // to prevent the word is long that will crash the whole app
// the safeStop is there to stop user to expand words that longer than 20 chars // the safeStop is there to stop user to expand words that longer than 20 chars