Tab 上面加上右键菜单(关闭、关闭其他、关闭所有)
This commit is contained in:
parent
d6caae9252
commit
7652d9d459
|
@ -115,5 +115,7 @@
|
||||||
"sing_up_error": "Sign Up Error",
|
"sing_up_error": "Sign Up Error",
|
||||||
"user_name_ruler": "Username only by az, AZ, 0-9, _ consisting of a length of 16",
|
"user_name_ruler": "Username only by az, AZ, 0-9, _ consisting of a length of 16",
|
||||||
"password_no_match": "Password doesn't match the confirmation",
|
"password_no_match": "Password doesn't match the confirmation",
|
||||||
"discard": "Discard"
|
"discard": "Discard",
|
||||||
|
"close": "Close",
|
||||||
|
"close_other": "Close Other"
|
||||||
}
|
}
|
|
@ -115,5 +115,7 @@
|
||||||
"sing_up_error": "登録に失敗しました",
|
"sing_up_error": "登録に失敗しました",
|
||||||
"user_name_ruler": "16の長さからなる_ AZ、AZ、0-9、によってユーザ名のみ",
|
"user_name_ruler": "16の長さからなる_ AZ、AZ、0-9、によってユーザ名のみ",
|
||||||
"password_no_match": "一貫性のないパスワード入力",
|
"password_no_match": "一貫性のないパスワード入力",
|
||||||
"discard": "あきらめる"
|
"discard": "あきらめる",
|
||||||
|
"close": "クローズ",
|
||||||
|
"close_other": "閉じるその他"
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,5 +115,7 @@
|
||||||
"sing_up_error": "注册失败",
|
"sing_up_error": "注册失败",
|
||||||
"user_name_ruler": "用户名只能由 a-z, A-Z, 0-9, _ 组成,长度为16",
|
"user_name_ruler": "用户名只能由 a-z, A-Z, 0-9, _ 组成,长度为16",
|
||||||
"password_no_match": "密码输入不一致",
|
"password_no_match": "密码输入不一致",
|
||||||
"discard": "放弃"
|
"discard": "放弃",
|
||||||
|
"close": "关闭",
|
||||||
|
"close_other": "关闭其它"
|
||||||
}
|
}
|
|
@ -115,5 +115,7 @@
|
||||||
"sing_up_error": "註冊失敗",
|
"sing_up_error": "註冊失敗",
|
||||||
"user_name_ruler": "用戶名只能由az, AZ, 0-9, _ 組成,長度為16",
|
"user_name_ruler": "用戶名只能由az, AZ, 0-9, _ 組成,長度為16",
|
||||||
"password_no_match": "密碼輸入不一致",
|
"password_no_match": "密碼輸入不一致",
|
||||||
"discard": "放棄"
|
"discard": "放棄",
|
||||||
|
"close": "關閉",
|
||||||
|
"close_other": "關閉其它"
|
||||||
}
|
}
|
|
@ -1,6 +1,24 @@
|
||||||
var editors = {
|
var editors = {
|
||||||
data: [],
|
data: [],
|
||||||
tabs: {},
|
tabs: {},
|
||||||
|
close: function () {
|
||||||
|
$(".edit-panel .tabs > div[data-index=" + $(".edit-panel .frame").data("index") + "]").find(".ico-close").click();
|
||||||
|
},
|
||||||
|
closeOther: function () {
|
||||||
|
var currentIndex = $(".edit-panel .frame").data("index");
|
||||||
|
|
||||||
|
// 设置全部关闭标识
|
||||||
|
var removeData = [];
|
||||||
|
$(".edit-panel .tabs > div").each(function (i) {
|
||||||
|
if (currentIndex !== $(this).data("index")) {
|
||||||
|
removeData.push($(this).data("index"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var firstIndex = removeData.splice(0, 1);
|
||||||
|
$("#dialogCloseEditor").data("removeData", removeData);
|
||||||
|
// 开始关闭
|
||||||
|
$(".edit-panel .tabs > div[data-index=" + firstIndex + "]").find(".ico-close").click();
|
||||||
|
},
|
||||||
_removeAllMarker: function () {
|
_removeAllMarker: function () {
|
||||||
var removeData = $("#dialogCloseEditor").data("removeData");
|
var removeData = $("#dialogCloseEditor").data("removeData");
|
||||||
if (removeData && removeData.length > 0) {
|
if (removeData && removeData.length > 0) {
|
||||||
|
@ -9,6 +27,28 @@ var editors = {
|
||||||
$(".edit-panel .tabs > div[data-index=" + removeIndex + "] .ico-close").click();
|
$(".edit-panel .tabs > div[data-index=" + removeIndex + "] .ico-close").click();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
_initClose: function () {
|
||||||
|
// 关闭、关闭其他、关闭所有
|
||||||
|
$(".edit-panel").on("mousedown", '.tabs > div', function (event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
if (event.button === 0) { // 左键
|
||||||
|
$(".edit-panel .frame").hide();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// event.button === 2 右键
|
||||||
|
var left = event.screenX;
|
||||||
|
if ($(".side").css("left") === "auto" || $(".side").css("left") === "0px") {
|
||||||
|
left = event.screenX - $(".side").width();
|
||||||
|
}
|
||||||
|
$(".edit-panel .frame").show().css({
|
||||||
|
"left": left + "px",
|
||||||
|
"top": "21px"
|
||||||
|
}).data('index', $(this).data("index"));
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
},
|
||||||
init: function () {
|
init: function () {
|
||||||
$("#dialogCloseEditor").dialog({
|
$("#dialogCloseEditor").dialog({
|
||||||
"modal": true,
|
"modal": true,
|
||||||
|
@ -152,6 +192,7 @@ var editors = {
|
||||||
|
|
||||||
this._initCodeMirrorHotKeys();
|
this._initCodeMirrorHotKeys();
|
||||||
this.openStartPage();
|
this.openStartPage();
|
||||||
|
this._initClose();
|
||||||
},
|
},
|
||||||
openStartPage: function () {
|
openStartPage: function () {
|
||||||
var dateFormat = function (time, fmt) {
|
var dateFormat = function (time, fmt) {
|
||||||
|
@ -467,11 +508,11 @@ var editors = {
|
||||||
tId = tree.getTIdByPath($it.attr("title"));
|
tId = tree.getTIdByPath($it.attr("title"));
|
||||||
tree.openFile(tree.fileTree.getNodeByTId(tId));
|
tree.openFile(tree.fileTree.getNodeByTId(tId));
|
||||||
tree.fileTree.selectNode(wide.curNode);
|
tree.fileTree.selectNode(wide.curNode);
|
||||||
|
|
||||||
var oldLine = wide.curEditor.getCursor().line;
|
var oldLine = wide.curEditor.getCursor().line;
|
||||||
var line = $it.find(".position").data("line") - 1;
|
var line = $it.find(".position").data("line") - 1;
|
||||||
var cursor = CodeMirror.Pos(line, $it.find(".position").data("ch") - 1);
|
var cursor = CodeMirror.Pos(line, $it.find(".position").data("ch") - 1);
|
||||||
|
|
||||||
wide.curEditor.setCursor(cursor);
|
wide.curEditor.setCursor(cursor);
|
||||||
|
|
||||||
var half = Math.floor(wide.curEditor.getScrollInfo().clientHeight / wide.curEditor.defaultTextHeight() / 2);
|
var half = Math.floor(wide.curEditor.getScrollInfo().clientHeight / wide.curEditor.defaultTextHeight() / 2);
|
||||||
|
|
|
@ -210,10 +210,10 @@ var wide = {
|
||||||
$("#dialogGoLinePrompt").dialog("close");
|
$("#dialogGoLinePrompt").dialog("close");
|
||||||
var editor = wide.curEditor;
|
var editor = wide.curEditor;
|
||||||
var oldLine = editor.getCursor().line + 1;
|
var oldLine = editor.getCursor().line + 1;
|
||||||
|
|
||||||
if (oldLine === line) {
|
if (oldLine === line) {
|
||||||
editor.focus();
|
editor.focus();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,19 @@
|
||||||
<span onclick="wide.fmt(editors.getCurrentPath(), wide.curEditor)" class="ico-format font-ico" title="{{.i18n.format}}"></span>
|
<span onclick="wide.fmt(editors.getCurrentPath(), wide.curEditor)" class="ico-format font-ico" title="{{.i18n.format}}"></span>
|
||||||
<span class="font-ico ico-max" onclick="windows.maxEditor()" title="{{.i18n.max_editor}}"></span>
|
<span class="font-ico ico-max" onclick="windows.maxEditor()" title="{{.i18n.max_editor}}"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="frame">
|
||||||
|
<ul>
|
||||||
|
<li onclick="editors.close()" title="{{.i18n.close}}">
|
||||||
|
<span>{{.i18n.close}}</span>
|
||||||
|
</li>
|
||||||
|
<li onclick="wide.closeAllFiles()" title="{{.i18n.close_all_files}}">
|
||||||
|
<span>{{.i18n.close_all_files}}</span>
|
||||||
|
</li>
|
||||||
|
<li onclick="editors.closeOther()" title="{{.i18n.close_other}}">
|
||||||
|
<span>{{.i18n.close_other}}</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<div class="tabs"></div>
|
<div class="tabs"></div>
|
||||||
<div class="tabs-panel"></div>
|
<div class="tabs-panel"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue