Open etiennebacher opened 3 years ago
I am not sure if this issue has gained any traction; however, it would be very useful to have this feature. While working on a Shiny app, I was hoping to change some inputs on the Shiny server side while cicerone was running, but found no clear way to reset the values when cicerone was closed.
I ended up with something like this:
tags$script(
HTML(
"
const observer = new MutationObserver(function(mutationList){
mutationList.forEach(function(mutation) {
mutation.addedNodes.forEach(function(node) {
if(node.id == 'driver-popover-item') {
document.getElementsByClassName('driver-close-btn')[0].onclick = function() {Shiny.setInputValue('close_cicerone', true, {priority: 'event'} )};
if(document.getElementsByClassName('driver-next-btn')[0].textContent === 'Done') {
document.getElementsByClassName('driver-next-btn')[0].onclick = function() {Shiny.setInputValue('close_cicerone', true, {priority: 'event'} )};
}
}
});
});
});
observer.observe(document.querySelector('body'), { subtree: false, childList: true });
"
)
)
Which enabled me to notify Shiny when cicerone was closed and then reset the inputs as needed. It would be nice to make this a bit cleaner on cicerone.
Hi, I'm doing a self-promotion here (because this repo seems a bit inactive): this is possible with conductor
The syntax of this package is very similar to cicerone
(I basically copied a lot of code) so it should be easy to use.
It would be nice to be able to detect whether cicerone is running or not (this was already mentioned in #4 but I create a separate issue for that).
driver.js
provides an API method for that (isActivated
) but I couldn't implement that because:this is not the same as
_cicerone_next
for example, because_cicerone_next
is only available whencicerone
is running, and ifcicerone
is running, well,isActivated
will necessarily provideTRUE
So I tried to create another JS function (similar to
Shiny.addCustomMessageHandler('cicerone-start'...
for example) but I couldn't find a way to updateisActivated
when the shiny app was running.Is it possible to do that?