punkave/apostrophe-editor-2 — pull request #26 by Mordred (2014-05-15 11:17:57+00:00)
Title: CKEditor 4.4.0 and external plugins loading

Hi,

I updated CKEditor to 4.4.0 and added support for widgets and external plugins loading, because, I need to allow users to insert HTML like this

```html

Title

```

into area, so that the user can modify only the "Title" string. CKEditor 4.4 has nice support for [Widgets](http://docs.ckeditor.com/#!/guide/widget_sdk_intro)

Developers can now extend CKEditor throught their own plugins.

Here is the example of the plugin which I have placed to the `/public/editor/plugins/headline/plugin.js` in my project:

```js
( function() {
CKEDITOR.plugins.add('headline', {
requires: 'widget',

icons: 'headline',

init: function(editor) {
editor.widgets.add('headline', {
button: 'Create headline',

template: '

\n

Title

\n

',

editables: {
title: {
selector: '.headline-title',
allowedContent: 'em strong'
}
},

allowedContent: 'div(!headline); h2(!headline-title)',

requiredContent: 'div(headline)',

upcast: function(element) {
return element.name == 'div' && element.hasClass('headline');
}
});
}
})
}() );
```

And then in the HTML:

```
{{ aposArea(global, 'footerAbout', {
textOnly: true,
controls: [ 'style', 'italic', 'bold', 'createLink', 'unlink', 'Headline' ],
plugins: [ { name: 'headline', path: '/editor/plugins/headline/' } ]
}) }}
```