post selectText message
This commit is contained in:
parent
ebab25c47d
commit
b4434ec404
1 changed files with 8 additions and 0 deletions
|
@ -345,6 +345,7 @@ txtjs.renderText = function(text) {
|
|||
html = text.replace(/</g, '<').replace(/>/g, '>')
|
||||
html = html.replace().replace(/\r\n/g, '\n').replace(/[\r\n]/g, '<br>')
|
||||
txtjs.html = Ox.encodeHTMLEntities(text).replace(/\r\n/g, '\n').replace(/[\r\n]/g, '<br>')
|
||||
window.addEventListener('mouseup', onMouseup)
|
||||
window.addEventListener('resize', onResize)
|
||||
window.addEventListener('scroll', onScroll)
|
||||
document.addEventListener('keydown', function(e) {
|
||||
|
@ -418,6 +419,13 @@ txtjs.renderText = function(text) {
|
|||
txtjs.renderSVGs()
|
||||
let factor, margin
|
||||
onResize()
|
||||
function onMouseup() {
|
||||
let note = txtjs.getNoteFromSelection()
|
||||
if (!note || txtjs.noteExists(note)) {
|
||||
txtjs.postMessage('selectText', null)
|
||||
}
|
||||
txtjs.postMessage('selectText', note)
|
||||
}
|
||||
function onResize() {
|
||||
factor = scrollTextElement.clientHeight / textElement.clientHeight
|
||||
margin = textElement.offsetWidth * 0.1
|
||||
|
|
Loading…
Reference in a new issue