Ticket #26907: 26907 V2.patch
File 26907 V2.patch, 6.6 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/user.php
92 92 93 93 if ( $update ) { 94 94 $user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' == $_POST['rich_editing'] ? 'false' : 'true'; 95 $user->dfw_mouse = isset( $_POST['dfw_mouse'] ) && 'true' == $_POST['dfw_mouse'] ? 'true' : 'false'; 95 96 $user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh'; 96 97 $user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false'; 97 98 } -
wp-admin/js/wp-fullscreen.js
11 11 uiScrollTop = 0, 12 12 transitionend = 'transitionend webkitTransitionEnd', 13 13 $body = $( document.body ), 14 $document = $( document ); 14 $document = $( document ), 15 MouseInToolbar = false; 15 16 16 17 /** 17 18 * PubSub … … 101 102 $body.addClass('wp-dfw-show-ui'); 102 103 } 103 104 104 if ( hide === 'hide' ) {105 if ( hide === 'hide' || hide === 'peak' ) { 105 106 uiTimer = setTimeout( _hideUI, 2000 ); 106 107 } 107 108 }; … … 198 199 s.$dfwTitle = null; 199 200 } 200 201 202 /* 203 Bind mouse/touch events to the document root, this usually catches events anywhere on screen 204 *except* within TinyMCE. 205 206 To capture events within TinyMCE's iframe we also have to bind to the iframe that TinyMCE creates 207 for it's contents. 208 209 For the mouse capture on the document we don't ru toggleUI as otherwise it will cancel out the 210 behaviour of keeping the toolbar visible when the pointer is inside of it. 211 */ 212 var wpfs_capture = wp_fullscreen_mouse(); 213 214 if( wpfs_capture == true ) { 215 var fs_body = $(document); 216 217 // Show/hide the ui when a touch event happens anywhere on screen. 218 fs_body.on( 'touchstart.wpdfw', function() { 219 toggleUI('show'); 220 }).on( 'touchend', function() { 221 toggleUI('hide'); 222 }); 223 224 // Show the ui when the mouse moves. 225 fs_body.on( 'mousemove.wpdfw', function() { 226 if( MouseInToolbar == false ) { 227 toggleUI('peak'); 228 } 229 }); 230 231 // Bind to the iframe, we don't need to check if we're in the toolbar as we can't be, we're in the iframe ;) 232 var content_ifr = document.getElementById('content_ifr'); 233 if( content_ifr != null ) { 234 content_ifr.contentWindow.document.onmousemove = function() { 235 toggleUI('peak'); 236 } 237 } 238 } 239 201 240 api.ui.fade( 'show', 'showing', 'shown' ); 202 241 }; 203 242 … … 210 249 if ( ! s.visible ) 211 250 return; 212 251 252 var wpfs_capture = wp_fullscreen_mouse(); 253 254 if( wpfs_capture == true ) { 255 // Clear out the mouse/touch events we setup when we enabled fullscreen. 256 var fs_body = $(document); 257 fs_body.off( 'mousemove.wpdfw' ); 258 fs_body.off( 'touchstart.wpdfw' ); 259 260 // Clear out the iframe mouse event we setup when we enabled fullscreen. 261 var content_ifr = document.getElementById('content_ifr'); 262 if( content_ifr != null ) { 263 content_ifr.contentWindow.document.onmousemove = null; 264 } 265 } 266 213 267 api.ui.fade( 'hide', 'hiding', 'hidden' ); 214 268 }; 215 269 … … 510 564 } 511 565 }); 512 566 567 // Show/hide the toolbar when entering/leaving it on the screen. 513 568 toolbar.on( 'mouseenter', function() { 569 MouseInToolbar = true; 514 570 toggleUI('show'); 515 571 }).on( 'mouseleave', function() { 572 MouseInToolbar = false; 516 573 toggleUI('hide'); 517 574 }); 518 575 519 576 // Bind buttons 520 577 $('#wp-fullscreen-buttons').on( 'click.wp-fullscreen', 'button', function( event ) { 521 578 var command = event.currentTarget.id ? event.currentTarget.id.substr(6) : null; -
wp-admin/user-edit.php
246 246 <th scope="row"><?php _e('Visual Editor')?></th> 247 247 <td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php if ( ! empty( $profileuser->rich_editing ) ) checked( 'false', $profileuser->rich_editing ); ?> /> <?php _e( 'Disable the visual editor when writing' ); ?></label></td> 248 248 </tr> 249 <tr> 250 <th scope="row"><?php _e('DFW Mouse')?></th> 251 <td><label for="dfw_mouse"><input name="dfw_mouse" type="checkbox" id="dfw_mouse" value="true" <?php if ( ! empty( $profileuser->dfw_mouse ) ) checked( 'true', $profileuser->dfw_mouse ); ?> /> <?php _e( 'Disable showing the toolbar in Distraction Free Writing mode unless the mouse is inside the toolbar' ); ?></label></td> 252 </tr> 249 253 <?php endif; ?> 250 254 <?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?> 251 255 <tr> -
wp-includes/class-wp-editor.php
835 835 } 836 836 } 837 837 }()); 838 839 function wp_fullscreen_mouse() { 840 return <?php $dfw_mouse = get_user_option( 'dfw_mouse' ); if( $dfw_mouse === false ) { echo 'true'; } else { if( $dfw_mouse == 'true' ) { echo 'false'; } else { echo 'true'; } }?>; 841 } 838 842 </script> 839 843 <?php 840 844 … … 892 896 continue; 893 897 } 894 898 895 $onclick = ! empty( $args['onclick'] ) ? ' onclick="' . $args['onclick'] . '"' : ''; 899 if( true == array_key_exists( 'customhtml', $args ) ) { 900 echo $args['customhtml']; 901 } 902 else { 903 904 $onclick = ! empty( $args['onclick'] ) ? ' onclick="' . $args['onclick'] . '"' : ''; 896 905 ?> 897 906 898 907 <div class="mce-widget mce-btn<?php if ( $args['both'] ) { ?> wp-fullscreen-both<?php } ?>"> … … 901 910 </button> 902 911 </div> 903 912 <?php 913 } 904 914 } 905 915 906 916 ?> -
wp-includes/user.php
1607 1607 if ( empty($rich_editing) ) 1608 1608 $rich_editing = 'true'; 1609 1609 1610 if ( empty($dfw_mouse) ) 1611 $dfw_mouse = 'false'; 1612 1610 1613 if ( empty($comment_shortcuts) ) 1611 1614 $comment_shortcuts = 'false'; 1612 1615 … … 1780 1783 * @return array 1781 1784 */ 1782 1785 function _get_additional_user_keys( $user ) { 1783 $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front' );1786 $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front', 'dfw_mouse' ); 1784 1787 return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) ); 1785 1788 } 1786 1789