Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: requal
Title: Shiny Application for Computer-Assisted Qualitative Data Analysis
Version: 1.2.4.9005
Version: 1.2.4.9006
Authors@R:
c(
person(given = "Radim",
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- foreign keys now enforced in SQLite
- default document encoding is now processed explicitly
- other minor fixes
- selecting segments on smartphones/tablets and by combination of mouse and keyboard now works

# requal 1.1.3 Rieppeleon

Expand Down
1 change: 1 addition & 0 deletions R/mod_document_code.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ mod_document_code_ui <- function(id) {
tags$article(
id = "article",
class = "scrollable80",
tabindex = 0,
.noWS = "outside"
),
.noWS = "outside"
Expand Down
18 changes: 12 additions & 6 deletions inst/app/www/document_code_js.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ function getCaretCharacterOffsetWithin(element) {
return caretOffset;
}

// Function to send calculated positions to Shiny
$( document ).ready(function() {
document.addEventListener('mouseup', function () {
var sel = window.getSelection();
// if(window.getSelection().baseNode.parentNode.id != "document_code_ui_1-focal_text") return;
function updateSelection() {
var sel = window.getSelection();
if(window.getSelection().anchorNode.parentNode.closest('article') == null) return;

if(sel.rangeCount > 0){
var range = sel.getRangeAt(0);
Expand Down Expand Up @@ -68,8 +66,16 @@ document.addEventListener('mouseup', function () {
console.log("tag_position" + tag_position_value)
Shiny.setInputValue('document_code_ui_1-tag_position', tag_position_value);
}
}, false);
}

// Function to send calculated positions to Shiny
$( document ).ready(function() {
var el = document.getElementById("document_code_ui_1-focal_text")
el.addEventListener('mouseup', updateSelection);
el.addEventListener('keyup', updateSelection);
el.addEventListener('touchend', updateSelection);
})

// Obtain information from iframe and send to Shiny
$(document).ready(function() {
var iframe = document.getElementsByTagName('iframe')[0];
Expand Down