Question

I'm trying to configure the fck editor in order to be able to add images with it.

I know that the current format is set in the config file like this:

FCKConfig.ToolbarSets["Basic"] = [ ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About']

What I don't know is how to change it. How could I make a new toolbarsets and set it? Another thing that I can't do is access the config file. I haven't found anywhere where it is. I can only access it throught the url like .resources/fckeditor/fckconfig.js.

I've tried in the model class in blossom the following code:

FckEditorDialog fck = tab.addFckEditor("body", "Body", "Adds the body to the view"); fck.setConfig("enterMode", "br"); fck.setConfig("customConfigurationsPath", "/myconfig.js");

Changing enterMode works, but customConfigurationsPath doesn't. In myconfig.js I put the following code:

FCKConfig.ToolbarSets["Basic"] = [
['Cut','Copy','Paste','PasteText','PasteWord'],
['Undo','Redo','-','Bold','Italic','Underline','StrikeThrough'],
'/',
['OrderedList','UnorderedList','-','Outdent','Indent'],
['Link','Unlink','Anchor'],
'/',
['Style'],
['Table','Image','Flash','Rule','SpecialChar'],
['About']
] ;

I think that maybe the path to my configuration file isn't good. I don't really know where to put it..

Thank you very much for your help :)

Was it helpful?

Solution

Generally in Magnolia, you don't mess about with the fckconfig.js file at all. It's set up to be generated dynamically according to the options that are set for the control. Instead, you'd just set the options appropriately to enable the functionality you want. According to this post on the user list, you'd want to do something like this:

@DialogFactory("my-dialog")
public void myDialog(DialogBuilder myDialog) {
  TabBuilder settings = myDialog.addTab("Main page settings");
  settings.addEdit("title", "Title", "The HTML page title");
  FckEditorDialog fedContent = settings.addFckEditor("content", "Content", "The Content"); 
  fedContent.setConfig(FckEditorDialog.PARAM_IMAGES, true);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top