(noteId: number, withShift = false)
| 717 | // --- Selection --- |
| 718 | |
| 719 | export function selectNote(noteId: number, withShift = false) { |
| 720 | if (!withShift) { |
| 721 | selectedNoteIds.value = [noteId] |
| 722 | notesState.noteId = noteId |
| 723 | return |
| 724 | } |
| 725 | |
| 726 | if (notesState.noteId !== undefined) { |
| 727 | const source = isSearch.value ? notesBySearch.value : notes.value |
| 728 | |
| 729 | if (source?.length) { |
| 730 | const orderedIds = source.map(note => note.id) |
| 731 | const rangeSelection = getContiguousSelection( |
| 732 | orderedIds, |
| 733 | notesState.noteId, |
| 734 | noteId, |
| 735 | ) |
| 736 | |
| 737 | if (rangeSelection.length) { |
| 738 | selectedNoteIds.value = rangeSelection |
| 739 | lastSelectedNoteId.value = noteId |
| 740 | } |
| 741 | } |
| 742 | } |
| 743 | else { |
| 744 | selectedNoteIds.value = [noteId] |
| 745 | lastSelectedNoteId.value = noteId |
| 746 | notesState.noteId = noteId |
| 747 | } |
| 748 | } |
| 749 | |
| 750 | export function selectFirstNote() { |
| 751 | let firstNote: NoteRecord | undefined |
no test coverage detected