This commit is contained in:
life
2015-03-13 00:20:58 +08:00
parent 5527cd6d47
commit 7f11dd63ee
13 changed files with 58 additions and 24 deletions

View File

@@ -65,6 +65,8 @@ if(process.platform != 'darwin') {
<script>
var gui = require('nw.gui');
var win = gui.Window.get();
win.setAlwaysOnTop(true);
// alert(win);
// win.focus();
// gui.Window.focus();

13
node_modules/common.js generated vendored
View File

@@ -30,6 +30,13 @@ var Common = {
this._uuid++;
return ((new Date()).getTime()) + '_' + this._uuid;
},
// 得到目录分隔符
getPathSep: function() {
if(process.platform.indexOf('win') != -1) {
return "\"";
}
return '/';
},
isOk: function(ret) {
if(!ret) {
return ret;
@@ -109,14 +116,16 @@ var Common = {
if(!fullFilePath) {
return ret;
}
var strs = fullFilePath.split('/');
var strs = fullFilePath.split(this.getPathSep());
if(strs.length == 1) {
ret.name = strs;
ret.name = strs[0];
} else {
ret.name = strs[strs.length - 1];
strs.pop();
ret.path = strs.join('/');
}
// console.log("---");
// console.log(ret);
var names = ret.name.split('.');
if(names.length > 1) {
ret.ext = names[names.length - 1];

3
node_modules/sync.js generated vendored
View File

@@ -89,6 +89,7 @@ var Sync = {
},
// 停止同步
// 第一次note.html -> login.html(使得_stop: true), -> note.html fullSync一看是stop
_stop: false,
stop: function() {
var me = this;
@@ -489,6 +490,7 @@ var Sync = {
// 全量同步
fullSync: function(callback) {
var me = this;
me._stop = false;
me._initSyncInfo();
// Web.syncNotebookFinish();
@@ -569,6 +571,7 @@ var Sync = {
},
incrSync: function(again) {
var me = this;
me._stop = false;
me._initSyncInfo();
// again表示重来

View File

@@ -4,6 +4,7 @@
"version": "0.1",
"main": "note.html",
"window": {
"icon": "public/images/logo/leanote_icon_blue.png",
"toolbar": false,
"frame": false,

View File

@@ -1544,6 +1544,7 @@ html,body, #page, #pageInner {
#noteAndEditor {
background-color: #fff;
}
body {
// display: none;
-webkit-user-select: none; // input, textarea还是可以选择的

View File

@@ -228,6 +228,7 @@ body {
}
.pren-tool {
position: fixed;
-webkit-user-select: none;
right: 0;
top: 0;
bottom: 0;

View File

@@ -185,6 +185,7 @@ body {
}
.pren-tool {
position: fixed;
-webkit-user-select: none;
right: 0;
top: 0;
bottom: 0;

View File

@@ -7,6 +7,7 @@
}
*::-webkit-scrollbar {
width: 6px;
height: 6px;
background-color: transparent;
position: absolute;
-webkit-transform: translatez(0);

View File

@@ -17,6 +17,7 @@
*::-webkit-scrollbar
{
width: 6px;
height: 6px;
// background-color: #F5F5F5;
background-color: transparent;
position: absolute;

View File

@@ -1193,12 +1193,15 @@ Note.saveNote = function(e) {
return false;
} else {
}
// copy, paste
if(e.ctrlKey || e.metaKey) {
if(num == 67) { // ctrl + c
document.execCommand('copy');
} else if(num == 86) { // ctrl + v
document.execCommand('paste');
// 不能要, 要的话会有两次paste
// document.execCommand('paste');
} else if(num == 65) { // ctrl + a
document.execCommand('selectAll');
} else if(num == 88) { // ctrl + x

View File

@@ -487,11 +487,11 @@ Notebook.changeNav = function() {
// 移动, 复制重新来, 因为nav变了, 移动至-----的notebook导航也变了
// 这里速度很慢
var t1 = (new Date()).getTime();
// var t1 = (new Date()).getTime();
Note.initContextmenu();
Share.initContextmenu(Note.notebooksCopy);
var t2 = (new Date()).getTime();
log(t2-t1);
// Share.initContextmenu(Note.notebooksCopy);
// var t2 = (new Date()).getTime();
// log(t2-t1);
}
/**

View File

@@ -161,6 +161,7 @@ var Resize = {
NotebookWidth: UserInfo.NotebookWidth,
NoteListWidth: UserInfo.NoteListWidth
}, function() {
// alert(UserInfo.NotebookWidth);
});
}
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() {
@@ -540,15 +554,6 @@ $(function() {
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不能点击
$('#preview-contents').on('click', 'a', function(e) {
e.preventDefault();
@@ -1045,6 +1050,7 @@ function fullSync(callback) {
// 增量同步
function incrSync() {
log('incr sync');
Note.showSpin();
SyncService.incrSync();
}
@@ -1113,7 +1119,13 @@ var State = {
$("#mainMask").html("");
$("#mainMask").hide(0);
}, 100);
})
});
// end
// 打开时,同步一下
setTimeout(function() {
incrSync();
}, 500);
// $('body').show();
},
@@ -1155,6 +1167,7 @@ var State = {
}
this.recoverAfter();
}
};
@@ -1225,11 +1238,6 @@ function initPage() {
// init notebook后才调用
// initSlimScroll();
LeaAce.handleEvent();
// end
// 开始时显示loading......
// 隐藏mask
});
};
@@ -1247,8 +1255,10 @@ function initPage() {
}
$('#username').text(UserInfo.Email);
userMenu();
setLayoutWidth();
} else {
location.href = 'login.html';
switchAccount();
// location.href = 'login.html';
}
});
}

View File

@@ -1377,6 +1377,7 @@ function switchAccount() {
win.close();
}
// 没有一处调用
function commonCmd(e) {
var num = e.which ? e.which : e.keyCode;
// copy, paste
@@ -1385,7 +1386,7 @@ function commonCmd(e) {
document.execCommand('copy');
} else if(num == 86) { // ctrl + v
document.execCommand('paste');
console.log("paste--------------")
// console.log("paste--------------");
} else if(num == 65) { // ctrl + a
document.execCommand('selectAll');
} else if(num == 88) { // ctrl + x