jenkins-bot has submitted this change and it was merged.
Change subject: Disable Apply Changes in reference dialog until changes have
been made
......................................................................
Disable Apply Changes in reference dialog until changes have been made
Bug: T57976
Change-Id: Ib5229bdc480ec437436c5d8d351b06417d4ffd9b
---
M modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
1 file changed, 22 insertions(+), 4 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 1b0432b..054cf47 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
@@ -138,17 +138,33 @@
/* Methods */
/**
+ * Determine whether the reference document we're editing has any content.
+ * @return {boolean} Document has content
+ */
+ve.ui.MWReferenceDialog.prototype.documentHasContent = function () {
+ // TODO: Check for other types of empty, e.g. only whitespace?
+ return
this.referenceModel.getDocument().data.countNonInternalElements() > 2;
+};
+
+/**
* Handle reference surface change events
*/
ve.ui.MWReferenceDialog.prototype.onDocumentTransact = function () {
- var data = this.referenceModel.getDocument().data,
- // TODO: Check for other types of empty, e.g. only whitespace?
- hasContent = data.countNonInternalElements() > 2;
+ var hasContent = this.documentHasContent();
this.actions.setAbilities( {
apply: hasContent,
insert: hasContent,
select: !hasContent && !this.search.isIndexEmpty()
+ } );
+};
+
+/**
+ * Handle reference group input change events
+ */
+ve.ui.MWReferenceDialog.prototype.onReferenceGroupInputChange = function () {
+ this.actions.setAbilities( {
+ apply: this.documentHasContent()
} );
};
@@ -277,6 +293,7 @@
$overlay: this.$overlay,
emptyGroupName: ve.msg(
'visualeditor-dialog-reference-options-group-placeholder' )
} );
+ this.referenceGroupInput.input.connect( this, { change:
'onReferenceGroupInputChange' } );
this.referenceGroupField = new OO.ui.FieldLayout(
this.referenceGroupInput, {
$: this.$,
align: 'top',
@@ -375,7 +392,8 @@
// If not, set disabled based on whether or not there
are any existing ones.
this.actions.setAbilities( {
select: !( this.selectedNode instanceof
ve.dm.MWReferenceNode ) &&
- !this.search.isIndexEmpty()
+ !this.search.isIndexEmpty(),
+ apply: false
} );
this.referenceGroupInput.populateMenu(
this.getFragment().getDocument().getInternalList() );
--
To view, visit https://gerrit.wikimedia.org/r/176861
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib5229bdc480ec437436c5d8d351b06417d4ffd9b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>
Gerrit-Reviewer: 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