This commit is contained in:
parent
4b7fee14f4
commit
7d24c3adfa
|
@ -168,6 +168,11 @@ func NewFile(w http.ResponseWriter, r *http.Request) {
|
||||||
fileType := args["fileType"].(string)
|
fileType := args["fileType"].(string)
|
||||||
|
|
||||||
if !createFile(path, fileType) {
|
if !createFile(path, fileType) {
|
||||||
|
if "f" == fileType {
|
||||||
|
extension := filepath.Ext(path)
|
||||||
|
data["mode"] = getEditorMode(extension)
|
||||||
|
|
||||||
|
}
|
||||||
data["succ"] = false
|
data["succ"] = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
"goinstall": "go install",
|
"goinstall": "go install",
|
||||||
"build_n_run": "构建 & 运行",
|
"build_n_run": "构建 & 运行",
|
||||||
"full_screen": "全屏",
|
"full_screen": "全屏",
|
||||||
|
"unread_notification": "未读通知",
|
||||||
"notification_2": "没有检查到 gocode,这将会导致 [自动完成] 失效",
|
"notification_2": "没有检查到 gocode,这将会导致 [自动完成] 失效",
|
||||||
"notification_3": "没有检查到 ide_stub,这将会导致 [跳转到声明]、[查找使用] 失效"
|
"notification_3": "没有检查到 ide_stub,这将会导致 [跳转到声明]、[查找使用] 失效"
|
||||||
}
|
}
|
|
@ -77,9 +77,6 @@ func WSHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
session.NotificationWS[sid] = &wsChan
|
session.NotificationWS[sid] = &wsChan
|
||||||
|
|
||||||
ret := map[string]interface{}{"output": "Notification initialized", "cmd": "init-notification"}
|
|
||||||
wsChan.Conn.WriteJSON(&ret)
|
|
||||||
|
|
||||||
glog.V(4).Infof("Open a new [Notification] with session [%s], %d", sid, len(session.NotificationWS))
|
glog.V(4).Infof("Open a new [Notification] with session [%s], %d", sid, len(session.NotificationWS))
|
||||||
|
|
||||||
// 添加用户事件处理器
|
// 添加用户事件处理器
|
||||||
|
@ -100,14 +97,5 @@ func WSHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
glog.Error("Notification WS ERROR: " + err.Error())
|
glog.Error("Notification WS ERROR: " + err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = map[string]interface{}{"output": "", "cmd": "notification-output"}
|
|
||||||
|
|
||||||
if err := wsChan.Conn.WriteJSON(&ret); err != nil {
|
|
||||||
glog.Error("Notification WS ERROR: " + err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
wsChan.Time = time.Now()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,7 +234,7 @@ ul {
|
||||||
}
|
}
|
||||||
/* end editor */
|
/* end editor */
|
||||||
|
|
||||||
/* start output */
|
/* start bottom-window-group */
|
||||||
.bottom-window-group .tabs {
|
.bottom-window-group .tabs {
|
||||||
background-color: #CAD3E3;
|
background-color: #CAD3E3;
|
||||||
border-top: 1px solid #8E97A7;
|
border-top: 1px solid #8E97A7;
|
||||||
|
@ -245,13 +245,39 @@ ul {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bottom-window-group .tabs-panel {
|
||||||
|
height: 133px;
|
||||||
|
}
|
||||||
|
|
||||||
.bottom-window-group textarea {
|
.bottom-window-group textarea {
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
color: #555555;
|
color: #555555;
|
||||||
height: 130px;
|
height: 130px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
/* end output */
|
|
||||||
|
.bottom-window-group .notification,
|
||||||
|
.bottom-window-group .search,
|
||||||
|
.bottom-window-group .output {
|
||||||
|
height: 133px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-window-group .notification > table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-window-group .notification td {
|
||||||
|
border-bottom: 1px solid #DDD;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-window-group .notification .type,
|
||||||
|
.bottom-window-group .notification .severity {
|
||||||
|
width: 50px;
|
||||||
|
padding: 0 5px;
|
||||||
|
}
|
||||||
|
/* end bottom-window-group */
|
||||||
|
|
||||||
/* start footer */
|
/* start footer */
|
||||||
.notification-count {
|
.notification-count {
|
||||||
|
|
|
@ -267,6 +267,9 @@ var editors = {
|
||||||
"Ctrl-S": function () {
|
"Ctrl-S": function () {
|
||||||
wide.saveFile();
|
wide.saveFile();
|
||||||
},
|
},
|
||||||
|
"Shift-Ctrl-S": function () {
|
||||||
|
wide.saveAllFiles();
|
||||||
|
},
|
||||||
"Shift-Alt-F": function () {
|
"Shift-Alt-F": function () {
|
||||||
wide.fmt();
|
wide.fmt();
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,12 +16,16 @@ var notification = {
|
||||||
};
|
};
|
||||||
|
|
||||||
notificationWS.onmessage = function (e) {
|
notificationWS.onmessage = function (e) {
|
||||||
var data = JSON.parse(e.data);
|
var data = JSON.parse(e.data),
|
||||||
if ('init-notification' !== data.cmd) {
|
$notification = $('.bottom-window-group .notification > table'),
|
||||||
|
notificationHTML = '';
|
||||||
|
|
||||||
|
notificationHTML += '<tr><td class="severity">' + data.severity
|
||||||
|
+ '</td><td class="message">' + data.message
|
||||||
|
+ '</td><td class="type">' + data.type + '</td></tr>';
|
||||||
|
$notification.append(notificationHTML);
|
||||||
|
|
||||||
$(".notification-count").show();
|
$(".notification-count").show();
|
||||||
$('.bottom-window-group .notification').text(
|
|
||||||
$('.bottom-window-group .notification').text() + data.output);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
notificationWS.onclose = function (e) {
|
notificationWS.onclose = function (e) {
|
||||||
|
|
|
@ -121,7 +121,8 @@ var tree = {
|
||||||
tree.fileTree.addNodes(wide.curNode, [{
|
tree.fileTree.addNodes(wide.curNode, [{
|
||||||
"name": name,
|
"name": name,
|
||||||
"iconSkin": iconSkin,
|
"iconSkin": iconSkin,
|
||||||
"path": request.path
|
"path": request.path,
|
||||||
|
"mode": data.mode
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -102,7 +102,7 @@ var wide = {
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
saveFile: function() {
|
_save: function () {
|
||||||
var request = newWideRequest();
|
var request = newWideRequest();
|
||||||
request.file = $(".edit-header .current span:eq(0)").attr("title");
|
request.file = $(".edit-header .current span:eq(0)").attr("title");
|
||||||
request.code = wide.curEditor.getValue();
|
request.code = wide.curEditor.getValue();
|
||||||
|
@ -116,8 +116,13 @@ var wide = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
saveFile: function () {
|
||||||
|
// 格式化后会对文件进行保存
|
||||||
|
this.fmt();
|
||||||
|
},
|
||||||
saveAllFiles: function () {
|
saveAllFiles: function () {
|
||||||
// TODO: save all files
|
// TODO: save all files
|
||||||
|
console.log("TODO: ssave all files");
|
||||||
},
|
},
|
||||||
closeFile: function () {
|
closeFile: function () {
|
||||||
// TODO: close file
|
// TODO: close file
|
||||||
|
@ -192,7 +197,7 @@ var wide = {
|
||||||
request.cursorCh = wide.curEditor.getCursor().ch;
|
request.cursorCh = wide.curEditor.getCursor().ch;
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case "text/x-go":
|
case "text/x-go": // 会保存文件
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/go/fmt',
|
url: '/go/fmt',
|
||||||
|
@ -206,7 +211,7 @@ var wide = {
|
||||||
});
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "text/html":
|
case "text/html": // 会保存文件
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/html/fmt',
|
url: '/html/fmt',
|
||||||
|
@ -226,7 +231,7 @@ var wide = {
|
||||||
var json = JSON.parse(wide.curEditor.getValue());
|
var json = JSON.parse(wide.curEditor.getValue());
|
||||||
wide.curEditor.setValue(JSON.stringify(json, "", " "));
|
wide.curEditor.setValue(JSON.stringify(json, "", " "));
|
||||||
|
|
||||||
this.save();
|
wide._save();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
delete e;
|
delete e;
|
||||||
}
|
}
|
||||||
|
@ -234,6 +239,8 @@ var wide = {
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
// TODO: XML 格式化处理
|
// TODO: XML 格式化处理
|
||||||
|
// 所有文件格式化后都需要进行保存
|
||||||
|
wide._save();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@
|
||||||
<div class="search" tabindex="-1"></div>
|
<div class="search" tabindex="-1"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="fn-none" data-index="notification">
|
<div class="fn-none" data-index="notification">
|
||||||
<textarea class="notification"></textarea>
|
<div tabindex="-1" class="notification"><table cellpadding="0" cellspacing="0"></table></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -163,7 +163,7 @@
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<span>|</span>
|
<span>|</span>
|
||||||
<span id="footer-cursor" style="float: right;"></span>
|
<span id="footer-cursor" style="float: right;"></span>
|
||||||
<span class="notification-count" title="you have unread notification">N</span>
|
<span class="notification-count" title="{{.i18n.unread_notification}}">Noty</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
Loading…
Reference in New Issue