mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 14:33:59 +00:00
Merge "Move setting of minor/watch defaults from MWSaveDialog to Target"
This commit is contained in:
commit
ea5a28e487
|
@ -907,9 +907,8 @@ ve.init.mw.ViewPageTarget.prototype.getSaveOptions = function () {
|
|||
// Firefox has Object.prototype.watch
|
||||
options.watch = undefined;
|
||||
}
|
||||
this.saveDialog.$saveOptions
|
||||
.find( '.ve-ui-mwSaveDialog-checkboxes' )
|
||||
.find( 'input:not(#wpMinoredit, #wpWatchthis)' )
|
||||
this.$checkboxes
|
||||
.not( '#wpMinoredit, #wpWatchthis' )
|
||||
.each( function () {
|
||||
var $this = $( this );
|
||||
// We can't just use $this.val() because .val() always returns the value attribute of
|
||||
|
@ -1219,7 +1218,7 @@ ve.init.mw.ViewPageTarget.prototype.setupSaveDialog = function () {
|
|||
} );
|
||||
// Setup edit summary and checkboxes
|
||||
this.saveDialog.setEditSummary( this.initialEditSummary );
|
||||
this.saveDialog.setupCheckboxes( ve.getObjectValues( this.checkboxes ).join( '\n' ) );
|
||||
this.saveDialog.setupCheckboxes( this.$checkboxes );
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,7 +68,7 @@ ve.init.mw.Target = function VeInitMwTarget( $container, pageName, revisionId )
|
|||
this.startTimeStamp = null;
|
||||
this.doc = null;
|
||||
this.editNotices = null;
|
||||
this.checkboxes = null;
|
||||
this.$checkboxes = null;
|
||||
this.remoteNotices = [];
|
||||
this.localNoticeMessages = [];
|
||||
this.isMobileDevice = (
|
||||
|
@ -190,7 +190,18 @@ ve.init.mw.Target.onLoad = function ( response ) {
|
|||
this.doc = ve.createDocumentFromHtml( this.originalHtml );
|
||||
|
||||
this.remoteNotices = ve.getObjectValues( data.notices );
|
||||
this.checkboxes = data.checkboxes;
|
||||
this.$checkboxes = $( ve.getObjectValues( data.checkboxes ).join( '' ) );
|
||||
// Populate checkboxes with default values for minor and watch
|
||||
this.$checkboxes
|
||||
.filter( '#wpMinoredit' )
|
||||
.prop( 'checked', mw.user.options.get( 'minordefault' ) )
|
||||
.end()
|
||||
.filter( '#wpWatchthis' )
|
||||
.prop( 'checked',
|
||||
mw.user.options.get( 'watchdefault' ) ||
|
||||
( mw.user.options.get( 'watchcreations' ) && !this.pageExists ) ||
|
||||
mw.config.get( 'wgVisualEditor' ).isPageWatched
|
||||
);
|
||||
|
||||
this.baseTimeStamp = data.basetimestamp;
|
||||
this.startTimeStamp = data.starttimestamp;
|
||||
|
|
|
@ -240,27 +240,18 @@ ve.ui.MWSaveDialog.prototype.reset = function () {
|
|||
*
|
||||
* This method is safe to call even when the dialog hasn't been initialized yet.
|
||||
*
|
||||
* @param {string} checkboxes Multiline HTML
|
||||
* @param {jQuery} $checkboxes jQuery collection of checkboxes
|
||||
*/
|
||||
ve.ui.MWSaveDialog.prototype.setupCheckboxes = function ( checkboxes ) {
|
||||
ve.ui.MWSaveDialog.prototype.setupCheckboxes = function ( $checkboxes ) {
|
||||
var saveDialog = this;
|
||||
this.setupDeferred.done( function () {
|
||||
saveDialog.$saveOptions.find( '.ve-ui-mwSaveDialog-checkboxes' )
|
||||
.html( checkboxes )
|
||||
.html( $checkboxes )
|
||||
.find( 'a' )
|
||||
.attr( 'target', '_blank' )
|
||||
.end()
|
||||
.find( '#wpMinoredit' )
|
||||
.prop( 'checked', mw.user.options.get( 'minordefault' ) )
|
||||
.prop( 'tabIndex', 0 )
|
||||
.end()
|
||||
.find( '#wpWatchthis' )
|
||||
.prop( 'checked',
|
||||
mw.user.options.get( 'watchdefault' ) ||
|
||||
( mw.user.options.get( 'watchcreations' ) && !this.pageExists ) ||
|
||||
mw.config.get( 'wgVisualEditor' ).isPageWatched
|
||||
).prop( 'tabIndex', 0 );
|
||||
// TODO: Need to set all checkboxes provided by api tabindex to 0 for proper accessibility
|
||||
.find( 'input' )
|
||||
.prop( 'tabIndex', 0 );
|
||||
} );
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue