Mention Tooltip: Support unicode names (#1377)
This commit is contained in:
parent
b1f91c921b
commit
26ed61ac52
@ -15,7 +15,14 @@ const runThrottled = throttle((cb) => cb(), 500, true);
|
||||
const RE_BR = /(<br>|<br\s?\/>)/g;
|
||||
const RE_SPACE = / /g;
|
||||
const RE_CLEAN_HTML = /(<div>|<\/div>)/gi;
|
||||
const RE_USERNAME_SEARCH = new RegExp('(^|\\s)@[\\w\\d_-]*$', 'gi');
|
||||
let RE_USERNAME_SEARCH: RegExp;
|
||||
|
||||
try {
|
||||
RE_USERNAME_SEARCH = new RegExp('(^|\\s)@[-_\\p{L}\\p{M}\\p{N}]*$', 'gui');
|
||||
} catch (e) {
|
||||
// Support for older versions of firefox
|
||||
RE_USERNAME_SEARCH = new RegExp('(^|\\s)@[-_\\d\\wа-яё]*$', 'gi');
|
||||
}
|
||||
|
||||
export default function useMentionTooltip(
|
||||
canSuggestMembers: boolean | undefined,
|
||||
|
||||
@ -1,4 +1,11 @@
|
||||
const RE_NOT_LETTER = /[^\wа-яё]+/;
|
||||
let RE_NOT_LETTER: RegExp;
|
||||
|
||||
try {
|
||||
RE_NOT_LETTER = new RegExp('[^\\p{L}\\p{M}]+', 'ui');
|
||||
} catch (e) {
|
||||
// Support for older versions of firefox
|
||||
RE_NOT_LETTER = new RegExp('[^\\wа-яё]+', 'i');
|
||||
}
|
||||
|
||||
export default function searchWords(haystack: string, needle: string) {
|
||||
if (!haystack || !needle) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user