# HG changeset patch # User Aurelien Campeas # Date 1251722236 -7200 # Node ID ea967a4f6ccbcefefb3876590a9ce133bfb255e2 # Parent 06814d57514f248820b0d65958ce8fded1fd4638 avoid installing editor n times for n ajax loads diff -r 06814d57514f -r ea967a4f6ccb web/data/cubicweb.ajax.js --- a/web/data/cubicweb.ajax.js Mon Aug 31 09:58:15 2009 +0200 +++ b/web/data/cubicweb.ajax.js Mon Aug 31 14:37:16 2009 +0200 @@ -51,7 +51,7 @@ } // find textareas and wrap them if there are some if (typeof(FCKeditor) != 'undefined') { - buildWysiwygEditors(node); + buildWysiwygEditors(); } if (typeof initFacetBoxEvents != 'undefined') { initFacetBoxEvents(node); @@ -351,7 +351,10 @@ */ function buildWysiwygEditors(parent) { jQuery('textarea').each(function () { - if (this.getAttribute('cubicweb:type', 'wysiwyg')) { + if (this.getAttribute('cubicweb:type') == 'wysiwyg') { + // mark editor as instanciated, we may be called a number of times + // (see postAjaxLoad) + this.setAttribute('cubicweb:type', 'fckeditor'); if (typeof FCKeditor != "undefined") { var fck = new FCKeditor(this.id); fck.Config['CustomConfigurationsPath'] = fckconfigpath;