Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
15 changes: 10 additions & 5 deletions inst/app/www/document_code_js.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ function getCaretCharacterOffsetWithin(element) {
return caretOffset;
}

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

if(sel.rangeCount > 0){
Expand Down Expand Up @@ -68,8 +66,15 @@ 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() {
document.addEventListener('mouseup', updateSelection);
document.addEventListener('keyup', updateSelection);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keyup tady není moc dobrej, volá tu funkci furt, i když třeba píšeš jméno kódu v jiným tabu
asi něco jako $('#document_code_ui_1-focal_text').on('mouseup keyup touchend', updateSelection); bude lepší?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hlageek check it out now

document.addEventListener('touchend', updateSelection);
})

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