Stabilize final text autosize
This commit is contained in:
@@ -124,10 +124,24 @@
|
|||||||
<!-- Edit Area (Auto resize textarea) -->
|
<!-- Edit Area (Auto resize textarea) -->
|
||||||
<label class="block text-xs font-bold text-app-textMuted mb-2 uppercase tracking-wider">Финальный текст</label>
|
<label class="block text-xs font-bold text-app-textMuted mb-2 uppercase tracking-wider">Финальный текст</label>
|
||||||
<textarea name="final_text"
|
<textarea name="final_text"
|
||||||
x-data="{ resize() { $el.style.height = 'auto'; $el.style.height = $el.scrollHeight + 'px' } }"
|
x-data="{
|
||||||
x-init="$nextTick(() => resize()); window.addEventListener('resize', () => $nextTick(() => resize()))"
|
ro: null,
|
||||||
|
resize() {
|
||||||
|
$el.style.height = '0px';
|
||||||
|
$el.style.height = $el.scrollHeight + 'px';
|
||||||
|
},
|
||||||
|
init() {
|
||||||
|
$el.value = $el.value.replace(/\s+$/u, '');
|
||||||
|
this.$nextTick(() => requestAnimationFrame(() => this.resize()));
|
||||||
|
this.ro = new ResizeObserver(() => this.$nextTick(() => this.resize()));
|
||||||
|
this.ro.observe($el);
|
||||||
|
},
|
||||||
|
destroy() {
|
||||||
|
this.ro?.disconnect();
|
||||||
|
}
|
||||||
|
}"
|
||||||
@input="resize()"
|
@input="resize()"
|
||||||
class="textarea w-full font-sans text-sm leading-relaxed resize-none overflow-hidden p-3 bg-app-bg border border-app-border min-h-48"
|
class="textarea w-full font-sans text-sm leading-relaxed resize-none overflow-hidden p-3 bg-app-bg border border-app-border min-h-[150px]"
|
||||||
placeholder="Напишите идеальный пост здесь...">{{ p.review_text.rstrip() }}</textarea>
|
placeholder="Напишите идеальный пост здесь...">{{ p.review_text.rstrip() }}</textarea>
|
||||||
|
|
||||||
<!-- Meta Inputs row -->
|
<!-- Meta Inputs row -->
|
||||||
|
|||||||
Reference in New Issue
Block a user