关闭 tab 按入栈顺序设置当前 tab
This commit is contained in:
parent
86e1d6ecc7
commit
a7b5fb1bcd
|
@ -4,6 +4,7 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>
|
<title>
|
||||||
{{.i18n.wide}}
|
{{.i18n.wide}}
|
||||||
|
|
||||||
</title>
|
</title>
|
||||||
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/codemirror.css">
|
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/codemirror.css">
|
||||||
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/hint/show-hint.css">
|
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/hint/show-hint.css">
|
||||||
|
@ -25,17 +26,20 @@
|
||||||
<li>
|
<li>
|
||||||
<span>
|
<span>
|
||||||
{{.i18n.file}}
|
{{.i18n.file}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
<div class="frame">
|
<div class="frame">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="save-all disabled" onclick="wide.saveAllFiles()">
|
<li class="save-all disabled" onclick="wide.saveAllFiles()">
|
||||||
<span>
|
<span>
|
||||||
{{.i18n.save_all_files}}
|
{{.i18n.save_all_files}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="close-all disabled" onclick="wide.closeAllFiles()">
|
<li class="close-all disabled" onclick="wide.closeAllFiles()">
|
||||||
<span>
|
<span>
|
||||||
{{.i18n.close_all_files}}
|
{{.i18n.close_all_files}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="hr">
|
<li class="hr">
|
||||||
|
@ -43,6 +47,7 @@
|
||||||
<li onclick="wide.exit()">
|
<li onclick="wide.exit()">
|
||||||
<span>
|
<span>
|
||||||
{{.i18n.exit}}
|
{{.i18n.exit}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -51,12 +56,14 @@
|
||||||
<li>
|
<li>
|
||||||
<span>
|
<span>
|
||||||
{{.i18n.run}}
|
{{.i18n.run}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
<div class="frame">
|
<div class="frame">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="run disabled" onclick="wide.run()">
|
<li class="run disabled" onclick="wide.run()">
|
||||||
<span>
|
<span>
|
||||||
{{.i18n.build_n_run}}
|
{{.i18n.build_n_run}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="hr">
|
<li class="hr">
|
||||||
|
@ -64,11 +71,13 @@
|
||||||
<li class="go-get disabled" onclick="wide.goget()">
|
<li class="go-get disabled" onclick="wide.goget()">
|
||||||
<span>
|
<span>
|
||||||
{{.i18n.goget}}
|
{{.i18n.goget}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="go-install disabled" onclick="wide.goinstall()">
|
<li class="go-install disabled" onclick="wide.goinstall()">
|
||||||
<span>
|
<span>
|
||||||
{{.i18n.goinstall}}
|
{{.i18n.goinstall}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -89,28 +98,33 @@
|
||||||
<li>
|
<li>
|
||||||
<span>
|
<span>
|
||||||
{{.i18n.help}}
|
{{.i18n.help}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
<div class="frame">
|
<div class="frame">
|
||||||
<ul>
|
<ul>
|
||||||
<li onclick="window.open('https://www.gitbook.io/book/88250/wide-user-guide')">
|
<li onclick="window.open('https://www.gitbook.io/book/88250/wide-user-guide')">
|
||||||
<span>
|
<span>
|
||||||
{{.i18n.wide_doc}}
|
{{.i18n.wide_doc}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li onclick="window.open('https://github.com/b3log/wide/issues/new')">
|
<li onclick="window.open('https://github.com/b3log/wide/issues/new')">
|
||||||
{{.i18n.report_issues}}
|
{{.i18n.report_issues}}
|
||||||
|
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li class="hr">
|
<li class="hr">
|
||||||
</li>
|
</li>
|
||||||
<li onclick="editors.openStartPage()">
|
<li onclick="editors.openStartPage()">
|
||||||
<span>
|
<span>
|
||||||
{{.i18n.start_page}}
|
{{.i18n.start_page}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li onclick="wide.openAbout()">
|
<li onclick="wide.openAbout()">
|
||||||
<span>
|
<span>
|
||||||
{{.i18n.about}}
|
{{.i18n.about}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -126,6 +140,7 @@
|
||||||
<div class="current" data-index="filreTree">
|
<div class="current" data-index="filreTree">
|
||||||
<span title="{{.i18n.file}}">
|
<span title="{{.i18n.file}}">
|
||||||
{{.i18n.file}}
|
{{.i18n.file}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -138,12 +153,15 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li onclick="tree.newFile();">
|
<li onclick="tree.newFile();">
|
||||||
{{.i18n.create_file}}
|
{{.i18n.create_file}}
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li onclick="tree.newDir();">
|
<li onclick="tree.newDir();">
|
||||||
{{.i18n.create_dir}}
|
{{.i18n.create_dir}}
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li onclick="tree.removeIt();">
|
<li onclick="tree.removeIt();">
|
||||||
{{.i18n.delete}}
|
{{.i18n.delete}}
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -152,6 +170,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li onclick="tree.removeIt();">
|
<li onclick="tree.removeIt();">
|
||||||
{{.i18n.delete}}
|
{{.i18n.delete}}
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -181,16 +200,19 @@
|
||||||
<div class="current" data-index="output">
|
<div class="current" data-index="output">
|
||||||
<span title="{{.i18n.output}}">
|
<span title="{{.i18n.output}}">
|
||||||
{{.i18n.output}}
|
{{.i18n.output}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div data-index="search">
|
<div data-index="search">
|
||||||
<span title="{{.i18n.search}}">
|
<span title="{{.i18n.search}}">
|
||||||
{{.i18n.search}}
|
{{.i18n.search}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div data-index="notification">
|
<div data-index="notification">
|
||||||
<span title="{{.i18n.notification}}">
|
<span title="{{.i18n.notification}}">
|
||||||
{{.i18n.notification}}
|
{{.i18n.notification}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -236,15 +258,18 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="notification-count" title="{{.i18n.unread_notification}}">
|
<span class="notification-count" title="{{.i18n.unread_notification}}">
|
||||||
{{.i18n.notification}}!
|
{{.i18n.notification}}!
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="dialogRemoveConfirm" class="fn-none">
|
<div id="dialogRemoveConfirm" class="fn-none">
|
||||||
{{.i18n.isDelete}}
|
{{.i18n.isDelete}}
|
||||||
|
|
||||||
<b>
|
<b>
|
||||||
</b>
|
</b>
|
||||||
?
|
?
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="dialogAlert" class="fn-none">
|
<div id="dialogAlert" class="fn-none">
|
||||||
</div>
|
</div>
|
||||||
|
@ -302,6 +327,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/jquery-2.1.1.min.js">
|
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/jquery-2.1.1.min.js">
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,11 +6,6 @@
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
#startPage .workspace {
|
|
||||||
line-height: 16px;
|
|
||||||
margin-bottom: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#startPage a {
|
#startPage a {
|
||||||
color: #4183c4;
|
color: #4183c4;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -44,6 +39,14 @@
|
||||||
border-bottom: 1px solid #f1f1f1;
|
border-bottom: 1px solid #f1f1f1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#startPage .details li.border.workspace {
|
||||||
|
line-height: 18px;
|
||||||
|
padding-bottom: 10px !important;
|
||||||
|
word-wrap: break-word;
|
||||||
|
white-space: normal;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
#startPage .news {
|
#startPage .news {
|
||||||
height: 300px;
|
height: 300px;
|
||||||
width: 60%;
|
width: 60%;
|
||||||
|
|
|
@ -4,6 +4,7 @@ var Tabs = function (obj) {
|
||||||
obj._stack = [];
|
obj._stack = [];
|
||||||
|
|
||||||
this.obj = obj;
|
this.obj = obj;
|
||||||
|
this.obj.STACKSIZE = 64;
|
||||||
|
|
||||||
this._init(obj);
|
this._init(obj);
|
||||||
};
|
};
|
||||||
|
@ -60,25 +61,26 @@ $.extend(Tabs.prototype, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
del: function (id) {
|
del: function (id) {
|
||||||
// TODO:
|
|
||||||
var $tabsPanel = this.obj._$tabsPanel,
|
var $tabsPanel = this.obj._$tabsPanel,
|
||||||
$tabs = this.obj._$tabs,
|
$tabs = this.obj._$tabs,
|
||||||
prevId = undefined,
|
stack = this.obj._stack,
|
||||||
currentId = $tabs.children(".current").data("index");
|
prevId = null;
|
||||||
$tabs.children("div[data-index='" + id + "']").remove();
|
$tabs.children("div[data-index='" + id + "']").remove();
|
||||||
$tabsPanel.children("div[data-index='" + id + "']").remove();
|
$tabsPanel.children("div[data-index='" + id + "']").remove();
|
||||||
|
|
||||||
if (this.obj._prevId === id) {
|
// 移除堆栈中该 id
|
||||||
this.obj._prevId = $tabs.children("div:first").data("index");
|
for (var i = 0; i < stack.length; i++) {
|
||||||
|
if (id === stack[i]) {
|
||||||
|
stack.splice(i, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentId !== id) {
|
prevId = stack[stack.length - 1];
|
||||||
prevId = currentId;
|
|
||||||
} else {
|
|
||||||
prevId = this.obj._prevId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (typeof this.obj.removeAfter === 'function') {
|
||||||
this.obj.removeAfter(id, prevId);
|
this.obj.removeAfter(id, prevId);
|
||||||
|
}
|
||||||
|
|
||||||
this.setCurrent(prevId);
|
this.setCurrent(prevId);
|
||||||
},
|
},
|
||||||
getCurrentId: function () {
|
getCurrentId: function () {
|
||||||
|
@ -98,9 +100,12 @@ $.extend(Tabs.prototype, {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.obj._stack.length === 1024) {
|
// tab 顺序入栈,如栈满则清除
|
||||||
this.obj._stack.splice(1023, 1);
|
var stack = this.obj._stack;
|
||||||
} else {
|
if (stack.length === this.obj.STACKSIZE) {
|
||||||
|
stack.splice(0, 1);
|
||||||
|
}
|
||||||
|
if (stack[stack.length - 1] !== id) {
|
||||||
this.obj._stack.push(id);
|
this.obj._stack.push(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,26 +2,27 @@
|
||||||
<ul class="details">
|
<ul class="details">
|
||||||
<li class="title">Wide</li>
|
<li class="title">Wide</li>
|
||||||
<li>
|
<li>
|
||||||
<label>{{.i18n.current_user}}</label>{{.i18n.colon}}
|
<label>{{.i18n.current_user}}{{.i18n.colon}}</label>
|
||||||
{{.username}}
|
{{.username}}
|
||||||
</li>
|
</li>
|
||||||
<li class="border">
|
<li class="border workspace">
|
||||||
<label>{{.i18n.workspace}}</label>{{.i18n.colon}}
|
<label>{{.i18n.workspace}}{{.i18n.colon}}</label>
|
||||||
<div class="workspace">{{.workspace}}</div>
|
<span>{{.workspace}}</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="border">
|
<li class="border">
|
||||||
<label><a href="http://88250.gitbooks.io/wide-user-guide" target="_blank">{{.i18n.user_guide}}</a></label> &
|
<label><a href="http://88250.gitbooks.io/wide-user-guide" target="_blank">{{.i18n.user_guide}}</a></label> &
|
||||||
<label><a href="http://88250.gitbooks.io/wide-dev-guide" target="_blank">{{.i18n.dev_guide}}</a></label>
|
<label><a href="http://88250.gitbooks.io/wide-dev-guide" target="_blank">{{.i18n.dev_guide}}</a></label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label>{{.i18n.current_ver}}</label>{{.i18n.colon}}{{.ver}}<br/>
|
<label>{{.i18n.current_ver}}{{.i18n.colon}}</label>
|
||||||
<label>{{.i18n.dev_team}}</label>{{.i18n.colon}}
|
{{.ver}}<br/>
|
||||||
|
<label>{{.i18n.dev_team}}{{.i18n.colon}}</label>
|
||||||
<a href="https://github.com/b3log/b3log-solo/wiki/About_us" target="_blank">B3log</a><br/>
|
<a href="https://github.com/b3log/b3log-solo/wiki/About_us" target="_blank">B3log</a><br/>
|
||||||
<label>{{.i18n.project_address}}</label>{{.i18n.colon}}
|
<label>{{.i18n.project_address}}{{.i18n.colon}} </label>
|
||||||
<a href="https://github.com/b3log/wide" target="_blank">github.com/b3log/wide</a>
|
<a href="https://github.com/b3log/wide" target="_blank">github.com/b3log/wide</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label>{{.i18n.donate_us}}</label>{{.i18n.colon}}
|
<label>{{.i18n.donate_us}}{{.i18n.colon}}</label>
|
||||||
<a href="http://b3log.org/donate.html" target="_blank">b3log.org/donate.html</a>
|
<a href="http://b3log.org/donate.html" target="_blank">b3log.org/donate.html</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in New Issue