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
git-svn-id: https://develop.svn.wordpress.org/trunk@27545 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b6e2bd9f0e
commit
0fdb6dadfb
@ -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;
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user