WordPress.org

Make WordPress Core

Changeset 27545


Ignore:
Timestamp:
03/14/2014 10:42:59 PM (7 years ago)
Author:
azaozz
Message:

TinyMCE: add internal command and shortcut (Alt+Shift+X) for toggling <code>. Define a button that can be added to any toolbar as wp_code. See #6113

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

Legend:

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

    r27532 r27545  
    662662}
    663663
     664.mce-i-wp_code:before {
     665    content: "\e017";
     666}
     667
    664668/* Editors */
    665669.wp-editor-wrap {
  • trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

    r27531 r27545  
    194194    });
    195195
     196    editor.addCommand( 'WP_Code', function() {
     197        editor.formatter.toggle('code');
     198    });
     199
    196200    editor.addCommand( 'WP_Page', function() {
    197201        editor.execCommand( 'WP_More', 'nextpage' );
     
    231235        tooltip: 'Help',
    232236        cmd: 'WP_Help'
     237    });
     238
     239    editor.addButton( 'wp_code', {
     240        tooltip: 'Code',
     241        cmd: 'WP_Code',
     242        stateSelector: 'code'
    233243    });
    234244
     
    443453    editor.addShortcut( modKey + '+h', '', 'WP_Help' );
    444454    editor.addShortcut( modKey + '+p', '', 'WP_Page' );
     455    editor.addShortcut( modKey + '+x', '', 'WP_Code' );
    445456    editor.addShortcut( 'ctrl+s', '', function() {
    446457        if ( typeof wp !== 'undefined' && wp.autosave ) {
Note: See TracChangeset for help on using the changeset viewer.