This commit is contained in:
parent
90227fbe98
commit
3b421b5d0b
|
@ -259,8 +259,7 @@ var editors = {
|
|||
return;
|
||||
}
|
||||
|
||||
var $usages = $('.bottom-window-group .search'),
|
||||
usagesHTML = '<ul>';
|
||||
var usagesHTML = '<ul>';
|
||||
|
||||
for (var i = 0, ii = data.usages.length; i < ii; i++) {
|
||||
usagesHTML += '<li>' + data.usages[i].path
|
||||
|
@ -268,34 +267,38 @@ var editors = {
|
|||
}
|
||||
usagesHTML += '</ul>';
|
||||
|
||||
if ($usages.find("ul").length === 0) {
|
||||
wide.usagesTab = new Tabs({
|
||||
id: ".bottom-window-group .search",
|
||||
removeAfter: function (id, prevId) {
|
||||
if ($usages.find("ul").length === 1) {
|
||||
$usages.find(".tabs").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$usages.find(".tabs-panel > div").append(usagesHTML);
|
||||
} else if ($usages.find("ul").length === 1) {
|
||||
$usages.find(".tabs").show();
|
||||
wide.usagesTab.add({
|
||||
id: "b",
|
||||
"title": 'Usages of ',
|
||||
"content": usagesHTML + 1
|
||||
});
|
||||
}
|
||||
|
||||
// focus
|
||||
wide.bottomWindowTab.setCurrent("search");
|
||||
windows.flowBottom();
|
||||
$(".bottom-window-group .search").focus();
|
||||
editors.appendSearch(usagesHTML);
|
||||
}
|
||||
});
|
||||
};
|
||||
},
|
||||
appendSearch: function (html) {
|
||||
var $usages = $('.bottom-window-group .search');
|
||||
if ($usages.find("ul").length === 0) {
|
||||
wide.usagesTab = new Tabs({
|
||||
id: ".bottom-window-group .search",
|
||||
removeAfter: function (id, prevId) {
|
||||
if ($usages.find("ul").length === 1) {
|
||||
$usages.find(".tabs").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$usages.find(".tabs-panel > div").append(html);
|
||||
} else if ($usages.find("ul").length === 1) {
|
||||
$usages.find(".tabs").show();
|
||||
wide.usagesTab.add({
|
||||
id: "b",
|
||||
"title": 'Usages of ',
|
||||
"content": html + 1
|
||||
});
|
||||
}
|
||||
|
||||
// focus
|
||||
wide.bottomWindowTab.setCurrent("search");
|
||||
windows.flowBottom();
|
||||
$(".bottom-window-group .search").focus();
|
||||
},
|
||||
// 新建一个编辑器 Tab,如果已经存在 Tab 则切换到该 Tab.
|
||||
newEditor: function (data) {
|
||||
$(".toolbars").show();
|
||||
|
|
|
@ -35,13 +35,6 @@ var hotkeys = {
|
|||
shiftKey: false,
|
||||
which: 54
|
||||
},
|
||||
// Ctrl+Q 关闭当前编辑器
|
||||
closeCurEditor: {
|
||||
ctrlKey: true,
|
||||
altKey: false,
|
||||
shiftKey: false,
|
||||
which: 81
|
||||
},
|
||||
// Ctrl+D 窗口组切换
|
||||
changeEditor: {
|
||||
ctrlKey: true,
|
||||
|
@ -49,6 +42,20 @@ var hotkeys = {
|
|||
shiftKey: false,
|
||||
which: 68
|
||||
},
|
||||
// Ctrl+F 搜索
|
||||
search: {
|
||||
ctrlKey: true,
|
||||
altKey: false,
|
||||
shiftKey: false,
|
||||
which: 70
|
||||
},
|
||||
// Ctrl+Q 关闭当前编辑器
|
||||
closeCurEditor: {
|
||||
ctrlKey: true,
|
||||
altKey: false,
|
||||
shiftKey: false,
|
||||
which: 81
|
||||
},
|
||||
// F6 构建并运行
|
||||
buildRun: {
|
||||
ctrlKey: false,
|
||||
|
@ -61,6 +68,13 @@ var hotkeys = {
|
|||
$("#files").keydown(function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var hotKeys = hotkeys.defaultKeyMap;
|
||||
if (event.ctrlKey === hotKeys.search.ctrlKey
|
||||
&& event.which === hotKeys.search.which) { // Ctrl+F 搜索
|
||||
$("#dialogSearchForm").dialog("open");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event.which) {
|
||||
case 46: // 删除
|
||||
tree.removeIt();
|
||||
|
|
|
@ -209,6 +209,45 @@ var wide = {
|
|||
wide.curEditor.focus();
|
||||
}
|
||||
});
|
||||
|
||||
$("#dialogSearchForm").dialog({
|
||||
"height": 52,
|
||||
"width": 260,
|
||||
"title": config.label.create_dir,
|
||||
"okText": config.label.create,
|
||||
"cancelText": config.label.cancel,
|
||||
"afterOpen": function () {
|
||||
$("#dialogSearchForm > input:eq(0)").val('').focus();
|
||||
},
|
||||
"ok": function () {
|
||||
var request = newWideRequest();
|
||||
request.dir = wide.curNode.path;
|
||||
request.text = $("#dialogSearchForm > input:eq(0)").val();
|
||||
request.extension = $("#dialogSearchForm > input:eq(1)").val();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/file/search/text',
|
||||
data: JSON.stringify(request),
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (!data.succ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var searcHTML = '<ul>';
|
||||
|
||||
for (var i = 0, ii = data.founds.length; i < ii; i++) {
|
||||
searcHTML += '<li>' + data.founds[i].path
|
||||
+ '</li>';
|
||||
}
|
||||
searcHTML += '</ul>';
|
||||
|
||||
editors.appendSearch(searcHTML);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
_initLayout: function () {
|
||||
var mainH = $(window).height() - $(".menu").height() - $(".footer").height() - 1,
|
||||
|
|
|
@ -195,6 +195,10 @@
|
|||
<div id="dialogGoLinePrompt" class="dialog-prompt fn-none">
|
||||
<input/><span class="tip"></span>
|
||||
</div>
|
||||
<div id="dialogSearchForm" class="dialog-prompt fn-none">
|
||||
<input/>
|
||||
<input/>
|
||||
</div>
|
||||
<script>
|
||||
var config = {
|
||||
"latestSessionContent": {{.latestSessionContent}},
|
||||
|
|
Loading…
Reference in New Issue