Set page notes if they are already created
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
let viewModel: NotebookViewModel
|
||||
let highlightParams: HighlightListItemParams
|
||||
@Binding var hasHighlightMutations: Bool
|
||||
|
||||
let onSaveAnnotation: (String) -> Void
|
||||
let onDeleteHighlight: () -> Void
|
||||
let onSetLabels: (String) -> Void
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
// annotation = highlightParams.annotation
|
||||
noteAnnotation = viewModel.noteItem?.annotation ?? ""
|
||||
showAnnotationModal = true
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,10 @@
|
||||
HighlightAnnotationSheet(
|
||||
annotation: $noteAnnotation,
|
||||
onSave: {
|
||||
// onSaveAnnotation(annotation)
|
||||
viewModel.updateNoteAnnotation(
|
||||
annotation: noteAnnotation,
|
||||
dataService: dataService
|
||||
)
|
||||
showAnnotationModal = false
|
||||
hasHighlightMutations = true
|
||||
},
|
||||
|
||||
@ -45,6 +45,13 @@ struct NoteItemParams: Identifiable {
|
||||
}
|
||||
}
|
||||
|
||||
func updateNoteAnnotation(annotation: String, dataService: DataService) {
|
||||
if let noteItem = self.noteItem {
|
||||
dataService.updateHighlightAttributes(highlightID: noteItem.highlightID, annotation: annotation)
|
||||
self.noteItem = NoteItemParams(highlightID: noteItem.highlightID, annotation: annotation)
|
||||
}
|
||||
}
|
||||
|
||||
func deleteHighlight(highlightID: String, dataService: DataService) {
|
||||
dataService.deleteHighlight(highlightID: highlightID)
|
||||
highlightItems.removeAll { $0.highlightID == highlightID }
|
||||
|
||||
@ -317,10 +317,6 @@ struct AnimatingCellHeight: AnimatableModifier {
|
||||
|
||||
func menuItems(for item: LinkedItem) -> some View {
|
||||
Group {
|
||||
Button(
|
||||
action: { viewModel.itemForHighlightsView = item },
|
||||
label: { Label("Notebook", systemImage: "highlighter") }
|
||||
)
|
||||
Button(
|
||||
action: { viewModel.itemUnderTitleEdit = item },
|
||||
label: { Label("Edit Info", systemImage: "info.circle") }
|
||||
|
||||
Reference in New Issue
Block a user