summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt1
-rw-r--r--editors/js/whizzywig-60.js89
-rw-r--r--editors/whizzywig.inc3
3 files changed, 93 insertions, 0 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index ee422dc..458170d 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -6,6 +6,7 @@ Wysiwyg x.x-x.x, xxxx-xx-xx
Wysiwyg 5.x-2.x, xxxx-xx-xx
---------------------------
+#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.
diff --git a/editors/js/whizzywig-60.js b/editors/js/whizzywig-60.js
new file mode 100644
index 0000000..62645b9
--- /dev/null
+++ b/editors/js/whizzywig-60.js
@@ -0,0 +1,89 @@
+// $Id$
+
+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/editors/whizzywig.inc b/editors/whizzywig.inc
index 14ceaa6..8735a96 100644
--- a/editors/whizzywig.inc
+++ b/editors/whizzywig.inc
@@ -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;