resize editor only when tab is fully shown

This commit is contained in:
nightwing 2013-07-23 19:12:24 +04:00
commit 22de40bf6a

View file

@ -79,12 +79,12 @@ $(function() {
e.preventDefault(); e.preventDefault();
}); });
var tabs = $("#tabnav"), var tabs = $("#tabnav"),
tab_a_selector = "a"; tab_a_selector = "a";
var firstLoad = true; var firstLoad = true;
tabs.find(tab_a_selector).click(function(e) { tabs.find(tab_a_selector).click(function(e) {
e.preventDefault(); e.preventDefault();
if ($(this).attr("href") === "/") { if ($(this).attr("href") === "/") {
window.location = "http://ace.ajax.org"; window.location = "http://ace.ajax.org";
@ -122,14 +122,18 @@ $(function() {
} }
$(this).tab("show"); $(this).tab("show");
embedded_editor.resize();
editor.resize();
var state = {}; var state = {};
state.nav = $(this).attr("href").substr(1); state.nav = $(this).attr("href").substr(1);
$.bbq.pushState(state); $.bbq.pushState(state);
}); });
$('#tabnav a[data-toggle="tab"]').on('shown', function (e) {
$(".tab-content .tab-pane.active .ace_editor").each(function(i, el){
el.env.onResize();
});
});
$(window).on("hashchange", function(e) { $(window).on("hashchange", function(e) {
_gaq.push(['_trackPageview',location.pathname + location.search + location.hash]); _gaq.push(['_trackPageview',location.pathname + location.search + location.hash]);
tabs.each(function() { tabs.each(function() {