You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@annotator.apache.org by GitBox <gi...@apache.org> on 2018/01/17 03:10:37 UTC

[GitHub] blahah opened a new issue #25: error: context not equal to range's container

blahah opened a new issue #25: error: context not equal to range's container
URL: https://github.com/apache/incubator-annotator/issues/25
 
 
   Hi, I'm trying to use annotator to allow generating an annotation from any arbitrary selection in a web page.
   
   I'm having an issue with `describeTextQuoteByRange` from `@annotator/dom`.
   
   If I modify the demo so that the `context` passed to `describeTextQuoteByRange` is anything other than the original value (`selectable`), it fails with the error:
   
   ```
   Uncaught (in promise) Error: Context not equal to range's container; not implemented.
       at quote.js:48
       at Generator.next (<anonymous>)
       at step (asyncToGenerator.js:10)
       at _next (asyncToGenerator.js:25)
       at asyncToGenerator.js:32
       at new Promise (<anonymous>)
       at asyncToGenerator.js:5
       at describeTextQuoteByRange (quote.js:21)
       at HTMLDocument.onSelectionChange (mount.js:26)
   ```
   
   I copied the approach used in the demo - I create a range using `var selectableRange = document.createRange()`, then add a node using `selectableRange.selectNodeContents(el)`.
   
   I tried using `document.body` as `el`, and various other elements larger than `selectable`, but they all give the same error. I also tried leaving out the `context` key from the options object, same result.
   
   Can you provide any insight into how this should be done?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services