Ticket #29558: 29558.6.patch
File 29558.6.patch, 14.7 KB (added by , 10 years ago) |
---|
-
src/wp-includes/class-wp-editor.php
993 993 'Keyboard Shortcuts' => __( 'Keyboard Shortcuts' ), 994 994 'Toolbar Toggle' => __( 'Toolbar Toggle' ), 995 995 'Insert Read More tag' => __( 'Insert Read More tag' ), 996 'Insert Page Break tag' => __( 'Insert Page Break tag' ), 996 997 'Read more...' => __( 'Read more...' ), // Title on the placeholder inside the editor 997 998 'Distraction-free writing mode' => __( 'Distraction-free writing mode' ), 998 999 'No alignment' => __( 'No alignment' ), // Tooltip for the 'alignnone' button in the image toolbar 999 1000 'Remove' => __( 'Remove' ), // Tooltip for the 'remove' button in the image toolbar 1000 1001 'Edit ' => __( 'Edit' ), // Tooltip for the 'edit' button in the image toolbar 1002 'Focus shortcuts:' => __( 'Focus shortcuts:' ), 1003 'Image toolbar (when an image is selected)' => __( 'Image toolbar (when an image is selected)' ), 1004 'Editor menu (when enabled)' => __( 'Editor menu (when enabled)' ), 1005 'Editor toolbar' => __( 'Editor toolbar' ), 1006 'Elements path' => __( 'Elements path' ) 1001 1007 ); 1002 1008 1003 1009 /** -
src/wp-includes/css/editor.css
79 79 width: calc( 100% - 36px ); 80 80 } 81 81 82 .mce-wp-help .mce-window-head {83 border-bottom: none;84 }85 86 82 .mce-textbox, 87 83 .mce-checkbox i.mce-i-checkbox, 88 84 #wp-link .query-results { … … 104 100 box-shadow: 0 0 2px rgba(30,140,190,0.8); 105 101 } 106 102 103 .mce-container kbd { 104 font-family: monospace; 105 padding: 3px 5px 2px 5px; 106 margin: 0 1px; 107 background: #eaeaea; 108 background: rgba(0,0,0,0.07); 109 font-size: 13px; 110 } 111 112 .mce-wp-help { 113 height: 400px; 114 overflow: auto; 115 } 116 117 .mce-wp-help td { 118 padding: 5px; 119 } 120 107 121 /* TinyMCE menus */ 108 122 .mce-menu, 109 123 .mce-floatpanel.mce-popover { -
src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
4 4 tinymce.ui.FloatPanel.zIndex = 100100; 5 5 6 6 tinymce.PluginManager.add( 'wordpress', function( editor ) { 7 var DOM = tinymce.DOM, wpAdvButton, modKey, style, 7 var DOM = tinymce.DOM, 8 each = tinymce.each, 9 __ = editor.editorManager.i18n.translate, 10 wpAdvButton, style, 8 11 last = 0; 9 12 10 13 if ( typeof window.jQuery !== 'undefined' ) { … … 29 32 state = 'hide'; 30 33 } 31 34 32 tinymce.each( toolbars, function( toolbar, i ) {35 each( toolbars, function( toolbar, i ) { 33 36 if ( i > 0 ) { 34 37 if ( state === 'hide' ) { 35 38 toolbar.hide(); … … 91 94 92 95 if ( e.content ) { 93 96 if ( e.content.indexOf( '<!--more' ) !== -1 ) { 94 title = editor.editorManager.i18n.translate( 'Read more...' );97 title = __( 'Read more...' ); 95 98 96 99 e.content = e.content.replace( /<!--more(.*?)-->/g, function( match, moretext ) { 97 100 return '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="more" data-wp-more-text="' + moretext + '" ' + … … 100 103 } 101 104 102 105 if ( e.content.indexOf( '<!--nextpage-->' ) !== -1 ) { 103 title = editor.editorManager.i18n.translate( 'Page break' );106 title = __( 'Page break' ); 104 107 105 108 e.content = e.content.replace( /<!--nextpage-->/g, 106 109 '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" ' + … … 149 152 tag = tag || 'more'; 150 153 classname += ' mce-wp-' + tag; 151 154 title = tag === 'more' ? 'Read more...' : 'Next page'; 152 title = editor.editorManager.i18n.translate( title );155 title = __( title ); 153 156 html = '<img src="' + tinymce.Env.transparentSrc + '" title="' + title + '" class="' + classname + '" ' + 154 157 'data-wp-more="' + tag + '" data-mce-resize="false" data-mce-placeholder="1" />'; 155 158 … … 188 191 }); 189 192 190 193 editor.addCommand( 'WP_Help', function() { 191 editor.windowManager.open({ 192 url: tinymce.baseURL + '/wp-mce-help.php', 194 var access = tinymce.Env.mac ? 'ctrl + alt' : 'shift + alt', 195 meta = tinymce.Env.mac ? 'cmd' : 'ctrl', 196 column1 = [], 197 column2 = [], 198 pieces = [], 199 rows, 200 i; 201 202 each( { 203 C: 'Copy', 204 X: 'Cut', 205 V: 'Paste', 206 A: 'Select all', 207 Z: 'Undo', 208 Y: 'Redo', 209 B: 'Bold', 210 I: 'Italic', 211 U: 'Underline', 212 K: 'Insert/edit link' 213 }, function( text, key ) { 214 column1.push( td( meta + ' + ' + key, text ) ); 215 } ); 216 217 each( [ 1, 2, 3, 4, 5, 6 ], function( key ) { 218 column1.push( td( access + ' + ' + key, 'Heading ' + key ) ); 219 } ); 220 221 each( { 222 L: 'Align left', 223 C: 'Align center', 224 R: 'Align right', 225 J: 'Justify', 226 D: 'Strikethrough', 227 Q: 'Blockquote', 228 U: 'Bullet list', 229 O: 'Numbered list', 230 A: 'Insert/edit link', 231 S: 'Remove link', 232 M: 'Insert/edit image', 233 T: 'Insert Read More tag', 234 H: 'Keyboard Shortcuts', 235 X: 'Code', 236 P: 'Insert Page Break tag', 237 W: 'Distraction-free writing mode', 238 N: 'Spellcheck' 239 }, function( text, key ) { 240 column2.push( td( access + ' + ' + key, text ) ); 241 } ); 242 243 function td( pattern, text ) { 244 return '<td>' + ( pattern ? '<kbd>' + pattern + '</kbd>' : '' ) + '</td><td>' + ( __( text ) || '' ) + '</td>'; 245 } 246 247 rows = Math.max( column1.length, column2.length ); 248 249 for ( i = 1; i <= rows; i++ ) { 250 pieces.push( '<tr>' + ( column1[ i ] || td() ) + ( column2[ i ] || td() ) + '</tr>' ); 251 } 252 253 editor.windowManager.open( { 193 254 title: 'Keyboard Shortcuts', 194 width: 450, 195 height: 420, 196 classes: 'wp-help', 197 buttons: { text: 'Close', onclick: 'close' } 198 }); 199 }); 255 spacing: 10, 256 padding: 10, 257 items: { 258 type: 'container', 259 classes: 'wp-help', 260 html: ( 261 '<table>' + pieces.join( '' ) + '</table>' + 262 '<p>' + __( 'Focus shortcuts:' ) + '</p>' + 263 '<table>' + 264 '<tr>' + td( 'alt + F8', 'Image toolbar (when an image is selected)' ) + '</tr>' + 265 '<tr>' + td( 'alt + F9', 'Editor menu (when enabled)' ) + '</tr>' + 266 '<tr>' + td( 'alt + F10', 'Editor toolbar' ) + '</tr>' + 267 '<tr>' + td( 'alt + F11', 'Elements path' ) + '</tr>' + 268 '</table>' 269 ) 270 }, 271 buttons: { 272 text: 'Close', 273 onclick: 'close' 274 } 275 } ); 276 } ); 200 277 201 278 editor.addCommand( 'WP_Medialib', function() { 202 279 if ( typeof wp !== 'undefined' && wp.media && wp.media.editor ) { … … 309 386 310 387 bodyClass.push('wp-editor'); 311 388 312 tinymce.each( bodyClass, function( cls ) {389 each( bodyClass, function( cls ) { 313 390 if ( cls ) { 314 391 dom.addClass( doc.body, cls ); 315 392 } … … 351 428 352 429 editor.on( 'PastePostProcess', function( event ) { 353 430 // Remove empty paragraphs 354 tinymce.each( dom.select( 'p', event.node ), function( node ) {431 each( dom.select( 'p', event.node ), function( node ) { 355 432 if ( dom.isEmpty( node ) ) { 356 433 dom.remove( node ); 357 434 } … … 402 479 }); 403 480 404 481 editor.on( 'preInit', function() { 482 var i; 483 405 484 // Don't replace <i> with <em> and <b> with <strong> and don't remove them when empty 406 485 editor.schema.addValidElements( '@[id|accesskey|class|dir|lang|style|tabindex|title|contenteditable|draggable|dropzone|hidden|spellcheck|translate],i,b' ); 407 486 408 487 if ( tinymce.Env.iOS ) { 409 488 editor.settings.height = 300; 410 489 } 411 });412 490 413 // Add custom shortcuts 414 modKey = 'alt+shift'; 491 for ( i = 1; i <= 9; i++ ) { 492 editor.shortcuts.remove( 'meta+shift+' + i ); 493 } 415 494 416 editor.addShortcut( modKey + '+c', '', 'JustifyCenter' ); 417 editor.addShortcut( modKey + '+r', '', 'JustifyRight' ); 418 editor.addShortcut( modKey + '+l', '', 'JustifyLeft' ); 419 editor.addShortcut( modKey + '+j', '', 'JustifyFull' ); 420 editor.addShortcut( modKey + '+q', '', 'mceBlockQuote' ); 421 editor.addShortcut( modKey + '+u', '', 'InsertUnorderedList' ); 422 editor.addShortcut( modKey + '+o', '', 'InsertOrderedList' ); 423 editor.addShortcut( modKey + '+n', '', 'mceSpellCheck' ); 424 editor.addShortcut( modKey + '+s', '', 'unlink' ); 425 editor.addShortcut( modKey + '+m', '', 'WP_Medialib' ); 426 editor.addShortcut( modKey + '+z', '', 'WP_Adv' ); 427 editor.addShortcut( modKey + '+t', '', 'WP_More' ); 428 editor.addShortcut( modKey + '+d', '', 'Strikethrough' ); 429 editor.addShortcut( modKey + '+h', '', 'WP_Help' ); 430 editor.addShortcut( modKey + '+p', '', 'WP_Page' ); 431 editor.addShortcut( modKey + '+x', '', 'WP_Code' ); 432 editor.addShortcut( 'ctrl+s', '', function() { 433 if ( typeof wp !== 'undefined' && wp.autosave ) { 434 wp.autosave.server.triggerSave(); 495 for ( i = 1; i <= 6; i++ ) { 496 editor.shortcuts.add( 'access+' + i, '', [ 'FormatBlock', false, 'h' + i ] ); 435 497 } 436 }); 437 498 499 each( { 500 c: 'JustifyCenter', 501 r: 'JustifyRight', 502 l: 'JustifyLeft', 503 j: 'JustifyFull', 504 q: 'mceBlockQuote', 505 u: 'InsertUnorderedList', 506 o: 'InsertOrderedList', 507 n: 'mceSpellCheck', 508 s: 'unlink', 509 m: 'WP_Medialib', 510 z: 'WP_Adv', 511 t: 'WP_More', 512 d: 'Strikethrough', 513 h: 'WP_Help', 514 p: 'WP_Page', 515 x: 'WP_Code' 516 }, function( command, key ) { 517 editor.shortcuts.add( 'access+' + key, '', command ); 518 } ); 519 520 editor.addShortcut( 'ctrl+s', '', function() { 521 if ( typeof wp !== 'undefined' && wp.autosave ) { 522 wp.autosave.server.triggerSave(); 523 } 524 } ); 525 } ); 526 438 527 /** 439 528 * Experimental: create a floating toolbar. 440 * This functionality will change in the next releases. Not recommen nded for use by plugins.441 */ 529 * This functionality will change in the next releases. Not recommended for use by plugins. 530 */ 442 531 ( function() { 443 var DOM = tinymce.DOM, 444 each = tinymce.each, 445 Factory = tinymce.ui.Factory, 532 var Factory = tinymce.ui.Factory, 446 533 settings = editor.settings, 447 534 currentToolbar, 448 535 currentSelection; -
src/wp-includes/js/tinymce/wp-mce-help.php
1 <?php2 /**3 * @package TinyMCE4 * @author Moxiecode5 * @copyright Copyright © 2005-2006, Moxiecode Systems AB, All rights reserved.6 */7 8 /** @ignore */9 require_once( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/wp-load.php' );10 header('Content-Type: text/html; charset=' . get_bloginfo('charset'));11 ?>12 <!DOCTYPE html>13 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>14 <head>15 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />16 <title><?php _e('Keyboard Shortcuts'); ?></title>17 18 <?php wp_admin_css( 'wp-admin', true ); ?>19 <style type="text/css">20 21 html {22 background: #fcfcfc;23 overflow: hidden;24 }25 26 body {27 min-width: 0;28 }29 30 .wrap {31 background-color: #fff;32 border-top: 1px solid #ddd;33 height: 390px;34 margin: 0;35 overflow: auto;36 padding: 10px 16px;37 }38 39 th {40 text-align: center;41 }42 43 .top th {44 text-decoration: underline;45 }46 47 .top .key {48 text-align: center;49 width: 5em;50 }51 52 .keys {53 border: 0 none;54 margin-bottom: 15px;55 width: 100%;56 }57 58 .keys p {59 display: inline-block;60 margin: 0px;61 padding: 0px;62 }63 64 .keys .left {65 text-align: left;66 }67 68 .keys .center {69 text-align: center;70 }71 72 .keys .right {73 text-align: right;74 }75 </style>76 <?php if ( is_rtl() ) : ?>77 <style type="text/css">78 79 .keys .left {80 text-align: right;81 }82 83 .keys .right {84 text-align: left;85 }86 87 </style>88 <?php endif; ?>89 </head>90 <body class="windows wp-core-ui">91 92 <div class="wrap">93 94 <div>95 <p><?php _e('Rather than reaching for your mouse to click on the toolbar, use these access keys. Windows and Linux use Ctrl + letter. Macintosh uses Command + letter.'); ?></p>96 97 <table class="keys">98 <tr class="top"><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th></tr>99 <tr><th>c</th><td><?php _e('Copy'); ?></td><th>v</th><td><?php _e('Paste'); ?></td></tr>100 <tr><th>a</th><td><?php _e('Select all'); ?></td><th>x</th><td><?php _e('Cut'); ?></td></tr>101 <tr><th>z</th><td><?php _e('Undo'); ?></td><th>y</th><td><?php _e('Redo'); ?></td></tr>102 <tr><th>b</th><td><?php _e('Bold'); ?></td><th>i</th><td><?php _e('Italic'); ?></td></tr>103 <tr><th>u</th><td><?php _e('Underline'); ?></td><th>1</th><td><?php _e('Heading 1'); ?></td></tr>104 <tr><th>2</th><td><?php _e('Heading 2'); ?></td><th>3</th><td><?php _e('Heading 3'); ?></td></tr>105 <tr><th>4</th><td><?php _e('Heading 4'); ?></td><th>5</th><td><?php _e('Heading 5'); ?></td></tr>106 <tr><th>6</th><td><?php _e('Heading 6'); ?></td><th>k</th><td><?php _e('Insert/edit link'); ?></td></tr>107 </table>108 109 <p><?php _e('The following shortcuts use different access keys: Alt + Shift + letter.'); ?></p>110 <table class="keys">111 <tr class="top"><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th></tr>112 <tr><th>n</th><td><?php _e('Check Spelling'); ?></td><th>l</th><td><?php _e('Align Left'); ?></td></tr>113 <tr><th>j</th><td><?php _e('Justify Text'); ?></td><th>c</th><td><?php _e('Align Center'); ?></td></tr>114 <tr><th>d</th><td><span style="text-decoration: line-through;"><?php _e('Strikethrough'); ?></span></td><th>r</th><td><?php _e('Align Right'); ?></td></tr>115 <tr><th>u</th><td><strong>•</strong> <?php _e('List'); ?></td><th>a</th><td><?php _e('Insert link'); ?></td></tr>116 <tr><th>o</th><td>1. <?php _e('List'); ?></td><th>s</th><td><?php _e('Remove link'); ?></td></tr>117 <tr><th>q</th><td><?php _e('Quote'); ?></td><th>m</th><td><?php _e('Insert Image'); ?></td></tr>118 <tr><th>w</th><td><?php _e('Distraction-free writing mode'); ?></td><th>t</th><td><?php _e('Insert More Tag'); ?></td></tr>119 <tr><th>p</th><td><?php _e('Insert Page Break tag'); ?></td><th>h</th><td><?php _e('Help'); ?></td></tr>120 <tr><th>x</th><td><?php _e('Add/remove code tag'); ?></td><th> </th><td> </td></tr>121 </table>122 123 <p><?php _e('Focus shortcuts:'); ?></p>124 125 <table class="keys focus">126 <tr><th class="left">Alt + F8</th><td><?php _e('Image toolbar (when an image is selected)'); ?></td></tr>127 <tr><th class="left">Alt + F9</th><td><?php _e('Editor menu (when enabled)'); ?></td></tr>128 <tr><th class="left">Alt + F10</th><td><?php _e('Editor toolbar'); ?></td></tr>129 <tr><th class="left">Alt + F11</th><td><?php _e('Elements path'); ?></td></tr>130 </table>131 132 <p><?php _e('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.'); ?></p>133 </div>134 135 </div>136 </body>137 </html>