Embedding CKEditor in SWT Java application in Linux
I'm having a problem with CKEditor not functioning properly. I have an SWT Java app running in Ubuntu. The app uses a Browser object to display an HTML page in the project which does nothing but display a CKEditor instance.
If I open the HTML page in Firefox, CKEditor renders OK, and everything works.
If开发者_运维百科 I run my Java app through Eclipse, the widget displays the HTML page, CKEditor renders OK, and everything works.
If I package my application up into a jar file and then run the app, the widget displays the HTML page, CKEditor renders OK, but nothing works. I can't type in the text area, none of the toolbar buttons work, and the javascript I have which runs
CKEDITOR.on('instanceReady', function( e ) { e.editor.execCommand('maximize'); });
does not execute.
I suspect something is wrong with the way the relative paths work when the files are packaged inside the jar, but everything appears to load correctly - the toolbar images, stylesheet, etc all load, but then no buttons can be clicked. It's like the UI breaks.
The only button which responds at all is if I click "Source", in which case I can edit the text area; clicking "Source" a second time goes back to WYSIWYG mode and leaves the CKEditor toolbar disabled (greyed out; no icons can be clicked on).
I have no ideas left for what to try. Suggestions?
I am not sure I understand: do your HTML files get bundled in the JAR file?
In any case, I would recommend proxying the files from an embedded web server. The DJ Native Swing project and DJ Sweet project have several HTML editors (including CKEditor) implemented using the SWT Browser and they all use this technique.
精彩评论