Added codeTag plugin into CKeditor
This commit is contained in:
parent
99b8190180
commit
9a8fb7a696
8
htmlarea/ckeditor/ckeditor/plugins/codeTag/README.md
Normal file
8
htmlarea/ckeditor/ckeditor/plugins/codeTag/README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Code tag in CKEditor
|
||||||
|
==============
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Install by placing in ckeditor/plugins/ and add the following to ckeditor/config.js
|
||||||
|
|
||||||
|
config.extraPlugins = 'codeTag';
|
BIN
htmlarea/ckeditor/ckeditor/plugins/codeTag/icons/code.png
Normal file
BIN
htmlarea/ckeditor/ckeditor/plugins/codeTag/icons/code.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 557 B |
15
htmlarea/ckeditor/ckeditor/plugins/codeTag/plugin.js
Normal file
15
htmlarea/ckeditor/ckeditor/plugins/codeTag/plugin.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
CKEDITOR.plugins.add( 'codeTag', {
|
||||||
|
icons: 'code',
|
||||||
|
init: function( editor ) {
|
||||||
|
editor.addCommand( 'wrapCode', {
|
||||||
|
exec: function( editor ) {
|
||||||
|
editor.insertHtml( '<code>' + editor.getSelection().getSelectedText() + '</code>' );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
editor.ui.addButton( 'Code', {
|
||||||
|
label: 'Wrap code',
|
||||||
|
command: 'wrapCode',
|
||||||
|
toolbar: 'insert'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
@ -65,7 +65,7 @@ CKEDITOR.editorConfig = function( config ) {
|
|||||||
- Allow <pre[*attributes](*classes)> for custom attributes/classes in code blocks
|
- Allow <pre[*attributes](*classes)> for custom attributes/classes in code blocks
|
||||||
*/
|
*/
|
||||||
// protect
|
// protect
|
||||||
config.extraAllowedContent = 'mediainsert[*]{*}(*);gallery[*]{*}(*);media[*]{*}(*);script[*]{*}(*);audio[*]{*}(*);div[*]{*}(*);span[*]{*}(*);img[height,width];pre[*](*);';
|
config.extraAllowedContent = 'mediainsert[*]{*}(*);gallery[*]{*}(*);media[*]{*}(*);script[*]{*}(*);audio[*]{*}(*);div[*]{*}(*);span[*]{*}(*);img[height,width];pre[*](*);code;tt;';
|
||||||
// Do not use auto paragraphs, added to these allowed tags (only!). Please regard that this was marked deprecated by CKE 4.4.5, but is a need for (our use of) extraAllowedContent - check this again by future versions!
|
// Do not use auto paragraphs, added to these allowed tags (only!). Please regard that this was marked deprecated by CKE 4.4.5, but is a need for (our use of) extraAllowedContent - check this again by future versions!
|
||||||
config.autoParagraph = false; // defaults(true)
|
config.autoParagraph = false; // defaults(true)
|
||||||
|
|
||||||
@ -234,7 +234,8 @@ CKEDITOR.editorConfig = function( config ) {
|
|||||||
{ name: 'others', items : s9ypluginbuttons },
|
{ name: 'others', items : s9ypluginbuttons },
|
||||||
{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] },
|
{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] },
|
||||||
{ name: 'document', groups : [ 'mode', 'document', 'doctools' ], items : [ 'Source' ] },
|
{ name: 'document', groups : [ 'mode', 'document', 'doctools' ], items : [ 'Source' ] },
|
||||||
{ name: 'cheatsheet', items : ['CheatSheet'] }
|
{ name: 'cheatsheet', items : ['CheatSheet'] },
|
||||||
|
{ name: 'codetag', items: [ 'Code' ] }
|
||||||
];
|
];
|
||||||
// console.log(JSON.stringify(config.toolbar_Full));
|
// console.log(JSON.stringify(config.toolbar_Full));
|
||||||
|
|
||||||
@ -252,7 +253,8 @@ CKEDITOR.editorConfig = function( config ) {
|
|||||||
{ name: 'mediaembed', items: [ 'MediaEmbed' ] },
|
{ name: 'mediaembed', items: [ 'MediaEmbed' ] },
|
||||||
{ name: 'others', items: s9ypluginbuttons },
|
{ name: 'others', items: s9ypluginbuttons },
|
||||||
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source' ] },
|
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source' ] },
|
||||||
{ name: 'about', items: [ 'About' ] }
|
{ name: 'about', items: [ 'About' ] },
|
||||||
|
//{ name: 'codetag', items: [ 'Code' ] }
|
||||||
];
|
];
|
||||||
// console.log(JSON.stringify(config.toolbar_s9y));
|
// console.log(JSON.stringify(config.toolbar_s9y));
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
// Plugin Dependencies: widget Add-on Dependencies: Line Utilities and Clipboard
|
// Plugin Dependencies: widget Add-on Dependencies: Line Utilities and Clipboard
|
||||||
// mediaembed is a fast and simple YouTube code CKEditor-Plugin: v. 0.5+ (https://github.com/frozeman/MediaEmbed, 2013-09-12) to avoid ACF restrictions
|
// mediaembed is a fast and simple YouTube code CKEditor-Plugin: v. 0.5+ (https://github.com/frozeman/MediaEmbed, 2013-09-12) to avoid ACF restrictions
|
||||||
// procurator and cheatsheet are S9y only plugins
|
// procurator and cheatsheet are S9y only plugins
|
||||||
var customplugins = 'mediaembed,procurator,cheatsheet,';
|
var customplugins = 'mediaembed,procurator,cheatsheet,codeTag,';
|
||||||
|
|
||||||
// for any new instance when it is created - listen on load
|
// for any new instance when it is created - listen on load
|
||||||
CKEDITOR.on('instanceReady', function(evt){
|
CKEDITOR.on('instanceReady', function(evt){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user