Implement clear on cancel of edit note

This commit is contained in:
Jackson Harper
2023-05-30 15:19:06 +08:00
parent a6c5e450a2
commit 0c495c7264
2 changed files with 9 additions and 0 deletions

View File

@ -240,6 +240,8 @@ fun WebReaderLoadingContainer(slug: String? = null, requestID: String? = null,
coroutineScope.launch {
if (save) {
webReaderViewModel.saveAnnotation(note ?: "")
} else {
webReaderViewModel.cancelAnnotation()
}
webReaderViewModel.annotation = null
}

View File

@ -328,6 +328,13 @@ class WebReaderViewModel @Inject constructor(
cancelAnnotationEdit()
}
fun cancelAnnotation() {
val script = "var event = new Event('dismissHighlight');document.dispatchEvent(event);"
enqueueScript(script)
cancelAnnotationEdit()
}
fun cancelAnnotationEdit() {
annotation = null
resetBottomSheet()