mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-21 13:34:04 +03:00
Issues/issue 1150 fix autogrow (#193)
* fix(c-input-text): set minimum height for input field (#1552) * refactor(sponsors): removed sponsor banners (#1553) * fix(issues): fix textarea always grows check if the textarea overflows before resizing it --------- Co-authored-by: Corentin Thomasset <corentin.thomasset74@gmail.com> Co-authored-by: Maximilian Bienhüls <maximilian.bienhuels@triluxds.com>
This commit is contained in:
4 files changed
+32
-27
No files matched your search
@@ -6,10 +6,6 @@
|
||||
|
||||
Useful tools for developer and people working in IT. [Have a look !](https://it-tools.tech).
|
||||
|
||||
## Sponsors
|
||||
|
||||
[](https://renderize.tech?utm_source=it-tools&utm_medium=readme)
|
||||
|
||||
## Functionalities and roadmap
|
||||
|
||||
Please check the [issues](https://github.com/CorentinTh/it-tools/issues) to see if some feature listed to be implemented.
|
||||
|
||||
+1
-19
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { IconDragDrop, IconFileDescription, IconHeart } from '@tabler/icons-vue';
|
||||
import { IconDragDrop, IconHeart } from '@tabler/icons-vue';
|
||||
import { useHead } from '@vueuse/head';
|
||||
import { computed } from 'vue';
|
||||
import Draggable from 'vuedraggable';
|
||||
@@ -43,24 +43,6 @@ function onUpdateFavoriteTools() {
|
||||
{{ $t('home.follow.thankYou') }}
|
||||
<n-icon :component="IconHeart" />
|
||||
</ColoredCard>
|
||||
|
||||
<a href="https://renderize.tech?utm_source=it-tools&utm_medium=banner" target="_blank" rel="noopener" class="text-current decoration-none">
|
||||
<c-card v-if="config.showSponsorBanner" class="cursor-pointer !border-2px !hover:border-primary">
|
||||
<div class="flex items-center justify-between">
|
||||
<n-icon :component="IconFileDescription" class="text-neutral-400 dark:text-neutral-600" size="40" />
|
||||
<div class="rounded-full bg-#eeeeee px-10px py-2px text-xs text-black dark:bg-#333333 dark:text-white">
|
||||
Sponsor
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="my-5px flex items-baseline gap-4 text-balance text-lg text-black dark:text-white">
|
||||
Generate PDFs from HTML with Renderize API
|
||||
</div>
|
||||
<div class="text-neutral-500 dark:text-neutral-400">
|
||||
Automate your document generation with our fast, developer-friendly API. Start with a free forever plan.
|
||||
</div>
|
||||
</c-card>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<transition name="height">
|
||||
|
||||
@@ -91,14 +91,41 @@ watch(
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
/**
|
||||
* Checks if the given HTMLElement overflows
|
||||
* copied from stackoverflow: https://stackoverflow.com/questions/143815/determine-if-an-html-elements-content-overflows
|
||||
* @param el The HTMLElement to check
|
||||
*/
|
||||
function checkOverflow(el: HTMLElement) {
|
||||
const curOverflow = el.style.overflow;
|
||||
if (!curOverflow || curOverflow === 'visible') {
|
||||
el.style.overflow = 'hidden';
|
||||
}
|
||||
|
||||
const isOverflowing = el.clientWidth < el.scrollWidth || el.clientHeight < el.scrollHeight;
|
||||
|
||||
el.style.overflow = curOverflow;
|
||||
|
||||
return isOverflowing;
|
||||
}
|
||||
|
||||
function resizeTextarea() {
|
||||
if (!textareaRef.value || !inputWrapperRef.value) {
|
||||
if (textareaRef.value === undefined) {
|
||||
return; // cannot chnge textarea if element is not available
|
||||
}
|
||||
|
||||
if (!multiline) {
|
||||
return; // textarea wont be displayed if multiline === false
|
||||
}
|
||||
|
||||
if (!checkOverflow(textareaRef.value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const scrollHeight = textareaRef.value.scrollHeight + 2;
|
||||
const textAreaElement = textareaRef.value!;
|
||||
|
||||
inputWrapperRef.value.style.height = `${scrollHeight}px`;
|
||||
const scrollHeight = textAreaElement.scrollHeight + 2;
|
||||
textAreaElement.style.height = `${scrollHeight}px`;
|
||||
}
|
||||
|
||||
const htmlInputType = computed(() => {
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import {
|
||||
import { presetScrollbar } from 'unocss-preset-scrollbar';
|
||||
|
||||
export default defineConfig({
|
||||
presets: [presetUno(), presetAttributify(), presetTypography(), presetScrollbar()],
|
||||
presets: [presetUno(), presetAttributify({ ignoreAttributes: ['size'] }), presetTypography(), presetScrollbar()],
|
||||
transformers: [transformerDirectives(), transformerVariantGroup()],
|
||||
theme: {
|
||||
colors: {
|
||||
|
||||
Reference in new issue
Block a user