From 36f913cd686b62367f9e8c311c4fdc5c09478313 Mon Sep 17 00:00:00 2001 From: Henrik Danielsson Date: Sat, 28 May 2011 11:14:53 +0200 Subject: [PATCH] Issue #1079694 by TwoD: Fixed Whizzywig not restoring textarea styles when detached. --- CHANGELOG.txt | 1 + editors/js/whizzywig-56.js | 9 +++------ editors/js/whizzywig-60.js | 11 ++++------- editors/js/whizzywig.js | 9 +++------ 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8db62e7..d5e52f9 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -28,6 +28,7 @@ Wysiwyg 7.x-2.0, 2010-01-06 Wysiwyg 6.x-2.x, xxxx-xx-xx --------------------------- +#1079694 by TwoD: Fixed Whizzywig not restoring textarea styles when detached. #1132142 by tacituseu, TwoD, sun: Fixed nicEdit not removing its submit handler. #1143104 by EugenMayer: Fixed CKEditor 3.5.4 version detection. #1009880 by AndyF: Fixed another CKEditor selection handling issue. diff --git a/editors/js/whizzywig-56.js b/editors/js/whizzywig-56.js index 759c578..229a70b 100644 --- a/editors/js/whizzywig-56.js +++ b/editors/js/whizzywig-56.js @@ -74,9 +74,7 @@ Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) { // 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'); + originalValues.originalStyle = $field.attr('style'); $field.css('width', $field.width() + 'px'); // Attach editor. @@ -113,9 +111,8 @@ Drupal.wysiwyg.editor.detach.whizzywig = function(context, params) { // 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); + $field.removeAttr('style'); + $field.attr('style', originalValues.originalStyle); }; if (typeof params != 'undefined') { diff --git a/editors/js/whizzywig-60.js b/editors/js/whizzywig-60.js index fd1d08c..dc995f6 100644 --- a/editors/js/whizzywig-60.js +++ b/editors/js/whizzywig-60.js @@ -23,9 +23,7 @@ Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) { // 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'); + originalValues.originalStyle = $field.attr('style'); $field.css('width', $field.width() + 'px'); // Attach editor. @@ -65,10 +63,9 @@ Drupal.wysiwyg.editor.detach.whizzywig = function(context, params) { // 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); - }; + $field.removeAttr('style'); + $field.attr('style', originalValues.originalStyle); + } if (typeof params != 'undefined') { for (var i = 0; i < whizzies.length; i++) { diff --git a/editors/js/whizzywig.js b/editors/js/whizzywig.js index 6f70bb8..e98bc4d 100644 --- a/editors/js/whizzywig.js +++ b/editors/js/whizzywig.js @@ -65,9 +65,7 @@ Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) { // 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'); + originalValues.originalStyle = $field.attr('style'); $field.css('width', $field.width() + 'px'); // Attach editor. @@ -106,9 +104,8 @@ Drupal.wysiwyg.editor.detach.whizzywig = function(context, params) { // 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); + $field.removeAttr('style'); + $field.attr('style', originalValues.originalStyle); }; if (typeof params != 'undefined') { -- 1.7.4.1