mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-22 22:30:52 +01:00
Fix prevent zalgo-text (Issue #23)
This commit is contained in:
parent
2fa3662860
commit
d5361ef5b3
@ -89,6 +89,15 @@ export const ChatInputView: FC<{}> = props =>
|
|||||||
|
|
||||||
if(text.length <= maxChatLength)
|
if(text.length <= maxChatLength)
|
||||||
{
|
{
|
||||||
|
const re = /%CC%/g
|
||||||
|
const hasZalgo = txt => re.test(encodeURIComponent(txt));
|
||||||
|
|
||||||
|
if (hasZalgo(text))
|
||||||
|
{
|
||||||
|
setChatValue('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setChatValue('');
|
setChatValue('');
|
||||||
sendChat(text, chatType, recipientName, chatStyleId);
|
sendChat(text, chatType, recipientName, chatStyleId);
|
||||||
}
|
}
|
||||||
@ -141,7 +150,7 @@ export const ChatInputView: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [ floodBlocked, inputRef, chatModeIdWhisper, anotherInputHasFocus, setInputFocus, checkSpecialKeywordForInput, sendChatValue ]);
|
}, [ floodBlocked, inputRef, chatModeIdWhisper, anotherInputHasFocus, setInputFocus, checkSpecialKeywordForInput, sendChatValue ]);
|
||||||
|
|
||||||
useUiEvent<RoomWidgetUpdateChatInputContentEvent>(RoomWidgetUpdateChatInputContentEvent.CHAT_INPUT_CONTENT, event =>
|
useUiEvent<RoomWidgetUpdateChatInputContentEvent>(RoomWidgetUpdateChatInputContentEvent.CHAT_INPUT_CONTENT, event =>
|
||||||
|
Loading…
Reference in New Issue
Block a user