From e66c79f5fa0ffc55f154bd9102ad2b5679943da8 Mon Sep 17 00:00:00 2001 From: Lorenz Padberg Date: Thu, 16 May 2024 01:27:36 +0200 Subject: [PATCH] Fix last char is emoji, remove console logs --- .../content-blocks/assignment/SubmissionInput.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/components/content-blocks/assignment/SubmissionInput.vue b/client/src/components/content-blocks/assignment/SubmissionInput.vue index 658f09e1..4c267dfa 100644 --- a/client/src/components/content-blocks/assignment/SubmissionInput.vue +++ b/client/src/components/content-blocks/assignment/SubmissionInput.vue @@ -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); } } );