Skip to content

Commit 414a562

Browse files
committed
2.3 released
1 parent 405d6c6 commit 414a562

File tree

8 files changed

+126
-74
lines changed

8 files changed

+126
-74
lines changed

main.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,19 @@ function removeEvents (win) {
116116
win.removeAllListeners('close');
117117
}
118118

119+
function close (e, force) {
120+
console.log('close:', force);
121+
if (mainWindow) {
122+
mainWindow.hide();
123+
e && e.preventDefault();
124+
mainWindow.webContents.send('closeWindow');
125+
} else {
126+
app.quit();
127+
}
128+
}
129+
119130
function bindEvents (win) {
131+
mainWindow = win;
120132

121133
// Emitted when the window is closed.
122134
win.on('closed', function() {
@@ -138,17 +150,6 @@ function bindEvents (win) {
138150
if(win && win.webContents)
139151
win.webContents.send('blurWindow');
140152
});
141-
142-
function close (e, force) {
143-
console.log('close:', force);
144-
if (win) {
145-
win.hide();
146-
e && e.preventDefault();
147-
win.webContents.send('closeWindow');
148-
} else {
149-
app.quit();
150-
}
151-
}
152153

153154
// 以前的关闭是真关闭, 现是是假关闭了
154155
// 关闭,先保存数据

node_modules/api.js

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/sync.js

Lines changed: 48 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/web.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/app/note.js

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -847,21 +847,22 @@ Note.renderChangedNote = function(changedNote) {
847847
// 清空右侧note信息, 可能是共享的,
848848
// 此时需要清空只读的, 且切换到note edit模式下
849849
Note.clearNoteInfo = function() {
850-
Note.clearCurNoteId();
851-
Tag.input.clearTags();
852-
$("#noteTitle").val("");
853-
setEditorContent("");
850+
Note.clearCurNoteId();
851+
Tag.input.clearTags();
852+
$("#noteTitle").val("");
853+
setEditorContent("");
854854

855-
// markdown editor
856-
/*
857-
$("#wmd-input").val("");
858-
$("#wmd-preview").html("");
859-
*/
855+
// markdown editor
856+
/*
857+
$("#wmd-input").val("");
858+
$("#wmd-preview").html("");
859+
*/
860860

861-
// 只隐藏即可
862-
$("#noteRead").hide();
863-
}
864-
// 清除noteList导航
861+
// 只隐藏即可
862+
$("#noteRead").hide();
863+
};
864+
865+
// 清除noteList导航
865866
Note.clearNoteList = function() {
866867
Note.noteItemListO.html(""); // 清空
867868
}
@@ -1252,23 +1253,31 @@ Note.hideSyncProgress = function() {
12521253
Note.unConnected = function() {
12531254
var me = this;
12541255
me._syncWarningE.show();
1255-
SyncService.setSyncFinished();
1256+
SyncService.setSyncFinished(true);
12561257
me.hideSpin();
12571258
me._syncWarningE.data('reason', 'unConnected');
12581259
me._syncWarningE.attr('title', 'Network error');
12591260
};
1261+
// 网络已经连接好了
1262+
Note.connected = function() {
1263+
var me = this;
1264+
if (me._syncWarningE.data('reason') == 'unConnected') {
1265+
me._syncWarningE.data('reason', '-');
1266+
me._syncWarningE.hide();
1267+
}
1268+
};
12601269
Note.notLogin = function() {
12611270
var me = this;
12621271
me._syncWarningE.show();
12631272
me.hideSpin();
1264-
SyncService.setSyncFinished();
1273+
SyncService.setSyncFinished(true);
12651274
me._syncWarningE.data('reason', 'notLogin');
12661275
me._syncWarningE.attr('title', getMsg('You need to sign in Leanote'));
12671276
};
12681277
Note.needUpgradeAccount = function() {
12691278
var me = this;
12701279
me.hideSpin();
1271-
SyncService.setSyncFinished();
1280+
SyncService.setSyncFinished(true);
12721281
me._syncWarningE.show();
12731282
me._syncWarningE.data('reason', 'NEED-UPGRADE-ACCOUNT');
12741283
me._syncWarningE.attr('title', getMsg('You need to upgrade Leanote account'));
@@ -1284,7 +1293,7 @@ Note.fixNetOrAuthError = function() {
12841293
} else if (reason == 'notLogin') {
12851294
alert(getMsg('You need to sign in Leanote'));
12861295
// 弹出登录框登录之, 重新弹出
1287-
window.open('login.html?ref=needLogin');
1296+
toLogin();
12881297

12891298
// 需要升级Leanote
12901299
} else if (reason == 'NEED-UPGRADE-ACCOUNT') {

public/js/app/page.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,8 +1216,8 @@ LeaAce = {
12161216
function fullSync(callback) {
12171217
log('full sync');
12181218
$('.loading-footer').show();
1219-
SyncService.fullSync(function(ret, ok) {
1220-
callback && callback(ok);
1219+
SyncService.fullSync(function(err, ret) {
1220+
callback && callback(err, ret);
12211221
});
12221222
}
12231223

@@ -1525,9 +1525,29 @@ function initPage(initedCallback) {
15251525
else if ('LastSyncUsn' in UserInfo && UserInfo['LastSyncUsn'] > 0) {
15261526
_init();
15271527
} else {
1528-
fullSync(function(ok) {
1529-
if (!ok) {
1530-
Notify.show({ title: 'Info', body: getMsg('Sync error, retry to sync after 3 seconds') });
1528+
fullSync(function(err, info) {
1529+
if (err) {
1530+
if (typeof err == 'object') {
1531+
if(err['Msg'] == 'NOTLOGIN') {
1532+
alert(getMsg('You need to sign in Leanote'));
1533+
toLogin();
1534+
return;
1535+
}
1536+
if(err['Msg'] == 'NEED-UPGRADE-ACCOUNT') {
1537+
alert(getMsg('You need to upgrade Leanote account'));
1538+
openExternal('https://leanote.com/pricing#buy');
1539+
setTimeout(function () {
1540+
toLogin();
1541+
}, 1000);
1542+
return;
1543+
}
1544+
}
1545+
1546+
if (isMac()) {
1547+
Notify.show({ title: 'Info', body: getMsg('Sync error, retry to sync after 3 seconds') });
1548+
} else {
1549+
alert(getMsg('Sync error, retry to sync after 3 seconds'));
1550+
}
15311551
setTimeout(function() {
15321552
reloadApp();
15331553
}, 3000);

public/js/app/tag.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ TagInput.prototype = {
220220
// called by Note
221221
setTags: function(tags) {
222222
if(!Array.isArray(tags)) {
223-
return;
223+
tags = [];
224224
}
225-
this.$tags.html('');
225+
this.clearTags();
226226
for(var i = 0; i < tags.length; ++i) {
227227
this._addTag(tags[i]);
228228
}

public/js/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ function toLogin() {
15241524
if(isMac()) {
15251525
ipc.send('openUrl', {html: 'login.html', width: 278, height: 370, show: true, frame: false, resizable: false })
15261526
} else {
1527-
ipc.send('openUrl', { width: 278, height: 400, show: true, frame: true, resizable: false })
1527+
ipc.send('openUrl', {html: 'login.html', width: 278, height: 400, show: true, frame: true, resizable: false })
15281528
}
15291529
// gui.getCurrentWindow().close();
15301530
}

0 commit comments

Comments
 (0)