Skip to content
Snippets Groups Projects
Commit ea51e758 authored by Paal Joergensen's avatar Paal Joergensen
Browse files

Fix bring back missing custom plugins

parent a31ecb6a
Branches
No related tags found
No related merge requests found
// Create a new plugin which registers a custom code highlighter
CKEDITOR.plugins.add('customCodeHighlighter', {
afterInit: function (editor) {
var highlighter = new CKEDITOR.plugins.codesnippet.highlighter({
languages: {
apache: 'Apache',
bash: 'Bash',
coffeescript: 'CoffeeScript',
cpp: 'C++',
cs: 'C#',
css: 'CSS',
diff: 'Diff',
html: 'HTML',
http: 'HTTP',
ini: 'INI',
java: 'Java',
javascript: 'JavaScript',
json: 'JSON',
makefile: 'Makefile',
markdown: 'Markdown',
nginx: 'Nginx',
objectivec: 'Objective-C',
perl: 'Perl',
php: 'PHP',
python: 'Python',
ruby: 'Ruby',
sql: 'SQL',
vbscript: 'VBScript',
xhtml: 'XHTML',
xml: 'XML'
},
init: function (ready) {
// Here we should load any required resources
ready();
},
highlighter: function (code, language, callback) {
// Here we are highlighting the code and returning it.
callback(code);
}
});
editor.plugins.codesnippet.setHighlighter(highlighter);
}
});
/*
* Remove   entities which were inserted ie. when removing a space and
* immediately inputting a space.
*
* NB: We could also set config.basicEntities to false, but this is stongly
* adviced against since this also does not turn ie. < into &lt;.
* @link http://stackoverflow.com/a/16468264/328272
*
* Based on StackOverflow answer.
* @link http://stackoverflow.com/a/14549010/328272
*/
CKEDITOR.plugins.add('removeRedundantNBSP', {
afterInit: function(editor) {
var config = editor.config,
dataProcessor = editor.dataProcessor,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
if (htmlFilter) {
htmlFilter.addRules({
text: function(text) {
return text.replace(/(\w)&nbsp;/gi, '$1 ');
}
}, {
applyToAll: true,
excludeNestedEditable: true
});
}
}
});
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment