Merge pull request #3024 from matrix-org/bwindels/autocomplete-tab
Message editing: tab completion
This commit is contained in:
commit
9d6a818591
2 changed files with 28 additions and 4 deletions
|
@ -39,8 +39,24 @@ export default class AutocompleteWrapperModel {
|
||||||
this._updateCallback({close: true});
|
this._updateCallback({close: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
onTab() {
|
async onTab(e) {
|
||||||
//forceCompletion here?
|
const acComponent = this._getAutocompleterComponent();
|
||||||
|
|
||||||
|
if (acComponent.state.completionList.length === 0) {
|
||||||
|
// Force completions to show for the text currently entered
|
||||||
|
await acComponent.forceComplete();
|
||||||
|
// Select the first item by moving "down"
|
||||||
|
await acComponent.onDownArrow();
|
||||||
|
} else {
|
||||||
|
if (e.shiftKey) {
|
||||||
|
await acComponent.onUpArrow();
|
||||||
|
} else {
|
||||||
|
await acComponent.onDownArrow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._updateCallback({
|
||||||
|
close: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpArrow() {
|
onUpArrow() {
|
||||||
|
|
|
@ -313,8 +313,16 @@ export class PillCandidatePart extends PlainPart {
|
||||||
return this._autoCompleteCreator(updateCallback);
|
return this._autoCompleteCreator(updateCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
acceptsInsertion(chr) {
|
acceptsInsertion(chr, i) {
|
||||||
return true;
|
if (i === 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return super.acceptsInsertion(chr, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
merge() {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
acceptsRemoval(position, chr) {
|
acceptsRemoval(position, chr) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue