Skip to content

Commit

Permalink
Maintain order when changing ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Sominemo committed Jan 8, 2025
1 parent 2c40ce1 commit a12e5e7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,14 @@ <h1>Telegram Limits Editor</h1>
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();
});
Expand Down Expand Up @@ -1705,6 +1713,14 @@ <h1>Telegram Limits Editor</h1>
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();
});
Expand Down

0 comments on commit a12e5e7

Please sign in to comment.