summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsun2010-11-13 19:37:54 (GMT)
committer sun2010-11-13 19:37:54 (GMT)
commitc5c671f22298091416df68f9c5a97aa18efb1f16 (patch)
tree1cd2684f2a7df3e1b0c89a56c837b5e3e2136f2d
parent92ff726ed5748c6af677d5c950de02754b9ec63c (diff)
#678580 by TwoD, sun: Fixed Drupal.wysiwygAttachToggleLink breaks click events.
-rw-r--r--CHANGELOG.txt1
-rw-r--r--wysiwyg.js53
2 files changed, 32 insertions, 22 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 065ccc6..85ed5bd 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -2,6 +2,7 @@
Wysiwyg 6.x-2.x, xxxx-xx-xx
---------------------------
+#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
diff --git a/wysiwyg.js b/wysiwyg.js
index 09d6d97..6ab1045 100644
--- a/wysiwyg.js
+++ b/wysiwyg.js
@@ -158,28 +158,9 @@ 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.
- Drupal.wysiwyg.getParams($('.wysiwyg-field-' + params.field + ':checked, div.wysiwyg-field-' + params.field, context).get(0), params);
- 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();
@@ -187,6 +168,34 @@ Drupal.wysiwygAttachToggleLink = function(context, params) {
};
/**
+ * 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.
+ Drupal.wysiwyg.getParams($('.wysiwyg-field-' + params.field + ':checked, div.wysiwyg-field-' + params.field, context).get(0), params);
+ 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.
*
* Syntax for CSS classes is "wysiwyg-name-value".