WordPress.org

Make WordPress Core

Changeset 36761


Ignore:
Timestamp:
02/28/2016 06:59:25 PM (5 years ago)
Author:
azaozz
Message:

TinyMCE textpattern:

  • Add description of the new patterns to the Shortcuts help modal.
  • Fix the layout a bit and make the patterns in two columns.
  • Disable the textpatterns plugin in IE < 9.

See #33300.

Location:
trunk/src/wp-includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-editor.php

    r36677 r36761  
    10671067            'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' =>
    10681068                __( 'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' ),
     1069            '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.' =>
     1070                __( '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.' ),
    10691071        );
    10701072
  • trunk/src/wp-includes/css/editor.css

    r36677 r36761  
    137137}
    138138
     139.mce-window .wp-editor-help table.wp-help-single {
     140    margin: 0 8px 20px;
     141}
     142
     143.mce-window .wp-editor-help table.fixed {
     144    table-layout: fixed;
     145}
     146
     147.mce-window .wp-editor-help table.fixed th:nth-child(odd),
     148.mce-window .wp-editor-help table.fixed td:nth-child(odd) {
     149    width: 12%;
     150}
     151
     152.mce-window .wp-editor-help table.fixed th:nth-child(even),
     153.mce-window .wp-editor-help table.fixed td:nth-child(even) {
     154    width: 38%;
     155}
     156
     157.mce-window .wp-editor-help table.fixed th:nth-child(odd) {
     158    padding: 5px 0 0;
     159}
     160
    139161.mce-window .wp-editor-help td,
    140162.mce-window .wp-editor-help th {
     
    158180    background: #eaeaea;
    159181    background: rgba(0,0,0,0.08);
    160 }
    161 
    162 .mce-window .wp-help-header td {
    163     font-weight: bold;
    164     padding: 0 5px;
    165182}
    166183
  • trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

    r36716 r36761  
    263263        html = html +
    264264            '<h2>' + __( 'Default shortcuts,' ) + ' ' + meta + '</h2>' +
    265             '<table class="wp-help-th-center">' +
     265            '<table class="wp-help-th-center fixed">' +
    266266                header +
    267267                table1.join('') +
    268268            '</table>' +
    269269            '<h2>' + __( 'Additional shortcuts,' ) + ' ' + access + '</h2>' +
    270             '<table class="wp-help-th-center">' +
     270            '<table class="wp-help-th-center fixed">' +
    271271                header +
    272272                table2.join('') +
    273273            '</table>';
    274274
    275         if ( editor.plugins.wptextpattern ) {
     275        if ( editor.plugins.wptextpattern && ( ! tinymce.Env.ie || tinymce.Env.ie > 8 ) ) {
    276276            // Text pattern section
    277277            html = html +
    278278                '<h2>' + __( '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.' ) + '</h2>' +
    279                 '<table>' +
    280                     tr({ '*':  'Bullet list' }) +
    281                     tr({ '-':  'Bullet list' }) +
    282                     tr({ '1.':  'Numbered list' }) +
    283                     tr({ '1)':  'Numbered list' }) +
     279                '<table class="wp-help-th-center fixed">' +
     280                    tr({ '*':  'Bullet list', '1.':  'Numbered list' }) +
     281                    tr({ '-':  'Bullet list', '1)':  'Numbered list' }) +
    284282                '</table>';
    285283
    286284            html = html +
    287285                '<h2>' + __( 'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' ) + '</h2>' +
    288                 '<table>' +
     286                '<table class="wp-help-single">' +
    289287                    tr({ '>': 'Blockquote' }) +
    290288                    tr({ '##': 'Heading 2' }) +
     
    293291                    tr({ '#####': 'Heading 5' }) +
    294292                    tr({ '######': 'Heading 6' }) +
     293                    tr({ '---': 'Horizontal rule' }) +
     294                    tr({ '***': 'Horizontal rule' }) +
     295                '</table>';
     296
     297            html = html +
     298                '<h2>' + __( '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.' ) + '</h2>' +
     299                '<table class="wp-help-th-center fixed">' +
     300                    tr({ '*': 'Italic', '**': 'Bold' }) +
     301                    tr({ '_': 'Italic', '__': 'Bold' }) +
     302                    tr({ '`': 'Code', empty: '' }) +
    295303                '</table>';
    296304        }
     
    299307        html = html +
    300308            '<h2>' + __( 'Focus shortcuts:' ) + '</h2>' +
    301             '<table>' +
     309            '<table class="wp-help-single">' +
    302310                tr({ 'Alt + F8':  'Inline toolbar (when an image, link or preview is selected)' }) +
    303311                tr({ 'Alt + F9':  'Editor menu (when enabled)' }) +
  • trunk/src/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js

    r36720 r36761  
    1212 */
    1313( function( tinymce, setTimeout ) {
     14    if ( tinymce.Env.ie && tinymce.Env.ie < 9 ) {
     15        return;
     16    }
     17
    1418    tinymce.PluginManager.add( 'wptextpattern', function( editor ) {
    1519        var VK = tinymce.util.VK;
     
    8387            var zero;
    8488
    85             if ( node.nodeType !== 3 || ! node.data.length || ! offset ) {
     89            if ( ! node || node.nodeType !== 3 || ! node.data.length || ! offset ) {
    8690                return;
    8791            }
Note: See TracChangeset for help on using the changeset viewer.