You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
avoid negatives
This commit is contained in:
committed by
GitHub
parent
3217becce8
commit
ef80a0b0b4
@ -62,15 +62,15 @@ export function textSerialize(model: EditorModel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function containsEmote(model: EditorModel) {
|
export function containsEmote(model: EditorModel) {
|
||||||
return startsWith(model, "/me ", true);
|
return startsWith(model, "/me ", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function startsWith(model: EditorModel, prefix: string, caseInsensitive = false) {
|
export function startsWith(model: EditorModel, prefix: string, caseSensitive = true) {
|
||||||
const firstPart = model.parts[0];
|
const firstPart = model.parts[0];
|
||||||
// part type will be "plain" while editing,
|
// part type will be "plain" while editing,
|
||||||
// and "command" while composing a message.
|
// and "command" while composing a message.
|
||||||
let text = firstPart && firstPart.text;
|
let text = firstPart && firstPart.text;
|
||||||
if (caseInsensitive) {
|
if (!caseSensitive) {
|
||||||
prefix = prefix.toLowerCase();
|
prefix = prefix.toLowerCase();
|
||||||
text = text.toLowerCase();
|
text = text.toLowerCase();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user