Skip to content

Commit

Permalink
Use 'annotator-hl' class for temporary highlights.
Browse files Browse the repository at this point in the history
- Fix for bug introduced by 033c012

- Spotted by Eric Collins (@tabfugnic) The "span" for the temporary
  highlight wasn't being ignored by Range.NormalizedRange#serialize()
  and was being included in the submitted XPath for the annotation,
  resulting in a failure to redraw the annotation on page load

Signed-off-by: Nick Stenning <nick@whiteink.com>
  • Loading branch information
Eric Collins authored and nickstenning committed Jun 22, 2012
1 parent 30192d9 commit 3ce1fdb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/annotator.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ class Annotator extends Delegator
# Show a temporary highlight so the user can see what they selected
if @selectedRanges and @selectedRanges.length
ranges = (Range.sniff(r).normalize() for r in @selectedRanges)
highlights = this.highlightRanges(ranges, 'annotator-hl-temporary')
highlights = this.highlightRanges(ranges, 'annotator-hl annotator-hl-temporary')

@editor.element.one 'hide', ->
for h in highlights
Expand Down
2 changes: 1 addition & 1 deletion test/spec/annotator_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ describe 'Annotator', ->
expect(annotator.showEditor).toHaveBeenCalledWith(annotation, mockOffset)

it "should add temporary highlights to the document to show the user what they selected", ->
expect(annotator.highlightRanges).toHaveBeenCalledWith(['normalized', 'normalized'], 'annotator-hl-temporary')
expect(annotator.highlightRanges).toHaveBeenCalledWith(['normalized', 'normalized'], 'annotator-hl annotator-hl-temporary')

describe "onEditAnnotation", ->
it "should display the Annotator#editor in the same positions as Annotatorviewer", ->
Expand Down

0 comments on commit 3ce1fdb

Please sign in to comment.