Skip to content

Commit

Permalink
Also store query in query-json if present in the page
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrancart committed Oct 15, 2024
1 parent aac5c5a commit 8f65c34
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sparnatural-bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ bindSparnaturalWithYasqe = function(sparnatural, yasqe, yasr) {
sparnatural.addEventListener("queryUpdated", (event) => {
queryString = sparnatural.expandSparql(event.detail.queryString);
yasqe.setValue(queryString);
if(document.getElementById('query-json') != null) {
// save query in JSON
document.getElementById('query-json').value = JSON.stringify(event.detail.queryJson)
}
});

sparnatural.addEventListener("submit", (event) => {
Expand Down Expand Up @@ -79,6 +83,10 @@ bindSparnaturalWithItself = function(sparnatural, yasqe, yasr) {
sparnatural.addEventListener("queryUpdated", (event) => {
queryString = sparnatural.expandSparql(event.detail.queryString);
yasqe.setValue(queryString);
if(document.getElementById('query-json') != null) {
// save query in JSON
document.getElementById('query-json').value = JSON.stringify(event.detail.queryJson)
}
});

sparnatural.addEventListener("submit", (event) => {
Expand Down

0 comments on commit 8f65c34

Please sign in to comment.