Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP Staging] input of '[' and other special characters fixed #30559

Merged
merged 10 commits into from
Oct 30, 2023
8 changes: 3 additions & 5 deletions src/libs/convertToLTRForComposer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ function hasRTLCharacters(text: string): boolean {

// Converts a given text to ensure it starts with the LTR (Left-to-Right) marker.
const convertToLTRForComposer: ConvertToLTRForComposer = (text) => {
// Ensure that the text starts with RTL characters if not we return the same text to avoid concatination with special character at the start which leads to unexpected behaviour for Emoji/Mention suggestions.
// Ensure that the text starts with RTL characters if not we return the same text to avoid concatination with special
// character at the start which leads to unexpected behaviour for Emoji/Mention suggestions.
if (!hasRTLCharacters(text)) {
// If text is empty string return empty string to avoid an empty draft due to special character.
if (text === '' || CONST.UNICODE.LTR.match(text)) {
return '';
}
return text;
return text.replace(CONST.UNICODE.LTR, '');
}

// Check if the text contains only spaces. If it does, we do not concatenate it with CONST.UNICODE.LTR,
Expand Down
Loading