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 ...@@ -14,12 +14,9 @@ class Annotator.Plugin.FragmentSelector extends Annotator.Plugin
# Create a FragmentSelector around a range # Create a FragmentSelector around a range
_getFragmentSelector: (annotation, target) => _getFragmentSelector: (annotation, target) =>
console.log "Should create a fragment selector" fragment = (new URL(@annotator.getRawHref())).hash
return []
[ [
type: "TextPositionSelector" type: "FragmentSelector"
start: startOffset value: fragment
end: endOffset
] ]
...@@ -127,12 +127,16 @@ class Annotator.Guest extends Annotator ...@@ -127,12 +127,16 @@ class Annotator.Guest extends Annotator
url.toString() url.toString()
# Utility function to get the decoded form of the document URI # Utility function to get the decoded form of the document URI
getHref: => getRawHref: ->
if @plugins.PDF if @plugins.PDF
@plugins.PDF.uri() @plugins.PDF.uri()
else 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: => getMetadata: =>
metadata = @plugins.Document?.metadata metadata = @plugins.Document?.metadata
metadata.link?.forEach (link) => link.href = @_removeHash link.href 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