This commit is contained in:
Liang Ding 2014-12-30 16:51:19 +08:00
parent 8d0ae1d7d1
commit 3de0437227
9 changed files with 52 additions and 7 deletions

View File

@ -49,7 +49,9 @@ func GetOutline(w http.ResponseWriter, r *http.Request) {
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, "", code, 0)
if err != nil {
panic(err)
data["succ"] = false
return
}
//ast.Print(fset, f)

View File

@ -161,5 +161,6 @@
"change_avatar": "Avatar modify go",
"open": "Open",
"pricing": "Pricing",
"search_no_match": "No matching files were found."
"search_no_match": "No matching files were found.",
"outline": "Outline"
}

View File

@ -161,5 +161,6 @@
"change_avatar": "アバターの変更は行く",
"open": "オープン",
"pricing": "价格",
"search_no_match": "一致するファイルが見つかりませんでした。"
"search_no_match": "一致するファイルが見つかりませんでした。",
"outline": "アウトライン"
}

View File

@ -161,5 +161,6 @@
"change_avatar": "头像修改请到",
"open": "打开",
"pricing": "价格",
"search_no_match": "没有发现匹配的文件。"
"search_no_match": "没有发现匹配的文件。",
"outline": "大纲"
}

View File

@ -161,5 +161,6 @@
"change_avatar": "頭像修改請到",
"open": "打開",
"pricing": "價格",
"search_no_match": "沒有發現匹配的文件。"
"search_no_match": "沒有發現匹配的文件。",
"outline": "大綱"
}

View File

@ -646,7 +646,7 @@ var editors = {
+ data[i].line + '" data-ch="' + data[i].ch + '"> (' + data[i].line + ':'
+ data[i].ch + ')</i></span></li>';
}
if (data.length === 0) {
searcHTML += '<li>' + config.label.search_no_match + '</li>';
}

View File

@ -51,12 +51,17 @@ var hotkeys = {
$("#files").focus();
}
},
// Ctrl-2
goOutline: {
ctrlKey: true,
altKey: false,
shiftKey: false,
which: 50,
fun: function () {
if (!wide.curEditor) {
return;
}
var request = newWideRequest();
request.code = wide.curEditor.getValue();

View File

@ -512,7 +512,6 @@ var wide = {
request.file = path;
request.code = editor.getValue();
request.nextCmd = ""; // build only, no following operation
$.ajax({
type: 'POST',
url: config.context + '/build',
@ -524,6 +523,24 @@ var wide = {
success: function (data) {
}
});
// refresh outline
var request = newWideRequest();
request.code = wide.curEditor.getValue();
$.ajax({
type: 'POST',
url: config.context + '/outline',
data: JSON.stringify(request),
dataType: "json",
success: function (data) {
if (!data.succ) {
return;
}
$("#outline").html(JSON.stringify(data));
}
});
return;
}

View File

@ -462,6 +462,23 @@
<div class="tabs"></div>
<div class="tabs-panel"></div>
</div>
<!--
TODO: https://github.com/b3log/wide/issues/199
<div style="height: 70%;position: absolute;right: 0;background-color: #FFF;width: 20%;">
<span title="{{.i18n.min}}" class="font-ico ico-min"></span>
<div class="tabs">
<div class="current">
<span title="{{.i18n.outline}}">{{.i18n.outline}}</span>
</div>
</div>
<div class="tabs-panel">
<div id="outline">
this is outline
</div>
</div>
</div>
-->
<div class="bottom-window-group">
<span title="{{.i18n.min}}" class="font-ico ico-min"></span>