This commit is contained in:
parent
d791044f24
commit
562c8ba1e9
|
@ -28,6 +28,7 @@
|
|||
"goget": "go get",
|
||||
"goinstall": "go install",
|
||||
"build_n_run": "构建 & 运行",
|
||||
"editor": "编辑器",
|
||||
"max_editor": "编辑器窗口最大化",
|
||||
"restore_editor": "编辑器窗口还原",
|
||||
"unread_notification": "未读通知",
|
||||
|
@ -48,9 +49,10 @@
|
|||
"restore_bottom": "底部窗口还原",
|
||||
"file_format": "文件后缀",
|
||||
"keyword": "关键字",
|
||||
"initialise": "初始化",
|
||||
"start_page": "起始页",
|
||||
"user_guide": "用户指南",
|
||||
"dev_guide": "开发指南",
|
||||
"keyboard_shortcuts": "键盘快捷键",
|
||||
"ver": "版本",
|
||||
"current_ver": "当前版本",
|
||||
"dev_team": "开发团队",
|
||||
|
@ -60,5 +62,27 @@
|
|||
"workspace": "工作空间",
|
||||
"project_address": "项目地址",
|
||||
"community": "社区",
|
||||
"autocomplete": "自动补全",
|
||||
"jump_to_decl": "跳转到声明",
|
||||
"show_expr_info": "查看表达式信息",
|
||||
"find_usages": "查找使用",
|
||||
"format": "格式化",
|
||||
"goto_line": "跳转到行",
|
||||
"delete_line": "删除当前行",
|
||||
"save_editor_file": "保存当前编辑器文件",
|
||||
"close_editor": "关闭当前编辑器",
|
||||
"full_screen": "编辑器全屏",
|
||||
"auto_indent": "自动缩进",
|
||||
"indent": "缩进",
|
||||
"unindent": "反缩进",
|
||||
"focus": "焦点",
|
||||
"switch_tab": "切换编辑器/窗口组 tab",
|
||||
"focus_editor": "焦点切换到编辑器",
|
||||
"focus_file_tree": "焦点切换到文件树",
|
||||
"focus_output": "焦点切换到输出窗口",
|
||||
"focus_search": "焦点切换到搜索窗口",
|
||||
"focus_notification": "焦点切换到通知窗口",
|
||||
"build_run": "构建并运行",
|
||||
|
||||
"colon": ":"
|
||||
}
|
||||
|
|
19
main.go
19
main.go
|
@ -203,6 +203,24 @@ func startHandler(w http.ResponseWriter, r *http.Request) {
|
|||
t.Execute(w, model)
|
||||
}
|
||||
|
||||
// 键盘快捷键页请求处理.
|
||||
func keyboardShortcutsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
i18n.Load()
|
||||
|
||||
model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(r), "locale": i18n.GetLocale(r)}
|
||||
|
||||
t, err := template.ParseFiles("view/keyboard_shortcuts.html")
|
||||
|
||||
if nil != err {
|
||||
glog.Error(err)
|
||||
http.Error(w, err.Error(), 500)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
t.Execute(w, model)
|
||||
}
|
||||
|
||||
// 关于页请求处理.
|
||||
func aboutHandler(w http.ResponseWriter, r *http.Request) {
|
||||
i18n.Load()
|
||||
|
@ -234,6 +252,7 @@ func main() {
|
|||
http.HandleFunc("/", handlerWrapper(indexHandler))
|
||||
http.HandleFunc("/start", handlerWrapper(startHandler))
|
||||
http.HandleFunc("/about", handlerWrapper(aboutHandler))
|
||||
http.HandleFunc("/keyboard_shortcuts", handlerWrapper(keyboardShortcutsHandler))
|
||||
|
||||
// 静态资源
|
||||
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
|
||||
|
|
|
@ -102,7 +102,7 @@ var editors = {
|
|||
|
||||
editors.tabs.add({
|
||||
id: "startPage",
|
||||
title: '<span title="' + config.label.initialise + '">' + config.label.initialise + '</span>',
|
||||
title: '<span title="' + config.label.start_page + '">' + config.label.start_page + '</span>',
|
||||
content: '<div id="startPage"></div>',
|
||||
after: function () {
|
||||
$("#startPage").load('/start');
|
||||
|
@ -149,7 +149,7 @@ var editors = {
|
|||
},
|
||||
getCurrentPath: function () {
|
||||
var currentPath = $(".edit-panel .tabs .current span:eq(0)").attr("title");
|
||||
if (currentPath === config.label.initialise) {
|
||||
if (currentPath === config.label.start_page) {
|
||||
currentPath = null;
|
||||
}
|
||||
return currentPath;
|
||||
|
|
|
@ -12,7 +12,7 @@ var session = {
|
|||
|
||||
editors.tabs.obj._$tabs.find("div").each(function () {
|
||||
var $it = $(this);
|
||||
if ($it.find("span:eq(0)").attr("title") !== config.label.initialise) {
|
||||
if ($it.find("span:eq(0)").attr("title") !== config.label.start_page) {
|
||||
filse.push($it.find("span:eq(0)").attr("title"));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
var Tabs = function (obj) {
|
||||
obj._$tabsPanel = $(obj.id + " > .tabs-panel");
|
||||
obj._$tabs = $(obj.id + " > .tabs");
|
||||
obj._stack = [];
|
||||
|
||||
this.obj = obj;
|
||||
|
||||
|
@ -47,21 +48,19 @@ $.extend(Tabs.prototype, {
|
|||
var $tabsPanel = this.obj._$tabsPanel,
|
||||
$tabs = this.obj._$tabs;
|
||||
|
||||
this.obj._prevId = $tabs.children("div.current").data("index");
|
||||
|
||||
$tabs.children("div").removeClass("current");
|
||||
$tabsPanel.children("div").hide();
|
||||
|
||||
$tabs.append('<div class="current" data-index="' + data.id + '">'
|
||||
+ data.title + '<span class="ico-close font-ico"></span></div>');
|
||||
$tabsPanel.append('<div data-index="' + data.id + '">' + data.content
|
||||
+ '</div>');
|
||||
|
||||
this.setCurrent(data.id);
|
||||
|
||||
if (typeof data.after === 'function') {
|
||||
data.after();
|
||||
}
|
||||
},
|
||||
del: function (id) {
|
||||
// TODO:
|
||||
var $tabsPanel = this.obj._$tabsPanel,
|
||||
$tabs = this.obj._$tabs,
|
||||
prevId = undefined,
|
||||
|
@ -99,7 +98,11 @@ $.extend(Tabs.prototype, {
|
|||
return false;
|
||||
}
|
||||
|
||||
this.obj._prevId = $currentTab.data("index");
|
||||
if (this.obj._stack.length === 1024) {
|
||||
this.obj._stack.splice(1023, 1);
|
||||
} else {
|
||||
this.obj._stack.push(id);
|
||||
}
|
||||
|
||||
$tabs.children("div").removeClass("current");
|
||||
$tabsPanel.children("div").hide();
|
||||
|
|
|
@ -80,8 +80,12 @@
|
|||
{{.i18n.report_issues}}
|
||||
</li>
|
||||
<li class="hr"></li>
|
||||
<li onclick="window.open('/keyboard_shortcuts')">
|
||||
{{.i18n.keyboard_shortcuts}}
|
||||
</li>
|
||||
<li class="hr"></li>
|
||||
<li onclick="editors.openStartPage()">
|
||||
<span>{{.i18n.start_page}}</span>
|
||||
<span>{{.i18n.start_page}}</span>
|
||||
</li>
|
||||
<li onclick="wide.openAbout()">
|
||||
<span>{{.i18n.about}}</span>
|
||||
|
@ -216,7 +220,7 @@
|
|||
"usages": "{{.i18n.usages}}",
|
||||
"search_text": "{{.i18n.search_text}}",
|
||||
"search": "{{.i18n.search}}",
|
||||
"initialise": "{{.i18n.initialise}}",
|
||||
"start_page": "{{.i18n.start_page}}",
|
||||
"confirm_save": "{{.i18n.confirm_save}}",
|
||||
"community": "{{.i18n.community}}"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{.i18n.wide}} - {{.i18n.keyboard_shortcuts}}</title>
|
||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||
</head>
|
||||
<body>
|
||||
<h2>{{.i18n.editor}}</h2>
|
||||
<ul>
|
||||
<li>Ctrl+\{{.i18n.colon}}{{.i18n.autocomplete}}</li>
|
||||
<li>Ctrl+B{{.i18n.colon}}{{.i18n.jump_to_decl}}</li>
|
||||
<li>Ctrl+I{{.i18n.colon}}{{.i18n.show_expr_info}}</li>
|
||||
<li>Alt+F7{{.i18n.colon}}{{.i18n.find_usages}}</li>
|
||||
<li>Alt+Shift+F{{.i18n.colon}}{{.i18n.format}}</li>
|
||||
<li>Ctrl+G{{.i18n.colon}}{{.i18n.goto_line}}</li>
|
||||
<li>Ctrl+E{{.i18n.colon}}{{.i18n.delete_line}}</li>
|
||||
<li>Ctrl+S{{.i18n.colon}}{{.i18n.save_editor_file}}</li>
|
||||
<li>Ctrl+Q{{.i18n.colon}}{{.i18n.close_editor}}</li>
|
||||
<li>F11{{.i18n.colon}}{{.i18n.full_screen}}</li>
|
||||
<li>Shift+Tab{{.i18n.colon}}{{.i18n.auto_indent}}</li>
|
||||
<li>Ctrl+]{{.i18n.colon}}{{.i18n.indent}}</li>
|
||||
<li>Ctrl+[{{.i18n.colon}}{{.i18n.unindent}}</li>
|
||||
</ul>
|
||||
<h2>{{.i18n.focus}}</h2>
|
||||
<ul>
|
||||
<li>Ctrl+D{{.i18n.colon}}{{.i18n.switch_tab}}</li>
|
||||
<li>Ctrl+0{{.i18n.colon}}{{.i18n.focus_editor}}</li>
|
||||
<li>Ctrl+1{{.i18n.colon}}{{.i18n.focus_file_tree}}</li>
|
||||
<li>Ctrl+4{{.i18n.colon}}{{.i18n.focus_output}}</li>
|
||||
<li>Ctrl+5{{.i18n.colon}}{{.i18n.focus_search}}</li>
|
||||
<li>Ctrl+6{{.i18n.colon}}{{.i18n.focus_notification}}</li>
|
||||
</ul>
|
||||
<h2>{{.i18n.run}}</h2>
|
||||
<ul>
|
||||
<li>F6{{.i18n.colon}}{{.i18n.build_run}}</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue