diff --git a/editor.html b/editor.html
index 9f22f6b0..fe580a8f 100644
--- a/editor.html
+++ b/editor.html
@@ -831,6 +831,79 @@
Telegram Limits Editor
static contentElement = null;
static draggingType = null;
+ static async openHelp(source) {
+ alert("We're already working on documentation. Until then, for guidance, please contact contributors directly.");
+ }
+
+ static async suggestEdit() {
+ try {
+ const dialog = document.createElement('dialog');
+ dialog.innerHTML = `
+
+ `;
+
+ dialog.querySelector('#cancelButton').addEventListener('click', () => {
+ dialog.close();
+ dialog.remove();
+ });
+ dialog.querySelector('#sendButton').addEventListener('click', async () => {
+ try {
+ const url = 'https://limits.tginfo.me/prop/suggest.php';
+
+ const data = {
+ structure: this.structure,
+ localization: this.localization,
+ description: dialog.querySelector('#description').value,
+ contact: dialog.querySelector('#contact').value,
+ };
+
+ const response = await fetch(url, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify(data),
+ });
+
+ const responseText = await response.text();
+ if (response.ok) {
+ alert('✅ Suggestion sent successfully:\n\n' + responseText);
+ } else {
+ alert('⛔️ An error occurred while sending the suggestion:\n\n' + responseText);
+ }
+ } catch (e) {
+ console.error(e);
+ alert('An error occurred while sending the suggestion: ' + e.message);
+ }
+ });
+
+ document.body.appendChild(dialog);
+ dialog.showModal();
+ } catch (e) {
+ console.error(e);
+ alert('An error occurred while sending the suggestion: ' + e.message);
+ }
+ }
+
static async check() {
if (!('showDirectoryPicker' in window)) {
alert('Your browser does not support the File System Access API. ' +
@@ -1024,13 +1097,23 @@ Telegram Limits Editor
helpButton.classList.add('icon');
helpButton.classList.add('secondary');
helpButton.textContent = 'help';
+ helpButton.title = 'Help & Documentation';
helpButton.addEventListener('click', () => EditorUi.openHelp("toolbar"));
toolbar.appendChild(helpButton);
+ const sendButton = document.createElement('button');
+ sendButton.classList.add('icon');
+ sendButton.classList.add('secondary');
+ sendButton.textContent = 'send';
+ sendButton.title = 'Send The Edit to @tginfo';
+ sendButton.addEventListener('click', () => EditorUi.suggestEdit());
+ toolbar.appendChild(sendButton);
+
const saveButton = document.createElement('button');
saveButton.classList.add('icon');
saveButton.classList.add('secondary');
saveButton.textContent = 'save';
+ saveButton.title = 'Save to Disk';
saveButton.addEventListener('click', () => this.save());
toolbar.appendChild(saveButton);