From 22bc1103b471724e5ac6c0997a66c2dcb9cb3e55 Mon Sep 17 00:00:00 2001 From: life Date: Sun, 1 Mar 2015 23:22:15 +0800 Subject: [PATCH] =?UTF-8?q?ctrl+a,=20context=20menu=E5=AE=9A=E4=BD=8D,=20m?= =?UTF-8?q?arkdown=E4=B8=80=E6=97=A6setContent=E5=B0=B1focus,=20=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E6=90=9C=E7=B4=A2=E5=A4=B1=E5=8E=BB=E7=84=A6=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/app/note.js | 10 +++++++++- public/js/app/service.js | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/public/js/app/note.js b/public/js/app/note.js index 4c9bb00f..15612cbe 100644 --- a/public/js/app/note.js +++ b/public/js/app/note.js @@ -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秒就要保存 } diff --git a/public/js/app/service.js b/public/js/app/service.js index 8dd71a0a..f43953b7 100644 --- a/public/js/app/service.js +++ b/public/js/app/service.js @@ -88,6 +88,7 @@ this.copy = new gui.MenuItem({ this.paste = new gui.MenuItem({ label: '粘贴', click: function () { + // document.execCommand("selectAll"); document.execCommand('paste'); } });