From d2c9bb6e3fa9cbb47648e73aff2d4abc7aa76f93 Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Wed, 9 Aug 2023 14:39:07 +0200 Subject: [PATCH] Fix saving an annotation after editing it --- .../components/annotations/user_annotation.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/assets/javascripts/components/annotations/user_annotation.ts b/app/assets/javascripts/components/annotations/user_annotation.ts index a9e6ec51bd..7f7370e45c 100644 --- a/app/assets/javascripts/components/annotations/user_annotation.ts +++ b/app/assets/javascripts/components/annotations/user_annotation.ts @@ -10,6 +10,7 @@ import "components/saved_annotations/new_saved_annotation"; import { initTooltips } from "utilities"; import "components/saved_annotations/saved_annotation_icon"; import { annotationState } from "state/Annotations"; +import { savedAnnotationState } from "state/SavedAnnotations"; /** * This component represents a single user annotation. @@ -105,6 +106,15 @@ export class UserAnnotationComponent extends i18nMixin(ShadowlessLitElement) { annotation_text: e.detail.text, saved_annotation_id: e.detail.savedAnnotationId || undefined, }); + if (e.detail.saveAnnotation) { + await savedAnnotationState.create( { + from: this.data.id, + saved_annotation: { + title: e.detail.savedAnnotationTitle, + annotation_text: e.detail.text, + } + }); + } this.editing = false; } catch (e) { this.annotationFormRef.value.hasErrors = true;