Ctrl+D, Ctrl+Q,notification
This commit is contained in:
parent
892a2aa48c
commit
640f5165ba
|
@ -0,0 +1 @@
|
||||||
|
111111111111111111111111111
|
|
@ -0,0 +1 @@
|
||||||
|
222222222222222222222
|
|
@ -252,3 +252,11 @@ ul {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
/* end output */
|
/* end output */
|
||||||
|
|
||||||
|
/* start footer */
|
||||||
|
.notification-count {
|
||||||
|
float: right;
|
||||||
|
display: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
/* end footer */
|
||||||
|
|
|
@ -35,6 +35,20 @@ var hotkeys = {
|
||||||
shiftKey: false,
|
shiftKey: false,
|
||||||
which: 54
|
which: 54
|
||||||
},
|
},
|
||||||
|
// Ctrl+Q 关闭当前编辑器
|
||||||
|
closeCurEditor: {
|
||||||
|
ctrlKey: true,
|
||||||
|
altKey: false,
|
||||||
|
shiftKey: false,
|
||||||
|
which: 81
|
||||||
|
},
|
||||||
|
// Ctrl+D 窗口组切换
|
||||||
|
changeEditor: {
|
||||||
|
ctrlKey: true,
|
||||||
|
altKey: false,
|
||||||
|
shiftKey: false,
|
||||||
|
which: 68
|
||||||
|
},
|
||||||
// F6 构建并运行
|
// F6 构建并运行
|
||||||
buildRun: {
|
buildRun: {
|
||||||
ctrlKey: false,
|
ctrlKey: false,
|
||||||
|
@ -206,6 +220,69 @@ var hotkeys = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.ctrlKey === hotKeys.closeCurEditor.ctrlKey
|
||||||
|
&& event.which === hotKeys.closeCurEditor.which) { // Ctrl+Q 关闭当前编辑器
|
||||||
|
if (editors.tabs.getCurrentId()) {
|
||||||
|
editors.tabs.del(editors.tabs.getCurrentId());
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.ctrlKey === hotKeys.changeEditor.ctrlKey
|
||||||
|
&& event.which === hotKeys.changeEditor.which) { // Ctrl+D 窗口组切换
|
||||||
|
if (document.activeElement.className === "notification"
|
||||||
|
|| document.activeElement.className === "output"
|
||||||
|
|| document.activeElement.className === "search") {
|
||||||
|
// 焦点在底部窗口组时,对底部进行切换
|
||||||
|
var tabs = ["output", "search", "notification"],
|
||||||
|
nextId = "";
|
||||||
|
for (var i = 0, ii = tabs.length; i < ii; i++) {
|
||||||
|
if (document.activeElement.className === tabs[i]) {
|
||||||
|
if (i < ii - 1) {
|
||||||
|
nextId = tabs[i + 1];
|
||||||
|
} else {
|
||||||
|
nextId = tabs[0];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wide.bottomWindowTab.setCurrent(nextId);
|
||||||
|
$(".bottom-window-group ." + nextId).focus();
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (editors.data.length > 1) {
|
||||||
|
var nextId = "";
|
||||||
|
for (var i = 0, ii = editors.data.length; i < ii; i++) {
|
||||||
|
if (editors.tabs.getCurrentId() === editors.data[i].id) {
|
||||||
|
if (i < ii - 1) {
|
||||||
|
nextId = editors.data[i + 1].id;
|
||||||
|
wide.curEditor = editors.data[i + 1].editor;
|
||||||
|
} else {
|
||||||
|
nextId = editors.data[0].id;
|
||||||
|
wide.curEditor = editors.data[0].editor;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
editors.tabs.setCurrent(nextId);
|
||||||
|
wide.curNode = tree.fileTree.getNodeByTId(nextId);
|
||||||
|
tree.fileTree.selectNode(wide.curNode);
|
||||||
|
|
||||||
|
wide.curEditor.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.which === hotKeys.buildRun.which) { // F6 构建并运行
|
if (event.which === hotKeys.buildRun.which) { // F6 构建并运行
|
||||||
wide.run();
|
wide.run();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
@ -1,28 +1,36 @@
|
||||||
var notificationWS = new WebSocket(config.channel.shell + '/notification/ws?sid=' + config.wideSessionId);
|
|
||||||
notificationWS.onopen = function() {
|
|
||||||
console.log('[notification onopen] connected');
|
|
||||||
};
|
|
||||||
notificationWS.onmessage = function(e) {
|
|
||||||
console.log('[notification onmessage]' + e.data);
|
|
||||||
var data = JSON.parse(e.data);
|
|
||||||
if ('init-notification' !== data.cmd) {
|
|
||||||
$('.bottom-window-group .notification').val(data.output);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
notificationWS.onclose = function(e) {
|
|
||||||
console.log('[notification onclose] disconnected (' + e.code + ')');
|
|
||||||
delete notificationWS;
|
|
||||||
};
|
|
||||||
notificationWS.onerror = function(e) {
|
|
||||||
console.log('[notification onerror] ' + e);
|
|
||||||
};
|
|
||||||
|
|
||||||
var notification = {
|
var notification = {
|
||||||
init: function() {
|
init: function() {
|
||||||
|
$(".notification-count").click(function() {
|
||||||
|
wide.bottomWindowTab.setCurrent("notification");
|
||||||
|
$(".bottom-window-group .notification").focus();
|
||||||
|
$(this).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
this._initWS();
|
||||||
|
},
|
||||||
|
_initWS: function() {
|
||||||
|
var notificationWS = new WebSocket(config.channel.shell + '/notification/ws?sid=' + config.wideSessionId);
|
||||||
|
|
||||||
|
notificationWS.onopen = function() {
|
||||||
|
console.log('[notification onopen] connected');
|
||||||
|
};
|
||||||
|
|
||||||
|
notificationWS.onmessage = function(e) {
|
||||||
|
var data = JSON.parse(e.data);
|
||||||
|
if ('init-notification' !== data.cmd) {
|
||||||
|
$(".notification-count").show();
|
||||||
|
$('.bottom-window-group .notification').text(
|
||||||
|
$('.bottom-window-group .notification').text() + data.output);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
notificationWS.onclose = function(e) {
|
||||||
|
console.log('[notification onclose] disconnected (' + e.code + ')');
|
||||||
|
delete notificationWS;
|
||||||
|
};
|
||||||
|
|
||||||
|
notificationWS.onerror = function(e) {
|
||||||
|
console.log('[notification onerror] ' + e);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
notification.init();
|
|
||||||
});
|
|
|
@ -14,7 +14,9 @@ $.extend(Tabs.prototype, {
|
||||||
obj._$tabs.on("click", "div", function(event) {
|
obj._$tabs.on("click", "div", function(event) {
|
||||||
var id = $(this).data("index");
|
var id = $(this).data("index");
|
||||||
_that.setCurrent(id);
|
_that.setCurrent(id);
|
||||||
obj.clickAfter(id);
|
if (typeof (obj.clickAfter) === "function") {
|
||||||
|
obj.clickAfter(id);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
obj._$tabs.on("click", ".ico-close", function(event) {
|
obj._$tabs.on("click", ".ico-close", function(event) {
|
||||||
|
|
|
@ -252,6 +252,7 @@ var tree = {
|
||||||
editors.tabs.setCurrent(treeNode.tId);
|
editors.tabs.setCurrent(treeNode.tId);
|
||||||
wide.curNode = treeNode;
|
wide.curNode = treeNode;
|
||||||
wide.curEditor = editors.data[i].editor;
|
wide.curEditor = editors.data[i].editor;
|
||||||
|
wide.curEditor.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,10 @@ var wide = {
|
||||||
},
|
},
|
||||||
_initBottomWindowGroup: function() {
|
_initBottomWindowGroup: function() {
|
||||||
this.bottomWindowTab = new Tabs({
|
this.bottomWindowTab = new Tabs({
|
||||||
id: ".bottom-window-group"
|
id: ".bottom-window-group",
|
||||||
|
clickAfter: function(id) {
|
||||||
|
this._$tabsPanel.find("." + id).focus();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
init: function() {
|
init: function() {
|
||||||
|
@ -241,4 +244,5 @@ $(document).ready(function() {
|
||||||
tree.init();
|
tree.init();
|
||||||
menu.init();
|
menu.init();
|
||||||
hotkeys.init();
|
hotkeys.init();
|
||||||
|
notification.init();
|
||||||
});
|
});
|
|
@ -163,6 +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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
Loading…
Reference in New Issue