Community
Participate
Working Groups
Changing the default ckEditor-Configuration requires at the moment the manipulation of the underlying JavaScript files. However there must be a way to initlize the widget with an own configuration from JavaSide. The following things must be customizable (the following list is not complete) * Avaialable Fonts * Default Font (font-family, font-size) * Available sizes
Any ideas on what might be required to make this work? I am willing to contribute ( I have a basic knowledge of both Eclipse APIs and Javascript ). By the looks of it, customisation would require injecting some code into base.html, probably by using HtmlComposer.execute(String). I've tried to simulate this, but I can't get access to the CKEditor instance: bc. composer.executeWithReturn(new GetHtmlCommand()); // ensure initialised composer.execute("try { alert(CKEDITOR.instances.editor1) } catch (error) { alert(error); }"); I always get ReferenceError: CKEDITOR is not defined .
Created attachment 196497 [details] patch Attached is a first approach how to implement that. To try this out, just create your editor this way: Configuration config = new Configuration(); config.setEnterMode("BR"); final HtmlComposer composer = new HtmlComposer(comp, SWT.NONE, config);
Created attachment 196498 [details] patch2 Please apply both patches
This is a first idea, which works and has a minimal impact. If you have a better idea, please let me know :)
I'll give it a shot, thanks. BTW, there seems to be a typo bc. + if (enterMode == "P"){ + config.enterMode = CKEDITOR.ENTER_P; + } else if (enterMode = "BR") { + config.enterMode = CKEDITOR.ENTER_BR; + } else if (enterMode = "BR") { + config.enterMode = CKEDITOR.ENTER_DIV; + } I think that: * the checks should use '==' * the last check should be against enterMode == 'DIV'
(In reply to comment #5) > I'll give it a shot, thanks. BTW, there seems to be a typo > > bc. > + if (enterMode == "P"){ > + config.enterMode = CKEDITOR.ENTER_P; > + } else if (enterMode = "BR") { > + config.enterMode = CKEDITOR.ENTER_BR; > + } else if (enterMode = "BR") { > + config.enterMode = CKEDITOR.ENTER_DIV; > + } > > I think that: > * the checks should use '==' > * the last check should be against enterMode == 'DIV' Yes, of course..Was a bit late yesterday ;)
I've applied the patch, and the block looks like this now: bc. if (enterMode == "P"){ config.enterMode = CKEDITOR.ENTER_P; } else if (enterMode == "BR") { alert("Setting BR mode..."); config.enterMode == CKEDITOR.ENTER_BR; } else if (enterMode == "DIV") { config.enterMode = CKEDITOR.ENTER_DIV; } alert("From parameter " + enterMode + " set config value to " + config.enterMode + " ( ENTER_BR is " + CKEDITOR.ENTER_BR + " )"); The issue is that setting the config.enterMode value does not seem to take effect. The 'Setting BR mode...' alter shows up, but the second alert reads 'From parameter BR set config value to 1 ( ENTER_BR is 2 ) ' . AFAIK ENTER_P has the value 1, so the config.enterMode is not set. Any idea why?
Um ... nevermind . == instead of = .
change config.enterMode == CKEDITOR.ENTER_BR; to config.enterMode = CKEDITOR.ENTER_BR;
Yup, thanks :-) So this snippet works just fine. bc. if (enterMode == "P"){ config.enterMode = CKEDITOR.ENTER_P; } else if (enterMode == "BR") { config.enterMode = CKEDITOR.ENTER_BR; } else if (enterMode == "DIV") { config.enterMode = CKEDITOR.ENTER_DIV; } Do you think that this can enter 0.8 before the according to the project plan ( http://www.eclipse.org/projects/project-plan.php?projectid=mylyn ) - 2011-06-01 Release Candidate (API Freeze) ?
s/before the according/before the API freeze according/ Typing is not my strong area today.
It's fine to make changes. Note that we'll freeze and branch early next week before RC3.
(In reply to comment #10) > > Do you think that this can enter 0.8 before the according to the project plan ( > http://www.eclipse.org/projects/project-plan.php?projectid=mylyn ) - 2011-06-01 > Release Candidate (API Freeze) ? I'll provide another patch tomorrow with the final implementation of setting the BR-Mode and the UseEntitySettings (Implementation-Details will change in comparision to the lateste pateches). Please give me feedback, so that I can push it to the branch before the merging for 0.8 is done. I'm not sure if we can implement all the configuration features the underlying ckeditor provides (for a full list see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html) but probably you can give me a list of "high-priorized" configuration elements that are important for your usecase.
That sounds great. I think that besides these two autoParagraph might be of use.
Created attachment 196824 [details] final patch Third patch. Implemented Entermode, ShiftEnterMode, Entities and Autoparagraph. Please give me feedback if that patch is suitable for you, so that I can push it. Here is an example how to use the config-stuff: Configuration config = new Configuration(); config.addConfigurationNode(new EnterModeConfiguration(EnterMode.BR)); config.addConfigurationNode(new ShiftEnterModeConfiguration(EnterMode.P)); config.addConfigurationNode(new UseEntitiesConfiguration(false)); final HtmlComposer composer = new HtmlComposer(comp, SWT.NONE, config);
Thanks for the updated patch. I am unable to apply the patches in succession - the first two succeed, but the third one fails with: bc. error: patch failed: org.eclipse.mylyn.htmltext/META-INF/MANIFEST.MF:17 error: org.eclipse.mylyn.htmltext/META-INF/MANIFEST.MF: patch does not apply Patch failed at 0001 Bug 332307 - Overwriting the default CkEditor configuration Am am on the 'master' branch and the last commit in it is bc.. commit 89d44c91d1d2b25b705ff044ca2922dadb344065 Author: Steffen Pingel <steffen.pingel@tasktop.com> Date: Wed May 25 15:34:32 2011 +0200 NEW - bug 345021: update Eclipse SUA for all features https://bugs.eclipse.org/bugs/show_bug.cgi?id=345021
I've pushed the changes now to the repository. Try updating directly from git.
Works just fine for me, thanks.
Ok, marking this as fixed. If other configurations are needed feel free to open a new bug.