This commit is contained in:
parent
90227fbe98
commit
3b421b5d0b
|
@ -259,8 +259,7 @@ var editors = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $usages = $('.bottom-window-group .search'),
|
var usagesHTML = '<ul>';
|
||||||
usagesHTML = '<ul>';
|
|
||||||
|
|
||||||
for (var i = 0, ii = data.usages.length; i < ii; i++) {
|
for (var i = 0, ii = data.usages.length; i < ii; i++) {
|
||||||
usagesHTML += '<li>' + data.usages[i].path
|
usagesHTML += '<li>' + data.usages[i].path
|
||||||
|
@ -268,6 +267,13 @@ var editors = {
|
||||||
}
|
}
|
||||||
usagesHTML += '</ul>';
|
usagesHTML += '</ul>';
|
||||||
|
|
||||||
|
editors.appendSearch(usagesHTML);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
},
|
||||||
|
appendSearch: function (html) {
|
||||||
|
var $usages = $('.bottom-window-group .search');
|
||||||
if ($usages.find("ul").length === 0) {
|
if ($usages.find("ul").length === 0) {
|
||||||
wide.usagesTab = new Tabs({
|
wide.usagesTab = new Tabs({
|
||||||
id: ".bottom-window-group .search",
|
id: ".bottom-window-group .search",
|
||||||
|
@ -278,13 +284,13 @@ var editors = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$usages.find(".tabs-panel > div").append(usagesHTML);
|
$usages.find(".tabs-panel > div").append(html);
|
||||||
} else if ($usages.find("ul").length === 1) {
|
} else if ($usages.find("ul").length === 1) {
|
||||||
$usages.find(".tabs").show();
|
$usages.find(".tabs").show();
|
||||||
wide.usagesTab.add({
|
wide.usagesTab.add({
|
||||||
id: "b",
|
id: "b",
|
||||||
"title": 'Usages of ',
|
"title": 'Usages of ',
|
||||||
"content": usagesHTML + 1
|
"content": html + 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,9 +298,6 @@ var editors = {
|
||||||
wide.bottomWindowTab.setCurrent("search");
|
wide.bottomWindowTab.setCurrent("search");
|
||||||
windows.flowBottom();
|
windows.flowBottom();
|
||||||
$(".bottom-window-group .search").focus();
|
$(".bottom-window-group .search").focus();
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
// 新建一个编辑器 Tab,如果已经存在 Tab 则切换到该 Tab.
|
// 新建一个编辑器 Tab,如果已经存在 Tab 则切换到该 Tab.
|
||||||
newEditor: function (data) {
|
newEditor: function (data) {
|
||||||
|
|
|
@ -35,13 +35,6 @@ var hotkeys = {
|
||||||
shiftKey: false,
|
shiftKey: false,
|
||||||
which: 54
|
which: 54
|
||||||
},
|
},
|
||||||
// Ctrl+Q 关闭当前编辑器
|
|
||||||
closeCurEditor: {
|
|
||||||
ctrlKey: true,
|
|
||||||
altKey: false,
|
|
||||||
shiftKey: false,
|
|
||||||
which: 81
|
|
||||||
},
|
|
||||||
// Ctrl+D 窗口组切换
|
// Ctrl+D 窗口组切换
|
||||||
changeEditor: {
|
changeEditor: {
|
||||||
ctrlKey: true,
|
ctrlKey: true,
|
||||||
|
@ -49,6 +42,20 @@ var hotkeys = {
|
||||||
shiftKey: false,
|
shiftKey: false,
|
||||||
which: 68
|
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 构建并运行
|
// F6 构建并运行
|
||||||
buildRun: {
|
buildRun: {
|
||||||
ctrlKey: false,
|
ctrlKey: false,
|
||||||
|
@ -61,6 +68,13 @@ var hotkeys = {
|
||||||
$("#files").keydown(function (event) {
|
$("#files").keydown(function (event) {
|
||||||
event.preventDefault();
|
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) {
|
switch (event.which) {
|
||||||
case 46: // 删除
|
case 46: // 删除
|
||||||
tree.removeIt();
|
tree.removeIt();
|
||||||
|
|
|
@ -209,6 +209,45 @@ var wide = {
|
||||||
wide.curEditor.focus();
|
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 () {
|
_initLayout: function () {
|
||||||
var mainH = $(window).height() - $(".menu").height() - $(".footer").height() - 1,
|
var mainH = $(window).height() - $(".menu").height() - $(".footer").height() - 1,
|
||||||
|
|
|
@ -195,6 +195,10 @@
|
||||||
<div id="dialogGoLinePrompt" class="dialog-prompt fn-none">
|
<div id="dialogGoLinePrompt" class="dialog-prompt fn-none">
|
||||||
<input/><span class="tip"></span>
|
<input/><span class="tip"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="dialogSearchForm" class="dialog-prompt fn-none">
|
||||||
|
<input/>
|
||||||
|
<input/>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var config = {
|
var config = {
|
||||||
"latestSessionContent": {{.latestSessionContent}},
|
"latestSessionContent": {{.latestSessionContent}},
|
||||||
|
|
Loading…
Reference in New Issue