Fix last char is emoji, remove console logs
This commit is contained in:
parent
dedd7feea5
commit
7711d108a6
|
|
@ -48,7 +48,11 @@ const editText = ref(props.inputText);
|
||||||
const emit = defineEmits(['input']);
|
const emit = defineEmits(['input']);
|
||||||
|
|
||||||
const containsEmoji = (text: string) => {
|
const containsEmoji = (text: string) => {
|
||||||
|
if (!text) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
const lastCharacter = Array.from(text)[Array.from(text).length - 1];
|
const lastCharacter = Array.from(text)[Array.from(text).length - 1];
|
||||||
|
|
||||||
if (lastCharacter && lastCharacter.charCodeAt(0)> 55000) //fix for the hand symbol 🖐️
|
if (lastCharacter && lastCharacter.charCodeAt(0)> 55000) //fix for the hand symbol 🖐️
|
||||||
return true
|
return true
|
||||||
const emojiRegex = /\p{Emoji}/u;
|
const emojiRegex = /\p{Emoji}/u;
|
||||||
|
|
@ -59,11 +63,9 @@ watch(
|
||||||
() => props.inputText,
|
() => props.inputText,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
// TODO: Lorenz this is an ugly fix!
|
// TODO: Lorenz this is an ugly fix!
|
||||||
console.log(newValue)
|
|
||||||
|
|
||||||
if (containsEmoji(newValue)) {
|
if (containsEmoji(newValue)) {
|
||||||
console.log("emoji found", newValue)
|
|
||||||
editText.value = newValue;
|
editText.value = newValue;
|
||||||
|
emit('input', editText.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue