Commit 3127119d authored by csillag's avatar csillag

Create the fragment selector

parent d816525e
......@@ -14,12 +14,9 @@ class Annotator.Plugin.FragmentSelector extends Annotator.Plugin
# Create a FragmentSelector around a range
_getFragmentSelector: (annotation, target) =>
console.log "Should create a fragment selector"
return []
fragment = (new URL(@annotator.getRawHref())).hash
[
type: "TextPositionSelector"
start: startOffset
end: endOffset
type: "FragmentSelector"
value: fragment
]
......@@ -127,12 +127,16 @@ class Annotator.Guest extends Annotator
url.toString()
# Utility function to get the decoded form of the document URI
getHref: =>
getRawHref: ->
if @plugins.PDF
@plugins.PDF.uri()
else
@_removeHash @plugins.Document.uri()
@plugins.Document.uri()
# Utility function to get a de-hashed form of the document URI
getHref: -> @_removeHash @getRawHref()
# Utility function to filter metadata and de-hash the URIs
getMetadata: =>
metadata = @plugins.Document?.metadata
metadata.link?.forEach (link) => link.href = @_removeHash link.href
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment