Cool, thanks Marius,
I was able to add something that adds a button to the CKEditor by using
approximately the following snippet:
require(['jquery'], function($) {$(document).ready(function() {
if(XWiki.contextaction=='edit') {
require(['deferred!ckeditor'], function(ckeditorPromise) {
ckeditorPromise.done(function(ckeditor) {
ckeditor.on('instanceCreated', function(event) {
event.editor.once('configLoaded', function(event) {
ckeditor.tools.extend(event.editor.config, {
plugins: 'ckeditor_wiris',
}, true);
});
ckeditor.plugins.addExternal('ckeditor_wiris',
'/wiriseditorapp/ckeditor_wiris/plugin.js');
});
});
});
}})});
within CKEditor.EditSheet2 which loads everywhere (I hope syntax-colored
html doesn't bother people's reading, it's a present of IntelliJ IDEA).
I am sure there are less verbose ways to do it!
One thing, however, where this is incomplete is that this only evaluates
if XWiki.contextaction=='edit' instead of checking for something more
realistic such as the availability of one or several CKeditors. It
doesn't trigger errors so it's not too bad (it is because of the
promise?). With comments on optimization, I think we should start a
snippet page or something such.
Now, the content that is created with this plugin (MathML elements) is
being killed by the rendering framework.
I guess I can either:
- let it be wrapped as a macro
- adjust the rendering framework to respect that bit
I think the second is impossible though. Or?
thanks
Paul
is there some
hint to add a plugin (with a button) to the CKEditor?
Yes, but you can also do it
without touching CKEditor.EditSheet (if
you want to write an extension for instance). See
http://jira.xwiki.org/browse/CKEDITOR-46?focusedCommentId=90672&page=co…
.
I tried adding the extraConfigs variable within
the configuration but it
seems like this cannot load my plugin.
I don't know what you mean by
"extraConfigs" but you can checkout
https://github.com/xwiki-contrib/application-ckeditor/blob/application-cked…
to see how to use an external plugin (in the first version of the CKEditor
integration the Source plugin was defined in a wiki page as a proof of
concept).
It would be cool to have an extension mechanism for that.
See
http://jira.xwiki.org/browse/CKEDITOR-16 .
I voted.