mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
Convert whitespace regex to const
This commit is contained in:
parent
0516556be9
commit
79b7592dd5
@ -48,9 +48,12 @@ const SURROGATE_PAIR_PATTERN = /([\ud800-\udbff])([\udc00-\udfff])/;
|
||||
// (with plenty of false positives, but that's OK)
|
||||
const SYMBOL_PATTERN = /([\u2100-\u2bff])/;
|
||||
|
||||
// Regex pattern for Zero-Width joiner unicode characters.
|
||||
// Regex pattern for Zero-Width joiner unicode characters
|
||||
const ZWJ_REGEX = new RegExp("\u200D|\u2003", "g");
|
||||
|
||||
// Regex pattern for whitespace characters
|
||||
const WHITESPACE_REGEX = new RegExp("\\s", "g");
|
||||
|
||||
// And this is emojione's complete regex
|
||||
const EMOJI_REGEX = new RegExp(emojione.unicodeRegexp+"+", "gi");
|
||||
const COLOR_REGEX = /^#[0-9a-fA-F]{6}$/;
|
||||
@ -505,7 +508,7 @@ export function bodyToHtml(content, highlights, opts={}) {
|
||||
|
||||
// Ignore spaces in body text. Emojis with spaces in between should
|
||||
// still be counted as purely emoji messages.
|
||||
contentBodyTrimmed = contentBodyTrimmed.replace(/\s/g, '');
|
||||
contentBodyTrimmed = contentBodyTrimmed.replace(WHITESPACE_REGEX, '');
|
||||
|
||||
// Remove zero width joiner characters from emoji messages. This ensures
|
||||
// that emojis that are made up of multiple unicode characters are still
|
||||
|
Loading…
Reference in New Issue
Block a user