commit 5454425e6fe82f9aff73ffa83f8ce5a5a3465c4a
Author: David Curry <david.curry@totaralms.com>
Date:   Fri Feb 28 13:20:26 2014 +1300

    T-11638 tinymce: Fix multiple collapse tabs making popup textareas unusable
    
    Change-Id: I03110cd7f96e88fb0daa4bffe317e1f7ae410f57

diff --git a/lib/editor/tinymce/yui/build/moodle-editor_tinymce-collapse/moodle-editor_tinymce-collapse-debug.js b/lib/editor/tinymce/yui/build/moodle-editor_tinymce-collapse/moodle-editor_tinymce-collapse-debug.js
index 732008b..9f53234 100644
--- a/lib/editor/tinymce/yui/build/moodle-editor_tinymce-collapse/moodle-editor_tinymce-collapse-debug.js
+++ b/lib/editor/tinymce/yui/build/moodle-editor_tinymce-collapse/moodle-editor_tinymce-collapse-debug.js
@@ -26,6 +26,12 @@ Y.extend(COLLAPSE, Y.Base, {
 
     initialise_toggles : function(refreshes) {
         var editors_initialised = this.editors_initialised(), self = this, editor;
+
+        // If the editor exists don't initialise it.
+        if (tinymce.activeEditor != null) {
+            return;
+        }
+
         if (!editors_initialised && refreshes) {
             setTimeout(function() {
                     self.initialise_toggles(refreshes - 1);
diff --git a/lib/editor/tinymce/yui/build/moodle-editor_tinymce-collapse/moodle-editor_tinymce-collapse-min.js b/lib/editor/tinymce/yui/build/moodle-editor_tinymce-collapse/moodle-editor_tinymce-collapse-min.js
index 485e26e..b7a7a80 100644
--- a/lib/editor/tinymce/yui/build/moodle-editor_tinymce-collapse/moodle-editor_tinymce-collapse-min.js
+++ b/lib/editor/tinymce/yui/build/moodle-editor_tinymce-collapse/moodle-editor_tinymce-collapse-min.js
@@ -1 +1 @@
-YUI.add("moodle-editor_tinymce-collapse",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{toggleNodeTemplate:null,init:function(){this.initialise_toggles(10)},editors_initialised:function(){return typeof tinyMCE!="undefined"},initialise_toggles:function(t){var n=this.editors_initialised(),r=this,i;if(!n&&t){setTimeout(function(){r.initialise_toggles(t-1)},100);return}this.toggleNodeTemplate=e.Node.create('<a class="toggle_editor_toolbar" />'),this.toggleNodeTemplate.setContent(M.util.get_string("showeditortoolbar","form")),e.one("body").delegate("click",this.toggle_collapse_from_event,"a.toggle_editor_toolbar",this);for(i in tinyMCE.editors)this.setup_collapse(tinyMCE.editors[i]);tinyMCE.onAddEditor.add(e.bind(this.add_setup_collapse_listener,this))},add_setup_collapse_listener:function(t,n){n.onInit.add(e.bind(this.setup_collapse,this))},setup_collapse:function(t){var n=e.Node(t.getElement()),r=e.Node(t.getContainer()).one("> table"),i;if(!n.hasClass("collapsible"))return;if(!r)return;i=this.toggleNodeTemplate.cloneNode(!0),r.get("parentNode").insert(i,r),e.Node(t.getElement()).hasClass("collapsed")?this.toggle_collapse(i,r,0):this.toggle_collapse(i,r,1),r.setStyle("height",""),r.setStyle("width","")},toggle_collapse:function(e,t,n){var r=t.one("td.mceToolbar").ancestor("tr"),i=t.one(".mceStatusbar").ancestor("tr");typeof n=="undefined"&&(r.getStyle("display")==="none"?n=1:n=0),n===0?(r.hide(),i.hide(),e.setContent(M.util.get_string("showeditortoolbar","form"))):(r.show(),i.show(),e.setContent(M.util.get_string("hideeditortoolbar","form")))},toggle_collapse_from_event:function(e){var t=e.target.ancestor("a",!0),n=e.target.ancestor("span",!0).one("table.mceLayout");this.toggle_collapse(t,n)}}),M.editor_collapse=M.editor_collapse||{},M.editor_collapse.init=function(e){return new n(e)}},"@VERSION@",{requires:["base","node","dom"]});
+YUI.add("moodle-editor_tinymce-collapse",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{toggleNodeTemplate:null,init:function(){this.initialise_toggles(10)},editors_initialised:function(){return typeof tinyMCE!=="undefined"},initialise_toggles:function(t){var n=this.editors_initialised(),r=this,i;if(tinymce.activeEditor!=null){return}if(!n&&t){setTimeout(function(){r.initialise_toggles(t-1)},100);return}this.toggleNodeTemplate=e.Node.create('<a class="toggle_editor_toolbar" />');this.toggleNodeTemplate.setContent(M.util.get_string("showeditortoolbar","form"));e.one("body").delegate("click",this.toggle_collapse_from_event,"a.toggle_editor_toolbar",this);for(i in tinyMCE.editors){this.setup_collapse(tinyMCE.editors[i])}tinyMCE.onAddEditor.add(e.bind(this.add_setup_collapse_listener,this))},add_setup_collapse_listener:function(t,n){n.onInit.add(e.bind(this.setup_collapse,this))},setup_collapse:function(t){var n=e.Node(t.getElement()),r=e.Node(t.getContainer()).one("> table"),i;if(!n.hasClass("collapsible")){return}if(!r){return}i=this.toggleNodeTemplate.cloneNode(true);r.get("parentNode").insert(i,r);if(e.Node(t.getElement()).hasClass("collapsed")){this.toggle_collapse(i,r,0)}else{this.toggle_collapse(i,r,1)}r.setStyle("height","");r.setStyle("width","")},toggle_collapse:function(e,t,n){var r=t.one("td.mceToolbar").ancestor("tr"),i=t.one(".mceStatusbar").ancestor("tr");if(typeof n==="undefined"){if(r.getStyle("display")==="none"){n=1}else{n=0}}if(n===0){r.hide();i.hide();e.setContent(M.util.get_string("showeditortoolbar","form"))}else{r.show();i.show();e.setContent(M.util.get_string("hideeditortoolbar","form"))}},toggle_collapse_from_event:function(e){var t=e.target.ancestor("a",true),n=e.target.ancestor("span",true).one("table.mceLayout");this.toggle_collapse(t,n)}});M.editor_collapse=M.editor_collapse||{};M.editor_collapse.init=function(e){return new n(e)}},"@VERSION@",{requires:["base","node","dom"]})
diff --git a/lib/editor/tinymce/yui/build/moodle-editor_tinymce-collapse/moodle-editor_tinymce-collapse.js b/lib/editor/tinymce/yui/build/moodle-editor_tinymce-collapse/moodle-editor_tinymce-collapse.js
index 732008b..9f53234 100644
--- a/lib/editor/tinymce/yui/build/moodle-editor_tinymce-collapse/moodle-editor_tinymce-collapse.js
+++ b/lib/editor/tinymce/yui/build/moodle-editor_tinymce-collapse/moodle-editor_tinymce-collapse.js
@@ -26,6 +26,12 @@ Y.extend(COLLAPSE, Y.Base, {
 
     initialise_toggles : function(refreshes) {
         var editors_initialised = this.editors_initialised(), self = this, editor;
+
+        // If the editor exists don't initialise it.
+        if (tinymce.activeEditor != null) {
+            return;
+        }
+
         if (!editors_initialised && refreshes) {
             setTimeout(function() {
                     self.initialise_toggles(refreshes - 1);
