I contacted Magnolia a few days back and got help with some code on how to add a plugin into the CKEditor within Magnolia.
I’ve successfully been able to do so, but I had several difficulties, which I’ll outline here:
1) I was unable to extend RichTextFieldFactory
My intention to add additional functionality to the RichTextFieldFactory by extending it failed because the method createFieldComponent.
I wanted to do something like:
but it seems that the plugins must be configured during the attach phase of the MagnoliaRichTextField, not sure why, this is the code from RichTextFieldFactory#createFieldComponent :
When adding the plugin there it worked fine, but it means I can’t extend RichTextFieldFactory because I must recreate the private variable richTextEditor.
2) The plugin file must be in /VAADIN/js/abbr
It was difficult to understand why the field was failing, my only guess was that the file was in the wrong location. It worked when I put it there (/abbr is because of the plugin name). It was not clear that it is necessary for the file to be in that location.
Sometimes, not consistently I would get this error, which is what hinted that the file wasn’t being found:
I’ll attach two classes, one is my original – failed - attempt and the successful attempt. Hopefully these are useful.