Hi all,
I'm trying to make a custom toolbar in FCKeditor for drupal. I went into fckconfig.js and added the following:
Then I went into the FCKeditor admin area and selected 'custom' toolbar. Now when I try to add content it says 'Toolbar 'custom' does not exist'. I think that I need to create a 'tool bar set' using the following code:
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
oFCKeditor.ToolbarSet = 'MyToolbar' ;
oFCKeditor.Create() ;
</script>
but I do not know where to add this in? Also is the 'mytoolbar' text the only part I need to change (to 'custom') or do I need to add other stuff to this code as well?
Is there an extra step I'm missing here? Do I need to add more code somewhere else? All this stuff is a bit much for me, I realise this is probably a basic question but I've been fooling around for a half hour trying to figure it out with no luck. Any help much appreciated.
I'm trying to make a custom toolbar in FCKeditor for drupal. I went into fckconfig.js and added the following:
FCKConfig.ToolbarSets["Custom"] = [
['Save','Cut','Copy','Paste','SpellCheck','Undo','Redo'],
['ImageButton'],
'/',
['Bold','Italic','Underline','StrikeThrough'],
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Table','Rule','Smiley','PageBreak'],
'/',
['Style','FontName','FontSize'],
['TextColor','BGColor'],
['FitWindow','ShowBlocks','-','About'] // No comma for the last row.
] ;
Then I went into the FCKeditor admin area and selected 'custom' toolbar. Now when I try to add content it says 'Toolbar 'custom' does not exist'. I think that I need to create a 'tool bar set' using the following code:
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
oFCKeditor.ToolbarSet = 'MyToolbar' ;
oFCKeditor.Create() ;
</script>
but I do not know where to add this in? Also is the 'mytoolbar' text the only part I need to change (to 'custom') or do I need to add other stuff to this code as well?
Is there an extra step I'm missing here? Do I need to add more code somewhere else? All this stuff is a bit much for me, I realise this is probably a basic question but I've been fooling around for a half hour trying to figure it out with no luck. Any help much appreciated.
Re: Noob needing help with custom ToolBarSets
First of all, you mustn't rewrite fckconfig.js, you must create a custom.config.js file in which you would specify your settings. This is a good practice to maintain your configurations after uploads of versions.
Then, you should tell your instance where it is located with this line(for instance):
oFCKeditor.Config['CustomConfigurationsPath'] = sBasePath + 'pagesizeeditor.config.js?' + ( new Date() * 1 ); //( new Date() * 1 ) avoids cache's problems.
In this file, create your toolbar as follows:
// Set our toolbar.
FCKConfig.ToolbarSets['PageSizeEditorToolbar'] = [
['Source','DocProps','-','Templates'],
........
'/',
['Style','FontFormat','FontName','FontSize','ShowBlocks','-','About'] // No comma for the last row.
];
And finally tell your instance which toolbar to use.
// Let's use a custom toolbar for this editor.
oFCKeditor.ToolbarSet = 'PageSizeEditorToolbar';
This is my example.
var sBasePath = '/gt_web/';
var oFCKeditor = new FCKeditor('pagesizeeditor') ;
oFCKeditor.BasePath = sBasePath;
// Set the custom configurations file path (in this way the original file is mantained).
oFCKeditor.Config['CustomConfigurationsPath'] = sBasePath + 'pagesizeeditor.config.js?' + ( new Date() * 1 );
// Let's use a custom toolbar for this editor.
oFCKeditor.ToolbarSet = 'PageSizeEditorToolbar';
oFCKeditor.Value = '';
oFCKeditor.Create();
Re: Noob needing help with custom ToolBarSets
Right now, w/ Drupal 6, I'm using the recommended FCKeditor 6.x-1.3-rc3 module, with includes a config file - fckeditor.config.js. The structure is:
[fckeditor]
fckeditor.config.js
[fckeditor]
fckconfig.js
(So the real FCKeditor 2.6.3 files are living inside the 2nd [fckeditor] folder.)
So now, my question is, do we still use the same custom config file method? (create a myconfig.js and put that in say... drupal/sites folder?) Will it intervene with the module's fckeditor.config.js?
Within the module's fckeditor.config.js, we got this that gives us the default "Filtered HTML" toolbar.
What I want to do is simply create a new filter set in drupal/admin/settings/filters ... let's say called "Relax Filtered HTML", and allow editor level users to use tags like <img> <blockquote> <cite>... etc. I was gonna just change the fckeditor.config.js but I guess that's a no no. What is the correct way to go about doing it?
Re: Noob needing help with custom ToolBarSets
Re: Noob needing help with custom ToolBarSets
I am also having trouble with custom toolbars... But I've isolated my problem to the custom config file -> it is simply being ignored!
My directory structure is as follow:
webroot/scripts/fckeditor (basedir)
webroot/scripts/customconfig.js
My editor initialization is as follow:
var oFCKeditor = new FCKeditor(ta.name);
oFCKeditor.BasePath = "scripts/fckeditor/";
oFCKeditor.Config["CustomConfigurationsPath"] = "scripts/fck_config.js?"+(new Date()*1);
oFCKeditor.ToolbarSet = 'Custom';
oFCKeditor.ReplaceTextarea();
My "Custom" toolbar is currently just a copy of "Basic" as in the fckconfig.js file renamed to "Custom". If I comment the ToolbarSet line it corretly displays the default toolbar, but I currently get a 'Toolbar set "Custom" doesn't exist' error.