Revisions: Explicitly set the 'from' handle position when switching from two-handled mode back to single-handled mode.
props adamsilverstein. fixes #26793. Built from https://develop.svn.wordpress.org/trunk@29052 git-svn-id: http://core.svn.wordpress.org/trunk@28840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ad7bc20cb1
commit
15f3b73984
|
@ -399,11 +399,23 @@ window.wp = window.wp || {};
|
||||||
},
|
},
|
||||||
|
|
||||||
changeMode: function( model, value ) {
|
changeMode: function( model, value ) {
|
||||||
// If we were on the first revision before switching, we have to bump them over one
|
var toIndex = this.revisions.indexOf( this.get( 'to' ) );
|
||||||
if ( value && 0 === this.revisions.indexOf( this.get('to') ) ) {
|
|
||||||
|
// If we were on the first revision before switching to two-handled mode,
|
||||||
|
// bump the 'to' position over one
|
||||||
|
if ( value && 0 === toIndex ) {
|
||||||
this.set({
|
this.set({
|
||||||
from: this.revisions.at(0),
|
from: this.revisions.at( toIndex ),
|
||||||
to: this.revisions.at(1)
|
to: this.revisions.at( toIndex + 1 )
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// When switching back to single-handled mode, reset 'from' model to
|
||||||
|
// one position before the 'to' model
|
||||||
|
if ( ! value && 0 !== toIndex ) { // '! value' means switching to single-handled mode
|
||||||
|
this.set({
|
||||||
|
from: this.revisions.at( toIndex - 1 ),
|
||||||
|
to: this.revisions.at( toIndex )
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.0-alpha-20140709';
|
$wp_version = '4.0-alpha-20140710';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue