Skip to main content
Inspiring
October 25, 2023
Answered

Disable Auto-select when ussing addAnnotation method

  • October 25, 2023
  • 2 replies
  • 679 views

Hi,
I want to be able to silently add annotations with out disturbing the user's workflow. Is there a way to not select an annotation when added using the addAnniotation method.

The update and delete methods work how I expect just not the add function.

 

Thanks

This topic has been closed for replies.
Correct answer Andreas23315768po3y

Hi,

 

I was wondering about the same thing, but the workaround with adding multiple annotations wasn't really an option for me, since it would pollute the undo history if I added a second annotation and instantly deleted it afterwards.

 

So I looked up the piece of code, that adds the annotations and it turns out, you can actually add a second argument to the addAnnotations method.

 

// silently adds a single annotation
annotationManager.addAnnotations([template], {silent: true});

 

Maybe someone should mention this in the documentation? Or will this be removed in future releases?

2 replies

Andreas23315768po3yCorrect answer
Inspiring
November 23, 2023

Hi,

 

I was wondering about the same thing, but the workaround with adding multiple annotations wasn't really an option for me, since it would pollute the undo history if I added a second annotation and instantly deleted it afterwards.

 

So I looked up the piece of code, that adds the annotations and it turns out, you can actually add a second argument to the addAnnotations method.

 

// silently adds a single annotation
annotationManager.addAnnotations([template], {silent: true});

 

Maybe someone should mention this in the documentation? Or will this be removed in future releases?

Inspiring
November 23, 2023
Great find! I would love to hear if this will be deprecated also.

I’ve been working on my solution for a bit and found that if you add the
annotation you want to add and a “bad” annotation (like a reply to non
existent comment). It will add the real annotation correctly, throw an
error for the “bad”, and still silently add. I just added some logic to
ignore the error.
Inspiring
November 1, 2023

For anyone who may come across this in the future, adding multiple annotations in one call of addAnnotations had the behaviour I was looking for.