Ticket #21414: 21414.1.patch
File 21414.1.patch, 12.3 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/user.php
97 97 } 98 98 99 99 $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : ''; 100 $user->editor_shortcuts = isset( $_POST['editor_shortcuts'] ) && 'true' === $_POST['editor_shortcuts'] ? 'true' : 'false'; 100 101 101 102 $user->use_ssl = 0; 102 103 if ( !empty($_POST['use_ssl']) ) -
src/wp-admin/js/editor-expand.js
1105 1105 } ); 1106 1106 1107 1107 editor.addCommand( 'wpToggleDFW', toggle ); 1108 editor.addShortcut( 'access+w', '', 'wpToggleDFW' ); 1108 1109 if ( ! editor.settings.wp_disable_custom_shortcuts ) { 1110 editor.addShortcut( 'access+w', '', 'wpToggleDFW' ); 1111 } 1109 1112 } ); 1110 1113 1111 1114 $document.on( 'tinymce-editor-init.focus', function( event, editor ) { -
src/wp-admin/user-edit.php
257 257 if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?> 258 258 <tr class="user-comment-shortcuts-wrap"> 259 259 <th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th> 260 <td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( ! empty( $profileuser->comment_shortcuts ) ) checked( 'true', $profileuser->comment_shortcuts ); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?></td> 260 <td> 261 <fieldset> 262 <legend class="screen-reader-text"><span><?php _e( 'Keyboard Shortcuts' ); ?></span></legend> 263 <label for="comment_shortcuts"> 264 <input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( ! empty( $profileuser->comment_shortcuts ) ) checked( 'true', $profileuser->comment_shortcuts ); ?> /> 265 <?php _e('Enable keyboard shortcuts for comment moderation.'); ?> 266 </label><br /> 267 <label for="editor_shortcuts"> 268 <input type="checkbox" name="editor_shortcuts" id="editor_shortcuts" value="true" <?php checked( ( ! isset( $profileuser->editor_shortcuts ) || $profileuser->editor_shortcuts !== 'false' ) ); ?> /> 269 <?php _e('Enable custom keyboard shortcuts for the Visual editor.'); ?> 270 </label><br /> 271 <?php _e('<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?> 272 </fieldset> 273 </td> 261 274 </tr> 262 275 <?php endif; ?> 263 276 <tr class="show-admin-bar user-admin-bar-front-wrap"> -
src/wp-includes/class-wp-editor.php
554 554 'wp_lang_attr' => get_bloginfo( 'language' ) 555 555 ); 556 556 557 if ( is_user_logged_in() && 'false' === get_user_option( 'editor_shortcuts' ) ) { 558 self::$first_init['wp_disable_custom_shortcuts'] = true; 559 self::$first_init['wp_profile_url'] = admin_url( 'profile.php' ); 560 } 561 557 562 if ( ! empty( $mce_external_plugins ) ) { 558 563 self::$first_init['external_plugins'] = wp_json_encode( $mce_external_plugins ); 559 564 } … … 1063 1068 'Ctrl + letter:' => __( 'Ctrl + letter:' ), 1064 1069 'Letter' => __( 'Letter' ), 1065 1070 'Action' => __( 'Action' ), 1071 'Currently disabled. Can be enabled in your %1$sprofile settings%2$s.' => __( 'Currently disabled. Can be enabled in your %1$sprofile settings%2$s.' ), 1072 'Can be disabled in your %1$sprofile settings%2$s.' => __( 'Can be disabled in your %1$sprofile settings%2$s.' ), 1066 1073 'To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.' => 1067 1074 __( 'To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.' ), 1068 1075 'When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' => -
src/wp-includes/css/editor.css
127 127 box-sizing: border-box; 128 128 } 129 129 130 .mce-window .mce-wp-help a { 131 color: #0073aa; 132 text-decoration: underline; 133 } 134 135 .mce-window .mce-wp-help a:hover, 136 .mce-window .mce-wp-help a:active { 137 color: #00a0d2; 138 } 139 130 140 .mce-window .mce-wp-help > .mce-container-body { 131 141 width: auto !important; 132 142 } -
src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
212 212 meta = tinymce.Env.mac ? __( 'Cmd + letter:' ) : __( 'Ctrl + letter:' ), 213 213 table1 = [], 214 214 table2 = [], 215 disabledStr, 215 216 header, html, dialog, $wrap; 216 217 217 218 each( [ … … 254 255 return out + '</tr>'; 255 256 } 256 257 258 if ( editor.settings.wp_disable_custom_shortcuts ) { 259 disabledStr = __( 'Currently disabled. Can be enabled in your %1$sprofile settings%2$s.' ); 260 } else { 261 disabledStr = __( 'Can be disabled in your %1$sprofile settings%2$s.' ); 262 } 263 264 disabledStr = disabledStr.replace( '%1$s', '<a href="' + editor.settings.wp_profile_url + '">' ).replace( '%2$s', '</a>' ); 265 257 266 header = [ __( 'Letter' ), __( 'Action' ), __( 'Letter' ), __( 'Action' ) ]; 258 267 header = '<tr><th>' + header.join( '</th><th>' ) + '</th></tr>'; 259 268 … … 267 276 table1.join('') + 268 277 '</table>' + 269 278 '<h2>' + __( 'Additional shortcuts,' ) + ' ' + access + '</h2>' + 279 '<p>' + disabledStr + '</p>' + 270 280 '<table class="wp-help-th-center fixed">' + 271 281 header + 272 282 table2.join('') + … … 421 431 }); 422 432 423 433 editor.on( 'init', function() { 424 var env = tinymce.Env, 434 var key, 435 env = tinymce.Env, 425 436 bodyClass = ['mceContentBody'], // back-compat for themes that use this in editor-style.css... 426 437 doc = editor.getDoc(), 427 438 dom = editor.dom; … … 502 513 }); 503 514 }); 504 515 } 516 517 if ( editor.settings.wp_disable_custom_shortcuts ) { 518 // Remove TinyMCE custom shortcuts, but leave the standard OS shortcuts 519 // like Cmd/Ctrl+Z, Cmd/Ctrl+C, Cmd/Ctrl+V, etc. 520 for( key = 1; key < 10; key++ ) { 521 editor.shortcuts.remove( 'access+' + key ); 522 } 523 // Remove the shortcut for the fullscreen plugin. 524 editor.shortcuts.remove( 'ctrl+shift+f' ); 525 } 505 526 }); 506 527 507 528 editor.on( 'SaveContent', function( event ) { … … 532 553 editor.settings.height = 300; 533 554 } 534 555 535 each( { 536 c: 'JustifyCenter', 537 r: 'JustifyRight', 538 l: 'JustifyLeft', 539 j: 'JustifyFull', 540 q: 'mceBlockQuote', 541 u: 'InsertUnorderedList', 542 o: 'InsertOrderedList', 543 s: 'unlink', 544 m: 'WP_Medialib', 545 z: 'WP_Adv', 546 t: 'WP_More', 547 d: 'Strikethrough', 548 h: 'WP_Help', 549 p: 'WP_Page', 550 x: 'WP_Code' 551 }, function( command, key ) { 552 editor.shortcuts.add( 'access+' + key, '', command ); 553 } ); 556 if ( ! editor.settings.wp_disable_custom_shortcuts ) { 557 each( { 558 c: 'JustifyCenter', 559 r: 'JustifyRight', 560 l: 'JustifyLeft', 561 j: 'JustifyFull', 562 q: 'mceBlockQuote', 563 u: 'InsertUnorderedList', 564 o: 'InsertOrderedList', 565 s: 'unlink', 566 m: 'WP_Medialib', 567 z: 'WP_Adv', 568 t: 'WP_More', 569 d: 'Strikethrough', 570 h: 'WP_Help', 571 p: 'WP_Page', 572 x: 'WP_Code' 573 }, function( command, key ) { 574 editor.shortcuts.add( 'access+' + key, '', command ); 575 } ); 554 576 555 editor.addShortcut( 'meta+s', '', function() { 556 if ( wp && wp.autosave ) { 557 wp.autosave.server.triggerSave(); 558 } 559 } ); 577 editor.addShortcut( 'meta+s', '', function() { 578 if ( wp && wp.autosave ) { 579 wp.autosave.server.triggerSave(); 580 } 581 } ); 582 } 560 583 561 584 if ( window.getUserSetting( 'editor_plain_text_paste_warning' ) > 1 ) { 562 585 editor.settings.paste_plaintext_inform = false; -
src/wp-includes/js/tinymce/plugins/wplink/plugin.js
251 251 } 252 252 } ); 253 253 254 // WP default shortcut 255 editor.addShortcut( 'access+a', '', 'WP_Link' ); 256 // The "de-facto standard" shortcut, see #27305 257 editor.addShortcut( 'meta+k', '', 'WP_Link' ); 254 if ( ! editor.settings.wp_disable_custom_shortcuts ) { 255 // WP default shortcut 256 editor.addShortcut( 'access+a', '', 'WP_Link' ); 257 // The "de-facto standard" shortcut, see #27305 258 editor.addShortcut( 'meta+k', '', 'WP_Link' ); 259 } 258 260 259 261 editor.addButton( 'link', { 260 262 icon: 'link', -
src/wp-includes/user.php
1336 1336 * Insert a user into the database. 1337 1337 * 1338 1338 * Most of the `$userdata` array fields have filters associated with the values. Exceptions are 1339 * 'ID', 'rich_editing', 'comment_shortcuts', ' admin_color', 'use_ssl',1339 * 'ID', 'rich_editing', 'comment_shortcuts', 'editor_shortcuts', 'admin_color', 'use_ssl', 1340 1340 * 'user_registered', and 'role'. The filters have the prefix 'pre_user_' followed by the field 1341 1341 * name. An example using 'description' would have the filter called, 'pre_user_description' that 1342 1342 * can be hooked into. … … 1371 1371 * False if not empty. 1372 1372 * @type string|bool $comment_shortcuts Whether to enable comment moderation keyboard 1373 1373 * shortcuts for the user. Default false. 1374 * @type string|bool $editor_shortcuts Whether to enable keyboard shortcuts for the 1375 * Visual editor. Default true. 1374 1376 * @type string $admin_color Admin color scheme for the user. Default 'fresh'. 1375 1377 * @type bool $use_ssl Whether the user should always access the admin over 1376 1378 * https. Default false. … … 1583 1585 1584 1586 $meta['comment_shortcuts'] = empty( $userdata['comment_shortcuts'] ) || 'false' === $userdata['comment_shortcuts'] ? 'false' : 'true'; 1585 1587 1588 $meta['editor_shortcuts'] = empty( $userdata['editor_shortcuts'] ) || 'false' !== $userdata['editor_shortcuts'] ? 'true' : 'false'; 1589 1586 1590 $admin_color = empty( $userdata['admin_color'] ) ? 'fresh' : $userdata['admin_color']; 1587 1591 $meta['admin_color'] = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $admin_color ); 1588 1592 … … 1637 1641 * @type string $last_name The user's last name. 1638 1642 * @type string $description The user's description. 1639 1643 * @type bool $rich_editing Whether to enable the rich-editor for the user. False if not empty. 1640 * @type bool $comment_shortcuts Whether to enable keyboard shortcuts for the user. Default false. 1644 * @type bool $comment_shortcuts Whether to enable keyboard shortcuts for comment moderation. Default false. 1645 * @type bool $editor_shortcuts Whether to enable keyboard shortcuts for the Visual editor. Default true. 1641 1646 * @type string $admin_color The color scheme for a user's admin screen. Default 'fresh'. 1642 1647 * @type int|bool $use_ssl Whether to force SSL on the user's admin area. 0|false if SSL is 1643 1648 * not forced. … … 1951 1956 * @return array List of user keys to be populated in wp_update_user(). 1952 1957 */ 1953 1958 function _get_additional_user_keys( $user ) { 1954 $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', ' admin_color', 'use_ssl', 'show_admin_bar_front' );1959 $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'editor_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front' ); 1955 1960 return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) ); 1956 1961 } 1957 1962