Merge pull request 'Fix edit cancel button' (#6421) from JakobDev/forgejo:cancelfix into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6421
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
Otto 2024-12-31 02:10:32 +00:00
commit bd7db225e8
2 changed files with 4 additions and 4 deletions

View file

@ -163,8 +163,8 @@
<div class="field"> <div class="field">
<div class="text right edit"> <div class="text right edit">
<button class="ui basic cancel button">{{ctx.Locale.Tr "repo.issues.cancel"}}</button> <button class="ui basic cancel button" data-button-name="cancel-edit">{{ctx.Locale.Tr "repo.issues.cancel"}}</button>
<button class="ui primary save button">{{ctx.Locale.Tr "repo.issues.save"}}</button> <button class="ui primary save button" data-button-name="save-edit">{{ctx.Locale.Tr "repo.issues.save"}}</button>
</div> </div>
</div> </div>
</div> </div>

View file

@ -464,8 +464,8 @@ async function onEditContent(event) {
comboMarkdownEditor = await initComboMarkdownEditor(editContentZone.querySelector('.combo-markdown-editor')); comboMarkdownEditor = await initComboMarkdownEditor(editContentZone.querySelector('.combo-markdown-editor'));
comboMarkdownEditor.attachedDropzoneInst = await setupDropzone(editContentZone.querySelector('.dropzone')); comboMarkdownEditor.attachedDropzoneInst = await setupDropzone(editContentZone.querySelector('.dropzone'));
editContentZone.addEventListener('ce-quick-submit', saveAndRefresh); editContentZone.addEventListener('ce-quick-submit', saveAndRefresh);
editContentZone.querySelector('.cancel.button').addEventListener('click', cancelAndReset); editContentZone.querySelector('button[data-button-name="cancel-edit"]').addEventListener('click', cancelAndReset);
editContentZone.querySelector('.save.button').addEventListener('click', saveAndRefresh); editContentZone.querySelector('button[data-button-name="save-edit"]').addEventListener('click', saveAndRefresh);
} else { } else {
const tabEditor = editContentZone.querySelector('.combo-markdown-editor').querySelector('.tabular.menu > a[data-tab-for=markdown-writer]'); const tabEditor = editContentZone.querySelector('.combo-markdown-editor').querySelector('.tabular.menu > a[data-tab-for=markdown-writer]');
tabEditor?.click(); tabEditor?.click();