On Fri, Aug 5, 2016 at 11:53 AM, Paul Libbrecht <paul(a)hoplahup.net> wrote:
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
You don't need to check for XWiki.contextaction=='edit'. That's the goal
of
the deferred module loading
http://platform.xwiki.org/xwiki/bin/view/DevGuide/JavaScriptAPI#HDeferredDe…
. The ckeditorPromise will be resolved when the editor is available (either
in edit mode or anywhere else the editor is loaded). In other words, you
don't pull CKEditor, you are notified if someone else pulls it.
Of course, you still need to load the JSX on each page. In order to load
your JSX only when the CKEditor code is loaded we would need a UI extension
point (that the CKEditor would execute each time its code is loaded).
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?
Very difficult anyway, so you should try the wiki macro approach first.
Hope this helps,
Marius
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=com.atlassian.jira.plugin.system.issuetabpanels:
comment-tabpanel#comment-90672
.
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-ckeditor-1.0/ui/src/main/resources/
CKEditor/EditSheet.xml#L154
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.
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs