mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-16 16:04:56 +00:00
win
This commit is contained in:
@@ -65,6 +65,8 @@ if(process.platform != 'darwin') {
|
|||||||
<script>
|
<script>
|
||||||
var gui = require('nw.gui');
|
var gui = require('nw.gui');
|
||||||
var win = gui.Window.get();
|
var win = gui.Window.get();
|
||||||
|
win.setAlwaysOnTop(true);
|
||||||
|
// alert(win);
|
||||||
// win.focus();
|
// win.focus();
|
||||||
// gui.Window.focus();
|
// gui.Window.focus();
|
||||||
|
|
||||||
|
13
node_modules/common.js
generated
vendored
13
node_modules/common.js
generated
vendored
@@ -30,6 +30,13 @@ var Common = {
|
|||||||
this._uuid++;
|
this._uuid++;
|
||||||
return ((new Date()).getTime()) + '_' + this._uuid;
|
return ((new Date()).getTime()) + '_' + this._uuid;
|
||||||
},
|
},
|
||||||
|
// 得到目录分隔符
|
||||||
|
getPathSep: function() {
|
||||||
|
if(process.platform.indexOf('win') != -1) {
|
||||||
|
return "\"";
|
||||||
|
}
|
||||||
|
return '/';
|
||||||
|
},
|
||||||
isOk: function(ret) {
|
isOk: function(ret) {
|
||||||
if(!ret) {
|
if(!ret) {
|
||||||
return ret;
|
return ret;
|
||||||
@@ -109,14 +116,16 @@ var Common = {
|
|||||||
if(!fullFilePath) {
|
if(!fullFilePath) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
var strs = fullFilePath.split('/');
|
var strs = fullFilePath.split(this.getPathSep());
|
||||||
if(strs.length == 1) {
|
if(strs.length == 1) {
|
||||||
ret.name = strs;
|
ret.name = strs[0];
|
||||||
} else {
|
} else {
|
||||||
ret.name = strs[strs.length - 1];
|
ret.name = strs[strs.length - 1];
|
||||||
strs.pop();
|
strs.pop();
|
||||||
ret.path = strs.join('/');
|
ret.path = strs.join('/');
|
||||||
}
|
}
|
||||||
|
// console.log("---");
|
||||||
|
// console.log(ret);
|
||||||
var names = ret.name.split('.');
|
var names = ret.name.split('.');
|
||||||
if(names.length > 1) {
|
if(names.length > 1) {
|
||||||
ret.ext = names[names.length - 1];
|
ret.ext = names[names.length - 1];
|
||||||
|
3
node_modules/sync.js
generated
vendored
3
node_modules/sync.js
generated
vendored
@@ -89,6 +89,7 @@ var Sync = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 停止同步
|
// 停止同步
|
||||||
|
// 第一次,note.html -> login.html(使得_stop: true), -> note.html fullSync,一看,是stop
|
||||||
_stop: false,
|
_stop: false,
|
||||||
stop: function() {
|
stop: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
@@ -489,6 +490,7 @@ var Sync = {
|
|||||||
// 全量同步
|
// 全量同步
|
||||||
fullSync: function(callback) {
|
fullSync: function(callback) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
me._stop = false;
|
||||||
me._initSyncInfo();
|
me._initSyncInfo();
|
||||||
|
|
||||||
// Web.syncNotebookFinish();
|
// Web.syncNotebookFinish();
|
||||||
@@ -569,6 +571,7 @@ var Sync = {
|
|||||||
},
|
},
|
||||||
incrSync: function(again) {
|
incrSync: function(again) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
me._stop = false;
|
||||||
me._initSyncInfo();
|
me._initSyncInfo();
|
||||||
|
|
||||||
// again表示重来
|
// again表示重来
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"version": "0.1",
|
"version": "0.1",
|
||||||
"main": "note.html",
|
"main": "note.html",
|
||||||
"window": {
|
"window": {
|
||||||
|
"icon": "public/images/logo/leanote_icon_blue.png",
|
||||||
"toolbar": false,
|
"toolbar": false,
|
||||||
|
|
||||||
"frame": false,
|
"frame": false,
|
||||||
|
@@ -1544,6 +1544,7 @@ html,body, #page, #pageInner {
|
|||||||
#noteAndEditor {
|
#noteAndEditor {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
// display: none;
|
// display: none;
|
||||||
-webkit-user-select: none; // input, textarea还是可以选择的
|
-webkit-user-select: none; // input, textarea还是可以选择的
|
||||||
|
@@ -228,6 +228,7 @@ body {
|
|||||||
}
|
}
|
||||||
.pren-tool {
|
.pren-tool {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
-webkit-user-select: none;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
@@ -185,6 +185,7 @@ body {
|
|||||||
}
|
}
|
||||||
.pren-tool {
|
.pren-tool {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
-webkit-user-select: none;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
}
|
}
|
||||||
*::-webkit-scrollbar {
|
*::-webkit-scrollbar {
|
||||||
width: 6px;
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
-webkit-transform: translatez(0);
|
-webkit-transform: translatez(0);
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
*::-webkit-scrollbar
|
*::-webkit-scrollbar
|
||||||
{
|
{
|
||||||
width: 6px;
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
// background-color: #F5F5F5;
|
// background-color: #F5F5F5;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@@ -1193,12 +1193,15 @@ Note.saveNote = function(e) {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// copy, paste
|
// copy, paste
|
||||||
if(e.ctrlKey || e.metaKey) {
|
if(e.ctrlKey || e.metaKey) {
|
||||||
if(num == 67) { // ctrl + c
|
if(num == 67) { // ctrl + c
|
||||||
document.execCommand('copy');
|
document.execCommand('copy');
|
||||||
} else if(num == 86) { // ctrl + v
|
} else if(num == 86) { // ctrl + v
|
||||||
document.execCommand('paste');
|
// 不能要, 要的话会有两次paste
|
||||||
|
// document.execCommand('paste');
|
||||||
} else if(num == 65) { // ctrl + a
|
} else if(num == 65) { // ctrl + a
|
||||||
document.execCommand('selectAll');
|
document.execCommand('selectAll');
|
||||||
} else if(num == 88) { // ctrl + x
|
} else if(num == 88) { // ctrl + x
|
||||||
|
@@ -487,11 +487,11 @@ Notebook.changeNav = function() {
|
|||||||
|
|
||||||
// 移动, 复制重新来, 因为nav变了, 移动至-----的notebook导航也变了
|
// 移动, 复制重新来, 因为nav变了, 移动至-----的notebook导航也变了
|
||||||
// 这里速度很慢
|
// 这里速度很慢
|
||||||
var t1 = (new Date()).getTime();
|
// var t1 = (new Date()).getTime();
|
||||||
Note.initContextmenu();
|
Note.initContextmenu();
|
||||||
Share.initContextmenu(Note.notebooksCopy);
|
// Share.initContextmenu(Note.notebooksCopy);
|
||||||
var t2 = (new Date()).getTime();
|
// var t2 = (new Date()).getTime();
|
||||||
log(t2-t1);
|
// log(t2-t1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -161,6 +161,7 @@ var Resize = {
|
|||||||
NotebookWidth: UserInfo.NotebookWidth,
|
NotebookWidth: UserInfo.NotebookWidth,
|
||||||
NoteListWidth: UserInfo.NoteListWidth
|
NoteListWidth: UserInfo.NoteListWidth
|
||||||
}, function() {
|
}, function() {
|
||||||
|
// alert(UserInfo.NotebookWidth);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
self.lineMove = false;
|
self.lineMove = false;
|
||||||
@@ -476,6 +477,19 @@ function scrollTo(self, tagName, text) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置宽度, 三栏
|
||||||
|
function setLayoutWidth() {
|
||||||
|
//------------------------
|
||||||
|
// 界面设置, 左侧是否是隐藏的
|
||||||
|
UserInfo.NotebookWidth = UserInfo.NotebookWidth || $("#notebook").width();
|
||||||
|
UserInfo.NoteListWidth = UserInfo.NoteListWidth || $("#noteList").width();
|
||||||
|
|
||||||
|
Resize.init();
|
||||||
|
// alert(UserInfo.NotebookWidth);
|
||||||
|
Resize.set3ColumnsWidth(UserInfo.NotebookWidth, UserInfo.NoteListWidth);
|
||||||
|
Resize.setMdColumnWidth(UserInfo.MdEditorWidth);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------
|
//--------------
|
||||||
// 调用之
|
// 调用之
|
||||||
$(function() {
|
$(function() {
|
||||||
@@ -540,15 +554,6 @@ $(function() {
|
|||||||
return preHeight < maxHeight ? preHeight : maxHeight;
|
return preHeight < maxHeight ? preHeight : maxHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------
|
|
||||||
// 界面设置, 左侧是否是隐藏的
|
|
||||||
UserInfo.NotebookWidth = UserInfo.NotebookWidth || $("#notebook").width();
|
|
||||||
UserInfo.NoteListWidth = UserInfo.NoteListWidth || $("#noteList").width();
|
|
||||||
|
|
||||||
Resize.init();
|
|
||||||
Resize.set3ColumnsWidth(UserInfo.NotebookWidth, UserInfo.NoteListWidth);
|
|
||||||
Resize.setMdColumnWidth(UserInfo.MdEditorWidth);
|
|
||||||
|
|
||||||
// markdown preview下的a不能点击
|
// markdown preview下的a不能点击
|
||||||
$('#preview-contents').on('click', 'a', function(e) {
|
$('#preview-contents').on('click', 'a', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -1045,6 +1050,7 @@ function fullSync(callback) {
|
|||||||
// 增量同步
|
// 增量同步
|
||||||
function incrSync() {
|
function incrSync() {
|
||||||
log('incr sync');
|
log('incr sync');
|
||||||
|
Note.showSpin();
|
||||||
SyncService.incrSync();
|
SyncService.incrSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1113,7 +1119,13 @@ var State = {
|
|||||||
$("#mainMask").html("");
|
$("#mainMask").html("");
|
||||||
$("#mainMask").hide(0);
|
$("#mainMask").hide(0);
|
||||||
}, 100);
|
}, 100);
|
||||||
})
|
});
|
||||||
|
|
||||||
|
// end
|
||||||
|
// 打开时,同步一下
|
||||||
|
setTimeout(function() {
|
||||||
|
incrSync();
|
||||||
|
}, 500);
|
||||||
// $('body').show();
|
// $('body').show();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1155,6 +1167,7 @@ var State = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.recoverAfter();
|
this.recoverAfter();
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1225,11 +1238,6 @@ function initPage() {
|
|||||||
// init notebook后才调用
|
// init notebook后才调用
|
||||||
// initSlimScroll();
|
// initSlimScroll();
|
||||||
LeaAce.handleEvent();
|
LeaAce.handleEvent();
|
||||||
|
|
||||||
// end
|
|
||||||
// 开始时显示loading......
|
|
||||||
// 隐藏mask
|
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1247,8 +1255,10 @@ function initPage() {
|
|||||||
}
|
}
|
||||||
$('#username').text(UserInfo.Email);
|
$('#username').text(UserInfo.Email);
|
||||||
userMenu();
|
userMenu();
|
||||||
|
setLayoutWidth();
|
||||||
} else {
|
} else {
|
||||||
location.href = 'login.html';
|
switchAccount();
|
||||||
|
// location.href = 'login.html';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1377,6 +1377,7 @@ function switchAccount() {
|
|||||||
win.close();
|
win.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 没有一处调用
|
||||||
function commonCmd(e) {
|
function commonCmd(e) {
|
||||||
var num = e.which ? e.which : e.keyCode;
|
var num = e.which ? e.which : e.keyCode;
|
||||||
// copy, paste
|
// copy, paste
|
||||||
@@ -1385,7 +1386,7 @@ function commonCmd(e) {
|
|||||||
document.execCommand('copy');
|
document.execCommand('copy');
|
||||||
} else if(num == 86) { // ctrl + v
|
} else if(num == 86) { // ctrl + v
|
||||||
document.execCommand('paste');
|
document.execCommand('paste');
|
||||||
console.log("paste--------------")
|
// console.log("paste--------------");
|
||||||
} else if(num == 65) { // ctrl + a
|
} else if(num == 65) { // ctrl + a
|
||||||
document.execCommand('selectAll');
|
document.execCommand('selectAll');
|
||||||
} else if(num == 88) { // ctrl + x
|
} else if(num == 88) { // ctrl + x
|
||||||
|
Reference in New Issue
Block a user