avoid installing editor n times for n ajax loads stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Mon, 31 Aug 2009 14:37:16 +0200
branchstable
changeset 3060 ea967a4f6ccb
parent 3055 06814d57514f
child 3061 e3e5ab4b987a
avoid installing editor n times for n ajax loads
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;