Skip to content
Snippets Groups Projects
Commit 2f0d3697 authored by john's avatar john
Browse files

no double accept/reject containers when selecting part of the track annotation

parent 2d374275
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,10 @@ class TrackChangeComponent extends AnnotationComponent {
.append(separator)
.append(reject)
if (this.shouldHideContainer()) {
container.addClass('sc-accept-reject-container-hide')
}
let el = $$('span')
.attr('data-id', id)
.addClass(this.getClassNames())
......@@ -37,8 +41,8 @@ class TrackChangeComponent extends AnnotationComponent {
if (status === 'add') el.addClass('sc-track-add-show')
}
const className = 'sc-track-change-' + status
el.addClass(className)
const statusClass = 'sc-track-change-' + status
el.addClass(statusClass)
return el
}
......@@ -77,6 +81,21 @@ class TrackChangeComponent extends AnnotationComponent {
return trackChangesView
}
shouldHideContainer () {
const annotation = this.props.node
const annotationSelection = annotation.getSelection()
const surface = this.context.surfaceParent
const selection = surface.getSelection()
if (selection.isNull() || selection.isCollapsed()) return false
const overlaps = selection.overlaps(annotationSelection)
const contains = selection.contains(annotationSelection)
if (overlaps && !contains) return true
return false
}
}
export default TrackChangeComponent
......@@ -3,7 +3,7 @@ $red: #f00;
$yellow: #f7f70c;
.se-selection-fragment {
.sc-accept-reject-container:only-of-type {
.sc-accept-reject-container.sc-accept-reject-container-hide {
display: none;
}
}
......
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