mirror of
				https://github.com/vector-im/element-web.git
				synced 2025-11-04 02:02:14 +01:00 
			
		
		
		
	Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
		
						commit
						d35ef7e7eb
					
				@ -26,11 +26,12 @@ import SettingsStore, {SettingLevel} from './settings/SettingsStore';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Command {
 | 
			
		||||
    constructor({name, args='', description, runFn}) {
 | 
			
		||||
    constructor({name, args='', description, runFn, hideCompletionAfterSpace=false}) {
 | 
			
		||||
        this.command = '/' + name;
 | 
			
		||||
        this.args = args;
 | 
			
		||||
        this.description = description;
 | 
			
		||||
        this.runFn = runFn;
 | 
			
		||||
        this.hideCompletionAfterSpace = hideCompletionAfterSpace;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    getCommand() {
 | 
			
		||||
@ -78,6 +79,7 @@ export const CommandMap = {
 | 
			
		||||
            });
 | 
			
		||||
            return success();
 | 
			
		||||
        },
 | 
			
		||||
        hideCompletionAfterSpace: true,
 | 
			
		||||
    }),
 | 
			
		||||
 | 
			
		||||
    nick: new Command({
 | 
			
		||||
@ -466,6 +468,7 @@ export const CommandMap = {
 | 
			
		||||
        name: 'me',
 | 
			
		||||
        args: '<message>',
 | 
			
		||||
        description: _td('Displays action'),
 | 
			
		||||
        hideCompletionAfterSpace: true,
 | 
			
		||||
    }),
 | 
			
		||||
};
 | 
			
		||||
/* eslint-enable babel/no-invalid-this */
 | 
			
		||||
 | 
			
		||||
@ -47,6 +47,8 @@ export default class CommandProvider extends AutocompleteProvider {
 | 
			
		||||
            // The input looks like a command with arguments, perform exact match
 | 
			
		||||
            const name = command[1].substr(1); // strip leading `/`
 | 
			
		||||
            if (CommandMap[name]) {
 | 
			
		||||
                // some commands, namely `me` and `ddg` don't suit having the usage shown whilst typing their arguments
 | 
			
		||||
                if (!CommandMap[name].hideCompletionAfterSpace) return [];
 | 
			
		||||
                matches = [CommandMap[name]];
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user