@@ -20,11 +20,9 @@ async function tryOnEditContent(e) {
2020 const rawContent = segment . querySelector ( '.raw-content' ) ;
2121
2222 let comboMarkdownEditor : ComboMarkdownEditor ;
23- let form : HTMLFormElement ;
2423
2524 const cancelAndReset = ( e ) => {
2625 e . preventDefault ( ) ;
27- form . classList . add ( 'ignore-dirty' ) ;
2826 showElem ( renderContent ) ;
2927 hideElem ( editContentZone ) ;
3028 comboMarkdownEditor . dropzoneReloadFiles ( ) ;
@@ -51,8 +49,7 @@ async function tryOnEditContent(e) {
5149 showErrorToast ( data . errorMessage ) ;
5250 return ;
5351 }
54- form . classList . remove ( 'ignore-dirty' ) ; // the form is no longer dirty
55- reinitializeAreYouSure ( form ) ;
52+ reinitializeAreYouSure ( editContentZone . querySelector ( 'form' ) ) ; // the form is no longer dirty
5653 editContentZone . setAttribute ( 'data-content-version' , data . contentVersion ) ;
5754 if ( ! data . content ) {
5855 renderContent . innerHTML = document . querySelector ( '#no-content' ) . innerHTML ;
@@ -91,7 +88,7 @@ async function tryOnEditContent(e) {
9188 comboMarkdownEditor = getComboMarkdownEditor ( editContentZone . querySelector ( '.combo-markdown-editor' ) ) ;
9289 if ( ! comboMarkdownEditor ) {
9390 editContentZone . innerHTML = document . querySelector ( '#issue-comment-editor-template' ) . innerHTML ;
94- form = editContentZone . querySelector ( 'form' ) ;
91+ const form = editContentZone . querySelector ( 'form' ) ;
9592 applyAreYouSure ( form ) ;
9693 const saveButton = querySingleVisibleElem < HTMLButtonElement > ( editContentZone , '.ui.primary.button' ) ;
9794 const cancelButton = querySingleVisibleElem < HTMLButtonElement > ( editContentZone , '.ui.cancel.button' ) ;
@@ -100,9 +97,6 @@ async function tryOnEditContent(e) {
10097 comboMarkdownEditor . container . addEventListener ( ComboMarkdownEditor . EventUploadStateChanged , syncUiState ) ;
10198 cancelButton . addEventListener ( 'click' , cancelAndReset ) ;
10299 form . addEventListener ( 'submit' , saveAndRefresh ) ;
103- } else {
104- form = editContentZone . querySelector ( 'form' ) ;
105- form . classList . remove ( 'ignore-dirty' ) ; // the form is shown again, respect the "dirty" state
106100 }
107101
108102 // FIXME: ideally here should reload content and attachment list from backend for existing editor, to avoid losing data
0 commit comments