Commit ff81f156 authored by Jake Hartnell's avatar Jake Hartnell Committed by Randall Leeds

Simplify code, tweak class names.

parent f9f6c771
...@@ -17,7 +17,6 @@ module.exports = class Annotator.Guest extends Annotator ...@@ -17,7 +17,6 @@ module.exports = class Annotator.Guest extends Annotator
".annotator-adder button click": "onAdderClick" ".annotator-adder button click": "onAdderClick"
".annotator-adder button mousedown": "onAdderMousedown" ".annotator-adder button mousedown": "onAdderMousedown"
".annotator-adder button mouseup": "onAdderMouseup" ".annotator-adder button mouseup": "onAdderMouseup"
".annotator-highlighter button click": "onHighlighterClick"
"setVisibleHighlights": "setVisibleHighlights" "setVisibleHighlights": "setVisibleHighlights"
# Plugin configuration # Plugin configuration
...@@ -36,7 +35,7 @@ module.exports = class Annotator.Guest extends Annotator ...@@ -36,7 +35,7 @@ module.exports = class Annotator.Guest extends Annotator
visibleHighlights: false visibleHighlights: false
html: jQuery.extend {}, Annotator::html, html: jQuery.extend {}, Annotator::html,
adder: '<div class="adder-group"><span class="annotator-adder"><button class="h-icon-mode-comment"></button></span><span class="annotator-highlighter"><button class="h-icon-border-color"></button></span>' adder: '<div class="annotator-adder"><button class="h-icon-mode-comment"></button><button class="h-icon-border-color annotator-highlighter"></button></div>'
constructor: (element, options, config = {}) -> constructor: (element, options, config = {}) ->
options.noScan = true options.noScan = true
...@@ -393,14 +392,11 @@ module.exports = class Annotator.Guest extends Annotator ...@@ -393,14 +392,11 @@ module.exports = class Annotator.Guest extends Annotator
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
@adder.hide() @adder.hide()
annotation = this.setupAnnotation(this.createAnnotation()) # Check to see if the highlight or note button was pushed.
Annotator.Util.getGlobal().getSelection().removeAllRanges() if event.target.className == "h-icon-border-color annotator-highlighter"
this.showEditor(annotation) this.setVisibleHighlights true
annotation = this.setupAnnotation(this.createHighlight())
onHighlighterClick: (event) => else
event.preventDefault() annotation = this.setupAnnotation(this.createAnnotation())
event.stopPropagation() this.showEditor(annotation)
@adder.hide()
this.setVisibleHighlights true
annotation = this.setupAnnotation(this.createHighlight())
Annotator.Util.getGlobal().getSelection().removeAllRanges() Annotator.Util.getGlobal().getSelection().removeAllRanges()
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
$base-font-size: 14px; $base-font-size: 14px;
//ADDER//////////////////////////////// //ADDER////////////////////////////////
.adder-group { .annotator-adder {
$border: $gray; $border: $gray;
$hoverborder: $gray-dark; $hoverborder: $gray-dark;
@include box-sizing(border-box); @include box-sizing(border-box);
......
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