mirror of https://github.com/vector-im/riot-web
only append colon to user-pill when at start of composer
by passing position to autocomplete, so completion can depend on where the pill-candidate appears.pull/21833/head
parent
2ff2ff0e75
commit
c9572250be
|
@ -65,10 +65,11 @@ export default class AutocompleteWrapperModel {
|
|||
this._getAutocompleterComponent().moveSelection(+1);
|
||||
}
|
||||
|
||||
onPartUpdate(part, offset) {
|
||||
onPartUpdate(part, pos) {
|
||||
// cache the typed value and caret here
|
||||
// so we can restore it in onComponentSelectionChange when the value is undefined (meaning it should be the typed text)
|
||||
this._queryPart = part;
|
||||
this._partIndex = pos.index;
|
||||
return this._updateQuery(part.text);
|
||||
}
|
||||
|
||||
|
@ -100,7 +101,9 @@ export default class AutocompleteWrapperModel {
|
|||
if (completionId === "@room") {
|
||||
return [this._partCreator.atRoomPill(completionId)];
|
||||
} else {
|
||||
return [this._partCreator.userPill(text, completionId), this._partCreator.plain(": ")];
|
||||
const pill = this._partCreator.userPill(text, completionId);
|
||||
const postfix = this._partCreator.plain(this._partIndex === 0 ? ": " : " ");
|
||||
return [pill, postfix];
|
||||
}
|
||||
}
|
||||
case "#":
|
||||
|
|
|
@ -226,7 +226,7 @@ export default class EditorModel {
|
|||
}
|
||||
// not _autoComplete, only there if active part is autocomplete part
|
||||
if (this.autoComplete) {
|
||||
return this.autoComplete.onPartUpdate(part, pos.offset);
|
||||
return this.autoComplete.onPartUpdate(part, pos);
|
||||
}
|
||||
} else {
|
||||
this._activePartIdx = null;
|
||||
|
|
Loading…
Reference in New Issue