Fix commands activating anywhere in the input (#156)

* Fix commands activating anywhere in the input

Writing `The command to leave a channel is /leave` might have had "fun"
consequences for users.

Fixes #155

* Fix go-to commands activating anywhere in the input

While less obtrusive than `/` commands activating anywhere, it seems
logical to only activate completion of those when at the beginning of
the input.
This commit is contained in:
Samuel Dionne-Riel 2021-11-07 00:32:50 -04:00 committed by GitHub
parent fb5a54dd17
commit 3776e32364
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,7 +29,7 @@ import MarkdownIC from '../../../../public/res/ic/outlined/markdown.svg';
import FileIC from '../../../../public/res/ic/outlined/file.svg';
import CrossIC from '../../../../public/res/ic/outlined/cross.svg';
const CMD_REGEX = /(\/|>[#*@]|:|@)(\S*)$/;
const CMD_REGEX = /(^\/|^>[#*@]|:|@)(\S*)$/;
let isTyping = false;
let isCmdActivated = false;
let cmdCursorPos = null;