From: Henrik Danielsson Date: Thu, 5 May 2011 21:04:55 +0000 (+0200) Subject: Issue #1132142 by tacituseu, TwoD, sun: Fixed nicEdit not removing its X-Git-Tag: 7.x-2.1~3 X-Git-Url: http://drupalcode.org/project/wysiwyg.git/commitdiff_plain/95eeea9820bd017a3e265da9b16b3f702eda27c4 Issue #1132142 by tacituseu, TwoD, sun: Fixed nicEdit not removing its submit handler. --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 3494dd6..8db62e7 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 --------------------------- +#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. #1048556 by cousin_itt, TwoD: Fixed TinyMCE insertdatetime plugin setting. diff --git a/editors/js/nicedit.js b/editors/js/nicedit.js index ba8fc91..d5d9795 100644 --- a/editors/js/nicedit.js +++ b/editors/js/nicedit.js @@ -4,9 +4,22 @@ * Attach this editor to a target element. */ Drupal.wysiwyg.editor.attach.nicedit = function(context, params, settings) { + // Intercept and ignore submit handlers or they will revert changes made + // since the instance was removed. The handlers are anonymous and hidden out + // of scope in a closure so we can't unbind them. The same operations are + // performed when the instance is detached anyway. + var oldAddEvent = bkLib.addEvent; + bkLib.addEvent = function(obj, type, fn) { + if (type != 'submit') { + oldAddEvent(obj, type, fn); + } + } // Attach editor. var editor = new nicEditor(settings); editor.panelInstance(params.field); + // The old addEvent() must be restored after creating a new instance, as + // plugins with dialogs use it to bind submit handlers to their forms. + bkLib.addEvent = oldAddEvent; editor.addEvent('focus', function () { Drupal.wysiwyg.activeId = params.field; });