Commit 8c1286f9 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Fix inline examples resizing when switching tabs.

Previously when switching from guide tab to class tab the examples
in first tab would get set to zero height.  Now only recalculating
the heights of examples in the tab to which we switch to.
parent a327a5ef
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -59,23 +59,26 @@ Ext.define('Docs.controller.InlineExamples', {
                }
            },
            'classoverview': {
                resize: this.adjustSize,
                resize: this.createResizer('.class-overview'),
                afterload: this.replaceExampleDivs
            },
            'guidecontainer': {
                resize: this.adjustSize,
                resize: this.createResizer('.guide-container'),
                afterload: this.replaceExampleDivs
            }
        });
    },

    adjustSize: function() {
        Ext.Array.each(Ext.ComponentQuery.query('.inlineexample'), function(c) {
            if (c.codeEditor) {
    // Creates function to resize examples inside a specified container
    createResizer: function(container) {
        return function() {
            Ext.Array.each(Ext.ComponentQuery.query(container + ' .inlineexample'), function(c) {
                if (c.codeEditor && c.isVisible()) {
                    c.doLayout();
                    c.codeEditor.refresh();
                }
            });
        };
    },

    activateTab: function(cmp, buttonCls) {