diff --git a/sites/all/modules/wysiwyg/CHANGELOG.txt b/sites/all/modules/wysiwyg/CHANGELOG.txt index 4c029e1485882ee4533220282f40149d572355de..5317afa3fcba63a273c25f26e8933de09dc2696b 100644 --- a/sites/all/modules/wysiwyg/CHANGELOG.txt +++ b/sites/all/modules/wysiwyg/CHANGELOG.txt @@ -1,18 +1,62 @@ -// $Id: CHANGELOG.txt,v 1.202 2010/09/25 11:53:19 twod Exp $ +// $Id: CHANGELOG.txt,v 1.243 2011/01/06 02:08:10 sun Exp $ -Wysiwyg x.x-x.x, xxxx-xx-xx +Wysiwyg 7.x-2.x, xxxx-xx-xx --------------------------- -Wysiwyg 7.x-3.x, xxxx-xx-xx +Wysiwyg 7.x-2.0, 2010-01-06 --------------------------- +#950216 by TwoD, sun: Fixed missing editor for a single text format. +#1007630 by aspilicious: Removed files[] declarations from .info file. +#612954 by sun: Reverted 'buttons' change in profile configuration form. +#975546 by TwoD, sun: Fixed markItUp CSS loaded with wrong weight. +#659428 by TwoD, sun: Fixed editor is attached to disabled text format widgets. +#975490 by G�bor Hojtsy: Updated for 'group' API change in drupal_add_js(). +#974604 by CrookedNumber, G�bor Hojtsy: Fixed theme CSS not loaded in editors. +#931374 by TwoD, ksenzee: Updated for text format schema change. +#826914 by catch, sun: Added database cache for wysiwyg_profile_load(). +#941230 by sun: Fixed missing Configuration link on Modules page. #739558 by sun, TwoD: Updated for new #type text_format. #612954 by TwoD: Fixed broken editor settings. #585932 by sun: Ported to Drupal 7. -Wysiwyg 6.x-3.x, xxxx-xx-xx +Wysiwyg 6.x-2.x, xxxx-xx-xx --------------------------- +by sun: Fixed coding style in wysiwyg_schema(). +#964978 by sun, TwoD: Added hook_wysiwyg_editor_settings_alter() documentation. +#775972 by TwoD, Agileware, sun: Fixed broken user default status preferences. +#1007066 by TwoD, penguin25: Fixed CKEditor ignores resizable option. +#613944 by TwoD, sun: Fixed data.node not always present in CKEditor. +#1009880 by TwoD: Fixed selection handling broken in CKEditor. + + +Wysiwyg 6.x-2.2, 2010-12-20 +--------------------------- +#613944 by TwoD, sun: Fixed data.node not available in CKEditor. +#748888 by TwoD, sun: Fixed isNode() not called in CKEditor. +#767550 by TwoD, sun, ungeek: Fixed invalid API docs and logic for + $plugin['filename']. +#988200 by sun: Changed static language list to ISO 639 defaults of Drupal core. +#973808 by David_Rothstein: Fixed CKEditor incorrectly formatting the <br> tag. +#773856 by Roi Danton: Added CSS path and file documentation. +#735186 by TwoD, torbs: Fixed missing Norwegian language code. +#678580 by TwoD, sun: Fixed Drupal.wysiwygAttachToggleLink breaks click events. +#497654 by TwoD: Fixed Drupal plugins disabled in FCKeditor/WebKit browsers. +#735624 by sun: Fixed enabling one button removes default editor toolbar. +#755610 by sun, TwoD, BrightBold: Fixed white-space in block formats setting + breaks editors. +#713942 by TwoD, sun: Fixed jQuery closure breaks OpenWYSIWYG. +#679056 by sun, TwoD: Fixed pressing enter in autocomplete detaches editors. +#80170 by sun: Changed dialog/plugin API for Inline API compatibility. +#803466 by hotspoons: Fixed TinyMCE image map support in advimage plugin. +#922436 by TwoD: Fixed Whizzywig Uncaught TypeError in Chrome. +#922520 by TwoD: Fixed Whizzywig is not detached properly. +#907186 by TwoD: Fixed Whizzywig v60+ compatibility. +#765292 by TwoD: Added TinyMCE WordCount plugin. +#768726 by TwoD: Added TinyMCE AutoResize plugin. +#781086 by TwoD: Fixed TinyMCE plugin options merged wrongly. +#767628 by TwoD: Fixed 'The version of markItUp could not be detected' error. #651490 by TwoD: Fixed Whizzywig width. #715228 by TwoD: Fixed TinyMCE image popups not launching for existing images. #606952 by TwoD: Fixed inserting content in fullscreen TinyMCE. @@ -24,9 +68,14 @@ Wysiwyg 6.x-3.x, xxxx-xx-xx #752516 by nquocbao, sun: Fixed openwysiwyg version callback. #753536 by TwoD: Fixed version detection for Whizzywig. #752516 by nquocbao, sun: Fixed file stream warnings in version callbacks. + + +Wysiwyg 6.x-2.1, 2010-03-08 +--------------------------- #628110 by quicksketch, sun, markus_petrux: Added editor settings alter hook. #689218 by wwalc, TwoD, sun: Improved support for CKEditor. #695398 by TwoD: Updated support for TinyMCE 3.3. +#613096 by Scott Reynolds: Fixed no editor appearing for user signature field. #696040 by Dave Reid: Fixed missing Cancel link on profile form. #594322 by TwoD: Added insert method for NicEdit. #659200 by TwoD: Fixed YUI Editor content lost in IE. @@ -45,12 +94,11 @@ Wysiwyg 6.x-3.x, xxxx-xx-xx #380586 by SimonEast: Updated YUI editor: Version detection not working. #610132 by TwoD: Updated CKEditor 3.0.1, stylesheets and version check. #620858 by quicksketch: Fixed focus event not firing for CKeditor. -#462146 by TwoD, et al: Added support for CKeditor. +#585932 by sun: Synced various clean-ups from 7.x. #489156 by sun: Removed orphan global 'showToggle' JS setting. #462146 by sun, Niels Hackius: Fixed version detection for CKeditor. #545210 by sun: Fixed default value for editor toggle link. #372826 by Roi Danton, sun: Added Wysiwyg API developer documentation. -#80170 by sun: Changed dialog/plugin API for Inline API compatibility. by sun: Fixed PHP notice. #514912 by Likeless, sun: Added plugin/button handling for WYMeditor. #538996 by darktygur: Fixed 404 errors for non-existing theme CSS files. @@ -61,7 +109,7 @@ by sun: Fixed PHP notice. #507608 by jfh: Added WYMeditor instance API methods. by sun: Fixed form_build_id not removed from serialized profile settings. #496744 by TwoD: Fixed FCKeditor: "Apply source formatting" not working. -#462146 by sun: Added CKeditor support. +#462146 by TwoD, et al: Added support for CKeditor. #490270 by sun: Fixed openWYSIWYG displays no buttons by default. #490266 by sun: Fixed JS error when wysiwyg profile contains no buttons. #400482 by sun: Fixed editor.instance.prepareContent() breaks editor's native @@ -229,6 +277,10 @@ Wysiwyg 6.x-0.3, 2008-09-12 #227687 by sun: Fixed improperly capitalized package name. #288028 by Matthew Davidson: Fixed outdated check for PHP input filter. #280727 by sun: Removed gzip compressor from installation instructions. + + +Wysiwyg 5.x-0.2, 2008-07-16 +--------------------------- by sun: Fixed JavaScript errors when JS aggregation/compression is enabled. #268562 by sun: Code clean-up; changed format for custom defined CSS classes and removed error-prone auto-layout of buttons in favor of aligning them in diff --git a/sites/all/modules/wysiwyg/editors/ckeditor.inc b/sites/all/modules/wysiwyg/editors/ckeditor.inc index cf314d0b4615cc0efd773d0e6c32bbe6dc2ccfc3..3109e7ab5766772445eb610d024b78d9ef5857a9 100644 --- a/sites/all/modules/wysiwyg/editors/ckeditor.inc +++ b/sites/all/modules/wysiwyg/editors/ckeditor.inc @@ -1,5 +1,5 @@ <?php -// $Id: ckeditor.inc,v 1.8 2010/09/10 02:13:59 sun Exp $ +// $Id: ckeditor.inc,v 1.11 2010/12/25 19:12:56 sun Exp $ /** * @file @@ -184,15 +184,16 @@ function wysiwyg_ckeditor_settings($editor, $config, $theme) { $settings['language'] = $config['language']; } if (isset($config['resizing'])) { - $settings['resize_enabled'] = $config['resizing']; + // CKEditor tests "!== false", so ensure it is a Boolean. + $settings['resize_enabled'] = (bool) $config['resizing']; } if (isset($config['toolbar_loc'])) { $settings['toolbarLocation'] = $config['toolbar_loc']; } + $settings['toolbar'] = array(); if (!empty($config['buttons'])) { $extra_plugins = array(); - $settings['toolbar'] = array(); $plugins = wysiwyg_get_plugins($editor['name']); foreach ($config['buttons'] as $plugin => $buttons) { foreach ($buttons as $button => $enabled) { @@ -232,11 +233,9 @@ function wysiwyg_ckeditor_settings($editor, $config, $theme) { if (!empty($extra_plugins)) { $settings['extraPlugins'] = implode(',', $extra_plugins); } - // For now, all buttons are placed into one row. - if (!empty($settings['toolbar'])) { - $settings['toolbar'] = array($settings['toolbar']); - } } + // For now, all buttons are placed into one row. + $settings['toolbar'] = array($settings['toolbar']); return $settings; } @@ -252,12 +251,13 @@ function wysiwyg_ckeditor_plugin_settings($editor, $profile, $plugins) { $settings[$name] = array(); // Add path for native external plugins. if (empty($plugin['internal']) && isset($plugin['path'])) { - $settings[$name]['path'] = base_path() . $plugin['path']; + $settings[$name]['path'] = base_path() . $plugin['path'] . '/'; } // Force native internal plugins to use the standard path. else { $settings[$name]['path'] = base_path() . $editor['library path'] . '/plugins/' . $name . '/'; } + // CKEditor defaults to 'plugin.js' on its own when filename is not set. if (!empty($plugin['filename'])) { $settings[$name]['fileName'] = $plugin['filename']; } diff --git a/sites/all/modules/wysiwyg/editors/fckeditor.inc b/sites/all/modules/wysiwyg/editors/fckeditor.inc index 76ed7600a745be5b5b795d155f1fbde213458068..d33a0c7ec7916f85aed68dad1f3471de9de9ac65 100644 --- a/sites/all/modules/wysiwyg/editors/fckeditor.inc +++ b/sites/all/modules/wysiwyg/editors/fckeditor.inc @@ -1,5 +1,5 @@ <?php -// $Id: fckeditor.inc,v 1.20 2010/04/02 14:05:36 sun Exp $ +// $Id: fckeditor.inc,v 1.22 2010/12/19 23:26:56 sun Exp $ /** * @file @@ -137,11 +137,11 @@ function wysiwyg_fckeditor_settings($editor, $config, $theme) { } } + // Use our custom toolbar set. + $settings['ToolbarSet'] = 'Wysiwyg'; + // Populate our custom toolbar set for fckeditor.config.js. + $settings['buttons'] = array(); if (!empty($config['buttons'])) { - // Use our custom toolbar set. - $settings['ToolbarSet'] = 'Wysiwyg'; - // Populate our custom toolbar set for fckeditor.config.js. - $settings['buttons'] = array(); $plugins = wysiwyg_get_plugins($editor['name']); foreach ($config['buttons'] as $plugin => $buttons) { foreach ($buttons as $button => $enabled) { @@ -162,11 +162,9 @@ function wysiwyg_fckeditor_settings($editor, $config, $theme) { } } } - // For now, all buttons are placed into one row. - if (!empty($settings['buttons'])) { - $settings['buttons'] = array($settings['buttons']); - } } + // For now, all buttons are placed into one row. + $settings['buttons'] = array($settings['buttons']); return $settings; } @@ -182,7 +180,8 @@ function wysiwyg_fckeditor_plugin_settings($editor, $profile, $plugins) { $settings[$name] = array(); // Add path for native external plugins; internal ones do not need a path. if (empty($plugin['internal']) && isset($plugin['path'])) { - $settings[$name]['path'] = base_path() . $plugin['path']; + // All native FCKeditor plugins use the filename fckplugin.js. + $settings[$name]['path'] = base_path() . $plugin['path'] . '/'; } if (!empty($plugin['languages'])) { $settings[$name]['languages'] = $plugin['languages']; diff --git a/sites/all/modules/wysiwyg/editors/js/ckeditor-3.0.js b/sites/all/modules/wysiwyg/editors/js/ckeditor-3.0.js index 1139c564d16954bdb970e587eac5e63564cc1cf4..8c4e8f4329d4dfd055e59149002b2fd5cb56164c 100644 --- a/sites/all/modules/wysiwyg/editors/js/ckeditor-3.0.js +++ b/sites/all/modules/wysiwyg/editors/js/ckeditor-3.0.js @@ -1,4 +1,4 @@ -// $Id: ckeditor-3.0.js,v 1.6 2009/11/17 15:32:09 twod Exp $ +// $Id: ckeditor-3.0.js,v 1.11 2010/12/29 20:02:10 twod Exp $ (function($) { Drupal.wysiwyg.editor.init.ckeditor = function(settings) { @@ -60,6 +60,9 @@ Drupal.wysiwyg.editor.attach.ckeditor = function(context, params, settings) { } } else { + // CKEditor adds default formatting to <br>, so we want to remove that + // here too. + tags.br = 1; // No indents or linebreaks; for (var tag in tags) { if (tag == 'pre') { @@ -106,6 +109,20 @@ Drupal.wysiwyg.editor.attach.ckeditor = function(context, params, settings) { }); } }, + + selectionChange: function (event) { + if (Drupal.settings.wysiwyg.plugins[params.format]) { + $.each(Drupal.settings.wysiwyg.plugins[params.format].drupal, function (name) { + var plugin = Drupal.wysiwyg.plugins[name]; + if ($.isFunction(plugin.isNode)) { + var node = event.data.selection.getSelectedElement(); + var state = plugin.isNode(node ? node.$ : null) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF; + event.editor.getCommand(name).setState(state); + } + }); + } + }, + focus: function(ev) { Drupal.wysiwyg.activeId = ev.editor.name; } @@ -151,10 +168,27 @@ Drupal.wysiwyg.editor.instance.ckeditor = { } if (typeof Drupal.wysiwyg.plugins[pluginName].invoke == 'function') { var pluginCommand = { - exec: function(editor) { - var data = { format: 'html', node: editor.getSelection().getSelectedElement() }; - // @todo This is NOT the same as data.node. - data.content = data.node ? data.node.innerHTML : ''; + exec: function (editor) { + var data = { format: 'html', node: null, content: '' }; + var selection = editor.getSelection(); + if (selection) { + data.node = selection.getSelectedElement(); + if (data.node) { + data.node = data.node.$; + } + if (selection.getType() == CKEDITOR.SELECTION_TEXT) { + if (CKEDITOR.env.ie) { + data.content = selection.getNative().createRange().text; + } + else { + data.content = selection.getNative().toString(); + } + } + else if (data.node) { + // content is supposed to contain the "outerHTML". + data.content = data.node.parentNode.innerHTML; + } + } Drupal.wysiwyg.plugins[pluginName].invoke(data, pluginSettings, editor.name); } }; diff --git a/sites/all/modules/wysiwyg/editors/js/fckeditor-2.6.js b/sites/all/modules/wysiwyg/editors/js/fckeditor-2.6.js index 5c22c14d774c6c65b434a4548e0ac83402bd1e68..12d582c2d44c95bbd0a65119d706786e1ac7142e 100644 --- a/sites/all/modules/wysiwyg/editors/js/fckeditor-2.6.js +++ b/sites/all/modules/wysiwyg/editors/js/fckeditor-2.6.js @@ -1,4 +1,4 @@ -// $Id: fckeditor-2.6.js,v 1.21 2010/09/10 02:06:48 sun Exp $ +// $Id: fckeditor-2.6.js,v 1.22 2010/11/13 18:53:15 sun Exp $ (function($) { /** @@ -135,6 +135,10 @@ Drupal.wysiwyg.editor.instance.fckeditor = { return FCK_TRISTATE_DISABLED; } var state = instance.FCK.GetNamedCommandState(this.Name); + // FCKeditor sets the wrong state in WebKit browsers. + if (!$.support.queryCommandEnabled && state == FCK_TRISTATE_DISABLED) { + state = FCK_TRISTATE_OFF; + } if (state == FCK_TRISTATE_OFF && instance.FCK.EditMode == FCK_EDITMODE_WYSIWYG) { if (typeof Drupal.wysiwyg.plugins[plugin].isNode == 'function') { var node = instance.FCKSelection.GetSelectedElement(); diff --git a/sites/all/modules/wysiwyg/editors/js/openwysiwyg.js b/sites/all/modules/wysiwyg/editors/js/openwysiwyg.js index 0428c9492fd6e22ed44d4ac860e0d57900f29121..2c94e6c6e67ee34d5b0554cc37fdb0cbf19dc578 100644 --- a/sites/all/modules/wysiwyg/editors/js/openwysiwyg.js +++ b/sites/all/modules/wysiwyg/editors/js/openwysiwyg.js @@ -1,17 +1,33 @@ -// $Id: openwysiwyg.js,v 1.2 2009/09/26 05:37:57 sun Exp $ +// $Id: openwysiwyg.js,v 1.4 2010/11/13 19:07:44 sun Exp $ -// Reset $() to jQuery. Yuck! +// Backup $ and reset it to jQuery. +Drupal.wysiwyg._openwysiwyg = $; $ = jQuery; +// Wrap openWYSIWYG's methods to temporarily use its version of $. +jQuery.each(WYSIWYG, function (key, value) { + if (jQuery.isFunction(value)) { + WYSIWYG[key] = function () { + var old$ = $; + $ = Drupal.wysiwyg._openwysiwyg; + var result = value.apply(this, arguments); + $ = old$; + return result; + }; + } +}); + +// Override editor functions. +WYSIWYG.getEditor = function (n) { + return Drupal.wysiwyg._openwysiwyg("wysiwyg" + n); +}; + (function($) { /** * Attach this editor to a target element. */ Drupal.wysiwyg.editor.attach.openwysiwyg = function(context, params, settings) { - jQuery.noConflict(); - $ = Drupal.wysiwyg._openwysiwyg; - // Initialize settings. settings.ImagesDir = settings.path + 'images/'; settings.PopupsDir = settings.path + 'popups/'; @@ -25,17 +41,12 @@ Drupal.wysiwyg.editor.attach.openwysiwyg = function(context, params, settings) { WYSIWYG.setSettings(params.field, config); WYSIWYG_Core.includeCSS(WYSIWYG.config[params.field].CSSFile); WYSIWYG._generate(params.field, config); - - $ = jQuery; }; /** * Detach a single or all editors. */ Drupal.wysiwyg.editor.detach.openwysiwyg = function(context, params) { - jQuery.noConflict(); - $ = Drupal.wysiwyg._openwysiwyg; - if (typeof params != 'undefined') { var instance = WYSIWYG.config[params.field]; if (typeof instance != 'undefined') { @@ -53,48 +64,6 @@ Drupal.wysiwyg.editor.detach.openwysiwyg = function(context, params) { jQuery('#' + field).show(); }); } - - $ = jQuery; -}; - -/** - * Custom implementation of $() for openwysiwyg. - */ -Drupal.wysiwyg._openwysiwyg = function (id) { - return document.getElementById(id); -}; - -// Override editor functions. -WYSIWYG.getEditor = function (n) { - return Drupal.wysiwyg._openwysiwyg("wysiwyg" + n); -}; -WYSIWYG._closeDropDowns = WYSIWYG.closeDropDowns; -WYSIWYG.closeDropDowns = function (n, id) { - jQuery.noConflict(); - $ = Drupal.wysiwyg._openwysiwyg; - WYSIWYG._closeDropDowns(n, id); - $ = jQuery; -}; -WYSIWYG._openDropDown = WYSIWYG.openDropDown; -WYSIWYG.openDropDown = function (n, id) { - jQuery.noConflict(); - $ = Drupal.wysiwyg._openwysiwyg; - WYSIWYG._openDropDown(n, id); - $ = jQuery; -}; -WYSIWYG._viewSource = WYSIWYG.viewSource; -WYSIWYG.viewSource = function (n, id) { - jQuery.noConflict(); - $ = Drupal.wysiwyg._openwysiwyg; - WYSIWYG._viewSource(n, id); - $ = jQuery; -}; -WYSIWYG._viewText = WYSIWYG.viewText; -WYSIWYG.viewText = function (n, id) { - jQuery.noConflict(); - $ = Drupal.wysiwyg._openwysiwyg; - WYSIWYG._viewText(n, id); - $ = jQuery; }; })(jQuery); diff --git a/sites/all/modules/wysiwyg/editors/js/tinymce-2.js b/sites/all/modules/wysiwyg/editors/js/tinymce-2.js index 79095cb28d810b9887d008a3200698cd4fa804a9..4b5726d218b798c8ead21cd390aa79d8917f4254 100644 --- a/sites/all/modules/wysiwyg/editors/js/tinymce-2.js +++ b/sites/all/modules/wysiwyg/editors/js/tinymce-2.js @@ -1,4 +1,4 @@ -// $Id: tinymce-2.js,v 1.13 2010/09/25 03:00:16 twod Exp $ +// $Id: tinymce-2.js,v 1.14 2010/10/17 20:52:40 twod Exp $ (function($) { /** @@ -49,9 +49,15 @@ Drupal.wysiwyg.editor.attach.tinymce = function(context, params, settings) { tinyMCE.settings[setting] = settings[setting]; } - // #715228: Remove extra mceItem class added by Wysiwyg < v2.1. + // Remove TinyMCE's internal mceItem class, which was incorrectly added to + // submitted content by Wysiwyg <2.1. TinyMCE only temporarily adds the class + // for placeholder elements. If preemptively set, the class prevents (native) + // editor plugins from gaining an active state, so we have to manually remove + // it prior to attaching the editor. This is done on the client-side instead + // of the server-side, as Wysiwyg has no way to figure out where content is + // stored, and the class only affects editing. $field = $('#' + params.field); - $field.val($field.val().replace(/class=(['"].*?)\bmceItem\b(.*?['"])/ig, 'class=$1$2')); + $field.val($field.val().replace(/(<.+?\s+class=['"][\w\s]*?)\bmceItem\b([\w\s]*?['"].*?>)/ig, '$1$2')); // Attach editor. tinyMCE.execCommand('mceAddControl', true, params.field); diff --git a/sites/all/modules/wysiwyg/editors/js/tinymce-3.js b/sites/all/modules/wysiwyg/editors/js/tinymce-3.js index a406e48a1c7e0c602f69303729c99ebb31334654..52d9648c8e5458aae507965bc689d4dbf8de5e2b 100644 --- a/sites/all/modules/wysiwyg/editors/js/tinymce-3.js +++ b/sites/all/modules/wysiwyg/editors/js/tinymce-3.js @@ -1,4 +1,4 @@ -// $Id: tinymce-3.js,v 1.21 2010/09/25 03:00:16 twod Exp $ +// $Id: tinymce-3.js,v 1.22 2010/10/17 20:52:40 twod Exp $ (function($) { /** @@ -61,9 +61,15 @@ Drupal.wysiwyg.editor.attach.tinymce = function(context, params, settings) { $('#' + ed.editorContainer + ' table.mceToolbar').remove(); }); - // #715228: Remove extra mceItem class added by Wysiwyg < v2.1. + // Remove TinyMCE's internal mceItem class, which was incorrectly added to + // submitted content by Wysiwyg <2.1. TinyMCE only temporarily adds the class + // for placeholder elements. If preemptively set, the class prevents (native) + // editor plugins from gaining an active state, so we have to manually remove + // it prior to attaching the editor. This is done on the client-side instead + // of the server-side, as Wysiwyg has no way to figure out where content is + // stored, and the class only affects editing. $field = $('#' + params.field); - $field.val($field.val().replace(/class=(['"].*?)\bmceItem\b(.*?['"])/ig, 'class=$1$2')); + $field.val($field.val().replace(/(<.+?\s+class=['"][\w\s]*?)\bmceItem\b([\w\s]*?['"].*?>)/ig, '$1$2')); // Attach editor. ed.render(); diff --git a/sites/all/modules/wysiwyg/editors/js/whizzywig-56.js b/sites/all/modules/wysiwyg/editors/js/whizzywig-56.js index 50fb2c000571c0532a331c5e002a27cb4f2b6313..cca4186559c456f699aedbd9f21167da9ec7b568 100644 --- a/sites/all/modules/wysiwyg/editors/js/whizzywig-56.js +++ b/sites/all/modules/wysiwyg/editors/js/whizzywig-56.js @@ -1,4 +1,4 @@ -// $Id: whizzywig-56.js,v 1.2 2010/09/25 11:53:19 twod Exp $ +// $Id: whizzywig-56.js,v 1.4 2010/10/18 19:53:12 sun Exp $ var wysiwygWhizzywig = { currentField: null, fields: {} }; var buttonPath = null; @@ -36,7 +36,9 @@ var o = function (id) { // Upon first access to "whizzy" + id, Whizzywig tries to access its IFRAME, // so we need to insert the editor into the DOM. if (id == 'whizzy' + wysiwygWhizzywig.currentField && wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField]) { - jQuery('#' + wysiwygWhizzywig.currentField).after('<div id="' + wysiwygWhizzywig.currentField + '-whizzywig">' + w() + '</div>'); + jQuery('#' + wysiwygWhizzywig.currentField).after('<div id="' + wysiwygWhizzywig.currentField + '-whizzywig"></div>'); + // Iframe's .contentWindow becomes null in Webkit if inserted via .after(). + jQuery('#' + wysiwygWhizzywig.currentField + '-whizzywig').html(w()); // Prevent subsequent invocations from inserting the editor multiple times. wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField] = ''; } @@ -72,7 +74,10 @@ Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) { wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField] = ''; // Whizzywig needs to have the width set 'inline'. $field = $('#' + params.field); - Drupal.wysiwyg.instances[params.field].originalWidth = $field.css('width'); + var originalValues = Drupal.wysiwyg.instances[params.field]; + originalValues.originalWidth = $field.css('width'); + originalValues.originalColor = $field.css('color'); + originalValues.originalZindex = $field.css('zIndex'); $field.css('width', $field.width() + 'px'); // Attach editor. @@ -80,7 +85,7 @@ Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) { // Whizzywig fails to detect and set initial textarea contents. var instance = $('#whizzy' + params.field).get(0); if (instance) { - instance.contentWindow.document.body.innerHTML = $('#' + params.field).val(); + instance.contentWindow.document.body.innerHTML = tidyD($field.val()); } }; @@ -88,34 +93,43 @@ Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) { * Detach a single or all editors. */ Drupal.wysiwyg.editor.detach.whizzywig = function(context, params) { - var detach = function (id) { - var instance = $('#whizzy' + whizzies[id]).get(0); + var detach = function (index) { + var id = whizzies[index]; + var instance = $('#whizzy' + id).get(0); if (!instance) { return; } - var body = instance.contentWindow.document.body; - var $field = $('#' + whizzies[id]); - body.innerHTML = tidyH(instance.contentWindow.document); + var editingArea = instance.contentWindow.document; + var $field = $('#' + id); + // Whizzywig shows the original textarea in source mode. + if ($field.css('display') == 'block') { + editingArea.body.innerHTML = $field.val(); + } // Save contents of editor back into textarea. - $field.val(window.get_xhtml ? get_xhtml(body) : body.innerHTML); - $field.val($field.val().replace(location.href + '#', '#')); + $field.val(tidyH(editingArea)); // Remove editor instance. - $('#' + whizzies[id] + '-whizzywig').remove(); - whizzies.splice(id, 1); - $field.css('width', Drupal.wysiwyg.instances[$field.attr('id')].originalWidth); + $('#' + id + '-whizzywig').remove(); + whizzies.splice(index, 1); + + // Restore original textarea styling. + var originalValues = Drupal.wysiwyg.instances[id]; + $field.css('width', originalValues.originalWidth); + $field.css('color', originalValues.originalColor); + $field.css('zIndex', originalValues.originalZindex); }; if (typeof params != 'undefined') { - for (var id in whizzies) { - if (whizzies[id] == params.field) { - detach(id); + for (var i = 0; i < whizzies.length; i++) { + if (whizzies[i] == params.field) { + detach(i); + break; } } } else { - for (var id in whizzies) { - detach(id); + while (whizzies.length > 0) { + detach(0); } } }; diff --git a/sites/all/modules/wysiwyg/editors/js/whizzywig-60.js b/sites/all/modules/wysiwyg/editors/js/whizzywig-60.js new file mode 100644 index 0000000000000000000000000000000000000000..b87df9aa5fd2db25b9ca286cec5170b4faa82d69 --- /dev/null +++ b/sites/all/modules/wysiwyg/editors/js/whizzywig-60.js @@ -0,0 +1,89 @@ +// $Id: whizzywig-60.js,v 1.1 2010/10/18 19:37:44 sun Exp $ + +var buttonPath = null; + +(function($) { + +/** + * Attach this editor to a target element. + */ +Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) { + // Previous versions used per-button images found in this location, + // now it is only used for custom buttons. + if (settings.buttonPath) { + window.buttonPath = settings.buttonPath; + } + // Assign the toolbar image path used for native buttons, if available. + if (settings.toolbarImagePath) { + btn._f = settings.toolbarImagePath; + } + // Fall back to text labels for all buttons. + else { + window.buttonPath = 'textbuttons'; + } + // Whizzywig needs to have the width set 'inline'. + $field = $('#' + params.field); + var originalValues = Drupal.wysiwyg.instances[params.field]; + originalValues.originalWidth = $field.css('width'); + originalValues.originalColor = $field.css('color'); + originalValues.originalZindex = $field.css('zIndex'); + $field.css('width', $field.width() + 'px'); + + // Attach editor. + makeWhizzyWig(params.field, (settings.buttons ? settings.buttons : 'all')); + // Whizzywig fails to detect and set initial textarea contents. + var instance = $('#whizzy' + params.field).get(0); + if (instance) { + instance.contentWindow.document.body.innerHTML = tidyD($field.val()); + } +}; + +/** + * Detach a single or all editors. + */ +Drupal.wysiwyg.editor.detach.whizzywig = function(context, params) { + var detach = function (index) { + var id = whizzies[index]; + var instance = $('#whizzy' + id).get(0); + if (!instance) { + return; + } + var editingArea = instance.contentWindow.document; + var $field = $('#' + id); + // Whizzywig shows the original textarea in source mode. + if ($field.css('display') == 'block') { + editingArea.body.innerHTML = $field.val(); + } + + // Save contents of editor back into textarea. + $field.val(tidyH(editingArea)); + // Move original textarea back to its previous location. + $container = $('#CONTAINER' + id); + $field.insertBefore($container); + // Remove editor instance. + $container.remove(); + whizzies.splice(index, 1); + + // Restore original textarea styling. + var originalValues = Drupal.wysiwyg.instances[id]; + $field.css('width', originalValues.originalWidth); + $field.css('color', originalValues.originalColor); + $field.css('zIndex', originalValues.originalZindex); + }; + + if (typeof params != 'undefined') { + for (var i = 0; i < whizzies.length; i++) { + if (whizzies[i] == params.field) { + detach(i); + break; + } + } + } + else { + while (whizzies.length > 0) { + detach(0); + } + } +}; + +})(jQuery); diff --git a/sites/all/modules/wysiwyg/editors/js/whizzywig.js b/sites/all/modules/wysiwyg/editors/js/whizzywig.js index ef42e468aaf74b240e23a2f6fdda6fac47fdef41..95052b4d4077eebbf8e54c0ade6d96d6bb703846 100644 --- a/sites/all/modules/wysiwyg/editors/js/whizzywig.js +++ b/sites/all/modules/wysiwyg/editors/js/whizzywig.js @@ -1,4 +1,4 @@ -// $Id: whizzywig.js,v 1.7 2010/09/25 11:53:19 twod Exp $ +// $Id: whizzywig.js,v 1.9 2010/10/18 19:53:12 sun Exp $ var wysiwygWhizzywig = { currentField: null, fields: {} }; var buttonPath = null; @@ -36,7 +36,9 @@ var o = function (id) { // Upon first access to "whizzy" + id, Whizzywig tries to access its IFRAME, // so we need to insert the editor into the DOM. if (id == 'whizzy' + wysiwygWhizzywig.currentField && wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField]) { - jQuery('#' + wysiwygWhizzywig.currentField).after('<div id="' + wysiwygWhizzywig.currentField + '-whizzywig">' + w() + '</div>'); + jQuery('#' + wysiwygWhizzywig.currentField).after('<div id="' + wysiwygWhizzywig.currentField + '-whizzywig"></div>'); + // Iframe's .contentWindow becomes null in Webkit if inserted via .after(). + jQuery('#' + wysiwygWhizzywig.currentField + '-whizzywig').html(w()); // Prevent subsequent invocations from inserting the editor multiple times. wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField] = ''; } @@ -63,9 +65,10 @@ Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) { wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField] = ''; // Whizzywig needs to have the width set 'inline'. $field = $('#' + params.field); - this.instances = this.instances || {}; - this.instances[params.field] = this.instances[params.field] || {}; - this.instances[params.field].originalWidth = $field.css('width'); + var originalValues = Drupal.wysiwyg.instances[params.field]; + originalValues.originalWidth = $field.css('width'); + originalValues.originalColor = $field.css('color'); + originalValues.originalZindex = $field.css('zIndex'); $field.css('width', $field.width() + 'px'); // Attach editor. @@ -73,7 +76,7 @@ Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) { // Whizzywig fails to detect and set initial textarea contents. var instance = $('#whizzy' + params.field).get(0); if (instance) { - instance.contentWindow.document.body.innerHTML = $('#' + params.field).val(); + instance.contentWindow.document.body.innerHTML = tidyD($field.val()); } }; @@ -81,34 +84,45 @@ Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) { * Detach a single or all editors. */ Drupal.wysiwyg.editor.detach.whizzywig = function(context, params) { - var detach = function (id) { - var instance = $('#whizzy' + whizzies[id]).get(0); + var detach = function (index) { + var id = whizzies[index]; + var instance = $('#whizzy' + id).get(0); if (!instance) { return; } var body = instance.contentWindow.document.body; - var $field = $('#' + whizzies[id]); + var $field = $('#' + id); + // Whizzywig shows the original textarea in source mode. + if ($field.css('display') == 'block') { + body.innerHTML = $field.val(); + } body.innerHTML = tidyH(body.innerHTML); // Save contents of editor back into textarea. $field.val(window.get_xhtml ? get_xhtml(body) : body.innerHTML); $field.val($field.val().replace(location.href + '#', '#')); // Remove editor instance. - $('#' + whizzies[id] + '-whizzywig').remove(); - whizzies.splice(id, 1); - $field.css('width', Drupal.wysiwyg.instances[$field.attr('id')].originalWidth); + $('#' + id + '-whizzywig').remove(); + whizzies.splice(index, 1); + + // Restore original textarea styling. + var originalValues = Drupal.wysiwyg.instances[id]; + $field.css('width', originalValues.originalWidth); + $field.css('color', originalValues.originalColor); + $field.css('zIndex', originalValues.originalZindex); }; if (typeof params != 'undefined') { - for (var id in whizzies) { - if (whizzies[id] == params.field) { - detach(id); + for (var i = 0; i < whizzies.length; i++) { + if (whizzies[i] == params.field) { + detach(i); + break; } } } else { - for (var id in whizzies) { - detach(id); + while (whizzies.length > 0) { + detach(0); } } }; diff --git a/sites/all/modules/wysiwyg/editors/markitup.inc b/sites/all/modules/wysiwyg/editors/markitup.inc index dfb63580cd75e862a9bb94d40cc05c407d5ccef5..75373e51f8deb2f5ca08f4aed036dbf3ba393ef7 100644 --- a/sites/all/modules/wysiwyg/editors/markitup.inc +++ b/sites/all/modules/wysiwyg/editors/markitup.inc @@ -1,5 +1,5 @@ <?php -// $Id: markitup.inc,v 1.9 2010/04/02 14:05:36 sun Exp $ +// $Id: markitup.inc,v 1.12 2010/12/19 19:19:56 sun Exp $ /** * @file @@ -14,15 +14,15 @@ function wysiwyg_markitup_editor() { 'title' => 'markItUp', 'vendor url' => 'http://markitup.jaysalvat.com', 'download url' => 'http://markitup.jaysalvat.com/downloads', - 'library path' => wysiwyg_get_path('markitup') . '/markitup', + 'library path' => wysiwyg_get_path('markitup'), 'libraries' => array( '' => array( 'title' => 'Source', - 'files' => array('jquery.markitup.js'), + 'files' => array('markitup/jquery.markitup.js'), ), 'pack' => array( 'title' => 'Packed', - 'files' => array('jquery.markitup.pack.js'), + 'files' => array('markitup/jquery.markitup.pack.js'), ), ), 'version callback' => 'wysiwyg_markitup_version', @@ -48,9 +48,14 @@ function wysiwyg_markitup_editor() { * The installed editor version. */ function wysiwyg_markitup_version($editor) { - $changelog = $editor['library path'] . '/readme.txt'; + // Changelog was in markitup/markitup/readme.txt <= 1.1.5. + $changelog = $editor['library path'] . '/markitup/readme.txt'; if (!file_exists($changelog)) { - return; + // Changelog was moved up to markitup/CHANGELOG.md after 1.1.5. + $changelog = $editor['library path'] . '/CHANGELOG.md'; + if (!file_exists($changelog)) { + return; + } } $changelog = fopen($changelog, 'r'); $line = fgets($changelog); @@ -92,12 +97,15 @@ function wysiwyg_markitup_themes($editor, $profile) { * Drupal.settings.wysiwyg.configs.{editor} */ function wysiwyg_markitup_settings($editor, $config, $theme) { - // Whoever is guilty for adding this horrible CSS-file-without-filepath - // override "feature" to Drupal core... stand in the corner! - drupal_add_css($editor['library path'] . '/skins/' . $theme . '/style.css', 'theme'); + drupal_add_css($editor['library path'] . '/markitup/skins/' . $theme . '/style.css', array( + // Specify an alternate basename; otherwise, style.css would override a + // commonly used style.css file of the theme. + 'basename' => 'markitup.' . $theme . '.style.css', + 'group' => CSS_THEME, + )); $settings = array( - 'root' => base_path() . $editor['library path'] . '/', + 'root' => base_path() . $editor['library path'] . '/markitup/', 'nameSpace' => $theme, 'markupSet' => array(), ); @@ -147,6 +155,7 @@ function wysiwyg_markitup_settings($editor, $config, $theme) { 'call' => 'preview', ), ); + $settings['markupSet'] = array(); if (!empty($config['buttons'])) { foreach ($config['buttons'] as $plugin) { foreach ($plugin as $button => $enabled) { @@ -156,9 +165,6 @@ function wysiwyg_markitup_settings($editor, $config, $theme) { } } } - else { - $settings['markupSet'] = $default_buttons; - } return $settings; } diff --git a/sites/all/modules/wysiwyg/editors/nicedit.inc b/sites/all/modules/wysiwyg/editors/nicedit.inc index 737e0913dfac3b8a9206a01b8164dd97d7ba2fc9..bddaa611a61c5458569e7e3de8ae87d33b988ac1 100644 --- a/sites/all/modules/wysiwyg/editors/nicedit.inc +++ b/sites/all/modules/wysiwyg/editors/nicedit.inc @@ -1,5 +1,5 @@ <?php -// $Id: nicedit.inc,v 1.7 2009/08/03 22:37:12 sun Exp $ +// $Id: nicedit.inc,v 1.8 2010/11/13 18:31:20 sun Exp $ /** * @file @@ -66,6 +66,7 @@ function wysiwyg_nicedit_settings($editor, $config, $theme) { ); // Add configured buttons or all available. + $settings['buttonList'] = array(); if (!empty($config['buttons'])) { $buttons = array(); foreach ($config['buttons'] as $plugin) { @@ -73,9 +74,6 @@ function wysiwyg_nicedit_settings($editor, $config, $theme) { } $settings['buttonList'] = array_keys($buttons); } - else { - $settings['fullPanel'] = TRUE; - } // Add editor content stylesheet. if (isset($config['css_setting'])) { diff --git a/sites/all/modules/wysiwyg/editors/openwysiwyg.inc b/sites/all/modules/wysiwyg/editors/openwysiwyg.inc index 0f3e594bbe3d7f11519769c43ec9e0cd5ac0f35e..4b11cd6e57f39f6cdd99a93e15f97b988368c4b3 100644 --- a/sites/all/modules/wysiwyg/editors/openwysiwyg.inc +++ b/sites/all/modules/wysiwyg/editors/openwysiwyg.inc @@ -1,5 +1,5 @@ <?php -// $Id: openwysiwyg.inc,v 1.6 2010/04/07 21:18:20 sun Exp $ +// $Id: openwysiwyg.inc,v 1.7 2010/11/13 18:31:21 sun Exp $ /** * @file @@ -108,6 +108,7 @@ function wysiwyg_openwysiwyg_settings($editor, $config, $theme) { } } + $settings['Toolbar'] = array(); if (!empty($config['buttons'])) { $plugins = wysiwyg_get_plugins($editor['name']); foreach ($config['buttons'] as $plugin => $buttons) { diff --git a/sites/all/modules/wysiwyg/editors/tinymce.inc b/sites/all/modules/wysiwyg/editors/tinymce.inc index 9c05ad1f68a6e254f59650458491518d655b4931..2c40eb6b1d307419d8e19e85fce3a4cc19a45eb6 100644 --- a/sites/all/modules/wysiwyg/editors/tinymce.inc +++ b/sites/all/modules/wysiwyg/editors/tinymce.inc @@ -1,5 +1,5 @@ <?php -// $Id: tinymce.inc,v 1.40 2010/09/25 00:12:34 twod Exp $ +// $Id: tinymce.inc,v 1.46 2010/12/19 23:26:56 sun Exp $ /** * @file @@ -199,11 +199,10 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) { // Find the enabled buttons and the button row they belong on. // Also map the plugin metadata for each button. // @todo What follows is a pain; needs a rewrite. + // $settings['buttons'] are stacked into $settings['theme_advanced_buttons1'] + // later. + $settings['buttons'] = array(); if (!empty($config['buttons']) && is_array($config['buttons'])) { - // $settings['buttons'] are stacked into - // $settings['theme_advanced_buttons1'] later. - // @todo Add a toolbar designer based on jQuery UI. - $settings['buttons'] = array(); // Only array keys in $settings['extensions'] matter; added to // $settings['plugins'] later. $settings['extensions'] = array(); @@ -294,11 +293,9 @@ function wysiwyg_tinymce_settings($editor, $config, $theme) { unset($settings['buttons']); // Convert the config values into the form expected by TinyMCE. - foreach ($settings as $key => $value) { - if (is_bool($value)) { - continue; - } - if (is_array($value)) { + $csv_settings = array('plugins', 'extended_valid_elements', 'theme_advanced_buttons1', 'theme_advanced_buttons2', 'theme_advanced_buttons3'); + foreach ($csv_settings as $key) { + if (isset($settings[$key]) && is_array($settings[$key])) { $settings[$key] = implode(',', $settings[$key]); } } @@ -318,8 +315,8 @@ function wysiwyg_tinymce_plugin_settings($editor, $profile, $plugins) { if (!empty($plugin['load'])) { // Add path for native external plugins; internal ones are loaded // automatically. - if (empty($plugin['internal']) && isset($plugin['path'])) { - $settings[$name] = base_path() . $plugin['path']; + if (empty($plugin['internal']) && isset($plugin['filename'])) { + $settings[$name] = base_path() . $plugin['path'] . '/' . $plugin['filename']; } } } @@ -337,9 +334,10 @@ function wysiwyg_tinymce_proxy_plugin_settings($editor, $profile, $plugins) { 'title' => $plugin['title'], 'icon' => base_path() . $plugin['icon path'] . '/' . $plugin['icon file'], 'iconTitle' => $plugin['icon title'], - // @todo These should only be set if the plugin defined them. - 'css' => base_path() . $plugin['css path'] . '/' . $plugin['css file'], ); + if (isset($plugin['css file'])) { + $settings[$name]['css'] = base_path() . $plugin['css path'] . '/' . $plugin['css file']; + } } return $settings; } @@ -410,7 +408,7 @@ function wysiwyg_tinymce_plugins($editor) { 'advimage' => array( 'path' => $editor['library path'] . '/plugins/advimage', 'extensions' => array('advimage' => t('Advanced image')), - 'extended_valid_elements' => array('img[src|alt|title|align|width|height|hspace|vspace|border|style|class|onmouseover|onmouseout|id|name]'), + 'extended_valid_elements' => array('img[src|alt|title|align|width|height|usemap|hspace|vspace|border|style|class|onmouseover|onmouseout|id|name]'), 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage', 'internal' => TRUE, 'load' => TRUE, @@ -580,6 +578,15 @@ function wysiwyg_tinymce_plugins($editor) { ); } } + if (version_compare($editor['installed version'], '3.2.5', '>=')) { + $plugins['autoresize'] = array( + 'path' => $editor['library path'] . '/plugins/autoresize', + 'extensions' => array('autoresize' => t('Auto resize')), + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize', + 'internal' => TRUE, + 'load' => TRUE, + ); + } if (version_compare($editor['installed version'], '3.3', '>=')) { $plugins['advlist'] = array( 'path' => $editor['library path'] . '/plugins/advlist', @@ -589,6 +596,15 @@ function wysiwyg_tinymce_plugins($editor) { 'load' => TRUE, ); } + if (version_compare($editor['installed version'], '3.2.6', '>=')) { + $plugins['wordcount'] = array( + 'path' => $editor['library path'] . '/plugins/wordcount', + 'extensions' => array('wordcount' => t('Word count')), + 'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount', + 'internal' => TRUE, + 'load' => TRUE, + ); + } return $plugins; } diff --git a/sites/all/modules/wysiwyg/editors/whizzywig.inc b/sites/all/modules/wysiwyg/editors/whizzywig.inc index 5782f6c70016f525f5e8e898d65c025f599ee354..4b8e643ff0249f842b45375928868469e8635509 100644 --- a/sites/all/modules/wysiwyg/editors/whizzywig.inc +++ b/sites/all/modules/wysiwyg/editors/whizzywig.inc @@ -1,5 +1,5 @@ <?php -// $Id: whizzywig.inc,v 1.6 2010/04/02 14:24:44 sun Exp $ +// $Id: whizzywig.inc,v 1.8 2010/11/13 18:31:21 sun Exp $ /** * @file @@ -30,6 +30,9 @@ function wysiwyg_whizzywig_editor() { '56' => array( 'js files' => array('whizzywig-56.js'), ), + '60' => array( + 'js files' => array('whizzywig-60.js'), + ), ), ); return $editor; @@ -90,6 +93,7 @@ function wysiwyg_whizzywig_settings($editor, $config, $theme) { } // Add configured buttons or all available. + $settings['buttons'] = array(); if (!empty($config['buttons'])) { $buttons = array(); foreach ($config['buttons'] as $plugin) { @@ -97,9 +101,6 @@ function wysiwyg_whizzywig_settings($editor, $config, $theme) { } $settings['buttons'] = implode(' ', array_keys($buttons)); } - else { - $settings['buttons'] = 'all'; - } // Add editor content stylesheet. if (isset($config['css_setting'])) { diff --git a/sites/all/modules/wysiwyg/editors/wymeditor.inc b/sites/all/modules/wysiwyg/editors/wymeditor.inc index 3baa67c9f554cf4f0f311123a0f5a6fba1c4c908..872ec3a0c96532fbcef1b99c6edddbe508ff15ec 100644 --- a/sites/all/modules/wysiwyg/editors/wymeditor.inc +++ b/sites/all/modules/wysiwyg/editors/wymeditor.inc @@ -1,5 +1,5 @@ <?php -// $Id: wymeditor.inc,v 1.8 2010/04/02 14:05:36 sun Exp $ +// $Id: wymeditor.inc,v 1.9 2010/11/13 18:31:21 sun Exp $ /** * @file @@ -113,10 +113,10 @@ function wysiwyg_wymeditor_settings($editor, $config, $theme) { } // Add configured buttons. + $settings['toolsItems'] = array(); if (!empty($config['buttons'])) { $buttoninfo = _wysiwyg_wymeditor_button_info(); $plugins = wysiwyg_get_plugins($editor['name']); - $settings['toolsItems'] = array(); foreach ($config['buttons'] as $plugin => $buttons) { foreach ($buttons as $button => $enabled) { // Iterate separately over buttons and extensions properties. diff --git a/sites/all/modules/wysiwyg/editors/yui.inc b/sites/all/modules/wysiwyg/editors/yui.inc index d4bae1bf024ff0c1dc717f85818212f13a5a85f4..c056017b8f52d796ea3e28a17195b9120ed3b59e 100644 --- a/sites/all/modules/wysiwyg/editors/yui.inc +++ b/sites/all/modules/wysiwyg/editors/yui.inc @@ -1,5 +1,5 @@ <?php -// $Id: yui.inc,v 1.10 2010/04/02 14:05:36 sun Exp $ +// $Id: yui.inc,v 1.11 2010/11/13 18:31:21 sun Exp $ /** * @file @@ -144,14 +144,15 @@ function wysiwyg_yui_settings($editor, $config, $theme) { $settings['autoHeight'] = TRUE; } + $settings += array( + 'toolbar' => array( + 'collapse' => FALSE, + 'draggable' => TRUE, + 'buttonType' => 'advanced', + 'buttons' => array(), + ), + ); if (!empty($config['buttons'])) { - $settings += array( - 'toolbar' => array( - 'collapse' => FALSE, - 'draggable' => TRUE, - 'buttonType' => 'advanced', - ), - ); $buttons = array(); foreach ($config['buttons'] as $plugin => $enabled_buttons) { foreach ($enabled_buttons as $button => $enabled) { diff --git a/sites/all/modules/wysiwyg/translations/sv.po b/sites/all/modules/wysiwyg/translations/sv.po deleted file mode 100644 index 5ac01617e229e384363b473a58e86d383e08e6d4..0000000000000000000000000000000000000000 --- a/sites/all/modules/wysiwyg/translations/sv.po +++ /dev/null @@ -1,835 +0,0 @@ -# $Id: sv.po,v 1.2 2009/04/20 23:39:57 seals Exp $ -# -# Swedish translation of Drupal (wysiwyg) -# Generated from files: -# wysiwyg.api.php,v 1.2 2008/10/29 12:20:20 sun -# wysiwyg.admin.inc,v 1.6.2.2 2009/02/12 09:29:42 sun -# wysiwyg.plugins.inc,v 1.1 2008/10/14 21:45:07 sun -# wysiwyg.module,v 1.17.2.6 2009/02/22 18:27:46 sun -# wysiwyg.info,v 1.1 2008/10/14 21:45:07 sun -# wysiwyg.install,v 1.3 2008/11/03 23:57:40 sun -# fckeditor.inc,v 1.6.2.5 2009/02/13 02:22:29 sun -# markitup.inc,v 1.1.2.2 2009/01/06 01:40:37 sun -# nicedit.inc,v 1.4 2008/12/05 15:35:23 sun -# tinymce.inc,v 1.17.2.11 2009/02/24 23:21:22 sun -# whizzywig.inc,v 1.1 2008/11/17 00:06:33 sun -# yui.inc,v 1.1 2008/12/08 18:58:10 sun -# -msgid "" -msgstr "" -"Project-Id-Version: WYSIWYG 6.x\n" -"POT-Creation-Date: 2009-03-02 01:23+0100\n" -"PO-Revision-Date: 2009-04-21 01:36+0100\n" -"Last-Translator: Magnus Gunnarsson <seals@passagen.se>\n" -"Language-Team: drupalsverige.se\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n!=1);\n" -"X-Poedit-Language: Swedish\n" -"X-Poedit-Country: SWEDEN\n" -"X-Poedit-SourceCharset: utf-8\n" - -#: wysiwyg.api.php:50;51 -msgid "My plugin title" -msgstr "Titel för mitt plugin" - -#: wysiwyg.api.php:60 -msgid "Button title (optional)" -msgstr "Titel för knappar (valfritt)" - -#: wysiwyg.admin.inc:19 -msgid "Home" -msgstr "Hem" - -#: wysiwyg.admin.inc:20 -msgid "Administer" -msgstr "Administrera" - -#: wysiwyg.admin.inc:21 -msgid "Site configuration" -msgstr "Inställningar för webbplatsen" - -#: wysiwyg.admin.inc:22 -msgid "Wysiwyg profiles" -msgstr "Profiler för WYSIWYG" - -#: wysiwyg.admin.inc:78 -msgid "%format Wysiwyg profile" -msgstr "Profil för %format åt WYSIWYG" - -#: wysiwyg.admin.inc:87 -msgid "Basic setup" -msgstr "Grundläggande inställning" - -#: wysiwyg.admin.inc:94 -msgid "Enabled by default" -msgstr "Aktiverad som standard" - -#: wysiwyg.admin.inc:97 -msgid "The default editor state for users having access to this profile. Users are able to override this state if the next option is enabled." -msgstr "Förvalt tillstånd på redigeraren för användarna som har åtkomst till denna profil. Användarna kommer att kunna åsidosätta detta läge om nästa alternativ är aktiverat." - -#: wysiwyg.admin.inc:102 -msgid "Allow users to choose default" -msgstr "Låter användarna kunna välja förvalt" - -#: wysiwyg.admin.inc:105 -msgid "If allowed, users will be able to choose their own editor default state in their user account settings." -msgstr "Om tillåten kommer användarna att själva kunna välja eget förvalt läge för redigeraren på deras inställningar för användarkontot." - -#: wysiwyg.admin.inc:110 -msgid "Show <em>enable/disable rich text</em> toggle link" -msgstr "Visa länkknappen <em>aktivera/inaktivera rich text</em>" - -#: wysiwyg.admin.inc:113 -msgid "Whether or not to show the <em>enable/disable rich text</em> toggle link below a textarea. If disabled, the user setting or global default is used (see above)." -msgstr "Huruvida knappen aktivera/avaktivera redigeraren Rich Text skall visas under textområde eller ej. Om inaktiverad används användarens förval eller så används det globala förvalda (se ovan)." - -#: wysiwyg.admin.inc:123 -msgid "Language" -msgstr "Språkanpassning" - -#: wysiwyg.admin.inc:126 -msgid "The language to use for the editor interface. Language codes are based on the <a href=\"http://www.loc.gov/standards/iso639-2/englangn.html\">ISO-639-2</a> format." -msgstr "Språket på gränsnittet för redigeraren. Språkkoderna baseras på formatet <a href=\"http://www.loc.gov/standards/iso639-2/englangn.html\">ISO-639-2</a>." - -#: wysiwyg.admin.inc:131 -msgid "Buttons and plugins" -msgstr "Knappar och insticksprogram" - -#: wysiwyg.admin.inc:176 -msgid "Editor appearance" -msgstr "Redigerarens utseende" - -#: wysiwyg.admin.inc:183 -msgid "Toolbar location" -msgstr "Verktygslådans placering" - -#: wysiwyg.admin.inc:185;201 -msgid "Bottom" -msgstr "Längst ned" - -#: wysiwyg.admin.inc:185;201 -msgid "Top" -msgstr "Längst upp" - -#: wysiwyg.admin.inc:186 -msgid "This option controls whether the editor toolbar is displayed above or below the editing area." -msgstr "Detta alternativ kontrollera huruvida redigerarens verktygslåda visas ovanför eller nedanför redigeringsområdet." - -#: wysiwyg.admin.inc:191 -msgid "Button alignment" -msgstr "Placering av knapp" - -#: wysiwyg.admin.inc:193 -msgid "Center" -msgstr "Centrerad" - -#: wysiwyg.admin.inc:193 -msgid "Left" -msgstr "Vänster" - -#: wysiwyg.admin.inc:193 -msgid "Right" -msgstr "Höger" - -#: wysiwyg.admin.inc:194 -msgid "This option controls the alignment of icons in the editor toolbar." -msgstr "Detta alternativ kontrollerar justeringen av ikoner i redigerarens verktygslåda." - -#: wysiwyg.admin.inc:199 -msgid "Path location" -msgstr "Plats för sökväg" - -#: wysiwyg.admin.inc:201 -msgid "Hide" -msgstr "Göm" - -#: wysiwyg.admin.inc:202 -msgid "Where to display the path to HTML elements (i.e. <code>body > table > tr > td</code>)." -msgstr "Var sökvägen till HTML-element skall visas (till exempel <code>body > table > tr > td</code>)." - -#: wysiwyg.admin.inc:207 -msgid "Enable resizing button" -msgstr "Aktivera knappen storleksförändring" - -#: wysiwyg.admin.inc:210 -msgid "This option gives you the ability to enable/disable the resizing button. If enabled, the Path location toolbar must be set to \"Top\" or \"Bottom\" in order to display the resize icon." -msgstr "Det här valet ger dig möjlighet att aktivera/invaktivera knappen storleksförändring. Om aktiverad, måste Sökvägen till verktygslokaliseringen vara satt till \"Längst upp\" eller \"Längst ned\" för att kunna visa ikonen för storleksförändring." - -#: wysiwyg.admin.inc:215 -msgid "Cleanup and output" -msgstr "Rensa upp och skicka" - -#: wysiwyg.admin.inc:222 -msgid "Verify HTML" -msgstr "Verifiera HTML" - -#: wysiwyg.admin.inc:225 -msgid "If enabled, potentially malicious code like <code><HEAD></code> tags will be removed from HTML contents." -msgstr "Om aktiverad kan potentiellt farlig kod såsom taggar av typen <code><HEAD></code> att tas bort från HTML-innehåll." - -#: wysiwyg.admin.inc:230 -msgid "Preformatted" -msgstr "Förformaterat" - -#: wysiwyg.admin.inc:233 -msgid "If enabled, the editor will insert TAB characters on tab and preserve other whitespace characters just like a PRE element in HTML does." -msgstr "Om aktiverad kommer redigeraren att infoga TAB-tecken vid tab och bevara andra tomrumstecken precis som elementet PRE i HTML gör." - -#: wysiwyg.admin.inc:238 -msgid "Convert <font> tags to styles" -msgstr "Konvertera taggar av typen <font> till stilar" - -#: wysiwyg.admin.inc:241 -msgid "If enabled, HTML tags declaring the font size, font family, font color and font background color will be replaced by inline CSS styles." -msgstr "Om aktiverad kommer HTML-taggar som deklarerar fontstorlek, fontfamilj, fontfärg och fontbakgrund att bytas ut mot infogad CSS." - -#: wysiwyg.admin.inc:246 -msgid "Remove linebreaks" -msgstr "Ta bort radbrytningar" - -#: wysiwyg.admin.inc:249 -msgid "If enabled, the editor will remove most linebreaks from contents. Disabling this option could avoid conflicts with other input filters." -msgstr "Om aktiverad kommer redigeraren att ta bort de flesta radbrytningar från innehåll. Inaktiveras detta alternativ kan konflikter undkommas med andra inmatningsfilter." - -#: wysiwyg.admin.inc:254 -msgid "Apply source formatting" -msgstr "Applicera källans formatering" - -#: wysiwyg.admin.inc:257 -msgid "If enabled, the editor will re-format the HTML source code. Disabling this option could avoid conflicts with other input filters." -msgstr "Om aktiverad kommer redigeraren omformatera källkoden för HTML. Inaktiveras detta alternativ så kan konflikter undkommas med andra inmatningsfilter." - -#: wysiwyg.admin.inc:262 -msgid "Force cleanup on standard paste" -msgstr "Tvinga fram upprensning på vanliga inklistringar" - -#: wysiwyg.admin.inc:265 -msgid "If enabled, the default paste function (CTRL-V or SHIFT-INS) behaves like the \"paste from word\" plugin function." -msgstr "Om aktiverad kommer den förvalda inklistringsfunktionen (CTRL-V eller SHIFT-INS) att uppföra sig såsom funktionen \"klistra in från Word\"." - -#: wysiwyg.admin.inc:270 -msgid "CSS" -msgstr "CSS" - -#: wysiwyg.admin.inc:277 -msgid "Block formats" -msgstr "Blockformat" - -#: wysiwyg.admin.inc:281 -msgid "Comma separated list of HTML block formats. Possible values: <code>@format-list</code>." -msgstr "Kommaseparerad lista av blockformat för HTML. Möjliga värden: <code>@format-list</code>." - -#: wysiwyg.admin.inc:286 -msgid "Editor CSS" -msgstr "Redigerarens CSS" - -#: wysiwyg.admin.inc:288 -msgid "Use theme CSS" -msgstr "Använd temats CSS" - -#: wysiwyg.admin.inc:288 -msgid "Define CSS" -msgstr "Definiera CSS" - -#: wysiwyg.admin.inc:288 -msgid "Editor default CSS" -msgstr "Förvald CSS för redigeraren" - -#: wysiwyg.admin.inc:289 -msgid "Defines the CSS to be used in the editor area.<br />Use theme CSS - loads stylesheets from current site theme.<br/>Define CSS - enter path for stylesheet files below.<br />Editor default CSS - uses default stylesheets from editor." -msgstr "Definiera vilken CSS som skall användas i redigerarens område.<br />Använd temats CSS - laddar stilmall från nuvarande webbplats tema.<br />Definiera CSS - ange sökvägen för stilmallsfilen nedan.<br />Förvalt för redigeraren." - -#: wysiwyg.admin.inc:294 -msgid "CSS path" -msgstr "Sökväg för CSS" - -#: wysiwyg.admin.inc:298 -msgid "If \"Define CSS\" has been selected above, enter path to a CSS file or a list of CSS files seperated by a comma." -msgstr "Om \"Definiera CSS\" har valts ovan, ange sökväg till en CSS-fil eller en lista av CSS-filer separerade av komma." - -#: wysiwyg.admin.inc:298 -msgid "Available tokens: %b (base path, f.e.: /), %t (path to theme, f.e.: themes/garland)" -msgstr "Tillgängliga tecken: %b (bassökväg, till exempel: /), %t (sökväg till tema, till exempel: themes/garland)" - -#: wysiwyg.admin.inc:298 -msgid "Examples:" -msgstr "Exempel:" - -#: wysiwyg.admin.inc:303 -msgid "CSS classes" -msgstr "CSS-klasser" - -#: wysiwyg.admin.inc:305 -msgid "Optionally define CSS classes for the \"Font style\" dropdown list.<br />Enter one class on each line in the format: !format. Example: !example<br />If left blank, CSS classes are automatically imported from all loaded stylesheet(s)." -msgstr "Valfritt kan du definiera CSS-klasser för rullgardinslistan \"Fontstil\".<br />Ange en klass på varje rad i formatet: !format. Exempel: !example<br />Om lämnad blank kommer CSS-klasser automatiskt att importeras från alla laddade stilmallar." - -#: wysiwyg.admin.inc:310;444 -msgid "Save" -msgstr "Spara" - -#: wysiwyg.admin.inc:343 -msgid "Wysiwyg profile for %format has been saved." -msgstr "Profilen för WYSIWYG för %format har sparats." - -#: wysiwyg.admin.inc:392 -msgid "No editor" -msgstr "Ingen redigerare" - -#: wysiwyg.admin.inc:396 -msgid "<a href=\"!vendor-url\">@editor</a> (<a href=\"!download-url\">Download</a>)" -msgstr "<a href=\"!vendor-url\">@editor</a> (<a href=\"!download-url\">Ladda ned</a>)" - -#: wysiwyg.admin.inc:397 -msgid "Not installed." -msgstr "Ej installerad." - -#: wysiwyg.admin.inc:398 -msgid "Extract the archive and copy its contents into a new folder in the following location:<br /><code>@editor-path</code>" -msgstr "Packa upp arkivet och kopiera dess innehåll till en ny katalog på följande plats:<br /><code>@editor-path</code>" - -#: wysiwyg.admin.inc:409 -msgid "Installation instructions" -msgstr "Instruktioner för installation" - -#: wysiwyg.admin.inc:412 -msgid "There are no editor libraries installed currently. The following list contains a list of currently supported editors:" -msgstr "Det finns inga bibliotek för redigerare installerade för närvarande. Följande lista innehåller en lista av stödda redigerare för närvarande:" - -#: wysiwyg.admin.inc:436 -msgid "Edit" -msgstr "Redigera" - -#: wysiwyg.admin.inc:439;496 -msgid "Remove" -msgstr "Ta bort" - -#: wysiwyg.admin.inc:456 -msgid "Input format" -msgstr "Inmatningsformat" - -#: wysiwyg.admin.inc:456 -msgid "Editor" -msgstr "Redigerare" - -#: wysiwyg.admin.inc:456 -msgid "Operations" -msgstr "Funktioner" - -#: wysiwyg.admin.inc:494 -msgid "Are you sure you want to remove the profile for %name?" -msgstr "Är du säker på att du vill radera profilen %name?" - -#: wysiwyg.admin.inc:496 -msgid "This action cannot be undone." -msgstr "Denna åtgärd kan inte ångras." - -#: wysiwyg.admin.inc:496 -msgid "Cancel" -msgstr "Avbryt" - -#: wysiwyg.admin.inc:507 -msgid "Wysiwyg profile for %name has been deleted." -msgstr "Profil för WYSIWYG för %namn har raderats." - -#: wysiwyg.plugins.inc:15 -msgid "Teaser break" -msgstr "Brytning för sammanfattning" - -#: wysiwyg.module:41 -msgid "A Wysiwyg profile can be associated to an input format. A Wysiwyg profile defines which client-side editor is loaded, what buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor-specific functions." -msgstr "En profil för WYSIWYG som kan associeras till ett inmatningsformat. En profil för WYSIWYG definierar vilken klientbaserad redigerade som är laddad, vilka knappar eller vilket tema som är aktiverat för redigeraren, hur redigeraren visas och en del andra redigerarspecifika funktioner." - -#: wysiwyg.module:273 -msgid "Disable rich-text" -msgstr "Avaktivera Rich text" - -#: wysiwyg.module:274 -msgid "Enable rich-text" -msgstr "Aktivera Rich text" - -#: wysiwyg.module:485 -msgid "Wysiwyg Editor settings" -msgstr "Inställningar för redigerare av typen WYSIWYG" - -#: wysiwyg.module:492 -msgid "Enable editor by default" -msgstr "Aktivera redigerare som standard" - -#: wysiwyg.module:495 -msgid "If enabled, rich-text editing is enabled by default in textarea fields." -msgstr "Om aktiverad så är redigering av typen rich-text aktiverad som standard i flerradiga textfält" - -#: wysiwyg.module:579 -msgid "The version of %editor could not be detected." -msgstr "Versionen av %editor kunde inte hittas." - -#: wysiwyg.module:592 -msgid "The installed version %version of %editor is not supported." -msgstr "Den installerade versionen %version av %editor stöds inte." - -#: wysiwyg.module:15 -#: wysiwyg.info:0 -msgid "Wysiwyg" -msgstr "WYSIWYG" - -#: wysiwyg.module:17 -msgid "Configure client-side editor profiles." -msgstr "Konfigurera profiler för klientsidans redigerare." - -#: wysiwyg.module:0 -msgid "wysiwyg" -msgstr "wysiwyg" - -#: wysiwyg.install:10 -msgid "Stores Wysiwyg profiles." -msgstr "Lagrar profiler för WYSIWYG." - -#: wysiwyg.info:0 -msgid "Allows users to edit contents with client-side editors." -msgstr "Låter användare redigera innehåll med klientbaserade redigerare." - -#: wysiwyg.info:0 -msgid "User interface" -msgstr "Användargränssnitt" - -#: editors/fckeditor.inc:166 -#: editors/markitup.inc:91;140 -#: editors/nicedit.inc:102 -#: editors/tinymce.inc:348 -#: editors/whizzywig.inc:110 -#: editors/yui.inc:227 -msgid "Bold" -msgstr "Fet" - -#: editors/fckeditor.inc:166 -#: editors/markitup.inc:92;140 -#: editors/nicedit.inc:102 -#: editors/tinymce.inc:348 -#: editors/whizzywig.inc:110 -#: editors/yui.inc:227 -msgid "Italic" -msgstr "Kursiv" - -#: editors/fckeditor.inc:166 -#: editors/nicedit.inc:102 -#: editors/tinymce.inc:348 -#: editors/whizzywig.inc:110 -#: editors/yui.inc:227 -msgid "Underline" -msgstr "Understruken" - -#: editors/fckeditor.inc:167 -#: editors/markitup.inc:93;141 -#: editors/nicedit.inc:103 -#: editors/tinymce.inc:349 -#: editors/yui.inc:228 -msgid "Strike-through" -msgstr "Genomstruken" - -#: editors/fckeditor.inc:168 -#: editors/nicedit.inc:104 -#: editors/tinymce.inc:350 -#: editors/whizzywig.inc:111 -#: editors/yui.inc:229 -msgid "Align left" -msgstr "Vänsterjustera" - -#: editors/fckeditor.inc:168 -#: editors/nicedit.inc:104 -#: editors/tinymce.inc:350 -#: editors/whizzywig.inc:111 -#: editors/yui.inc:229 -msgid "Align center" -msgstr "Centerjustera" - -#: editors/fckeditor.inc:168 -#: editors/nicedit.inc:104 -#: editors/tinymce.inc:350 -#: editors/whizzywig.inc:111 -#: editors/yui.inc:229 -msgid "Align right" -msgstr "Högerjustera" - -#: editors/fckeditor.inc:168 -#: editors/tinymce.inc:350 -msgid "Justify" -msgstr "Justera" - -#: editors/fckeditor.inc:169 -#: editors/nicedit.inc:105 -#: editors/tinymce.inc:351 -#: editors/whizzywig.inc:112 -#: editors/yui.inc:230 -msgid "Bullet list" -msgstr "Punktlista" - -#: editors/fckeditor.inc:169 -#: editors/nicedit.inc:105 -#: editors/tinymce.inc:351 -#: editors/whizzywig.inc:112 -#: editors/yui.inc:230 -msgid "Numbered list" -msgstr "Numrerad lista" - -#: editors/fckeditor.inc:170 -#: editors/nicedit.inc:106 -#: editors/tinymce.inc:352 -#: editors/whizzywig.inc:113 -#: editors/yui.inc:231 -msgid "Outdent" -msgstr "Ta bort indrag" - -#: editors/fckeditor.inc:170 -#: editors/nicedit.inc:106 -#: editors/tinymce.inc:352 -#: editors/whizzywig.inc:113 -#: editors/yui.inc:231 -msgid "Indent" -msgstr "Gör indrag" - -#: editors/fckeditor.inc:171 -#: editors/tinymce.inc:353 -#: editors/whizzywig.inc:114 -msgid "Undo" -msgstr "Ångra" - -#: editors/fckeditor.inc:171 -#: editors/tinymce.inc:353 -#: editors/whizzywig.inc:114 -msgid "Redo" -msgstr "Gör om" - -#: editors/fckeditor.inc:172 -#: editors/markitup.inc:95;143 -#: editors/nicedit.inc:113 -#: editors/tinymce.inc:354 -#: editors/whizzywig.inc:118 -#: editors/yui.inc:232 -msgid "Link" -msgstr "Länka" - -#: editors/fckeditor.inc:172 -#: editors/nicedit.inc:113 -#: editors/tinymce.inc:354 -msgid "Unlink" -msgstr "Ta bort länk" - -#: editors/fckeditor.inc:172 -#: editors/tinymce.inc:354 -msgid "Anchor" -msgstr "Ankare" - -#: editors/fckeditor.inc:173 -#: editors/markitup.inc:94;142 -#: editors/nicedit.inc:107 -#: editors/tinymce.inc:355 -#: editors/whizzywig.inc:115;119 -#: editors/yui.inc:233 -msgid "Image" -msgstr "Bild" - -#: editors/fckeditor.inc:174 -#: editors/nicedit.inc:108 -#: editors/tinymce.inc:357 -#: editors/whizzywig.inc:116 -msgid "Forecolor" -msgstr "Förgrundsfärg" - -#: editors/fckeditor.inc:174 -#: editors/nicedit.inc:108 -#: editors/tinymce.inc:357 -#: editors/whizzywig.inc:116 -msgid "Backcolor" -msgstr "Bakgrundsfärg" - -#: editors/fckeditor.inc:175 -msgid "Superscript" -msgstr "Upphöjd" - -#: editors/fckeditor.inc:175 -msgid "Subscript" -msgstr "Nedsänkt" - -#: editors/fckeditor.inc:176 -#: editors/tinymce.inc:359 -msgid "Blockquote" -msgstr "Blockcitat" - -#: editors/fckeditor.inc:176 -#: editors/nicedit.inc:115 -#: editors/tinymce.inc:359 -#: editors/whizzywig.inc:122 -msgid "Source code" -msgstr "Källkod" - -#: editors/fckeditor.inc:177 -#: editors/nicedit.inc:110 -#: editors/tinymce.inc:360 -#: editors/whizzywig.inc:117 -msgid "Horizontal rule" -msgstr "Horisontell linje" - -#: editors/fckeditor.inc:178 -#: editors/tinymce.inc:361 -msgid "Cut" -msgstr "Klipp ut" - -#: editors/fckeditor.inc:178 -#: editors/tinymce.inc:361 -msgid "Copy" -msgstr "Kopiera" - -#: editors/fckeditor.inc:178 -#: editors/tinymce.inc:361 -msgid "Paste" -msgstr "Klistra in" - -#: editors/fckeditor.inc:179 -msgid "Paste Text" -msgstr "Klistra in text" - -#: editors/fckeditor.inc:179 -#: editors/tinymce.inc:472 -msgid "Paste from Word" -msgstr "Klistra in från Word" - -#: editors/fckeditor.inc:180 -msgid "Show blocks" -msgstr "Visa block" - -#: editors/fckeditor.inc:181 -#: editors/tinymce.inc:363 -#: editors/yui.inc:236 -msgid "Remove format" -msgstr "Ta bort format" - -#: editors/fckeditor.inc:182 -#: editors/tinymce.inc:364 -msgid "Character map" -msgstr "Teckenkarta" - -#: editors/fckeditor.inc:183 -msgid "About" -msgstr "Om" - -#: editors/fckeditor.inc:185 -#: editors/nicedit.inc:114 -#: editors/tinymce.inc:430 -#: editors/whizzywig.inc:109 -#: editors/yui.inc:238 -msgid "HTML block format" -msgstr "Format för HTML-block" - -#: editors/fckeditor.inc:185 -#: editors/nicedit.inc:114 -#: editors/tinymce.inc:430 -#: editors/whizzywig.inc:109 -#: editors/yui.inc:238 -msgid "Font" -msgstr "Font" - -#: editors/fckeditor.inc:185 -#: editors/nicedit.inc:114 -#: editors/tinymce.inc:430 -#: editors/whizzywig.inc:109 -#: editors/yui.inc:238 -msgid "Font size" -msgstr "Fontstorlek" - -#: editors/fckeditor.inc:185 -#: editors/tinymce.inc:430 -#: editors/yui.inc:238 -msgid "Font style" -msgstr "Fontstil" - -#: editors/fckeditor.inc:186 -#: editors/tinymce.inc:507 -#: editors/whizzywig.inc:120 -msgid "Table" -msgstr "Tabell" - -#: editors/fckeditor.inc:187 -#: editors/tinymce.inc:493 -msgid "Search" -msgstr "Sök" - -#: editors/fckeditor.inc:187 -#: editors/tinymce.inc:493 -msgid "Replace" -msgstr "Byt ut" - -#: editors/fckeditor.inc:187 -#: editors/tinymce.inc:472 -msgid "Select all" -msgstr "Välj alla" - -#: editors/fckeditor.inc:188 -msgid "Create DIV container" -msgstr "Skapa DIV-behållare" - -#: editors/fckeditor.inc:189 -#: editors/tinymce.inc:422 -msgid "Flash" -msgstr "Flash" - -#: editors/fckeditor.inc:189 -msgid "Smiley" -msgstr "Smiley" - -#: editors/fckeditor.inc:190 -msgid "FitWindow" -msgstr "Passa fönster" - -#: editors/fckeditor.inc:191 -msgid "Check spelling" -msgstr "Kontrollera stavning" - -#: editors/markitup.inc:98;145 -#: editors/tinymce.inc:479 -msgid "Preview" -msgstr "Förhandsgranska" - -#: editors/nicedit.inc:109 -#: editors/tinymce.inc:358 -#: editors/yui.inc:235 -msgid "Sup" -msgstr "Upphöjd" - -#: editors/nicedit.inc:109 -#: editors/tinymce.inc:358 -#: editors/yui.inc:235 -msgid "Sub" -msgstr "Nedsänkt" - -#: editors/tinymce.inc:356 -#: editors/whizzywig.inc:121 -msgid "Clean-up" -msgstr "Upprensning" - -#: editors/tinymce.inc:362 -msgid "Visual aid" -msgstr "Hjälpmedel" - -#: editors/tinymce.inc:365 -msgid "Help" -msgstr "Hjälp" - -#: editors/tinymce.inc:370 -msgid "Advanced horizontal rule" -msgstr "Avancerad horisontell linje" - -#: editors/tinymce.inc:378 -msgid "Advanced image" -msgstr "Avancerad bild" - -#: editors/tinymce.inc:386 -msgid "Advanced link" -msgstr "Avancerad länk" - -#: editors/tinymce.inc:394 -msgid "Auto save" -msgstr "Automatiskt sparande" - -#: editors/tinymce.inc:401 -msgid "Context menu" -msgstr "Menysammanhang" - -#: editors/tinymce.inc:408 -msgid "Left-to-right" -msgstr "Vänster-till-höger" - -#: editors/tinymce.inc:408 -msgid "Right-to-left" -msgstr "Höger-till-vänster" - -#: editors/tinymce.inc:415 -msgid "Emotions" -msgstr "Känslor" - -#: editors/tinymce.inc:437 -msgid "Fullscreen" -msgstr "Hellskärm" - -#: editors/tinymce.inc:444 -msgid "Inline popups" -msgstr "Löpande popups" - -#: editors/tinymce.inc:454 -msgid "Insert date" -msgstr "Infoga datum" - -#: editors/tinymce.inc:454 -msgid "Insert time" -msgstr "Sätt in tid" - -#: editors/tinymce.inc:465 -msgid "Insert layer" -msgstr "Infoga lager" - -#: editors/tinymce.inc:465 -msgid "Move forward" -msgstr "Gå framåt" - -#: editors/tinymce.inc:465 -msgid "Move backward" -msgstr "Gå tillbaka" - -#: editors/tinymce.inc:465 -msgid "Absolute" -msgstr "Absolut" - -#: editors/tinymce.inc:472 -msgid "Paste text" -msgstr "Klistra in text" - -#: editors/tinymce.inc:486 -msgid "Print" -msgstr "Skriv ut" - -#: editors/tinymce.inc:500 -msgid "Style properties" -msgstr "Egenskaper för stil" - -#: editors/tinymce.inc:516 -msgid "Citation" -msgstr "Citering" - -#: editors/tinymce.inc:516 -msgid "Deleted" -msgstr "Raderad" - -#: editors/tinymce.inc:516 -msgid "Abbreviation" -msgstr "Förkortning" - -#: editors/tinymce.inc:516 -msgid "Acronym" -msgstr "Akronym" - -#: editors/tinymce.inc:516 -msgid "Inserted" -msgstr "Infogad" - -#: editors/tinymce.inc:523 -msgid "Safari compatibility" -msgstr "Kompatibilitet med Safari" - -#: editors/whizzywig.inc:123 -msgid "Spell check" -msgstr "Rättstavningskontroll" - -#: editors/yui.inc:234 -msgid "Font Color" -msgstr "Fontfärg" - -#: editors/yui.inc:234 -msgid "Background Color" -msgstr "Bakgrundfärg" - -#: editors/yui.inc:237 -msgid "Show/hide hidden elements" -msgstr "Visa/göm gömda element" - diff --git a/sites/all/modules/wysiwyg/wysiwyg.admin.inc b/sites/all/modules/wysiwyg/wysiwyg.admin.inc index e418c13a59bb456f49e337e84e829f121e04878f..7111758d2d2db38997b08f9dd27a488bf95803af 100644 --- a/sites/all/modules/wysiwyg/wysiwyg.admin.inc +++ b/sites/all/modules/wysiwyg/wysiwyg.admin.inc @@ -1,5 +1,5 @@ <?php -// $Id: wysiwyg.admin.inc,v 1.23 2010/02/07 14:49:45 sun Exp $ +// $Id: wysiwyg.admin.inc,v 1.29 2011/01/06 00:03:13 sun Exp $ /** * @file @@ -13,7 +13,7 @@ function wysiwyg_profile_form($form, &$form_state, $profile) { // Merge in defaults. $profile = (array) $profile; $profile += array( - 'format' => 0, + 'format' => '', 'editor' => '', ); if (empty($profile['settings'])) { @@ -92,13 +92,26 @@ function wysiwyg_profile_form($form, &$form_state, $profile) { $form['basic']['language'] = array( '#type' => 'select', - '#title' => t('Language'), + '#title' => t('Interface language'), '#default_value' => $profile->settings['language'], - '#options' => drupal_map_assoc(array('ar', 'ca', 'cs', 'cy', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'fr_ca', 'he', 'hu', 'is', 'it', 'ja', 'ko', 'nb', 'nl', 'nn', 'pl', 'pt', 'pt_br', 'ru', 'ru_KOI8-R', 'ru_UTF-8', 'si', 'sk', 'sv', 'th', 'tr', 'uk', 'zh_cn', 'zh_tw', 'zh_tw_utf8')), - '#description' => t('The language to use for the editor interface. Language codes are based on the <a href="http://www.loc.gov/standards/iso639-2/englangn.html">ISO-639-2</a> format.'), ); + // @see _locale_prepare_predefined_list() + require_once DRUPAL_ROOT . '/includes/iso.inc'; + $predefined = _locale_get_predefined_list(); + foreach ($predefined as $key => $value) { + // Include native name in output, if possible + if (count($value) > 1) { + $tname = t($value[0]); + $predefined[$key] = ($tname == $value[1]) ? $tname : "$tname ($value[1])"; + } + else { + $predefined[$key] = t($value[0]); + } + } + asort($predefined); + $form['basic']['language']['#options'] = $predefined; - $form['wysiwyg_buttons'] = array( + $form['buttons'] = array( '#type' => 'fieldset', '#title' => t('Buttons and plugins'), '#collapsible' => TRUE, @@ -125,7 +138,7 @@ function wysiwyg_profile_form($form, &$form_state, $profile) { } $title = (isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title); $title = (!empty($icon) ? $icon . ' ' . $title : $title); - $form['wysiwyg_buttons'][$name][$button] = array( + $form['buttons'][$name][$button] = array( '#type' => 'checkbox', '#title' => $title, '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : FALSE, @@ -134,7 +147,7 @@ function wysiwyg_profile_form($form, &$form_state, $profile) { } else if (isset($meta['extensions']) && is_array($meta['extensions'])) { foreach ($meta['extensions'] as $extension => $title) { - $form['wysiwyg_buttons'][$name][$extension] = array( + $form['buttons'][$name][$extension] = array( '#type' => 'checkbox', '#title' => isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title, '#default_value' => !empty($profile->settings['buttons'][$name][$extension]) ? $profile->settings['buttons'][$name][$extension] : FALSE, @@ -297,14 +310,18 @@ function wysiwyg_profile_form($form, &$form_state, $profile) { */ function wysiwyg_profile_form_submit($form, &$form_state) { $values = $form_state['values']; - if (isset($values['wysiwyg_buttons'])) { + if (isset($values['buttons'])) { // Store only enabled buttons for each plugin. - foreach ($values['wysiwyg_buttons'] as $plugin => $buttons) { - $values['buttons'][$plugin] = array_filter($values['wysiwyg_buttons'][$plugin]); + foreach ($values['buttons'] as $plugin => $buttons) { + $values['buttons'][$plugin] = array_filter($values['buttons'][$plugin]); } // Store only enabled plugins. $values['buttons'] = array_filter($values['buttons']); } + // Remove any white-space from 'block_formats' setting, since editor + // implementations rely on a comma-separated list to explode(). + $values['block_formats'] = preg_replace('@\s+@', '', $values['block_formats']); + // Remove input format name. $format = $values['format']; $input_format = $values['input_format']; @@ -317,6 +334,7 @@ function wysiwyg_profile_form_submit($form, &$form_state) { // Insert new profile data. db_query("UPDATE {wysiwyg} SET settings = :settings WHERE format = :format", array(':settings' => serialize($values), ':format' => $format)); + cache_clear_all('wysiwyg_profiles', 'cache'); drupal_set_message(t('Wysiwyg profile for %format has been saved.', array('%format' => $input_format))); @@ -500,6 +518,7 @@ function wysiwyg_profile_overview_submit($form, &$form_state) { )) ->execute(); } + cache_clear_all('wysiwyg_profiles', 'cache'); } /** @@ -525,6 +544,8 @@ function wysiwyg_profile_delete_confirm($form, &$form_state, $profile) { function wysiwyg_profile_delete_confirm_submit($form, &$form_state) { $format = $form_state['values']['format']; wysiwyg_profile_delete($format->format); + cache_clear_all('wysiwyg_profiles', 'cache'); + drupal_set_message(t('Wysiwyg profile for %name has been deleted.', array('%name' => $format->name))); $form_state['redirect'] = 'admin/config/content/wysiwyg'; } diff --git a/sites/all/modules/wysiwyg/wysiwyg.api.php b/sites/all/modules/wysiwyg/wysiwyg.api.php index 30d67f81b29e52b87a33bd7621b239e2a8b389e8..bd021e0d495d175cec05191171696dedd9556c4f 100644 --- a/sites/all/modules/wysiwyg/wysiwyg.api.php +++ b/sites/all/modules/wysiwyg/wysiwyg.api.php @@ -1,5 +1,5 @@ <?php -// $Id: wysiwyg.api.php,v 1.4 2009/08/09 02:46:50 sun Exp $ +// $Id: wysiwyg.api.php,v 1.7 2011/01/06 00:19:01 sun Exp $ /** * @file @@ -44,8 +44,13 @@ function hook_wysiwyg_plugin($editor, $version) { 'myplugin' => array( // A URL to the plugin's homepage. 'url' => 'http://drupal.org/project/img_assist', - // The full path to the native editor plugin. - 'path' => drupal_get_path('module', 'img_assist') . '/drupalimage/editor_plugin.js', + // The full path to the native editor plugin, no trailing slash. + // Ignored when 'internal' is set to TRUE below. + 'path' => drupal_get_path('module', 'img_assist') . '/drupalimage', + // The name of the plugin's main JavaScript file. + // Ignored when 'internal' is set to TRUE below. + // Default value depends on which editor the plugin is for. + 'filename' => 'editor_plugin.js', // A list of buttons provided by this native plugin. The key has to // match the corresponding JavaScript implementation. The value is // is displayed on the editor configuration form only. @@ -72,7 +77,8 @@ function hook_wysiwyg_plugin($editor, $version) { 'load' => TRUE, // Boolean whether this plugin is a native plugin, i.e. shipped with // the editor. Definition must be ommitted for plugins provided by - // other modules. + // other modules. TRUE means 'path' and 'filename' above are ignored + // and the plugin is instead loaded from the editor's plugin folder. 'internal' => TRUE, // TinyMCE-specific: Additional HTML elements to allow in the markup. 'extended_valid_elements' => array( @@ -149,6 +155,12 @@ function hook_INCLUDE_plugin() { // An alternative filename of the integration JavaScript; defaults to // '[plugin-name].js'. 'js file' => 'awesome.js', + // An alternative path to the integration stylesheet; defaults to + // '[path-to-module]/[plugins-directory]/[plugin-name]'. + 'css path' => drupal_get_path('module', 'mymodule') . '/awesomeness', + // An alternative filename of the integration stylesheet; defaults to + // '[plugin-name].css'. + 'css file' => 'awesome.css', // An array of settings for this button. Required, but API is still in flux. 'settings' => array( ), @@ -161,3 +173,35 @@ function hook_INCLUDE_plugin() { return $plugins; } +/** + * Act on editor profile settings. + * + * This hook is invoked from wysiwyg_get_editor_config() after the JavaScript + * settings have been generated for an editor profile and before the settings + * are added to the page. The settings may be customized or enhanced; typically + * with options that cannot be controlled through Wysiwyg module's + * administrative UI currently. + * + * Modules implementing this hook to enforce settings that can also be + * controlled through the UI should also implement + * hook_form_wysiwyg_profile_form_alter() to adjust or at least indicate on the + * editor profile configuration form that certain/affected settings cannot be + * changed. + * + * @param $settings + * An associative array of JavaScript settings to pass to the editor. + * @param $context + * An associative array containing additional context information: + * - editor: The plugin definition array of the editor. + * - profile: The editor profile object, as loaded from the database. + * - theme: The name of the editor theme/skin. + */ +function hook_wysiwyg_editor_settings_alter(&$settings, $context) { + // Each editor has its own collection of native settings that may be extended + // or overridden. Please consult the respective official vendor documentation + // for details. + if ($context['profile']->editor == 'tinymce') { + // Supported values to JSON data types. + $settings['cleanup_on_startup'] = TRUE; + } +} diff --git a/sites/all/modules/wysiwyg/wysiwyg.info b/sites/all/modules/wysiwyg/wysiwyg.info index 57946c9be5702faa3b7d513fac68a3c258d5fe84..4bb7336e48607433a15979ab2564ec3e4b5d69ad 100644 --- a/sites/all/modules/wysiwyg/wysiwyg.info +++ b/sites/all/modules/wysiwyg/wysiwyg.info @@ -1,4 +1,4 @@ -; $Id: wysiwyg.info,v 1.4 2009/09/26 05:37:56 sun Exp $ +; $Id: wysiwyg.info,v 1.6 2011/01/06 00:06:18 sun Exp $ name = Wysiwyg description = Allows users to edit contents with client-side editors. package = User interface @@ -7,14 +7,11 @@ package = User interface ;dependencies[] = popups ;dependencies[] = debug core = 7.x -files[] = wysiwyg.module -files[] = wysiwyg.install -files[] = wysiwyg.admin.inc -files[] = wysiwyg.dialog.inc +configure = admin/config/content/wysiwyg -; Information added by drupal.org packaging script on 2010-09-25 -version = "7.x-2.x-dev" +; Information added by drupal.org packaging script on 2011-01-06 +version = "7.x-2.0" core = "7.x" project = "wysiwyg" -datestamp = "1285417346" +datestamp = "1294281172" diff --git a/sites/all/modules/wysiwyg/wysiwyg.init.js b/sites/all/modules/wysiwyg/wysiwyg.init.js index 375237604717a22a8899910b4dad283a41f26fc0..b3a87bfbb0ce87efcfffc94986a7ed1118d1f3ac 100644 --- a/sites/all/modules/wysiwyg/wysiwyg.init.js +++ b/sites/all/modules/wysiwyg/wysiwyg.init.js @@ -1,4 +1,4 @@ -// $Id: wysiwyg.init.js,v 1.3 2009/02/01 09:20:48 sun Exp $ +// $Id: wysiwyg.init.js,v 1.4 2010/11/13 18:53:15 sun Exp $ Drupal.wysiwyg = Drupal.wysiwyg || { 'instances': {} }; @@ -6,3 +6,15 @@ Drupal.wysiwyg.editor = Drupal.wysiwyg.editor || { 'init': {}, 'attach': {}, 'de Drupal.wysiwyg.plugins = Drupal.wysiwyg.plugins || {}; +(function ($) { + // Determine support for queryCommandEnabled(). + // An exception should be thrown for non-existing commands. + // Safari and Chrome (WebKit based) return -1 instead. + try { + document.queryCommandEnabled('__wysiwygTestCommand'); + $.support.queryCommandEnabled = false; + } + catch (error) { + $.support.queryCommandEnabled = true; + } +})(jQuery); diff --git a/sites/all/modules/wysiwyg/wysiwyg.install b/sites/all/modules/wysiwyg/wysiwyg.install index 24508f1915df89f2385dcb9ed1ae14cbd1a0f51e..ba4c5ea5f2ebc0533e3eeca7d9360941344c7c0b 100644 --- a/sites/all/modules/wysiwyg/wysiwyg.install +++ b/sites/all/modules/wysiwyg/wysiwyg.install @@ -1,18 +1,80 @@ <?php -// $Id: wysiwyg.install,v 1.7 2010/09/10 00:39:16 sun Exp $ +// $Id: wysiwyg.install,v 1.12 2011/01/06 01:49:52 sun Exp $ /** * Implementation of hook_schema(). */ function wysiwyg_schema() { $schema['wysiwyg'] = array( - 'description' => t('Stores Wysiwyg profiles.'), + 'description' => 'Stores Wysiwyg profiles.', 'fields' => array( - 'format' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), - 'editor' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''), - 'settings' => array('type' => 'text', 'size' => 'normal'), + 'format' => array( + 'description' => 'The {filter_format}.format of the text format.', + 'type' => 'varchar', + 'length' => 255, + // Primary keys are implicitly not null. + 'not null' => TRUE, + ), + 'editor' => array( + 'description' => 'Internal name of the editor attached to the text format.', + 'type' => 'varchar', + 'length' => 128, + 'not null' => TRUE, + 'default' => '', + ), + 'settings' => array( + 'description' => 'Configuration settings for the editor.', + 'type' => 'text', + 'size' => 'normal', + ), ), 'primary key' => array('format'), + 'foreign keys' => array( + 'format' => array( + 'table' => 'filter_format', + 'columns' => array('format' => 'format'), + ), + ), + ); + $schema['wysiwyg_user'] = array( + 'description' => 'Stores user preferences for wysiwyg profiles.', + 'fields' => array( + 'uid' => array( + 'description' => 'The {users}.uid of the user.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'format' => array( + 'description' => 'The {filter_format}.format of the text format.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => FALSE, + ), + 'status' => array( + 'description' => 'Boolean indicating whether the format is enabled by default.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + ), + 'indexes' => array( + 'uid' => array('uid'), + 'format' => array('format'), + ), + 'foreign keys' => array( + 'uid' => array( + 'table' => 'users', + 'columns' => array('uid' => 'uid'), + ), + 'format' => array( + 'table' => 'filter_format', + 'columns' => array('format' => 'format'), + ), + ), ); return $schema; } @@ -49,6 +111,19 @@ function wysiwyg_enable() { )); } +/** + * Implements hook_update_dependencies(). + */ +function wysiwyg_update_dependencies() { + // Ensure that format columns are only changed after Filter module has changed + // the primary records. + $dependencies['wysiwyg'][7000] = array( + 'filter' => 7010, + ); + + return $dependencies; +} + /** * Retrieve a list of input formats to associate profiles to. */ @@ -163,3 +238,71 @@ function wysiwyg_update_6200() { return $ret; } +/** + * Change {wysiwyg}.format into a string. + */ +function wysiwyg_update_7000() { + db_drop_primary_key('wysiwyg'); + db_change_field('wysiwyg', 'format', 'format', array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + )); + db_add_primary_key('wysiwyg', array('format')); +} + +/** + * Create the {wysiwyg_user} table. + */ +function wysiwyg_update_7200() { + if (!db_table_exists('wysiwyg_user')) { + db_create_table('wysiwyg_user', array( + 'description' => 'Stores user preferences for wysiwyg profiles.', + 'fields' => array( + 'uid' => array( + 'description' => 'The {users}.uid of the user.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'format' => array( + 'description' => 'The {filter_format}.format of the text format.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => FALSE, + ), + 'status' => array( + 'description' => 'Boolean indicating whether the format is enabled by default.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + ), + 'indexes' => array( + 'uid' => array('uid'), + 'format' => array('format'), + ), + 'foreign keys' => array( + 'uid' => array( + 'table' => 'users', + 'columns' => array('uid' => 'uid'), + ), + 'format' => array( + 'table' => 'filter_format', + 'columns' => array('format' => 'format'), + ), + ), + )); + } + else { + db_change_field('wysiwyg_user', 'format', 'format', array( + 'description' => 'The {filter_format}.format of the text format.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => FALSE, + )); + } +} diff --git a/sites/all/modules/wysiwyg/wysiwyg.js b/sites/all/modules/wysiwyg/wysiwyg.js index 14b49195a08207094ec3b2cad2fd03d719cee71f..f9336407cad941293ca6ece3de95f2aab48e5fd8 100644 --- a/sites/all/modules/wysiwyg/wysiwyg.js +++ b/sites/all/modules/wysiwyg/wysiwyg.js @@ -1,4 +1,4 @@ -// $Id: wysiwyg.js,v 1.19 2010/09/25 00:46:33 twod Exp $ +// $Id: wysiwyg.js,v 1.22 2011/01/06 00:11:48 sun Exp $ (function($) { /** @@ -46,7 +46,7 @@ Drupal.behaviors.attachWysiwyg = { } $('.wysiwyg', context).once('wysiwyg', function() { - if (!this.id || !this.value || typeof Drupal.settings.wysiwyg.triggers[this.id] === 'undefined') { + if (!this.id || typeof Drupal.settings.wysiwyg.triggers[this.id] === 'undefined') { return; } var $this = $(this); @@ -72,7 +72,11 @@ Drupal.behaviors.attachWysiwyg = { }); } // Detach any editor when the containing form is submitted. - $('#' + params.field).parents('form').submit(function () { + $('#' + params.field).parents('form').submit(function (event) { + // Do not detach if the event was cancelled. + if (event.originalEvent.returnValue === false) { + return; + } Drupal.wysiwygDetach(context, params[format]); }); }); @@ -160,34 +164,43 @@ Drupal.wysiwygAttachToggleLink = function(context, params) { } $('#wysiwyg-toggle-' + params.field) .html(params.status ? Drupal.settings.wysiwyg.disable : Drupal.settings.wysiwyg.enable).show() - .unbind('click').click(function() { - if (params.status) { - // Detach current editor. - params.status = false; - Drupal.wysiwygDetach(context, params); - // After disabling the editor, re-attach default behaviors. - // @todo We HAVE TO invoke Drupal.wysiwygAttach() here. - Drupal.wysiwyg.editor.attach.none(context, params); - Drupal.wysiwyg.instances[params.field] = Drupal.wysiwyg.editor.instance.none; - Drupal.wysiwyg.instances[params.field].editor = 'none'; - $(this).html(Drupal.settings.wysiwyg.enable).blur(); - } - else { - // Before enabling the editor, detach default behaviors. - Drupal.wysiwyg.editor.detach.none(context, params); - // Attach new editor using parameters of the currently selected input format. - params = Drupal.settings.wysiwyg.triggers[params.trigger]['format' + $('#' + params.trigger).val()]; - params.status = true; - Drupal.wysiwygAttach(context, params); - $(this).html(Drupal.settings.wysiwyg.disable).blur(); - } - }); + .unbind('click.wysiwyg', Drupal.wysiwyg.toggleWysiwyg) + .bind('click.wysiwyg', { params: params, context: context }, Drupal.wysiwyg.toggleWysiwyg); + // Hide toggle link in case no editor is attached. if (params.editor == 'none') { $('#wysiwyg-toggle-' + params.field).hide(); } }; +/** + * Callback for the Enable/Disable rich editor link. + */ +Drupal.wysiwyg.toggleWysiwyg = function (event) { + var context = event.data.context; + var params = event.data.params; + if (params.status) { + // Detach current editor. + params.status = false; + Drupal.wysiwygDetach(context, params); + // After disabling the editor, re-attach default behaviors. + // @todo We HAVE TO invoke Drupal.wysiwygAttach() here. + Drupal.wysiwyg.editor.attach.none(context, params); + Drupal.wysiwyg.instances[params.field] = Drupal.wysiwyg.editor.instance.none; + Drupal.wysiwyg.instances[params.field].editor = 'none'; + $(this).html(Drupal.settings.wysiwyg.enable).blur(); + } + else { + // Before enabling the editor, detach default behaviors. + Drupal.wysiwyg.editor.detach.none(context, params); + // Attach new editor using parameters of the currently selected input format. + params = Drupal.settings.wysiwyg.triggers[params.trigger]['format' + $('#' + params.trigger).val()]; + params.status = true; + Drupal.wysiwygAttach(context, params); + $(this).html(Drupal.settings.wysiwyg.disable).blur(); + } +} + /** * Parse the CSS classes of an input format DOM element into parameters. * diff --git a/sites/all/modules/wysiwyg/wysiwyg.module b/sites/all/modules/wysiwyg/wysiwyg.module index aa18705dd1fffc7c67983e9e98550b72d944ee9c..8e8b3c7d7b38dd1b3d0a55f900ea742e74531002 100644 --- a/sites/all/modules/wysiwyg/wysiwyg.module +++ b/sites/all/modules/wysiwyg/wysiwyg.module @@ -1,5 +1,5 @@ <?php -// $Id: wysiwyg.module,v 1.45 2010/03/20 14:54:29 sun Exp $ +// $Id: wysiwyg.module,v 1.51 2011/01/06 01:43:26 sun Exp $ /** * @file @@ -110,8 +110,9 @@ function wysiwyg_element_info_alter(&$types) { */ function wysiwyg_pre_render_text_format($element) { // filter_process_format() copies properties to the expanded 'value' child - // element. - if (!isset($element['format'])) { + // element. Skip this text format widget, if it contains no 'format' or when + // the current user does not have access to edit the value. + if (!isset($element['format']) || !empty($element['value']['#disabled'])) { return $element; } @@ -136,10 +137,12 @@ function wysiwyg_pre_render_text_format($element) { foreach ($format_field['format']['#options'] as $format_id => $format_name) { $format = 'format' . $format_id; // Initialize default settings, defaulting to 'none' editor. - $settings[$format]['editor'] = 'none'; - $settings[$format]['status'] = 1; - $settings[$format]['toggle'] = 1; - $settings[$format]['resizable'] = $resizable; + $settings[$format] = array( + 'editor' => 'none', + 'status' => 1, + 'toggle' => 1, + 'resizable' => $resizable, + ); // Fetch the profile associated to this text format. $profile = wysiwyg_get_profile($format_id); @@ -161,15 +164,23 @@ function wysiwyg_pre_render_text_format($element) { } // Use a hidden element for a single text format. if (!$format_field['format']['#access']) { - $format_field['guidelines']['format'] = array( + $format_field['wysiwyg'] = array( '#type' => 'hidden', '#name' => $format_field['format']['#name'], - '#id' => $format_field['format']['#id'], '#value' => $format_id, - '#attributes' => array('class' => array('wysiwyg')), + '#attributes' => array( + 'id' => $format_field['format']['#id'], + 'class' => array('wysiwyg'), + ), ); - $format_field['guidelines']['format']['#attached']['js'][] = array( - 'data' => array('wysiwyg' => array('triggers' => array($format_field['format']['#id'] => $settings))), + $format_field['wysiwyg']['#attached']['js'][] = array( + 'data' => array( + 'wysiwyg' => array( + 'triggers' => array( + $format_field['format']['#id'] => $settings, + ), + ), + ), 'type' => 'setting', ); } @@ -177,7 +188,13 @@ function wysiwyg_pre_render_text_format($element) { else { $format_field['format']['#attributes']['class'][] = 'wysiwyg'; $format_field['format']['#attached']['js'][] = array( - 'data' => array('wysiwyg' => array('triggers' => array($format_field['format']['#id'] => $settings))), + 'data' => array( + 'wysiwyg' => array( + 'triggers' => array( + $format_field['format']['#id'] => $settings, + ), + ), + ), 'type' => 'setting', ); } @@ -307,7 +324,7 @@ function wysiwyg_load_editor($profile) { $path = drupal_get_path('module', 'wysiwyg'); // Initialize our namespaces in the *header* to do not force editor // integration scripts to check and define Drupal.wysiwyg on its own. - drupal_add_js($path . '/wysiwyg.init.js', array('weight' => JS_LIBRARY)); + drupal_add_js($path . '/wysiwyg.init.js', array('group' => JS_LIBRARY)); // The 'none' editor is a special editor implementation, allowing us to // attach and detach regular Drupal behaviors just like any other editor. @@ -560,7 +577,7 @@ function wysiwyg_get_css() { $files = array(); foreach (drupal_add_css() as $filepath => $info) { - if ($info['weight'] >= CSS_THEME && $info['media'] != 'print') { + if ($info['group'] >= CSS_THEME && $info['media'] != 'print') { if (file_exists($filepath)) { $files[] = base_path() . $filepath; } @@ -575,12 +592,16 @@ function wysiwyg_get_css() { function wysiwyg_profile_load($format) { static $profiles; - if (!isset($profiles) || !array_key_exists($format, $profiles)) { - $result = db_query('SELECT format, editor, settings FROM {wysiwyg} WHERE format = :format', array(':format' => $format)); + if ($cached = cache_get('wysiwyg_profiles')) { + $profiles = $cached->data; + } + else { + $result = db_query('SELECT format, editor, settings FROM {wysiwyg}'); foreach ($result as $profile) { $profile->settings = unserialize($profile->settings); $profiles[$profile->format] = $profile; } + cache_set('wysiwyg_profiles', $profiles); } return (isset($profiles[$format]) ? $profiles[$format] : FALSE); @@ -605,46 +626,87 @@ function wysiwyg_profile_load_all() { } /** - * Implementation of hook_user(). + * Implements hook_form_FORM_ID_alter(). */ -function wysiwyg_user($type, &$edit, &$user, $category = NULL) { - if ($type == 'form' && $category == 'account') { - // @todo http://drupal.org/node/322433 - $profile = new stdClass; - if (isset($profile->settings['user_choose']) && $profile->settings['user_choose']) { - $form['wysiwyg'] = array( - '#type' => 'fieldset', - '#title' => t('Wysiwyg Editor settings'), - '#weight' => 10, - '#collapsible' => TRUE, - '#collapsed' => TRUE, - ); - $form['wysiwyg']['wysiwyg_status'] = array( - '#type' => 'checkbox', - '#title' => t('Enable editor by default'), - '#default_value' => isset($user->wysiwyg_status) ? $user->wysiwyg_status : (isset($profile->settings['default']) ? $profile->settings['default'] : FALSE), - '#return_value' => 1, - '#description' => t('If enabled, rich-text editing is enabled by default in textarea fields.'), - ); - return array('wysiwyg' => $form); +function wysiwyg_form_user_profile_form_alter(&$form, &$form_state, $form_id) { + $account = $form['#user']; + $user_formats = filter_formats($account); + $options = array(); + $options_default = array(); + foreach (wysiwyg_profile_load_all() as $format => $profile) { + // Only show profiles that have user_choose enabled. + if (!empty($profile->settings['user_choose']) && isset($user_formats[$format])) { + $options[$format] = check_plain($user_formats[$format]->name); + if (wysiwyg_user_get_status($profile, $account)) { + $options_default[] = $format; + } } } - elseif ($type == 'validate' && isset($edit['wysiwyg_status'])) { - return array('wysiwyg_status' => $edit['wysiwyg_status']); + if (!empty($options)) { + $form['wysiwyg']['wysiwyg_status'] = array( + '#type' => 'checkboxes', + '#title' => t('Text formats enabled for rich-text editing'), + '#options' => $options, + '#default_value' => $options_default, + ); + } +} + +/** + * Implements hook_user_insert(). + * + * Wysiwyg's user preferences are normally not exposed on the user registration + * form, but in case they are manually altered in, we invoke + * wysiwyg_user_update() accordingly. + */ +function wysiwyg_user_insert(&$edit, $account, $category) { + wysiwyg_user_update($edit, $account, $category); +} + +/** + * Implements hook_user_update(). + */ +function wysiwyg_user_update(&$edit, $account, $category) { + if (isset($edit['wysiwyg_status'])) { + db_delete('wysiwyg_user') + ->condition('uid', $account->uid) + ->execute(); + $query = db_insert('wysiwyg_user') + ->fields(array('uid', 'format', 'status')); + foreach ($edit['wysiwyg_status'] as $format => $status) { + $query->values(array( + 'uid' => $account->uid, + 'format' => $format, + 'status' => (int) (bool) $status, + )); + } + $query->execute(); } } -function wysiwyg_user_get_status($profile) { +function wysiwyg_user_get_status($profile, $account = NULL) { global $user; - if (!empty($profile->settings['user_choose']) && isset($user->wysiwyg_status)) { - $status = $user->wysiwyg_status; + if (!isset($account)) { + $account = $user; + } + + // Default wysiwyg editor status information is only required on forms, so we + // do not pre-emptively load and attach this information on every user_load(). + if (!isset($account->wysiwyg_status)) { + $account->wysiwyg_status = db_query("SELECT format, status FROM {wysiwyg_user} WHERE uid = :uid", array( + ':uid' => $account->uid, + ))->fetchAllKeyed(); + } + + if (!empty($profile->settings['user_choose']) && isset($account->wysiwyg_status[$profile->format])) { + $status = $account->wysiwyg_status[$profile->format]; } else { $status = isset($profile->settings['default']) ? $profile->settings['default'] : TRUE; } - return $status; + return (bool) $status; } /** @@ -960,4 +1022,3 @@ function _wysiwyg_process_include($module, $identifier, $path, $hook) { /** * @} End of "defgroup wysiwyg_api". */ -