Compare commits

..

No commits in common. "d5282b064a7b9936fcf1d3ed2563e54f00c4cc64" and "a71ffdb82fbc449ad6fe8b46f164c601d52b701e" have entirely different histories.

View file

@ -219,9 +219,7 @@ txtjs.noteExists = function(note) {
txtjs.onMessage = function(data, event) {
if (event == 'selectAnnotation') {
txtjs.selectNote(data.id, false)
} else if (event == 'addAnnotation') {
txtjs.addNoteFromSelection()
txtjs.selectNote(data.id)
} else if (event == 'addAnnotations') {
data.annotations.forEach(function(note) {
txtjs.renderNote(note)
@ -445,9 +443,8 @@ txtjs.renderText = function(text) {
let note = txtjs.getNoteFromSelection()
if (!note || txtjs.noteExists(note)) {
txtjs.postMessage('selectText', null)
} else {
txtjs.postMessage('selectText', note)
}
txtjs.postMessage('selectText', note)
}
function onResize() {
factor = scrollTextElement.clientHeight / textElement.clientHeight
@ -479,7 +476,7 @@ txtjs.selectNextNote = function(direction) {
txtjs.selectNote(ids[Ox.mod(ids.indexOf(id) + direction, ids.length)])
}
txtjs.selectNote = function(id, trigger) {
txtjs.selectNote = function(id) {
let selected = txtjs.getSelectedNote()
if (selected) {
selected.elements.forEach(function(element) {
@ -501,7 +498,5 @@ txtjs.selectNote = function(id, trigger) {
// elements[0].scrollIntoView()
// window.scrollTo(0, elements[0].offsetTop)
}
if (trigger !== false) {
txtjs.postMessage('selectNote', {id: id})
}
txtjs.postMessage('selectNote', {id: id})
}