Skip to content

Commit

Permalink
Prevent jittering during editing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sominemo committed Jan 8, 2025
1 parent d48aa75 commit c55e0b7
Showing 1 changed file with 16 additions and 32 deletions.
48 changes: 16 additions & 32 deletions editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -1597,10 +1597,8 @@ <h1>Telegram Limits Editor</h1>
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 || '';
Expand All @@ -1617,10 +1615,8 @@ <h1>Telegram Limits Editor</h1>
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');
Expand All @@ -1643,10 +1639,8 @@ <h1>Telegram Limits Editor</h1>
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');
Expand All @@ -1673,10 +1667,8 @@ <h1>Telegram Limits Editor</h1>
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');
Expand Down Expand Up @@ -1780,10 +1772,8 @@ <h1>Telegram Limits Editor</h1>
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';
Expand All @@ -1796,10 +1786,8 @@ <h1>Telegram Limits Editor</h1>
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';
Expand All @@ -1812,10 +1800,8 @@ <h1>Telegram Limits Editor</h1>
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');
Expand All @@ -1837,10 +1823,8 @@ <h1>Telegram Limits Editor</h1>
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);

Expand Down

0 comments on commit c55e0b7

Please sign in to comment.