Ticket #38063: 38063.2.patch
| File 38063.2.patch, 14.3 KB (added by , 10 years ago) |
|---|
-
src/wp-includes/class-wp-editor.php
26 26 private static $editor_buttons_css = true; 27 27 private static $drag_drop_upload = false; 28 28 private static $old_dfw_compat = false; 29 private static $translation; 29 30 30 31 private function __construct() {} 31 32 … … 357 358 /** This filter is documented in wp-admin/includes/media.php */ 358 359 $no_captions = (bool) apply_filters( 'disable_captions', '' ); 359 360 $ext_plugins = ''; 361 $tooltips = array(); 360 362 363 foreach ( self::get_translation() as $name => $value ) { 364 if ( is_array( $value ) ) { 365 $tooltips[$name] = $value[1]; 366 } 367 } 368 361 369 if ( $set['teeny'] ) { 362 370 363 371 /** … … 550 558 'wpeditimage_disable_captions' => $no_captions, 551 559 'wpeditimage_html5_captions' => current_theme_supports( 'html5', 'caption' ), 552 560 'plugins' => implode( ',', $plugins ), 553 'wp_lang_attr' => get_bloginfo( 'language' ) 561 'wp_lang_attr' => get_bloginfo( 'language' ), 562 'wp_tooltips' => wp_json_encode( $tooltips ), 554 563 ); 555 564 556 565 if ( ! empty( $mce_external_plugins ) ) { … … 812 821 ) ); 813 822 } 814 823 815 /** 816 * Translates the default TinyMCE strings and returns them as JSON encoded object ready to be loaded with tinymce.addI18n(). 817 * Can be used directly (_WP_Editors::wp_mce_translation()) by passing the same locale as set in the TinyMCE init object. 818 * 819 * @static 820 * @param string $mce_locale The locale used for the editor. 821 * @param bool $json_only optional Whether to include the JavaScript calls to tinymce.addI18n() and tinymce.ScriptLoader.markDone(). 822 * @return string Translation object, JSON encoded. 823 */ 824 public static function wp_mce_translation( $mce_locale = '', $json_only = false ) { 825 826 $mce_translation = array( 824 private static function get_translation() { 825 if ( empty( self::$translation ) ) { 826 self::$translation = array( 827 827 // Default TinyMCE strings 828 828 'New document' => __( 'New document' ), 829 829 'Formats' => _x( 'Formats', 'TinyMCE' ), 830 830 831 831 'Headings' => _x( 'Headings', 'TinyMCE' ), 832 'Heading 1' => __( 'Heading1' ),833 'Heading 2' => __( 'Heading2' ),834 'Heading 3' => __( 'Heading3' ),835 'Heading 4' => __( 'Heading4' ),836 'Heading 5' => __( 'Heading5' ),837 'Heading 6' => __( 'Heading6' ),832 'Heading 1' => array( __( 'Heading 1' ), 'access1' ), 833 'Heading 2' => array( __( 'Heading 2' ), 'access2' ), 834 'Heading 3' => array( __( 'Heading 3' ), 'access3' ), 835 'Heading 4' => array( __( 'Heading 4' ), 'access4' ), 836 'Heading 5' => array( __( 'Heading 5' ), 'access5' ), 837 'Heading 6' => array( __( 'Heading 6' ), 'access6' ), 838 838 839 839 /* translators: block tags */ 840 840 'Blocks' => _x( 'Blocks', 'TinyMCE' ), 841 'Paragraph' => __( 'Paragraph' ),842 'Blockquote' => __( 'Blockquote' ),841 'Paragraph' => array( __( 'Paragraph' ), 'access7' ), 842 'Blockquote' => array( __( 'Blockquote' ), 'accessQ' ), 843 843 'Div' => _x( 'Div', 'HTML tag' ), 844 844 'Pre' => _x( 'Pre', 'HTML tag' ), 845 845 'Preformatted' => _x( 'Preformatted', 'HTML tag' ), … … 846 846 'Address' => _x( 'Address', 'HTML tag' ), 847 847 848 848 'Inline' => _x( 'Inline', 'HTML elements' ), 849 'Underline' => __( 'Underline' ),850 'Strikethrough' => __( 'Strikethrough' ),849 'Underline' => array( __( 'Underline' ), 'metaU' ), 850 'Strikethrough' => array( __( 'Strikethrough' ), 'accessD' ), 851 851 'Subscript' => __( 'Subscript' ), 852 852 'Superscript' => __( 'Superscript' ), 853 853 'Clear formatting' => __( 'Clear formatting' ), 854 'Bold' => __( 'Bold' ),855 'Italic' => __( 'Italic' ),856 'Code' => __( 'Code' ),854 'Bold' => array( __( 'Bold' ), 'metaB' ), 855 'Italic' => array( __( 'Italic' ), 'metaI' ), 856 'Code' => array( __( 'Code' ), 'accessX' ), 857 857 'Source code' => __( 'Source code' ), 858 858 'Font Family' => __( 'Font Family' ), 859 859 'Font Sizes' => __( 'Font Sizes' ), 860 860 861 'Align center' => __( 'Align center' ),862 'Align right' => __( 'Align right' ),863 'Align left' => __( 'Align left' ),864 'Justify' => __( 'Justify' ),861 'Align center' => array( __( 'Align center' ), 'accessC' ), 862 'Align right' => array( __( 'Align right' ), 'accessR' ), 863 'Align left' => array( __( 'Align left' ), 'accessL' ), 864 'Justify' => array( __( 'Justify' ), 'accessJ' ), 865 865 'Increase indent' => __( 'Increase indent' ), 866 866 'Decrease indent' => __( 'Decrease indent' ), 867 867 868 'Cut' => __( 'Cut' ),869 'Copy' => __( 'Copy' ),870 'Paste' => __( 'Paste' ),871 'Select all' => __( 'Select all' ),872 'Undo' => __( 'Undo' ),873 'Redo' => __( 'Redo' ),868 'Cut' => array( __( 'Cut' ), 'metaX' ), 869 'Copy' => array( __( 'Copy' ), 'metaC' ), 870 'Paste' => array( __( 'Paste' ), 'metaV' ), 871 'Select all' => array( __( 'Select all' ), 'metaA' ), 872 'Undo' => array( __( 'Undo' ), 'metaZ' ), 873 'Redo' => array( __( 'Redo' ), 'metaY' ), 874 874 875 875 'Ok' => __( 'OK' ), 876 876 'Cancel' => __( 'Cancel' ), … … 877 877 'Close' => __( 'Close' ), 878 878 'Visual aids' => __( 'Visual aids' ), 879 879 880 'Bullet list' => __( 'Bulleted list' ),881 'Numbered list' => __( 'Numbered list' ),880 'Bullet list' => array( __( 'Bulleted list' ), 'accessU' ), 881 'Numbered list' => array( __( 'Numbered list' ), 'accessO' ), 882 882 'Square' => _x( 'Square', 'list style' ), 883 883 'Default' => _x( 'Default', 'list style' ), 884 884 'Circle' => _x( 'Circle', 'list style' ), … … 904 904 'Author' => __( 'Author' ), 905 905 906 906 // Media, image plugins 907 'Insert/edit image' => __( 'Insert/edit image' ),907 'Insert/edit image' => array( __( 'Insert/edit image' ), 'accessM' ), 908 908 'General' => __( 'General' ), 909 909 'Advanced' => __( 'Advanced' ), 910 910 'Source' => __( 'Source' ), … … 938 938 'Horizontal line' => __( 'Horizontal line' ), 939 939 'Horizontal space' => __( 'Horizontal space' ), 940 940 'Restore last draft' => __( 'Restore last draft' ), 941 'Insert/edit link' => __( 'Insert/edit link' ),942 'Remove link' => __( 'Remove link' ),941 'Insert/edit link' => array( __( 'Insert/edit link' ), 'metaK' ), 942 'Remove link' => array( __( 'Remove link' ), 'accessS' ), 943 943 944 944 'Color' => __( 'Color' ), 945 945 'Custom color' => __( 'Custom color' ), … … 1043 1043 'Format' => _x( 'Format', 'TinyMCE menu' ), 1044 1044 1045 1045 // WordPress strings 1046 'Toolbar Toggle' => __( 'Toolbar Toggle' ),1047 'Insert Read More tag' => __( 'Insert Read More tag' ),1048 'Insert Page Break tag' => __( 'Insert Page Break tag' ),1046 'Toolbar Toggle' => array( __( 'Toolbar Toggle' ), 'accessZ' ), 1047 'Insert Read More tag' => array( __( 'Insert Read More tag' ), 'accessT' ), 1048 'Insert Page Break tag' => array( __( 'Insert Page Break tag' ), 'accessP' ), 1049 1049 'Read more...' => __( 'Read more...' ), // Title on the placeholder inside the editor (no ellipsis) 1050 'Distraction-free writing mode' => __( 'Distraction-free writing mode' ),1050 'Distraction-free writing mode' => array( __( 'Distraction-free writing mode' ), 'accessW' ), 1051 1051 'No alignment' => __( 'No alignment' ), // Tooltip for the 'alignnone' button in the image toolbar 1052 1052 'Remove' => __( 'Remove' ), // Tooltip for the 'remove' button in the image toolbar 1053 1053 'Edit ' => __( 'Edit' ), // Tooltip for the 'edit' button in the image toolbar … … 1056 1056 'Link options' => __( 'Link options' ), // Tooltip for the 'link options' button in the inline link dialog 1057 1057 1058 1058 // Shortcuts help modal 1059 'Keyboard Shortcuts' => __( 'Keyboard Shortcuts' ),1059 'Keyboard Shortcuts' => array( __( 'Keyboard Shortcuts' ), 'accessH' ), 1060 1060 'Default shortcuts,' => __( 'Default shortcuts,' ), 1061 1061 'Additional shortcuts,' => __( 'Additional shortcuts,' ), 1062 1062 'Focus shortcuts:' => __( 'Focus shortcuts:' ), … … 1079 1079 __( 'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' ), 1080 1080 'The next group of formatting shortcuts are applied as you type or when you insert them around plain text in the same paragraph. Press Escape or the Undo button to undo.' => 1081 1081 __( 'The next group of formatting shortcuts are applied as you type or when you insert them around plain text in the same paragraph. Press Escape or the Undo button to undo.' ), 1082 ); 1082 ); 1083 } 1083 1084 1084 1085 /** 1085 1086 * Link plugin (not included): … … 1092 1093 * Url 1093 1094 */ 1094 1095 1096 return self::$translation; 1097 } 1098 1099 /** 1100 * Translates the default TinyMCE strings and returns them as JSON encoded object ready to be loaded with tinymce.addI18n(). 1101 * Can be used directly (_WP_Editors::wp_mce_translation()) by passing the same locale as set in the TinyMCE init object. 1102 * 1103 * @static 1104 * @param string $mce_locale The locale used for the editor. 1105 * @param bool $json_only optional Whether to include the JavaScript calls to tinymce.addI18n() and tinymce.ScriptLoader.markDone(). 1106 * @return string Translation object, JSON encoded. 1107 */ 1108 public static function wp_mce_translation( $mce_locale = '', $json_only = false ) { 1095 1109 if ( ! $mce_locale ) { 1096 1110 $mce_locale = self::$mce_locale; 1097 1111 } 1098 1112 1113 $mce_translation = self::get_translation(); 1114 1115 foreach ( $mce_translation as $name => $value ) { 1116 if ( is_array( $value ) ) { 1117 $mce_translation[$name] = $value[0]; 1118 } 1119 } 1120 1099 1121 /** 1100 1122 * Filters translated strings prepared for TinyMCE. 1101 1123 * -
src/wp-includes/css/editor.css
588 588 .mce-menu .mce-menu-item-normal.mce-active, 589 589 .mce-menu .mce-menu-item-preview.mce-active { 590 590 background: #0073aa; /* See color scheme. */ 591 color: #fff; 591 592 } 592 593 593 594 .mce-menu .mce-menu-item-preview.mce-active { … … 650 651 margin-left: -2px; 651 652 } 652 653 654 /* Keyboard shortcuts position */ 655 .mce-menu.mce-menu-align .mce-menu-item-normal { 656 position: relative; 657 } 658 659 .mce-menu.mce-menu-align .mce-menu-shortcut { 660 bottom: 0.5em; 661 } 662 653 663 /* Buttons in modals */ 654 664 .mce-primary button, 655 665 .mce-primary button i { -
src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
231 231 meta = tinymce.Env.mac ? __( 'Cmd + letter:' ) : __( 'Ctrl + letter:' ), 232 232 table1 = [], 233 233 table2 = [], 234 row1 = {}, 235 row2 = {}, 236 i1 = 0, 237 i2 = 0, 238 tooltips = editor.settings.wp_tooltips, 234 239 header, html, dialog, $wrap; 235 240 236 each( [ 237 { c: 'Copy', x: 'Cut' }, 238 { v: 'Paste', a: 'Select all' }, 239 { z: 'Undo', y: 'Redo' }, 240 { b: 'Bold', i: 'Italic' }, 241 { u: 'Underline', k: 'Insert/edit link' } 242 ], function( row ) { 243 table1.push( tr( row ) ); 244 } ); 241 if ( ! tooltips ) { 242 return; 243 } 245 244 246 each( [ 247 { 1: 'Heading 1', 2: 'Heading 2' }, 248 { 3: 'Heading 3', 4: 'Heading 4' }, 249 { 5: 'Heading 5', 6: 'Heading 6' }, 250 { l: 'Align left', c: 'Align center' }, 251 { r: 'Align right', j: 'Justify' }, 252 { d: 'Strikethrough', q: 'Blockquote' }, 253 { u: 'Bullet list', o: 'Numbered list' }, 254 { a: 'Insert/edit link', s: 'Remove link' }, 255 { m: 'Insert/edit image', t: 'Insert Read More tag' }, 256 { h: 'Keyboard Shortcuts', x: 'Code' }, 257 { p: 'Insert Page Break tag', w: 'Distraction-free writing mode' } 258 ], function( row ) { 259 table2.push( tr( row ) ); 260 } ); 261 262 function tr( row ) { 245 function tr( row, columns ) { 263 246 var out = '<tr>'; 247 var i = 0; 264 248 249 columns = columns || 1; 250 265 251 each( row, function( text, key ) { 266 if ( ! text ) { 267 out += '<td></td><td></td>'; 268 } else { 269 out += '<td><kbd>' + key + '</kbd></td><td>' + __( text ) + '</td>'; 270 } 252 out += '<td><kbd>' + key + '</kbd></td><td>' + __( text ) + '</td>'; 253 i++; 271 254 }); 272 255 256 while ( i < columns ) { 257 out += '<td></td><td></td>'; 258 i++; 259 } 260 273 261 return out + '</tr>'; 274 262 } 275 263 264 each ( tooltips, function( tooltip, name ) { 265 var letter; 266 267 if ( tooltip.indexOf( 'meta' ) !== -1 ) { 268 i1++; 269 letter = tooltip.replace( 'meta', '' ).toLowerCase(); 270 271 if ( letter ) { 272 row1[ letter ] = name; 273 274 if ( i1 % 2 === 0 ) { 275 table1.push( tr( row1, 2 ) ); 276 row1 = {}; 277 } 278 } 279 } else if ( tooltip.indexOf( 'access' ) !== -1 ) { 280 i2++; 281 letter = tooltip.replace( 'access', '' ).toLowerCase(); 282 283 if ( letter ) { 284 row2[ letter ] = name; 285 286 if ( i2 % 2 === 0 ) { 287 table2.push( tr( row2, 2 ) ); 288 row2 = {}; 289 } 290 } 291 } 292 } ); 293 294 // Add remaining single entries. 295 if ( i1 % 2 > 0 ) { 296 table1.push( tr( row1, 2 ) ); 297 } 298 299 if ( i2 % 2 > 0 ) { 300 table2.push( tr( row2, 2 ) ); 301 } 302 276 303 header = [ __( 'Letter' ), __( 'Action' ), __( 'Letter' ), __( 'Action' ) ]; 277 304 header = '<tr><th>' + header.join( '</th><th>' ) + '</th></tr>'; 278 305 … … 521 548 }); 522 549 }); 523 550 } 551 552 if ( editor.settings.wp_tooltips ) { 553 var tooltips = tinymce.extend( {}, editor.settings.wp_tooltips ); 554 var access = 'Shift+Alt+'; 555 var meta = 'Ctrl+'; 556 557 // For Mac: shift = \u2303, ctrl = \u21E7, cmd = \u2318, alt = \u2325 558 559 if ( tinymce.Env.mac ) { 560 access = '\u2303\u2325 '; 561 meta = '\u2318 '; 562 } 563 564 each( tooltips, function( value, name ) { 565 tooltips[ name ] = value.replace( 'access', access ).replace( 'meta', meta ); 566 } ); 567 568 each( editor.theme.panel.find('button'), function( button ) { 569 if ( button && button.settings.tooltip && tooltips.hasOwnProperty( button.settings.tooltip ) ) { 570 button.settings.tooltip += ' (' + tooltips[ button.settings.tooltip ] + ')'; 571 } 572 } ); 573 574 // listbox for the "blocks" drop-down 575 each( editor.theme.panel.find('listbox'), function( listbox ) { 576 if ( listbox && listbox.settings.text === 'Paragraph' ) { 577 each( listbox.settings.values, function( item ) { 578 if ( item.text && tooltips.hasOwnProperty( item.text ) ) { 579 item.shortcut = '(' + tooltips[ item.text ] + ')'; 580 } 581 } ); 582 } 583 } ); 584 } 524 585 }); 525 586 526 587 editor.on( 'SaveContent', function( event ) {
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)