Custom FCKeditor config (full)


/ Published in: JavaScript
Save to your folder(s)

Replacement config settings for the Drupal FCKeditor module. Replace contents of .../modules/fckeditor/fckeditor.config.js


Copy this code and paste it in your HTML
  1. // $Id: fckeditor.config.js,v 1.5.2.5.2.12 2008/12/12 19:37:35 wwalc Exp $
  2.  
  3. /*
  4.  WARNING: clear browser's cache after you modify this file.
  5.  If you don't do this, you may notice that browser is ignoring all your changes.
  6. */
  7.  
  8. /*
  9.  Define as many toolbars as you need, you can change toolbar names
  10.  DrupalBasic will be forced on some smaller textareas (if enabled)
  11.  if you change the name of DrupalBasic, you have to update
  12.  FCKEDITOR_FORCE_SIMPLE_TOOLBAR_NAME in fckeditor.module
  13.  */
  14.  
  15. //uncomment these three lines to enable teaser break and page break plugins
  16. //remember to add 'DrupalBreak' and 'DrupalPageBreak' buttons to the toolbar
  17. FCKConfig.Plugins.Add( 'drupalbreak', 'en,pl,ru' ) ;
  18. FCKConfig.Plugins.Add( 'imgassist' ) ;
  19. //To enable plugins below you should install additional Drupal modules.
  20. //Please refer to the README.txt for more instructions.
  21. //FCKConfig.Plugins.Add( 'drupalpagebreak', 'en,pl,ru' ) ;
  22. //FCKConfig.Plugins.Add( 'linktonode', 'en,pl' ) ;
  23. //FCKConfig.Plugins.Add( 'linktomenu', 'en,pl' ) ;
  24. /*
  25.  This toolbar is dedicated to users with "Full HTML" access
  26.  some of commands used here (like 'FontName') use inline styles,
  27.  which unfortunately are stripped by "Filtered HTML" filter
  28.  */
  29. FCKConfig.ToolbarSets['DrupalFull'] = [
  30. ['Source'],
  31. ['Cut','Copy','Paste','PasteText','PasteWord'],
  32. ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
  33. ['Bold','Italic','StrikeThrough','-','Subscript','Superscript'],
  34. ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'],
  35. ['Style'],
  36. ['JustifyLeft','JustifyCenter','JustifyRight'],
  37. ['BGColor','CreateDiv','ShowBlocks','Templates'],
  38. /*
  39.  * EXPERIMENTAL
  40.  * Uncomment the line below to enable linktonode and linktomenu buttons
  41.  * ATTENTION: Link to Content module must be installed first!
  42.  * Remember to load appropriate plugins with FCKConfig.Plugins.Add command a couple of lines above
  43.  */
  44. //['Link','Unlink','LinkToNode','LinkToMenu','Anchor'],
  45. ['Link','Unlink','Anchor'],
  46. ['Image','Flash','Table','Rule','SpecialChar'],
  47. //uncomment this line to enable the page break button
  48. //remember to load appropriate plugin with FCKConfig.Plugins.Add
  49. //['Image','Flash','Table','Rule','SpecialChar','DrupalBreak','DrupalPageBreak'],
  50. ] ;
  51.  
  52.  
  53. FCKConfig.ToolbarSets['DrupalBasic'] = [
  54. ['FontFormat','-','Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink', 'Image']
  55. ] ;
  56.  
  57. //This toolbar should work fine with "Filtered HTML" filter
  58. FCKConfig.ToolbarSets['DrupalFiltered'] = [
  59. ['Source'],
  60. ['Cut','Copy','Paste','PasteText','PasteWord'],
  61. ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
  62. /*
  63.  * EXPERIMENTAL
  64.  * Uncomment the line below to enable linktonode and linktomenu buttons
  65.  * ATTENTION: Link to Content module must be installed first!
  66.  * Remember to load appropriate plugins with FCKConfig.Plugins.Add command a couple of lines above
  67.  */
  68. //['Link','Unlink','LinkToNode','LinkToMenu','Anchor'],
  69. ['Link','Unlink','Anchor'],
  70. ['Image','Flash','Table','Rule','Smiley','SpecialChar'],
  71. '/',
  72. ['FontFormat'],
  73. ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
  74. ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'],
  75. //uncomment this line to the enable page break button
  76. //remember to load appropriate plugin with FCKConfig.Plugins.Add
  77. //['JustifyLeft','JustifyCenter','JustifyRight','DrupalBreak','DrupalPageBreak','ShowBlocks'],
  78. ['JustifyLeft','JustifyCenter','JustifyRight','DrupalBreak','ShowBlocks'],
  79. ] ;
  80.  
  81. //helper function to add button at the end of the toolbar
  82. function addToolbarElement(element, toolbar, pos){
  83. var ts = FCKConfig.ToolbarSets ;
  84. if (ts[toolbar]) {
  85. var len=ts[toolbar].length;
  86. if (pos>=len) pos=len-1;
  87. if (ts[toolbar][(len -pos -1)] == '/') pos++;
  88. if (pos>=len) pos=len-1;
  89. if (!ts[toolbar][(len -pos -1)]) pos++;
  90. FCKConfig.ToolbarSets[toolbar][(len -pos -1)].push(element);
  91. }
  92. }
  93.  
  94. // Protect PHP code tags (<?...?>) so FCKeditor will not break them when
  95. // switching from Source to WYSIWYG.
  96. // Uncommenting this line doesn't mean the user will not be able to type PHP
  97. // code in the source. This kind of prevention must be done in the server side
  98. // (as does Drupal), so just leave this line as is.
  99. FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code
  100.  
  101. var _FileBrowserLanguage = 'php' ;
  102. var _QuickUploadLanguage = 'php' ;
  103.  
  104. // This overrides the IndentLength/IndentUnit settings.
  105. FCKConfig.IndentClasses = ['rteindent1','rteindent2','rteindent3','rteindent4'] ;
  106.  
  107. // [ Left, Center, Right, Justified ]
  108. FCKConfig.JustifyClasses = ['rteleft','rtecenter','rteright','rtejustify'] ;
  109. //Set to 'encode' if you want to obfuscate emails with javascript
  110. FCKConfig.EMailProtection = 'none' ;
  111.  
  112. // Z
  113. // Let's see if this takes.
  114. // http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options/CustomStyles
  115. FCKConfig.CustomStyles =
  116. {
  117. //'Main Title' : { Element : 'h3', Styles : { 'color' : 'Red' } },
  118. //'MY STYLE 1' : {Element :'h2', Styles : {'color' : 'Blue' , 'background-color' : 'Red' } }
  119. };
  120.  
  121. // I prefer to see block elements.
  122. FCKConfig.StartupShowBlocks = true;
  123.  
  124. //
  125. FCKConfig.EditorAreaStyles = 'body { background-image: none; background-color: #FFF }';
  126.  
  127. // Don't think this works, but let's try
  128. FCKConfig.FormatSource = true ;
  129. FCKConfig.FormatOutput = true ;
  130.  
  131. // Add support for custom templates.
  132. FCKConfig.TemplatesXmlPath = '../../fcktemplates.xml';
  133. FCKConfig.TemplateReplaceAll = false;
  134. FCKConfig.TemplateReplaceCheckbox = true;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.