ctrl+a, context menu定位, markdown一旦setContent就focus, 导致搜索失去焦点

This commit is contained in:
life
2015-03-01 23:22:15 +08:00
parent e00a35a845
commit 22bc1103b4
2 changed files with 10 additions and 1 deletions

View File

@@ -1136,11 +1136,16 @@ 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');
} else if(num == 65) { // ctrl + a
document.execCommand('selectAll');
} else if(num == 88) { // ctrl + x
document.execCommand('cut');
}
}
};
@@ -1436,7 +1441,6 @@ Note.searchNote = function() {
return;
}
// 之前有, 还有结束的
// if(Note.lastSearch) {
// Note.lastSearch.abort();
@@ -1460,6 +1464,10 @@ Note.searchNote = function() {
if(t == Note.searchSeq && notes) {
Notebook.changeCurNotebookTitle('Search results', false, notes.length);
Note.renderNotes(notes);
// markdown一旦setContent就focus, 导致搜索失去焦点
setTimeout(function() {
$("#searchNoteInput").focus();
})
if(!isEmpty(notes)) {
Note.changeNote(notes[0].NoteId, false/*, true || Note.isOver2Seconds*/); // isShare, needSaveChanged?, 超过2秒就要保存
}

View File

@@ -88,6 +88,7 @@ this.copy = new gui.MenuItem({
this.paste = new gui.MenuItem({
label: '粘贴',
click: function () {
// document.execCommand("selectAll");
document.execCommand('paste');
}
});