You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Make individual Entrys responsible for determining suffixes
This makes it cleaner as CommandEntry always wants a space, but MemberEntry wants a space or ": " depending on if it is the first word or not.
This commit is contained in:
@@ -43,10 +43,10 @@ class Entry {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {?string} The suffix to override whatever the default is, or null to
|
||||
* @return {?string} The suffix to append to the tab-complete, or null to
|
||||
* not do this.
|
||||
*/
|
||||
getOverrideSuffix() {
|
||||
getSuffix(isFirstWord) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class CommandEntry extends Entry {
|
||||
return this.getText();
|
||||
}
|
||||
|
||||
getOverrideSuffix() {
|
||||
getSuffix(isFirstWord) {
|
||||
return " "; // force a space after the command.
|
||||
}
|
||||
}
|
||||
@@ -94,6 +94,10 @@ class MemberEntry extends Entry {
|
||||
getKey() {
|
||||
return this.member.userId;
|
||||
}
|
||||
|
||||
getSuffix(isFirstWord) {
|
||||
return isFirstWord ? ": " : " ";
|
||||
}
|
||||
}
|
||||
|
||||
MemberEntry.fromMemberList = function(members) {
|
||||
|
||||
Reference in New Issue
Block a user