jenkins-bot has submitted this change and it was merged.
Change subject: Don't re-enable apply changes in reference dialog if the
changes have been undone
......................................................................
Don't re-enable apply changes in reference dialog if the changes have been
undone
Per Roan on Ib5229bdc
Bug: T57976
Change-Id: I0450ab59ea8aa2e3130eb9124de74e67ffc0497f
---
M modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
1 file changed, 14 insertions(+), 3 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
index 054cf47..acab8d7 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
@@ -146,6 +146,16 @@
return
this.referenceModel.getDocument().data.countNonInternalElements() > 2;
};
+/*
+ * Determine whether any changes have been made (and haven't been undone)
+ * @return {boolean} Dialog can be applied
+ */
+ve.ui.MWReferenceDialog.prototype.canApply = function () {
+ return this.documentHasContent() &&
+ (
this.referenceSurface.getSurface().getModel().hasBeenModified() ||
+ this.referenceGroupInput.input.getValue() !==
this.originalGroup );
+};
+
/**
* Handle reference surface change events
*/
@@ -153,7 +163,7 @@
var hasContent = this.documentHasContent();
this.actions.setAbilities( {
- apply: hasContent,
+ apply: this.canApply(),
insert: hasContent,
select: !hasContent && !this.search.isIndexEmpty()
} );
@@ -164,7 +174,7 @@
*/
ve.ui.MWReferenceDialog.prototype.onReferenceGroupInputChange = function () {
this.actions.setAbilities( {
- apply: this.documentHasContent()
+ apply: this.canApply()
} );
};
@@ -245,7 +255,8 @@
this.referenceModel.getDocument().connect( this, { transact:
'onDocumentTransact' } );
// Initialization
- this.referenceGroupInput.input.setValue( this.referenceModel.getGroup()
);
+ this.originalGroup = this.referenceModel.getGroup();
+ this.referenceGroupInput.input.setValue( this.originalGroup );
this.contentFieldset.$element.append( this.referenceSurface.$element );
this.referenceSurface.initialize();
--
To view, visit https://gerrit.wikimedia.org/r/177944
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0450ab59ea8aa2e3130eb9124de74e67ffc0497f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits