This commit is contained in:
Van 2014-10-10 18:04:03 +08:00
parent cac2e23db4
commit 3b7413a680
3 changed files with 53 additions and 12 deletions

View File

@ -15,9 +15,21 @@
"Password": "admin", "Password": "admin",
"Workspace": "{pwd}/data/user_workspaces/admin", "Workspace": "{pwd}/data/user_workspaces/admin",
"LatestSessionContent": { "LatestSessionContent": {
"FileTree": [], "FileTree": [
"Files": [], "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest",
"CurrentFile": "" "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello",
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time",
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\pkg",
"D:\\go\\src\\pkg",
"D:\\go\\src\\pkg\\archive",
"D:\\go\\src\\pkg\\archive\\tar",
"D:\\go\\src\\pkg\\archive\\tar\\testdata"
],
"Files": [
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\main.go",
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\main.go"
],
"CurrentFile": "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\main.go"
} }
} }
] ]

View File

@ -192,6 +192,30 @@
width: 16px; width: 16px;
} }
/* 统一为 static/js/lib/codemirror-4.5/addon/hint/show-hint.css 中的.CodeMirror-hints */
.edit-exprinfo {
position: absolute;
z-index: 10;
overflow: hidden;
list-style: none;
margin: 0;
padding: 2px;
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
border-radius: 3px;
border: 1px solid silver;
background: white;
font-size: 90%;
font-family: monospace;
max-height: 20em;
overflow-y: auto;
}
.CodeMirror-focused .cm-matchhighlight { .CodeMirror-focused .cm-matchhighlight {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==); background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==);
background-position: bottom; background-position: bottom;

View File

@ -107,6 +107,7 @@ var editors = {
for (var i = 0; i < autocompleteArray.length; i++) { for (var i = 0; i < autocompleteArray.length; i++) {
var displayText = ''; var displayText = '';
// TODO: 图标
switch (autocompleteArray[i].class) { switch (autocompleteArray[i].class) {
case "type": case "type":
case "const": case "const":
@ -130,8 +131,6 @@ var editors = {
} }
autocompleteHints[i] = { autocompleteHints[i] = {
// TODO: 添加类型、图标
displayText: displayText, displayText: displayText,
text: autocompleteArray[i].name text: autocompleteArray[i].name
}; };
@ -180,12 +179,13 @@ var editors = {
data: JSON.stringify(request), data: JSON.stringify(request),
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
// TODO: V
console.log(data);
if (!data.succ) { if (!data.succ) {
return; return;
} }
var position = wide.curEditor.cursorCoords();
$("body").append('<div style="top:'
+ (position.top + 15) + 'px;left:' + position.left
+ 'px" class="edit-exprinfo">' + data.info + '</div>');
} }
}); });
}; };
@ -331,6 +331,7 @@ var editors = {
}); });
editor.on('cursorActivity', function (cm) { editor.on('cursorActivity', function (cm) {
$(".edit-exprinfo").remove();
var cursor = cm.getCursor(); var cursor = cm.getCursor();
$(".footer .cursor").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |'); $(".footer .cursor").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |');
@ -341,6 +342,10 @@ var editors = {
windows.clearFloat(); windows.clearFloat();
}); });
editor.on('blur', function (cm) {
$(".edit-exprinfo").remove();
});
editor.setSize('100%', $(".edit-panel").height() - $(".edit-panel .tabs").height()); editor.setSize('100%', $(".edit-panel").height() - $(".edit-panel .tabs").height());
editor.setValue(data.content); editor.setValue(data.content);
editor.setOption("mode", data.mode); editor.setOption("mode", data.mode);