Ctrl+I
This commit is contained in:
parent
cac2e23db4
commit
3b7413a680
|
@ -15,9 +15,21 @@
|
|||
"Password": "admin",
|
||||
"Workspace": "{pwd}/data/user_workspaces/admin",
|
||||
"LatestSessionContent": {
|
||||
"FileTree": [],
|
||||
"Files": [],
|
||||
"CurrentFile": ""
|
||||
"FileTree": [
|
||||
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -192,6 +192,30 @@
|
|||
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 {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==);
|
||||
background-position: bottom;
|
||||
|
|
|
@ -107,6 +107,7 @@ var editors = {
|
|||
for (var i = 0; i < autocompleteArray.length; i++) {
|
||||
var displayText = '';
|
||||
|
||||
// TODO: 图标
|
||||
switch (autocompleteArray[i].class) {
|
||||
case "type":
|
||||
case "const":
|
||||
|
@ -125,13 +126,11 @@ var editors = {
|
|||
break;
|
||||
default:
|
||||
console.warn("Can't handle autocomplete [" + autocompleteArray[i].class + "]");
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
autocompleteHints[i] = {
|
||||
// TODO: 添加类型、图标
|
||||
|
||||
displayText: displayText,
|
||||
text: autocompleteArray[i].name
|
||||
};
|
||||
|
@ -164,7 +163,7 @@ var editors = {
|
|||
// 用于覆盖 cm 默认绑定的某些快捷键功能.
|
||||
CodeMirror.commands.doNothing = function (cm) {
|
||||
};
|
||||
|
||||
|
||||
CodeMirror.commands.exprInfo = function (cm) {
|
||||
var cur = wide.curEditor.getCursor();
|
||||
|
||||
|
@ -180,12 +179,13 @@ var editors = {
|
|||
data: JSON.stringify(request),
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
// TODO: V
|
||||
console.log(data);
|
||||
|
||||
if (!data.succ) {
|
||||
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) {
|
||||
$(".edit-exprinfo").remove();
|
||||
var cursor = cm.getCursor();
|
||||
|
||||
$(".footer .cursor").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |');
|
||||
|
@ -341,9 +342,13 @@ var editors = {
|
|||
windows.clearFloat();
|
||||
});
|
||||
|
||||
editor.on('blur', function (cm) {
|
||||
$(".edit-exprinfo").remove();
|
||||
});
|
||||
|
||||
editor.setSize('100%', $(".edit-panel").height() - $(".edit-panel .tabs").height());
|
||||
editor.setValue(data.content);
|
||||
editor.setOption("mode", data.mode);
|
||||
editor.setOption("mode", data.mode);
|
||||
editor.setOption("gutters", ["CodeMirror-lint-markers", "CodeMirror-foldgutter"]);
|
||||
|
||||
if ("text/x-go" === data.mode || "application/json" === data.mode) {
|
||||
|
@ -353,7 +358,7 @@ var editors = {
|
|||
if ("application/xml" === data.mode || "text/html" === data.mode) {
|
||||
editor.setOption("autoCloseTags", true);
|
||||
}
|
||||
|
||||
|
||||
editor.setCursor(cursor);
|
||||
|
||||
wide.curEditor = editor;
|
||||
|
|
Loading…
Reference in New Issue