Fix last char is emoji, remove console logs

This commit is contained in:
Lorenz Padberg 2024-05-16 01:27:36 +02:00
parent dedd7feea5
commit e66c79f5fa
1 changed files with 5 additions and 3 deletions

View File

@ -48,7 +48,11 @@ const editText = ref(props.inputText);
const emit = defineEmits(['input']);
const containsEmoji = (text: string) => {
if (!text) {
return false
}
const lastCharacter = Array.from(text)[Array.from(text).length - 1];
if (lastCharacter && lastCharacter.charCodeAt(0)> 55000) //fix for the hand symbol 🖐
return true
const emojiRegex = /\p{Emoji}/u;
@ -59,11 +63,9 @@ watch(
() => props.inputText,
(newValue) => {
// TODO: Lorenz this is an ugly fix!
console.log(newValue)
if (containsEmoji(newValue)) {
console.log("emoji found", newValue)
editText.value = newValue;
emit('input', editText.value);
}
}
);