Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to redraw annotation after updating docData #24

Open
mindis opened this issue Oct 26, 2017 · 3 comments
Open

How to redraw annotation after updating docData #24

mindis opened this issue Oct 26, 2017 · 3 comments

Comments

@mindis
Copy link

mindis commented Oct 26, 2017

Hi

I have external tagger that updates docData object. How can I refresh visualized annotations after the update?

For example if I execute in chrome developer console
docData.entities.push(["N11", "Name", [[220, 227]]]);
I'd like this new annotation to become visible in browser.

I see that such annotation becomes visible if I add another annotation manually afterwards, but I wish I could refresh annotations automatically.

I've tried to execute window_onload() but that messes up Annotator UI and I can't add other annotations

thanks!

@reckart
Copy link

reckart commented Oct 29, 2017

In the original brat, something like this should probably work

dispatcher.post('renderData');

@mindis
Copy link
Author

mindis commented Oct 30, 2017

Used the following hack (I think this issue related to #4)

modified index.html line 425 to prevent automating brat display on page load:

docData.entities.push(["N11", "Name", [[220, 227]]]); //add another entity to annotation
localStorage.setItem("docData", JSON.stringify(window.docData)); // save entity in storage
location.reload(); // clear all objects
var docData = JSON.parse(localStorage.getItem('docData')); //reload docData from storage
window_onload(); //visualise

@shunjizhan
Copy link

shunjizhan commented Feb 28, 2019

brat.dispatcher.post('requestRenderData', [docData]);

works for me, where brat is your brat instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants