Mercurial > hg > rr-repo
comparison sites/all/modules/wysiwyg/editors/js/fckeditor.config.js @ 0:ff03f76ab3fe
initial version
author | danieleb <danielebarchiesi@me.com> |
---|---|
date | Wed, 21 Aug 2013 18:51:11 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ff03f76ab3fe |
---|---|
1 | |
2 Drupal = window.parent.Drupal; | |
3 | |
4 /** | |
5 * Fetch and provide original editor settings as local variable. | |
6 * | |
7 * FCKeditor does not support to pass complex variable types to the editor. | |
8 * Instance settings passed to FCKinstance.Config are temporarily stored in | |
9 * FCKConfig.PageConfig. | |
10 */ | |
11 var wysiwygFormat = FCKConfig.PageConfig.wysiwygFormat; | |
12 var wysiwygSettings = Drupal.settings.wysiwyg.configs.fckeditor[wysiwygFormat]; | |
13 var pluginSettings = (Drupal.settings.wysiwyg.plugins[wysiwygFormat] ? Drupal.settings.wysiwyg.plugins[wysiwygFormat] : { 'native': {}, 'drupal': {} }); | |
14 | |
15 /** | |
16 * Apply format-specific settings. | |
17 */ | |
18 for (var setting in wysiwygSettings) { | |
19 if (setting == 'buttons') { | |
20 // Apply custom Wysiwyg toolbar for this format. | |
21 // FCKConfig.ToolbarSets['Wysiwyg'] = wysiwygSettings.buttons; | |
22 | |
23 // Temporarily stack buttons into multiple button groups and remove | |
24 // separators until #277954 is solved. | |
25 FCKConfig.ToolbarSets['Wysiwyg'] = []; | |
26 for (var i = 0; i < wysiwygSettings.buttons[0].length; i++) { | |
27 FCKConfig.ToolbarSets['Wysiwyg'].push([wysiwygSettings.buttons[0][i]]); | |
28 } | |
29 FCKTools.AppendStyleSheet(document, '#xToolbar .TB_Start { display:none; }'); | |
30 // Set valid height of select element in silver and office2003 skins. | |
31 if (FCKConfig.SkinPath.match(/\/office2003\/$/)) { | |
32 FCKTools.AppendStyleSheet(document, '#xToolbar .SC_FieldCaption { height: 24px; } #xToolbar .TB_End { display: none; }'); | |
33 } | |
34 else if (FCKConfig.SkinPath.match(/\/silver\/$/)) { | |
35 FCKTools.AppendStyleSheet(document, '#xToolbar .SC_FieldCaption { height: 27px; }'); | |
36 } | |
37 } | |
38 else { | |
39 FCKConfig[setting] = wysiwygSettings[setting]; | |
40 } | |
41 } | |
42 | |
43 // Fix Drupal toolbar obscuring editor toolbar in fullscreen mode. | |
44 var oldFitWindowExecute = FCKFitWindow.prototype.Execute; | |
45 var $drupalToolbar = window.parent.jQuery('#toolbar', Drupal.overlayChild ? window.parent.window.parent.document : window.parent.document); | |
46 FCKFitWindow.prototype.Execute = function() { | |
47 oldFitWindowExecute.apply(this, arguments); | |
48 if (this.IsMaximized) { | |
49 $drupalToolbar.hide(); | |
50 } | |
51 else { | |
52 $drupalToolbar.show(); | |
53 } | |
54 } | |
55 | |
56 /** | |
57 * Initialize this editor instance. | |
58 */ | |
59 Drupal.wysiwyg.editor.instance.fckeditor.init(window); | |
60 | |
61 /** | |
62 * Register native plugins for this input format. | |
63 * | |
64 * Parameters to Plugins.Add are: | |
65 * - Plugin name. | |
66 * - Languages the plugin is available in. | |
67 * - Location of the plugin folder; <plugin_name>/fckplugin.js is appended. | |
68 */ | |
69 for (var plugin in pluginSettings['native']) { | |
70 // Languages and path may be undefined for internal plugins. | |
71 FCKConfig.Plugins.Add(plugin, pluginSettings['native'][plugin].languages, pluginSettings['native'][plugin].path); | |
72 } | |
73 | |
74 /** | |
75 * Register Drupal plugins for this input format. | |
76 * | |
77 * Parameters to addPlugin() are: | |
78 * - Plugin name. | |
79 * - Format specific plugin settings. | |
80 * - General plugin settings. | |
81 * - A reference to this window so the plugin setup can access FCKConfig. | |
82 */ | |
83 for (var plugin in pluginSettings.drupal) { | |
84 Drupal.wysiwyg.editor.instance.fckeditor.addPlugin(plugin, pluginSettings.drupal[plugin], Drupal.settings.wysiwyg.plugins.drupal[plugin], window); | |
85 } | |
86 |