insert command completion as command part (instead of plain)
this prevents the command being sent as plain text this adds a `type` property to completions to decide which parts should be inserted into the composer, hence deciding how they will be rendered.
This commit is contained in:
parent
133e68191a
commit
228905bec2
7 changed files with 25 additions and 13 deletions
|
@ -456,15 +456,20 @@ export class CommandPartCreator extends PartCreator {
|
|||
createPartForInput(text, partIndex) {
|
||||
// at beginning and starts with /? create
|
||||
if (partIndex === 0 && text[0] === "/") {
|
||||
return new CommandPart("", this._autoCompleteCreator);
|
||||
// text will be inserted by model, so pass empty string
|
||||
return this.command("");
|
||||
} else {
|
||||
return super.createPartForInput(text, partIndex);
|
||||
}
|
||||
}
|
||||
|
||||
command(text) {
|
||||
return new CommandPart(text, this._autoCompleteCreator);
|
||||
}
|
||||
|
||||
deserializePart(part) {
|
||||
if (part.type === "command") {
|
||||
return new CommandPart(part.text, this._autoCompleteCreator);
|
||||
return this.command(part.text);
|
||||
} else {
|
||||
return super.deserializePart(part);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue