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

Built from https://develop.svn.wordpress.org/trunk@27545


git-svn-id: http://core.svn.wordpress.org/trunk@27388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz
2014-03-14 22:43:16 +00:00
parent e1fee3abc6
commit 08663710cb
7 changed files with 22 additions and 3 deletions

View File

@@ -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();

File diff suppressed because one or more lines are too long