Layout and tabs view informs its views about being hidden
[fnpeditor.git] / views / tabs / tabs.js
index 7298d4e..bc14083 100644 (file)
@@ -57,8 +57,12 @@ define([
             if(slug !== this.selectedTab && this.contents[slug]) {\r
                 this.trigger('leaving', this.selectedTab);\r
                 \r
-                if(this.selectedTab)\r
-                    this.contents[this.selectedTab].detach();\r
+                if(this.selectedTab) {\r
+                    var toDetach = this.contents[this.selectedTab];\r
+                    if(toDetach.onHide)\r
+                        toDetach.onHide();\r
+                    toDetach.detach();\r
+                }\r
                 this.nodes.content.append(this.contents[slug]);\r
                 if(this.contents[slug].onShow) {\r
                     this.contents[slug].onShow();\r