File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1572,7 +1572,21 @@ function initEditor() {
1572
1572
} ) ;
1573
1573
} ) . trigger ( 'keyup' ) ;
1574
1574
1575
- $ ( '#commit-button' ) . click ( function ( event ) {
1575
+ // Using events from https://github.com/codedance/jquery.AreYouSure#advanced-usage
1576
+ // to enable or disable the commit button
1577
+ const $commitButton = $ ( '#commit-button' ) ;
1578
+ const $editForm = $ ( '.ui.edit.form' ) ;
1579
+
1580
+ // Disabling the button at the start
1581
+ $commitButton . prop ( 'disabled' , true ) ;
1582
+ $editForm . on ( 'dirty.areYouSure' , function ( ) {
1583
+ $commitButton . prop ( 'disabled' , false ) ;
1584
+ } ) ;
1585
+ $editForm . on ( 'clean.areYouSure' , function ( ) {
1586
+ $commitButton . prop ( 'disabled' , true ) ;
1587
+ } ) ;
1588
+
1589
+ $commitButton . click ( function ( event ) {
1576
1590
// A modal which asks if an empty file should be committed
1577
1591
if ( $editArea . val ( ) . length === 0 ) {
1578
1592
$ ( '#edit-empty-content-modal' ) . modal ( {
You can’t perform that action at this time.
0 commit comments