From bf72237b380e8bb301046e4e7507f6ae0f911bd4 Mon Sep 17 00:00:00 2001 From: jacobherrington Date: Sat, 15 Sep 2018 17:09:42 -0500 Subject: [PATCH 1/2] fix a bug causing right click to copy a note --- browser/main/NoteList/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 880f8479..520d87df 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -519,7 +519,7 @@ class NoteList extends React.Component { click: this.cloneNote.bind(this) }, { label: copyNoteLink, - click: this.copyNoteLink(note) + click: this.copyNoteLink }) if (note.type === 'MARKDOWN_NOTE') { if (note.blog && note.blog.blogLink && note.blog.blogId) { @@ -684,8 +684,11 @@ class NoteList extends React.Component { }) } - copyNoteLink (note) { - const noteLink = `[${note.title}](:note:${note.key})` + copyNoteLink () { + const { selectedNoteKeys } = this.state + const notes = this.notes.map((note) => Object.assign({}, note)) + const selectedNote = findNotesByKeys(notes, selectedNoteKeys)[0] + const noteLink = `[${selectedNote.title}](:note:${selectedNote.key})` return copy(noteLink) } From dfe0d74845318ddc5b17093d7cc738ce62f4f21a Mon Sep 17 00:00:00 2001 From: jacobherrington Date: Sun, 16 Sep 2018 11:22:35 -0500 Subject: [PATCH 2/2] remove code finding the selected note --- browser/main/NoteList/index.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 520d87df..30ad93c3 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -519,7 +519,7 @@ class NoteList extends React.Component { click: this.cloneNote.bind(this) }, { label: copyNoteLink, - click: this.copyNoteLink + click: this.copyNoteLink.bind(this, note) }) if (note.type === 'MARKDOWN_NOTE') { if (note.blog && note.blog.blogLink && note.blog.blogId) { @@ -684,11 +684,8 @@ class NoteList extends React.Component { }) } - copyNoteLink () { - const { selectedNoteKeys } = this.state - const notes = this.notes.map((note) => Object.assign({}, note)) - const selectedNote = findNotesByKeys(notes, selectedNoteKeys)[0] - const noteLink = `[${selectedNote.title}](:note:${selectedNote.key})` + copyNoteLink (note) { + const noteLink = `[${note.title}](:note:${note.key})` return copy(noteLink) }