[MGNLCKEDIT-11] Review configuration options in the DialogCKEditor Created: 18/Apr/14  Updated: 22/Apr/14  Resolved: 18/Apr/14

Status: Closed
Project: CKEditor Integration (closed)
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0.2

Type: Task Priority: Neutral
Reporter: Jaroslav Simak Assignee: Jaroslav Simak
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
is cloned by MGNLUI-2810 Review configuration options in the C... Closed
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Date of First Response:

 Description   

Some of the configuration options defined in the DialogCKEditor are obsolete/unused/old. Configuration options needs to be reviewed.

Part of this task is also to add some of the missing configuration options (see http://docs.ckeditor.com/#!/api/CKEDITOR.config).



 Comments   
Comment by Richard Unger [ 18/Apr/14 ]

Currently, when one sets custom js config for the ckEditor the magnolia DAM integration is lost. We had to create our own implementation of the control to code around this. (Source attached).

When revisiting the config options, please:

  • make sure the magnolia DAM integration gets loaded by default, even when providing a custom config file
  • each ckeditor instance can have its own configuration

As a suggestion:

The current configuration model is that properties get defined in JCR in the field definition, and these are then converted by the control implementation into a JS config file, toolbar config, etc...
This is kind of complicated.

Why not directly expose the ckeditor config options by having a subnode whose properties are directly converted into js, without the translation step?
--> it would be much simpler to implement, and would have the advantage that every ckeditor option is directly available without having to modify the control implementation for each option.

Comment by Jaroslav Simak [ 18/Apr/14 ]

Hello Richard,

thanks for your input. I'll implement things you suggested when i have some time. I'll keep ticket reopened util its done.

Regards,
Jaroslav

Comment by Richard Unger [ 18/Apr/14 ]

Thanks a lot!

here's our workaround for the dam integration thing. Looks like it may have already made it into AssetsEnabledRichTextFieldFactory.

RichTextFieldFactory.java
package at.lfrz.magnolia.atk.field;

import javax.inject.Inject;

import org.apache.commons.lang.StringUtils;

import info.magnolia.dam.DamManager;
import info.magnolia.dam.asset.field.factory.AssetsEnabledRichTextFieldFactory;
import info.magnolia.i18nsystem.SimpleTranslator;
import info.magnolia.ui.api.app.AppController;
import info.magnolia.ui.api.context.UiContext;
import info.magnolia.ui.form.field.definition.RichTextFieldDefinition;
import info.magnolia.ui.vaadin.richtext.MagnoliaRichTextFieldConfig;

import com.vaadin.data.Item;
import com.vaadin.server.VaadinService;


/**
 * @author Richard Unger, Bence Vass
 */
public class RichTextFieldFactory extends AssetsEnabledRichTextFieldFactory {




	private static final String PLUGIN_NAME_MAGNOLIALINK = "magnolialink";
    private static final String PLUGIN_PATH_MAGNOLIALINK = "/VAADIN/js/magnolialink/";
    
    private static final String PLUGIN_NAME_WORDCOUNT = "wordcount";
    private static final String PLUGIN_PATH_WORDCOUNT = "/VAADIN/js/wordcount/";
    
    private static final String PLUGIN_NAME_DEVTOOLS = "devtools";
    private static final String PLUGIN_PATH_DEVTOOLS = "/VAADIN/js/devtools/";
    
    private static final String PLUGIN_NAME_DIALOGSIMPLIFIER = "dialogsimplifier";
    private static final String PLUGIN_PATH_DIALOGSIMPLIFIER = "/VAADIN/js/dialogsimplifier/";

    
	@Inject
	public RichTextFieldFactory(RichTextFieldDefinition definition,
			Item relatedFieldItem, AppController appController,
			UiContext uiContext, SimpleTranslator i18n, DamManager manager) {
		super(definition, relatedFieldItem, appController, uiContext, i18n, manager);
	}


	
	@Override
	protected MagnoliaRichTextFieldConfig initializeCKEditorConfig() {
		MagnoliaRichTextFieldConfig config = super.initializeCKEditorConfig();		
		if (StringUtils.isNotBlank(definition.getConfigJsFile())){
			String path = VaadinService.getCurrentRequest().getContextPath();
	        // load magnolialink plugin + eventlistener
			config.addPlugin(PLUGIN_NAME_MAGNOLIALINK, path + PLUGIN_PATH_MAGNOLIALINK);
	        config.addListenedEvent(EVENT_GET_MAGNOLIA_LINK);
	        // load wordcount plugin
	        config.addPlugin(PLUGIN_NAME_WORDCOUNT, path + PLUGIN_PATH_WORDCOUNT);
	        // load dialogsimplifier plugin
	        config.addPlugin(PLUGIN_NAME_DIALOGSIMPLIFIER, path + PLUGIN_PATH_DIALOGSIMPLIFIER);
	        // load devtools plugin - disable in production
	        // config.addPlugin(PLUGIN_NAME_DEVTOOLS, path + PLUGIN_PATH_DEVTOOLS);
		}
		return config;
	}
	
	
	

}
Comment by Jaroslav Simak [ 18/Apr/14 ]

Ah, i misunderstood you - you're referring the CKEditor that is implemented in 5.x branch, however this project targeted to the 4.5 branch (replace fckEditor with ckEditor). I apologies for that.

Nevertheless i'll pass your post to our developers to get their opinion.

Regards,
Jaroslav

Generated at Sun Feb 11 23:59:24 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.