diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index aaa7e035..7c15b82b 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,4 +2,4 @@ blank_issues_enabled: true contact_links: - name: Suggest edits url: https://limits.tginfo.me/editor.html - about: Edit Telegram Limits website and send your suggestion to @tginfo \ No newline at end of file + about: Use our editor to submit suggestions \ No newline at end of file diff --git a/editor.html b/editor.html index c7a5e2cf..7fc263fb 100644 --- a/editor.html +++ b/editor.html @@ -868,6 +868,18 @@

Telegram Limits Editor

} static async suggestEdit() { + let error; + try { + this.editor.validate(); + } catch (e) { + console.error(e); + const answer = confirm("Errors found in the generated files. Do you want to submit a bug report?\n\nError: " + e.message); + if (!answer) { + return; + } + error = e; + } + try { const dialog = document.createElement('dialog'); dialog.innerHTML = ` @@ -896,6 +908,11 @@

Telegram Limits Editor

`; + if (error) { + dialog.querySelector('#description').maxLength = 600; + dialog.querySelector('#description').value = ' { dialog.close(); dialog.remove(); @@ -904,10 +921,19 @@

Telegram Limits Editor

try { const url = 'https://limits.tginfo.me/prop/suggest.php'; + let desc = dialog.querySelector('#description').value; + + if (error) { + desc += '\n\nError: ' + error.message; + if (desc.length > 800) { + desc = desc.slice(0, 800); + } + } + const data = { structure: this.structure, localization: this.localization, - description: dialog.querySelector('#description').value, + description: desc, contact: dialog.querySelector('#contact').value, };