From c28a77bb9f0f7137026c09865477ac7cefe7a861 Mon Sep 17 00:00:00 2001 From: Andrea Pruccoli Date: Mon, 25 Mar 2024 12:06:20 +0100 Subject: [PATCH] feat: add direct call to annotationModule `updateAnnotation` within reader instance --- src/reader.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/reader.ts b/src/reader.ts index 2a9f10ba..4d7108ff 100644 --- a/src/reader.ts +++ b/src/reader.ts @@ -522,6 +522,16 @@ export default class D2Reader { addAnnotation = async (highlight: Annotation) => { return (await this.annotationModule?.addAnnotation(highlight)) ?? false; }; + /** + * Update annotation + * + * This should be used only when the add/delete of the annotation note + * is not directly handled in the `addAnnotation`/`addCommentToAnnotation` + * callback defined in the configuration of the D2Reader.load() method + * */ + updateAnnotation = async (highlight: Annotation) => { + return (await this.annotationModule?.updateAnnotation(highlight)) ?? false; + }; /** Hide Annotation Layer */ hideAnnotationLayer = () => {