Merge branch 'master' of https://github.com/b3log/wide
This commit is contained in:
commit
aceddad8ad
|
@ -0,0 +1 @@
|
|||
111111111111111111111111111
|
|
@ -0,0 +1 @@
|
|||
222222222222222222222
|
|
@ -252,3 +252,11 @@ ul {
|
|||
width: 100%;
|
||||
}
|
||||
/* end output */
|
||||
|
||||
/* start footer */
|
||||
.notification-count {
|
||||
float: right;
|
||||
display: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
/* end footer */
|
||||
|
|
|
@ -35,6 +35,20 @@ var hotkeys = {
|
|||
shiftKey: false,
|
||||
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 构建并运行
|
||||
buildRun: {
|
||||
ctrlKey: false,
|
||||
|
@ -206,6 +220,69 @@ var hotkeys = {
|
|||
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 构建并运行
|
||||
wide.run();
|
||||
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 = {
|
||||
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) {
|
||||
var id = $(this).data("index");
|
||||
_that.setCurrent(id);
|
||||
obj.clickAfter(id);
|
||||
if (typeof (obj.clickAfter) === "function") {
|
||||
obj.clickAfter(id);
|
||||
}
|
||||
});
|
||||
|
||||
obj._$tabs.on("click", ".ico-close", function(event) {
|
||||
|
|
|
@ -252,6 +252,7 @@ var tree = {
|
|||
editors.tabs.setCurrent(treeNode.tId);
|
||||
wide.curNode = treeNode;
|
||||
wide.curEditor = editors.data[i].editor;
|
||||
wide.curEditor.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,10 @@ var wide = {
|
|||
},
|
||||
_initBottomWindowGroup: function() {
|
||||
this.bottomWindowTab = new Tabs({
|
||||
id: ".bottom-window-group"
|
||||
id: ".bottom-window-group",
|
||||
clickAfter: function(id) {
|
||||
this._$tabsPanel.find("." + id).focus();
|
||||
}
|
||||
});
|
||||
},
|
||||
init: function() {
|
||||
|
@ -241,4 +244,5 @@ $(document).ready(function() {
|
|||
tree.init();
|
||||
menu.init();
|
||||
hotkeys.init();
|
||||
notification.init();
|
||||
});
|
|
@ -163,6 +163,7 @@
|
|||
<div class="footer">
|
||||
<span>|</span>
|
||||
<span id="footer-cursor" style="float: right;"></span>
|
||||
<span class="notification-count" title="you have unread notification">N</span>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
Loading…
Reference in New Issue