fckeditor.config.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. Drupal = window.parent.Drupal;
  2. /**
  3. * Fetch and provide original editor settings as local variable.
  4. *
  5. * FCKeditor does not support to pass complex variable types to the editor.
  6. * Instance settings passed to FCKinstance.Config are temporarily stored in
  7. * FCKConfig.PageConfig.
  8. */
  9. var wysiwygFormat = FCKConfig.PageConfig.wysiwygFormat;
  10. var wysiwygSettings = Drupal.settings.wysiwyg.configs.fckeditor[wysiwygFormat];
  11. var pluginSettings = (Drupal.settings.wysiwyg.plugins[wysiwygFormat] ? Drupal.settings.wysiwyg.plugins[wysiwygFormat] : { 'native': {}, 'drupal': {} });
  12. /**
  13. * Apply format-specific settings.
  14. */
  15. for (var setting in wysiwygSettings) {
  16. if (setting == 'buttons') {
  17. // Apply custom Wysiwyg toolbar for this format.
  18. // FCKConfig.ToolbarSets['Wysiwyg'] = wysiwygSettings.buttons;
  19. // Temporarily stack buttons into multiple button groups and remove
  20. // separators until #277954 is solved.
  21. FCKConfig.ToolbarSets['Wysiwyg'] = [];
  22. for (var i = 0; i < wysiwygSettings.buttons[0].length; i++) {
  23. FCKConfig.ToolbarSets['Wysiwyg'].push([wysiwygSettings.buttons[0][i]]);
  24. }
  25. FCKTools.AppendStyleSheet(document, '#xToolbar .TB_Start { display:none; }');
  26. // Set valid height of select element in silver and office2003 skins.
  27. if (FCKConfig.SkinPath.match(/\/office2003\/$/)) {
  28. FCKTools.AppendStyleSheet(document, '#xToolbar .SC_FieldCaption { height: 24px; } #xToolbar .TB_End { display: none; }');
  29. }
  30. else if (FCKConfig.SkinPath.match(/\/silver\/$/)) {
  31. FCKTools.AppendStyleSheet(document, '#xToolbar .SC_FieldCaption { height: 27px; }');
  32. }
  33. }
  34. else {
  35. FCKConfig[setting] = wysiwygSettings[setting];
  36. }
  37. }
  38. /**
  39. * Initialize this editor instance.
  40. */
  41. Drupal.wysiwyg.editor.instance.fckeditor.init(window);
  42. /**
  43. * Register native plugins for this input format.
  44. *
  45. * Parameters to Plugins.Add are:
  46. * - Plugin name.
  47. * - Languages the plugin is available in.
  48. * - Location of the plugin folder; <plugin_name>/fckplugin.js is appended.
  49. */
  50. for (var plugin in pluginSettings['native']) {
  51. // Languages and path may be undefined for internal plugins.
  52. FCKConfig.Plugins.Add(plugin, pluginSettings['native'][plugin].languages, pluginSettings['native'][plugin].path);
  53. }
  54. /**
  55. * Register Drupal plugins for this input format.
  56. *
  57. * Parameters to addPlugin() are:
  58. * - Plugin name.
  59. * - Format specific plugin settings.
  60. * - General plugin settings.
  61. * - A reference to this window so the plugin setup can access FCKConfig.
  62. */
  63. for (var plugin in pluginSettings.drupal) {
  64. Drupal.wysiwyg.editor.instance.fckeditor.addPlugin(plugin, pluginSettings.drupal[plugin], Drupal.settings.wysiwyg.plugins.drupal[plugin], window);
  65. }