Commit c2fda671 authored by csillag's avatar csillag

When opening an annotation card, scroll to highlight. (As in #787)

parent 23d6d82c
...@@ -724,6 +724,11 @@ class Viewer ...@@ -724,6 +724,11 @@ class Viewer
method: 'setActiveHighlights' method: 'setActiveHighlights'
params: highlights params: highlights
$scope.openDetails = (annotation) ->
for p in providers
p.channel.notify
method: 'scrollTo'
params: annotation.$$tag
class Search class Search
this.$inject = ['$filter', '$location', '$routeParams', '$scope', 'annotator'] this.$inject = ['$filter', '$location', '$routeParams', '$scope', 'annotator']
......
...@@ -217,6 +217,7 @@ thread = ['$timeout', ($timeout) -> ...@@ -217,6 +217,7 @@ thread = ['$timeout', ($timeout) ->
$timeout -> $timeout ->
return unless Object.keys(childrenEditing).length is 0 return unless Object.keys(childrenEditing).length is 0
scope.collapsed = !scope.collapsed scope.collapsed = !scope.collapsed
scope.openDetails scope.annotation unless scope.collapsed
, 10 , 10
scope.$on 'toggleEditing', (event) -> scope.$on 'toggleEditing', (event) ->
......
...@@ -68,6 +68,13 @@ class Annotator.Guest extends Annotator ...@@ -68,6 +68,13 @@ class Annotator.Guest extends Annotator
$(this).removeClass('annotator-hl-active') $(this).removeClass('annotator-hl-active')
) )
.bind('scrollTo', (ctx, tag) =>
@wrapper.find('.annotator-hl')
.each ->
if $(this).data('annotation').$$tag is tag
$(this).scrollintoview()
)
.bind('adderClick', => .bind('adderClick', =>
@onAdderClick @event @onAdderClick @event
) )
......
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