From a12e5e724eb9c8905a08932f201a66dc31f85522 Mon Sep 17 00:00:00 2001 From: Sominemo Date: Wed, 8 Jan 2025 23:12:40 +0200 Subject: [PATCH] Maintain order when changing ID --- editor.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/editor.html b/editor.html index 78aa3158..9f22f6b0 100644 --- a/editor.html +++ b/editor.html @@ -1245,6 +1245,14 @@

Telegram Limits Editor

this.localization[newId] = this.localization[oldId]; delete this.localization[oldId]; + const newLocalization = {}; + + for (const section of this.structure) { + newLocalization[section.id] = this.localization[section.id]; + } + + this.localization = newLocalization; + this.markDirty(); this.constructContent(); }); @@ -1705,6 +1713,14 @@

Telegram Limits Editor

sectionLocale.items[newId] = sectionLocale.items[oldId]; delete sectionLocale.items[oldId]; + const newItems = {}; + + for (const item of section.items) { + newItems[item.id] = sectionLocale.items[item.id]; + } + + sectionLocale.items = newItems; + this.markDirty(); this.constructContent(); });