Commit 0b55aeef authored by Alain Takoudjou's avatar Alain Takoudjou

Slaprunner Editor: Fix closing tab issues

parent 7e0537d1
......@@ -13,6 +13,7 @@
height: 30px;
color: #737373;
border-bottom: 4px solid #7FAED3;
min-width: 936px;
}
.box_header ul{float: left; padding-top: 2px; text-shadow: 0px 1px #F1F1F1;}
.box_header li{float: left;border: 1px solid #AAB8C2;padding: 1px 5px 1px 0;margin-left: 5px; text-indent: 5px;}
......
......@@ -236,7 +236,8 @@ $(document).ready(function () {
/*Close Selected Tab*/
$("#tabControl div.item:last span.bt_close").click(function () {
var $tab = $(this).parent(), position = 0;
var $tab = $(this).parent(), position = 0,
active = $tab.hasClass('active');
var rel = $tab.attr('rel');
if (editorlist[ rel ].changed) {
if (!window.confirm("You have unsaved changes. Your changes will be lost if you don't save them")){
......@@ -247,14 +248,14 @@ $(document).ready(function () {
}
}
//Remove tab
if ( $tab.hasClass('active') && $("#tabControl div.item").length > 0 ) {
position = ($tab.index() == 0) ? 1 : $tab.index();
$("#tabControl div.item:nth-child("+position+")").click();
}
position = ($tab.index() === 0) ? 1 : $tab.index();
editorlist[ rel ].editor.destroy();
delete editorlist[ rel ];
$tab.remove();
$("#tabContent pre[rel='" + rel + "']").remove();
if ( active && $("#tabControl div.item").length > 0 ) {
$("#tabControl div.item:nth-child("+position+")").click();
}
resizeTabItems ();
saveTabList ();
return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment