From 093a19b6d9552abde18ccd407a21fc8eaf5b3a03 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Wed, 8 Jul 2015 19:42:59 +0000 Subject: [PATCH] TinyMCE: add help for the text patterns to the shortcuts help popup. See #31441. git-svn-id: https://develop.svn.wordpress.org/trunk@33127 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-editor.php | 2 + src/wp-includes/css/editor.css | 3 + .../js/tinymce/plugins/wordpress/plugin.js | 69 ++++++++++++------- 3 files changed, 51 insertions(+), 23 deletions(-) diff --git a/src/wp-includes/class-wp-editor.php b/src/wp-includes/class-wp-editor.php index c721c49306..0ed7747a64 100644 --- a/src/wp-includes/class-wp-editor.php +++ b/src/wp-includes/class-wp-editor.php @@ -1045,6 +1045,8 @@ final class _WP_Editors { 'Action' => __( 'Action' ), '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.' => __( '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.' ), + 'When starting a new paragraph with one of these patterns followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' => + __( 'When starting a new paragraph with one of these patterns followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' ), ); /** diff --git a/src/wp-includes/css/editor.css b/src/wp-includes/css/editor.css index 4cd07ae90d..a4a1fad93d 100644 --- a/src/wp-includes/css/editor.css +++ b/src/wp-includes/css/editor.css @@ -150,6 +150,9 @@ .mce-window .wp-editor-help th { font-weight: bold; padding: 5px 0 0; +} + +.mce-window .wp-editor-help .wp-help-th-center th { text-align: center; } diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js index 01b0e576b3..2ed49d175c 100644 --- a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js @@ -205,7 +205,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { meta = tinymce.Env.mac ? __( 'Cmd + letter:' ) : __( 'Ctrl + letter:' ), table1 = [], table2 = [], - header; + header, html; each( [ { c: 'Copy', x: 'Cut' }, @@ -250,33 +250,56 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { header = [ __( 'Letter' ), __( 'Action' ), __( 'Letter' ), __( 'Action' ) ]; header = '' + header.join( '' ) + ''; + html = '
'; + + // Main section, default and additional shortcuts + html = html + + '

' + __( 'Default shortcuts,' ) + ' ' + meta + '

' + + '' + + header + + table1.join('') + + '
' + + '

' + __( 'Additional shortcuts,' ) + ' ' + access + '

' + + '' + + header + + table2.join('') + + '
'; + + if ( editor.plugins.wptextpattern ) { + // Text pattern section + html = html + + '

' + __( 'When starting a new paragraph with one of these patterns followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' ) + '

' + + '' + + tr({ '* or -': 'Bullet list' }) + + tr({ '1. or 1)': 'Numbered list' }) + + tr({ '>': 'Blockquote' }) + + tr({ '##': 'Heading 2' }) + + tr({ '###': 'Heading 3' }) + + tr({ '####': 'Heading 4' }) + + tr({ '#####': 'Heading 5' }) + + tr({ '######': 'Heading 6' }) + + '
'; + } + + // Focus management section + html = html + + '

' + __( 'Focus shortcuts:' ) + '

' + + '' + + tr({ 'Alt + F8': 'Inline toolbar (when an image, link or preview is selected)' }) + + tr({ 'Alt + F9': 'Editor menu (when enabled)' }) + + tr({ 'Alt + F10': 'Editor toolbar' }) + + tr({ 'Alt + F11': 'Elements path' }) + + '
' + + '

' + __( '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.' ) + '

'; + + html += '
'; + editor.windowManager.open( { title: 'Keyboard Shortcuts', items: { type: 'container', classes: 'wp-help', - html: ( - '
' + - '

' + __( 'Default shortcuts,' ) + ' ' + meta + '

' + - '' + - header + - table1.join('') + - '
' + - '

' + __( 'Additional shortcuts,' ) + ' ' + access + '

' + - '' + - header + - table2.join('') + - '
' + - '

' + __( 'Focus shortcuts:' ) + '

' + - '' + - tr({ 'Alt + F8': 'Inline toolbar (when an image, link or preview is selected)' }) + - tr({ 'Alt + F9': 'Editor menu (when enabled)' }) + - tr({ 'Alt + F10': 'Editor toolbar' }) + - tr({ 'Alt + F11': 'Elements path' }) + - '
' + - '

' + __( '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.' ) + '

' + - '
' - ) + html: html }, buttons: { text: 'Close',