-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Feature multiselect notes delete and move to another folder #1070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
2d0e14c
a504a45
a7e458b
70b69a3
bcb1fb4
9139495
9095fe9
e57fef2
c876306
f0f23ed
037ff2e
84f18ce
a36e779
eee212f
c33f9d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,7 +153,7 @@ class NoteList extends React.Component { | |
| } | ||
| let { router } = this.context | ||
| let { location } = this.props | ||
| let { selectedNoteKeys } = this.state | ||
| let { selectedNoteKeys, shiftKeyDown } = this.state | ||
|
|
||
| let targetIndex = this.getTargetIndex() | ||
|
|
||
|
|
@@ -162,10 +162,16 @@ class NoteList extends React.Component { | |
| } | ||
| targetIndex-- | ||
|
|
||
| selectedNoteKeys = [] | ||
| if (!shiftKeyDown) { | ||
| selectedNoteKeys = [] | ||
| } | ||
| const priorNote = Object.assign({}, this.notes[targetIndex]) | ||
| const priorNoteKey = `${priorNote.storage}-${priorNote.key}` | ||
| selectedNoteKeys.push(priorNoteKey) | ||
| if (selectedNoteKeys.includes(priorNoteKey)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sota1235 Currently I have state that only save |
||
| selectedNoteKeys.pop() | ||
| } else { | ||
| selectedNoteKeys.push(priorNoteKey) | ||
| } | ||
|
|
||
| this.focusNote(selectedNoteKeys, priorNoteKey) | ||
| } | ||
|
|
@@ -176,22 +182,30 @@ class NoteList extends React.Component { | |
| } | ||
| let { router } = this.context | ||
| let { location } = this.props | ||
| let { selectedNoteKeys } = this.state | ||
| let { selectedNoteKeys, shiftKeyDown } = this.state | ||
|
|
||
| let targetIndex = this.getTargetIndex() | ||
|
|
||
| if (targetIndex === this.notes.length - 1) { | ||
|
||
| return | ||
| } else if (targetIndex === this.notes.length - 1) { | ||
|
||
| targetIndex = 0 | ||
| } else { | ||
| targetIndex++ | ||
| if (targetIndex < 0) targetIndex = 0 | ||
| else if (targetIndex > this.notes.length - 1) targetIndex === this.notes.length - 1 | ||
| } | ||
|
|
||
| selectedNoteKeys = [] | ||
| if (!shiftKeyDown) { | ||
| selectedNoteKeys = [] | ||
| } | ||
| const nextNote = Object.assign({}, this.notes[targetIndex]) | ||
| const nextNoteKey = `${nextNote.storage}-${nextNote.key}` | ||
| selectedNoteKeys.push(nextNoteKey) | ||
| if (selectedNoteKeys.includes(nextNoteKey)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just mentioned it above. |
||
| selectedNoteKeys.pop() | ||
| } else { | ||
| selectedNoteKeys.push(nextNoteKey) | ||
| } | ||
|
|
||
| this.focusNote(selectedNoteKeys, nextNoteKey) | ||
|
|
||
|
|
@@ -222,6 +236,7 @@ class NoteList extends React.Component { | |
| } | ||
|
|
||
| handleNoteListKeyDown (e) { | ||
| const { shiftKeyDown } = this.state | ||
| if (e.metaKey || e.ctrlKey) return true | ||
|
|
||
| if (e.keyCode === 65 && !e.shiftKey) { | ||
|
|
@@ -231,7 +246,7 @@ class NoteList extends React.Component { | |
|
|
||
| if (e.keyCode === 68) { | ||
| e.preventDefault() | ||
| ee.emit('detail:delete') | ||
| this.deleteNote() | ||
| } | ||
|
|
||
| if (e.keyCode === 69) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use
getNoteKeyfor creating note key.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used that. Thanks.