Commit d18c5145 authored by techird's avatar techird

修复文件状态提示

parent 7458951d
...@@ -87,8 +87,8 @@ $(function() { ...@@ -87,8 +87,8 @@ $(function() {
notice = (function() { notice = (function() {
return window.alert; return window.alert;
})(), })(),
wordLimit = function (word, limit) { wordLimit = function(word, limit) {
limit = limit || 15; limit = limit || 15;
return word.length > limit ? (word.substr(0, limit - 3) + '...') : word; return word.length > limit ? (word.substr(0, limit - 3) + '...') : word;
}; };
...@@ -124,7 +124,7 @@ $(function() { ...@@ -124,7 +124,7 @@ $(function() {
acceptFiles.push(p.fileExtension); acceptFiles.push(p.fileExtension);
} }
}); });
function importUseEncoding(encoding) { function importUseEncoding(encoding) {
return function() { return function() {
$('<input type="file" />') $('<input type="file" />')
...@@ -187,7 +187,9 @@ $(function() { ...@@ -187,7 +187,9 @@ $(function() {
$file_btn = $('<button id="file-btn">文件</button>').addClass('dropdown').appendTo($menu); $file_btn = $('<button id="file-btn">文件</button>').addClass('dropdown').appendTo($menu);
$file_menu = $.kmuidropmenu({data: createFileMenu()}) $file_menu = $.kmuidropmenu({
data: createFileMenu()
})
.addClass('file-menu') .addClass('file-menu')
.appendTo('body'); .appendTo('body');
...@@ -346,19 +348,14 @@ $(function() { ...@@ -346,19 +348,14 @@ $(function() {
function setRemotePath(path, saved) { function setRemotePath(path, saved) {
var filename; var filename;
remotePath = path; remotePath = path;
if (remotePath) {
filename = getFileName(remotePath);
if (!saved) {
filename = '* ' + filename;
}
$title.text((filename));
} else if (currentAccount) {
$title.text(('* ' + minder.getMinderTitle()));
} else {
$title.text((filename || minder.getMinderTitle()));
}
document.title = [filename || minder.getMinderTitle(), titleSuffix].join(' - '); filename = remotePath ? getFileName(remotePath) : minder.getMinderTitle();
if (!saved) filename = '* ' + filename;
$title.text(filename)
document.title = [filename, titleSuffix].join(' - ');
} }
// 检查是否在 Cookie 中登录过了 // 检查是否在 Cookie 中登录过了
...@@ -870,12 +867,16 @@ $(function() { ...@@ -870,12 +867,16 @@ $(function() {
if (e.shiftKey) { if (e.shiftKey) {
share(); share();
} else { } else {
setTimeout(function () { save(); }); setTimeout(function() {
save();
});
} }
break; break;
case KM.keymap.n: case KM.keymap.n:
e.preventDefault(); e.preventDefault();
setTimeout(function () { newFile(); }); setTimeout(function() {
newFile();
});
break; break;
} }
} }
...@@ -887,9 +888,7 @@ $(function() { ...@@ -887,9 +888,7 @@ $(function() {
minder.on('contentchange', function() { minder.on('contentchange', function() {
if (!watchingChanges || lastContent == minder.exportData('json')) return; if (!watchingChanges || lastContent == minder.exportData('json')) return;
var current = draftManager.save(); var current = draftManager.save();
if (currentAccount) { setRemotePath(remotePath, current.sync);
setRemotePath(remotePath, current.sync);
}
lastContent = minder.exportData('json'); lastContent = minder.exportData('json');
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment