activate highlighter on pickColor
This commit is contained in:
parent
10a87d72a1
commit
12ea7db7d0
1 changed files with 26 additions and 18 deletions
|
@ -872,11 +872,17 @@ class highlightRef extends App.ControllerContent
|
||||||
|
|
||||||
toggleHighlight: (e) =>
|
toggleHighlight: (e) =>
|
||||||
if @isActive
|
if @isActive
|
||||||
|
@deactivate()
|
||||||
|
else
|
||||||
|
@activate()
|
||||||
|
|
||||||
|
deactivate: ->
|
||||||
@highlightIcon.css('fill', '')
|
@highlightIcon.css('fill', '')
|
||||||
@isActive = false
|
@isActive = false
|
||||||
@articles.off('mouseup', @onMouseUp)
|
@articles.off('mouseup', @onMouseUp)
|
||||||
@articles.removeAttr('data-highlightcolor')
|
@articles.removeAttr('data-highlightcolor')
|
||||||
else
|
|
||||||
|
activate: ->
|
||||||
selection = rangy.getSelection()
|
selection = rangy.getSelection()
|
||||||
# if there's already something selected,
|
# if there's already something selected,
|
||||||
# don't go into highlight mode
|
# don't go into highlight mode
|
||||||
|
@ -898,7 +904,9 @@ class highlightRef extends App.ControllerContent
|
||||||
$(e.currentTarget).find('.visibility-change').addClass('is-active')
|
$(e.currentTarget).find('.visibility-change').addClass('is-active')
|
||||||
@activeColorIndex = $(e.currentTarget).attr('data-key')
|
@activeColorIndex = $(e.currentTarget).attr('data-key')
|
||||||
|
|
||||||
if @isActive
|
if not @isActive
|
||||||
|
@activate()
|
||||||
|
else
|
||||||
@highlightIcon.css('fill', @colors[@activeColorIndex].color)
|
@highlightIcon.css('fill', @colors[@activeColorIndex].color)
|
||||||
|
|
||||||
@setColor()
|
@setColor()
|
||||||
|
|
Loading…
Reference in a new issue