From c55e0b7d52ecb748c3016c245ac501be8dd0a481 Mon Sep 17 00:00:00 2001 From: Sominemo Date: Wed, 8 Jan 2025 18:35:25 +0200 Subject: [PATCH] Prevent jittering during editing --- editor.html | 48 ++++++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/editor.html b/editor.html index 0eeebe8a..a5e657b3 100644 --- a/editor.html +++ b/editor.html @@ -1597,10 +1597,8 @@

Telegram Limits Editor

this.markDirty(); }); - setTimeout(() => { - itemName.style.height = "5px"; - itemName.style.height = (itemName.scrollHeight) + "px"; - }, 0); + itemName.style.height = "5px"; + itemName.style.height = (itemName.scrollHeight) + "px"; const itemHint = document.createElement('textarea'); itemHint.value = sectionLocale.items[item.id].hint || ''; @@ -1617,10 +1615,8 @@

Telegram Limits Editor

this.markDirty(); }); - setTimeout(() => { - itemHint.style.height = "5px"; - itemHint.style.height = (itemHint.scrollHeight) + "px"; - }, 0); + itemHint.style.height = "5px"; + itemHint.style.height = (itemHint.scrollHeight) + "px"; const itemContentContainer = document.createElement('div'); itemContentContainer.classList.add('item-content-container'); @@ -1643,10 +1639,8 @@

Telegram Limits Editor

this.markDirty(); }); - setTimeout(() => { - itemContent.style.height = "5px"; - itemContent.style.height = (itemContent.scrollHeight) + "px"; - }, 0); + itemContent.style.height = "5px"; + itemContent.style.height = (itemContent.scrollHeight) + "px"; const itemContentPremiumContainer = document.createElement('div'); itemContentPremiumContainer.classList.add('item-content-premium-container'); @@ -1673,10 +1667,8 @@

Telegram Limits Editor

this.markDirty(); }); - setTimeout(() => { - itemContentPremium.style.height = "5px"; - itemContentPremium.style.height = (itemContentPremium.scrollHeight) + "px"; - }, 0); + itemContentPremium.style.height = "5px"; + itemContentPremium.style.height = (itemContentPremium.scrollHeight) + "px"; const idContainer = document.createElement('div'); idContainer.classList.add('id-container'); @@ -1780,10 +1772,8 @@

Telegram Limits Editor

idContainer.textContent = itemId; }); - setTimeout(() => { - newItemName.style.height = "5px"; - newItemName.style.height = (newItemName.scrollHeight) + "px"; - }, 0); + newItemName.style.height = "5px"; + newItemName.style.height = (newItemName.scrollHeight) + "px"; const newItemHint = document.createElement('textarea'); newItemHint.placeholder = 'Hint'; @@ -1796,10 +1786,8 @@

Telegram Limits Editor

newItemHint.style.height = (newItemHint.scrollHeight) + "px"; }); - setTimeout(() => { - newItemHint.style.height = "5px"; - newItemHint.style.height = (newItemHint.scrollHeight) + "px"; - }, 0); + newItemHint.style.height = "5px"; + newItemHint.style.height = (newItemHint.scrollHeight) + "px"; const newItemContent = document.createElement('textarea'); newItemContent.placeholder = 'Limit Description'; @@ -1812,10 +1800,8 @@

Telegram Limits Editor

newItemContent.style.height = (newItemContent.scrollHeight) + "px"; }); - setTimeout(() => { - newItemContent.style.height = "5px"; - newItemContent.style.height = (newItemContent.scrollHeight) + "px"; - }, 0); + newItemContent.style.height = "5px"; + newItemContent.style.height = (newItemContent.scrollHeight) + "px"; const newItemContentPremiumContainer = document.createElement('div'); newItemContentPremiumContainer.classList.add('item-content-premium-container'); @@ -1837,10 +1823,8 @@

Telegram Limits Editor

newItemContentPremium.style.height = (newItemContentPremium.scrollHeight) + "px"; }); - setTimeout(() => { - newItemContentPremium.style.height = "5px"; - newItemContentPremium.style.height = (newItemContentPremium.scrollHeight) + "px"; - }, 0); + newItemContentPremium.style.height = "5px"; + newItemContentPremium.style.height = (newItemContentPremium.scrollHeight) + "px"; addItemPanelRow.appendChild(idContainer);