add info message for space between emoji and text
parent
06b143e623
commit
83a8a7498d
|
@ -555,13 +555,13 @@
|
||||||
// this function is to show the user a help message if there could be spacing added between emojis and text
|
// this function is to show the user a help message if there could be spacing added between emojis and text
|
||||||
function isEmojiSpacingOk(text) {
|
function isEmojiSpacingOk(text) {
|
||||||
// regex to find emojis followed by a letter or another emoji without a space in between
|
// regex to find emojis followed by a letter or another emoji without a space in between
|
||||||
let regex = /([\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{1FA70}-\u{1FAFF}])([^\s]|$)/gu;
|
let regex = /([\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{1FA70}-\u{1FAFF}])(?=[^\s]|$)/gu;
|
||||||
|
|
||||||
// check if the regex finds a matching pattern
|
// check if the regex finds a matching pattern
|
||||||
let match;
|
let match;
|
||||||
while ((match = regex.exec(text)) !== null) {
|
while ((match = regex.exec(text)) !== null) {
|
||||||
if (match[2] !== ' ' && match[2] !== '') {
|
if (match.index + match[0].length < text.length && text[match.index + match[0].length] !== ' ') {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue