Revisions: Fix PHP loading of comparison to first revision, and premature rendering of tooltip.
Props aaroncampbell, markjaquith. Fixes #24873 for trunk. git-svn-id: http://core.svn.wordpress.org/trunk@24864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a1c4a3fb76
commit
b53325cad3
|
@ -179,8 +179,11 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null
|
||||||
// Now, grab the initial diff
|
// Now, grab the initial diff
|
||||||
$compare_two_mode = is_numeric( $from );
|
$compare_two_mode = is_numeric( $from );
|
||||||
if ( ! $compare_two_mode ) {
|
if ( ! $compare_two_mode ) {
|
||||||
$from = array_keys( array_slice( $revisions, array_search( $selected_revision_id, array_keys( $revisions ) ) - 1, 1, true ) );
|
$found = array_search( $selected_revision_id, array_keys( $revisions ) );
|
||||||
$from = $from[0];
|
if ( $found )
|
||||||
|
$from = array_shift( array_keys( array_slice( $revisions, $found - 1, 1, true ) ) );
|
||||||
|
else
|
||||||
|
$from = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$from = absint( $from );
|
$from = absint( $from );
|
||||||
|
|
|
@ -155,8 +155,6 @@ window.wp = window.wp || {};
|
||||||
this.listenTo( this.slider, 'hovered:revision', this.updateRevision );
|
this.listenTo( this.slider, 'hovered:revision', this.updateRevision );
|
||||||
this.listenTo( this.slider, 'change:hovering', this.setHovering );
|
this.listenTo( this.slider, 'change:hovering', this.setHovering );
|
||||||
this.listenTo( this.slider, 'change:scrubbing', this.setScrubbing );
|
this.listenTo( this.slider, 'change:scrubbing', this.setScrubbing );
|
||||||
|
|
||||||
this.set({ revision: this.revisions.get( this.frame.get('to') ) });
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -754,9 +752,12 @@ window.wp = window.wp || {};
|
||||||
},
|
},
|
||||||
|
|
||||||
prepare: function() {
|
prepare: function() {
|
||||||
return _.extend( { type: 'tooltip' }, {
|
if ( _.isNull( this.model.get('revision') ) )
|
||||||
attributes: this.model.get('revision').toJSON()
|
return;
|
||||||
});
|
else
|
||||||
|
return _.extend( { type: 'tooltip' }, {
|
||||||
|
attributes: this.model.get('revision').toJSON()
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
|
Loading…
Reference in New Issue