diff --git a/src/wp-includes/css/editor.css b/src/wp-includes/css/editor.css index 8e00807996..1d854589ec 100644 --- a/src/wp-includes/css/editor.css +++ b/src/wp-includes/css/editor.css @@ -661,6 +661,10 @@ i.mce-i-wp_page:before { content: '\f158'; } +.mce-i-wp_code:before { + content: "\e017"; +} + /* Editors */ .wp-editor-wrap { position: relative; diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js index 51f26dcdb8..0d2f34d288 100644 --- a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js @@ -193,6 +193,10 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { } }); + editor.addCommand( 'WP_Code', function() { + editor.formatter.toggle('code'); + }); + editor.addCommand( 'WP_Page', function() { editor.execCommand( 'WP_More', 'nextpage' ); }); @@ -232,6 +236,12 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { cmd: 'WP_Help' }); + editor.addButton( 'wp_code', { + tooltip: 'Code', + cmd: 'WP_Code', + stateSelector: 'code' + }); + // Menubar // Insert->Add Media if ( typeof wp !== 'undefined' && wp.media && wp.media.editor ) { @@ -442,6 +452,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { editor.addShortcut( modKey + '+d', '', 'Strikethrough' ); editor.addShortcut( modKey + '+h', '', 'WP_Help' ); editor.addShortcut( modKey + '+p', '', 'WP_Page' ); + editor.addShortcut( modKey + '+x', '', 'WP_Code' ); editor.addShortcut( 'ctrl+s', '', function() { if ( typeof wp !== 'undefined' && wp.autosave ) { wp.autosave.server.triggerSave();