Fix last char is emoji, remove console logs
This commit is contained in:
parent
dedd7feea5
commit
e66c79f5fa
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue