You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
Style changes and improvements in autocomplete
This commit is contained in:
@@ -39,6 +39,8 @@ const COMMANDS = [
|
||||
}
|
||||
];
|
||||
|
||||
let instance = null;
|
||||
|
||||
export default class CommandProvider extends AutocompleteProvider {
|
||||
constructor() {
|
||||
super();
|
||||
@@ -49,7 +51,7 @@ export default class CommandProvider extends AutocompleteProvider {
|
||||
|
||||
getCompletions(query: String) {
|
||||
let completions = [];
|
||||
const matches = query.match(/(^\/\w+)/);
|
||||
const matches = query.match(/(^\/\w*)/);
|
||||
if(!!matches) {
|
||||
const command = matches[0];
|
||||
completions = this.fuse.search(command).map(result => {
|
||||
@@ -66,4 +68,11 @@ export default class CommandProvider extends AutocompleteProvider {
|
||||
getName() {
|
||||
return 'Commands';
|
||||
}
|
||||
|
||||
static getInstance(): CommandProvider {
|
||||
if(instance == null)
|
||||
instance = new CommandProvider();
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user