rename selection event to selectText, replace deselectAnnotation with selectAnnotation({id: null})
This commit is contained in:
parent
5186079059
commit
2c5c56c036
3 changed files with 15 additions and 16 deletions
|
|
@ -81,7 +81,7 @@ function deselectAllAnnotations() {
|
|||
g.classList.remove('selected')
|
||||
if (!Ox.contains(ids, id)) {
|
||||
ids.push(id)
|
||||
Ox.$parent.postMessage('deselectAnnotation', {id: id})
|
||||
Ox.$parent.postMessage('selectAnnotation', {id: null})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -179,7 +179,7 @@ document.onreadystatechange = function () {
|
|||
currentSelection = null
|
||||
}
|
||||
if (!currentSelection) {
|
||||
Ox.$parent.postMessage('selection', false)
|
||||
Ox.$parent.postMessage('selectText', false)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -194,7 +194,7 @@ document.onreadystatechange = function () {
|
|||
text: text,
|
||||
contents: contents
|
||||
}
|
||||
Ox.$parent.postMessage('selection', text ? true : false)
|
||||
Ox.$parent.postMessage('selectText', text ? true : false)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,9 +60,9 @@ window.addEventListener('keydown', function(event) {
|
|||
window.addEventListener('mouseup', function(event) {
|
||||
var selection = window.getSelection()
|
||||
if (selection.isCollapsed) {
|
||||
Ox.$parent.postMessage('selection', false)
|
||||
Ox.$parent.postMessage('selectText', false)
|
||||
} else {
|
||||
Ox.$parent.postMessage('selection', true)
|
||||
Ox.$parent.postMessage('selectText', true)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ function renderAnnotation(annotation) {
|
|||
el.addEventListener('click', function() {
|
||||
if (el.classList.contains('selected')) {
|
||||
deselectAnnotation(annotation.id)
|
||||
Ox.$parent.postMessage('deselectAnnotation', {id: annotation.id})
|
||||
Ox.$parent.postMessage('selectAnnotation', {id: null})
|
||||
} else {
|
||||
selectAnnotation(annotation.id)
|
||||
Ox.$parent.postMessage('selectAnnotation', {id: annotation.id})
|
||||
|
|
@ -178,7 +178,7 @@ function deselectAllAnnotations() {
|
|||
console.log('deselect', g, id)
|
||||
if (!Ox.contains(ids, id)) {
|
||||
ids.push(id)
|
||||
Ox.$parent.postMessage('deselectAnnotation', {id: id})
|
||||
Ox.$parent.postMessage('selectAnnotation', {id: null})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue