MCPcopy Create free account
hub / github.com/massCodeIO/massCode / selectNote

Function selectNote

src/renderer/composables/spaces/notes/useNotes.ts:719–748  ·  view source on GitHub ↗
(noteId: number, withShift = false)

Source from the content-addressed store, hash-verified

717// --- Selection ---
718
719export 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
750export function selectFirstNote() {
751 let firstNote: NoteRecord | undefined

Callers 4

selectSearchNoteFunction · 0.90
openNoteDeepLinkFunction · 0.85

Calls 1

getContiguousSelectionFunction · 0.90

Tested by

no test coverage detected