Skip to content

Commit

Permalink
ID fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sominemo committed Jan 8, 2025
1 parent c55e0b7 commit ff588b9
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,7 @@ <h1>Telegram Limits Editor</h1>

const idContainer = document.createElement('span');
idContainer.classList.add('id-container');
idContainer.textContent = '<empty>>';
idContainer.addEventListener('click', () => {
const newId = prompt('New Section ID:', sectionId);

Expand All @@ -1319,7 +1320,7 @@ <h1>Telegram Limits Editor</h1>
}

sectionId = newId;
idContainer.textContent = newId;
idContainer.textContent = newId || '<empty>';
});

const newSectionName = document.createElement('input');
Expand All @@ -1337,7 +1338,7 @@ <h1>Telegram Limits Editor</h1>
} while (checkIfSectionIdExists(newSectionId));

sectionId = newSectionId;
idContainer.textContent = sectionId;
idContainer.textContent = sectionId || '<empty>';
});

const colorSuggestions = [
Expand Down Expand Up @@ -1749,6 +1750,28 @@ <h1>Telegram Limits Editor</h1>

const idContainer = document.createElement('span');
idContainer.classList.add('id-container');
idContainer.textContent = '<empty>';

idContainer.addEventListener('click', () => {
const newId = prompt('New Item ID:', itemId);

if (!newId) return;

try {
this.editor.validateSectionId(newId);
} catch (error) {
alert(error.message);
return;
}

if (checkIfItemIdExists(newId)) {
alert('Item with this ID already exists.');
return;
}

itemId = newId;
idContainer.textContent = itemId || '<empty>';
});

const newItemTitleContainer = document.createElement('div');
newItemTitleContainer.classList.add('title-field-container');
Expand All @@ -1769,7 +1792,7 @@ <h1>Telegram Limits Editor</h1>
} while (checkIfItemIdExists(newItemId));

itemId = newItemId;
idContainer.textContent = itemId;
idContainer.textContent = itemId || '<empty>';
});

newItemName.style.height = "5px";
Expand Down

0 comments on commit ff588b9

Please sign in to comment.