forked from danielsvane/ckeditor-code-tag
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplugin.js
More file actions
24 lines (20 loc) · 668 Bytes
/
plugin.js
File metadata and controls
24 lines (20 loc) · 668 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
CKEDITOR.plugins.add( 'codeTag', {
icons: 'code',
init: function( editor ) {
var style = new CKEDITOR.style( { element: 'code' } );
// Listen to contextual style activation.
editor.attachStyleStateChange( style, function (state) {
!editor.readOnly && editor.getCommand( 'wrapCode').setState(state);
} );
// Create the command.
editor.addCommand( 'wrapCode', new CKEDITOR.styleCommand( style ) );
// Register the button, if the button plugin is enabled.
if ( editor.ui.addButton ) {
editor.ui.addButton( 'Code', {
label: 'Code',
command: 'wrapCode',
toolbar: 'insert'
} );
}
}
});