From 441efe7d832c0e510a81855e8fbbc882d638296d Mon Sep 17 00:00:00 2001 From: Mykyta Mykulskyi Date: Mon, 23 Dec 2024 21:05:32 +0100 Subject: [PATCH] feat: add `mode` and `description` to quiz --- .../js/Helpers/vDynamicTextAreaHeight.ts | 7 ++-- resources/js/components/Crud/CrudInput.vue | 7 +++- .../components/QuizzesPanel/QuizComponent.vue | 2 +- .../js/components/QuizzesPanel/QuizHeader.vue | 42 +++++++++++++++++++ 4 files changed, 52 insertions(+), 6 deletions(-) diff --git a/resources/js/Helpers/vDynamicTextAreaHeight.ts b/resources/js/Helpers/vDynamicTextAreaHeight.ts index 08dd79b9..70d4c060 100644 --- a/resources/js/Helpers/vDynamicTextAreaHeight.ts +++ b/resources/js/Helpers/vDynamicTextAreaHeight.ts @@ -1,14 +1,13 @@ import { type DirectiveBinding } from 'vue' function initDynamicHeightCalc(input: HTMLTextAreaElement & { _calculateDynamicHeight: () => void }, binding?: DirectiveBinding) { + input.style.resize = 'none' input._calculateDynamicHeight = () => calculateDynamicHeight(input, binding) document.fonts.addEventListener('loadingdone', input._calculateDynamicHeight) input.addEventListener('transitionend', input._calculateDynamicHeight) input._calculateDynamicHeight() - input.style.resize = 'none' - input.style.overflowY = 'hidden' } function calculateDynamicHeight(input: HTMLTextAreaElement, binding?: DirectiveBinding){ @@ -18,8 +17,8 @@ function calculateDynamicHeight(input: HTMLTextAreaElement, binding?: DirectiveB // Reset the height to a minimal value to refresh scrollHeight. // This ensures the textarea will shrink when text is removed. - input.style.height = '5px' - input.style.height = `${input.scrollHeight}px` + input.style.height = '0' + input.style.height = `${input.scrollHeight+1}px` } function removeDynamicHeightCalc(input: HTMLTextAreaElement & { _calculateDynamicHeight: () => void }) { diff --git a/resources/js/components/Crud/CrudInput.vue b/resources/js/components/Crud/CrudInput.vue index 8ddd9649..3c3dd09f 100644 --- a/resources/js/components/Crud/CrudInput.vue +++ b/resources/js/components/Crud/CrudInput.vue @@ -13,6 +13,8 @@ const props = defineProps<{ error?: string password?: boolean large?: boolean + row?: boolean + column?: boolean format?: (value: T) => any } & InputProps>() @@ -28,10 +30,12 @@ function handleInput() {