JohnCoene / cicerone

🏛️ Give tours of your Shiny apps
https://cicerone.john-coene.com
Other
187 stars 7 forks source link

allow additional arguments with on_highlighted with mathjax #19

Closed etiennebacher closed 3 years ago

etiennebacher commented 3 years ago

The latest commit that enabled MathJax prevents from passing additional arguments to on_highlighted. This PR corrects this. Example of misfunction (check the console):

library(shiny)

guide <- Cicerone$
  new(mathjax = TRUE)$ # enable MathJax
  step(
    el = "text_inputId",
    title = helpText('Dynamic output 1:  $$\\alpha^2$$'),
    description = "This is where you enter the text you want to print.",
    on_highlighted = "console.log('something')"
  )

ui <- fluidPage(
  withMathJax(), # include MathJax
  use_cicerone(), 
  textInput("text_inputId", "Enter some text"),
  actionButton("submit_inputId", "Submit text")
)

server <- function(input, output){

  guide$init()$start()

}

shinyApp(ui, server)