question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

renderAnnotation is not called when applying add_annotation operation

See original GitHub issue

Do you want to request a feature or report a bug?

Report a bug.

What’s the current behavior?

If you get add_annotation operation from another editor (lets call it remote editor) and you want to apply it to your editor instance (lets call it local editor), it is applied correctly to the value (value.annotations is properly updated) however, renderAnnotation is not called on local editor.

Also if you change the text within the range of the annotation in remote editor, the annotation range and offset is not updated. In local editor (the one that created the annotation), range is updated properly.

So there is some difference between calling:

editor.addAnnotation(annotation)

and calling

editor.applyOperation(operationContainingAnnotation)

What’s the expected behavior?

renderAnnotation should be called if anything in value.annotations has changes. Also annotations should be updated whenever document.value has changed.

Without it annotations cannot be used in collaborative editing (we use operational transform).

Minimal reproducible example

I updated Syncing operations example to include this case. It shows this behavior with minimal changes. Here is my commit, if you checkout this, you will be able to reproduce it: https://github.com/kierson/slate/commit/21ef412649373fd53d39106db1886ee4e2d75d25

I added new Comment icon. So you have to just select some text in one of editors and click comment button. It will add new annotation and render orange text in one of the editors. But it should render it on both editors.

I would be happy to fix it myself and open a PR if someone can point me out where to look for solution.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
linonetwocommented, Jul 12, 2019

In my case, using addAnnotation won’t call renderAnnotation

0reactions
ianstormtaylorcommented, Nov 28, 2019

I believe that this may be fixed by https://github.com/ianstormtaylor/slate/pull/3093, which has changed a lot of the logic in Slate and slate-react especially. I’m going to close this out, but as always, feel free to open a new issue if it persists for you. Thanks for understanding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AnnotationLayer (NASA World Wind)
The AnnotationRenderer is specified by calling ... Opacity is not applied to layers of this type because each annotation has an attribute set...
Read more >
kubectl annotate - Kubernetes
An annotation is a key/value pair that can hold larger (compared to a label), and possibly not human-readable, data. It is intended to...
Read more >
Why are my Vexflow annotations drifting to the bottom
My application is displaying text anycodings_vexflow annotati ... ... private renderAnnotation(textNote: string): vexflow.Flow.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found