Revisions: improve show_split_view=false support for title.

* When show_split_view argument false, show title changes in a single column and only show title once if title is unchanged.

Props johnbillion, mbelchev.
Fixes #42402.  



git-svn-id: https://develop.svn.wordpress.org/trunk@42966 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Adam Silverstein 2018-04-10 16:11:55 +00:00
parent 495ac15555
commit d68affa9c2
1 changed files with 14 additions and 2 deletions

View File

@ -111,7 +111,19 @@ function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
// It's a better user experience to still show the Title, even if it didn't change.
// No, you didn't see this.
$diff = '<table class="diff"><colgroup><col class="content diffsplit left"><col class="content diffsplit middle"><col class="content diffsplit right"></colgroup><tbody><tr>';
// In split screen mode, show the title before/after side by side.
if ( true === $args['show_split_view'] ) {
$diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td><td></td><td>' . esc_html( $compare_to->post_title ) . '</td>';
} else {
$diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td>';
// In single column mode, only show the title once if unchanged.
if ( $compare_from->post_title !== $compare_to->post_title ) {
$diff .= '</tr><tr><td>' . esc_html( $compare_to->post_title ) . '</td>';
}
}
$diff .= '</tr></tbody>';
$diff .= '</table>';
}