jenkins-bot has submitted this change and it was merged.
Change subject: Fix inconsistencies and errors with Dialog onOpen/Close
......................................................................
Fix inconsistencies and errors with Dialog onOpen/Close
Removed inherited (and often wrong) documentation, replaced direct
usage of onApplyButtonClick with more standard onClose handling,
and one case of calling the wrong parent method.
Change-Id: I86ed16860e996b42c141a6499eefb9084d759a72
---
M modules/ve/ui/dialogs/ve.ui.MWMediaEditDialog.js
M modules/ve/ui/dialogs/ve.ui.MWMediaInsertDialog.js
M modules/ve/ui/dialogs/ve.ui.MWMetaDialog.js
M modules/ve/ui/dialogs/ve.ui.MWReferenceDialog.js
M modules/ve/ui/dialogs/ve.ui.MWTransclusionDialog.js
M modules/ve/ui/dialogs/ve.ui.PagedDialog.js
M modules/ve/ui/ve.ui.Dialog.js
7 files changed, 27 insertions(+), 114 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve/ui/dialogs/ve.ui.MWMediaEditDialog.js
b/modules/ve/ui/dialogs/ve.ui.MWMediaEditDialog.js
index e45e550..31e7293 100644
--- a/modules/ve/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -57,11 +57,6 @@
/* Methods */
-/**
- * Handle frame ready events.
- *
- * @method
- */
ve.ui.MWMediaEditDialog.prototype.initialize = function () {
// Call parent method
ve.ui.Dialog.prototype.initialize.call( this );
@@ -78,11 +73,6 @@
this.$body.append( this.contentFieldset.$ );
};
-/**
- * Handle frame ready events.
- *
- * @method
- */
ve.ui.MWMediaEditDialog.prototype.onOpen = function () {
var data, doc = this.surface.getModel().getDocument();
@@ -113,12 +103,6 @@
this.captionSurface.view.documentView.documentNode.$.focus();
};
-/**
- * Handle frame ready events.
- *
- * @method
- * @param {string} action Action that caused the window to be closed
- */
ve.ui.MWMediaEditDialog.prototype.onClose = function ( action ) {
var data, doc, surfaceModel = this.surface.getModel();
diff --git a/modules/ve/ui/dialogs/ve.ui.MWMediaInsertDialog.js
b/modules/ve/ui/dialogs/ve.ui.MWMediaInsertDialog.js
index 5c25aad..ebf8885 100644
--- a/modules/ve/ui/dialogs/ve.ui.MWMediaInsertDialog.js
+++ b/modules/ve/ui/dialogs/ve.ui.MWMediaInsertDialog.js
@@ -38,48 +38,35 @@
/* Methods */
-/**
- * Handle media select events.
- *
- * @method
- * @param {string} item Selected item
- */
ve.ui.MWMediaInsertDialog.prototype.onSelect = function ( item ) {
this.item = item;
this.applyButton.setDisabled( item === null );
};
-/**
- * Handle apply button click events.
- *
- * @method
- */
-ve.ui.MWMediaInsertDialog.prototype.onApplyButtonClick = function () {
- var info = this.item.imageinfo[0];
-
- this.surface.getModel().getFragment().insertContent( [
- {
- 'type': 'mwBlockImage',
- 'attributes': {
- 'align': 'right',
- 'href': info.descriptionurl,
- 'src': info.thumburl,
- 'width': info.thumbwidth,
- 'height': info.thumbheight
- }
- },
- { 'type': '/mwBlockImage' }
- ] );
+ve.ui.MWMediaInsertDialog.prototype.onClose = function ( action ) {
+ var info;
// Parent method
- ve.ui.Dialog.prototype.onApplyButtonClick.call( this );
+ ve.ui.Dialog.prototype.onClose.call( this );
+
+ if ( action === 'apply' ) {
+ info = this.item.imageinfo[0];
+ this.surface.getModel().getFragment().insertContent( [
+ {
+ 'type': 'mwBlockImage',
+ 'attributes': {
+ 'align': 'right',
+ 'href': info.descriptionurl,
+ 'src': info.thumburl,
+ 'width': info.thumbwidth,
+ 'height': info.thumbheight
+ }
+ },
+ { 'type': '/mwBlockImage' }
+ ] );
+ }
};
-/**
- * Initialize frame contents.
- *
- * @method
- */
ve.ui.MWMediaInsertDialog.prototype.initialize = function () {
// Parent method
ve.ui.Dialog.prototype.initialize.call( this );
diff --git a/modules/ve/ui/dialogs/ve.ui.MWMetaDialog.js
b/modules/ve/ui/dialogs/ve.ui.MWMetaDialog.js
index 84bb58a..04c2e20 100644
--- a/modules/ve/ui/dialogs/ve.ui.MWMetaDialog.js
+++ b/modules/ve/ui/dialogs/ve.ui.MWMetaDialog.js
@@ -45,11 +45,6 @@
/* Methods */
-/**
- * Handle frame ready events.
- *
- * @method
- */
ve.ui.MWMetaDialog.prototype.initialize = function () {
var languagePromise;
@@ -143,15 +138,13 @@
}, this ) );
};
-/**
- * Handle frame ready events.
- *
- * @method
- */
ve.ui.MWMetaDialog.prototype.onOpen = function () {
var surfaceModel = this.surface.getModel(),
categoryWidget = this.categoryWidget,
defaultSortKeyItem = this.getDefaultSortKeyItem();
+
+ // Parent method
+ ve.ui.PagedDialog.prototype.onOpen.call( this );
this.defaultSortInput.setValue(
defaultSortKeyItem ? defaultSortKeyItem.getAttribute( 'content'
) : ''
@@ -162,21 +155,12 @@
surfaceModel.breakpoint();
surfaceModel.stopHistoryTracking();
- // Parent method
- ve.ui.PagedDialog.prototype.onOpen.call( this );
-
// Update input position once visible
setTimeout( function () {
categoryWidget.fitInput();
} );
};
-/**
- * Handle frame ready events.
- *
- * @method
- * @param {string} action Action that caused the window to be closed
- */
ve.ui.MWMetaDialog.prototype.onClose = function ( action ) {
var hasTransactions, newDefaultSortKeyItem, newDefaultSortKeyItemData,
surfaceModel = this.surface.getModel(),
diff --git a/modules/ve/ui/dialogs/ve.ui.MWReferenceDialog.js
b/modules/ve/ui/dialogs/ve.ui.MWReferenceDialog.js
index 57dee19..7e4815f 100644
--- a/modules/ve/ui/dialogs/ve.ui.MWReferenceDialog.js
+++ b/modules/ve/ui/dialogs/ve.ui.MWReferenceDialog.js
@@ -58,11 +58,6 @@
/* Methods */
-/**
- * Handle frame ready events.
- *
- * @method
- */
ve.ui.MWReferenceDialog.prototype.initialize = function () {
// Call parent method
ve.ui.Dialog.prototype.initialize.call( this );
@@ -100,11 +95,6 @@
);
};
-/**
- * Handle frame ready events.
- *
- * @method
- */
ve.ui.MWReferenceDialog.prototype.onOpen = function () {
var focusedNode, data, refGroup, listKey,
doc = this.surface.getModel().getDocument();
@@ -142,19 +132,13 @@
this.referenceSurface.view.documentView.documentNode.$.focus();
};
-/**
- * Handle frame ready events.
- *
- * @method
- * @param {string} action Action that caused the window to be closed
- */
ve.ui.MWReferenceDialog.prototype.onClose = function ( action ) {
var data, doc, listIndex, listGroup, listKey, refGroup, newItem,
refNode, oldListGroup,
oldListKey, oldNodes, internalList, attrChanges,
surfaceModel = this.surface.getModel();
// Parent method
- ve.ui.Dialog.prototype.onOpen.call( this );
+ ve.ui.Dialog.prototype.onClose.call( this );
// Save changes
if ( action === 'apply' ) {
diff --git a/modules/ve/ui/dialogs/ve.ui.MWTransclusionDialog.js
b/modules/ve/ui/dialogs/ve.ui.MWTransclusionDialog.js
index a96a14a..31e3c28 100644
--- a/modules/ve/ui/dialogs/ve.ui.MWTransclusionDialog.js
+++ b/modules/ve/ui/dialogs/ve.ui.MWTransclusionDialog.js
@@ -60,11 +60,6 @@
/* Methods */
-/**
- * Handle frame ready events.
- *
- * @method
- */
ve.ui.MWTransclusionDialog.prototype.initialize = function () {
// Call parent method
ve.ui.PagedDialog.prototype.initialize.call( this );
@@ -76,11 +71,6 @@
} );
};
-/**
- * Handle frame open events.
- *
- * @method
- */
ve.ui.MWTransclusionDialog.prototype.onOpen = function () {
// Parent method
ve.ui.PagedDialog.prototype.onOpen.call( this );
@@ -101,18 +91,15 @@
}
};
-/**
- * Handle window close events.
- *
- * @param {string} action Action that caused the window to be closed
- */
ve.ui.MWTransclusionDialog.prototype.onClose = function ( action ) {
var surfaceModel = this.surface.getModel(),
obj = this.transclusion.getPlainObject();
+ // Parent method
+ ve.ui.PagedDialog.prototype.onClose.call( this );
+
// Save changes
if ( action === 'apply' ) {
-
if ( this.node instanceof ve.ce.MWTransclusionNode ) {
surfaceModel.getFragment().changeAttributes( { 'mw':
obj } );
} else {
@@ -131,9 +118,6 @@
this.clearPages();
this.node = null;
this.content = null;
-
- // Parent method
- ve.ui.PagedDialog.prototype.onClose.call( this );
};
/**
diff --git a/modules/ve/ui/dialogs/ve.ui.PagedDialog.js
b/modules/ve/ui/dialogs/ve.ui.PagedDialog.js
index 5a56084..3e9b445 100644
--- a/modules/ve/ui/dialogs/ve.ui.PagedDialog.js
+++ b/modules/ve/ui/dialogs/ve.ui.PagedDialog.js
@@ -43,11 +43,6 @@
/* Methods */
-/**
- * Handle frame ready events.
- *
- * @method
- */
ve.ui.PagedDialog.prototype.initialize = function () {
// Call parent method
ve.ui.Dialog.prototype.initialize.call( this );
diff --git a/modules/ve/ui/ve.ui.Dialog.js b/modules/ve/ui/ve.ui.Dialog.js
index 3b99e8e..de673c8 100644
--- a/modules/ve/ui/ve.ui.Dialog.js
+++ b/modules/ve/ui/ve.ui.Dialog.js
@@ -124,11 +124,6 @@
}
};
-/**
- * Initialize frame contents.
- *
- * @method
- */
ve.ui.Dialog.prototype.initialize = function () {
// Call parent method
ve.ui.Window.prototype.initialize.call( this );
--
To view, visit https://gerrit.wikimedia.org/r/69500
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I86ed16860e996b42c141a6499eefb9084d759a72
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[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