Regex with better distinction between LTR and RTL characters
Co-authored-by: MoonE <maxi_kroeg@web.de>
This commit is contained in:
@@ -75,7 +75,17 @@ function getDeclutterBox(replayImageOrLabelArgs) {
|
|||||||
return replayImageOrLabelArgs[3].declutterBox;
|
return replayImageOrLabelArgs[3].declutterBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rtlRegEx = /[\u0591-\u07FF]/;
|
const rtlRegEx = new RegExp(
|
||||||
|
/* eslint-disable prettier/prettier */
|
||||||
|
'[' +
|
||||||
|
String.fromCharCode(0x00591) + '-' + String.fromCharCode(0x008ff) +
|
||||||
|
String.fromCharCode(0x0fb1d) + '-' + String.fromCharCode(0x0fdff) +
|
||||||
|
String.fromCharCode(0x0fe70) + '-' + String.fromCharCode(0x0fefc) +
|
||||||
|
String.fromCharCode(0x10800) + '-' + String.fromCharCode(0x10fff) +
|
||||||
|
String.fromCharCode(0x1e800) + '-' + String.fromCharCode(0x1efff) +
|
||||||
|
']'
|
||||||
|
/* eslint-enable prettier/prettier */
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} text Text.
|
* @param {string} text Text.
|
||||||
|
|||||||
Reference in New Issue
Block a user