trestletech/shinyAce

Cannot use a certain ID for Shiny app with shinyAce

CinchBlue opened this issue · 1 comments

Hello,

library(shiny)
library(shinyAce)

#' Define UI for application that demonstrates a simple Ace editor
ui <- 
  navbarPage('asdfsadf',
    tabPanel('Hello',
    headerPanel("Shiny Ace Evaluate Code"),
          aceEditor("codebox.code", mode="r", value="df <- data.frame(num=1:4, 
            let=LETTERS[2:5], 
            rand=rnorm(4))
          df"),
          actionButton("codebox.eval", "Evaluate"),
        div(class="span6",
          h2("Output"),
          verbatimTextOutput("codebox.output")
        )
      )
  )



#' Define server logic required to generate simple ace editor
server <- function(input, output, session) {
  output$codebox.output <- renderPrint({
    input$codebox.eval
    return(isolate(eval(parse(text=input$codebox.code))))
  })  
}

shinyApp(ui, server)

The code above does not result in the correct behavior for the Ace editor. My guess is that the ID, when coverted to JavaScript, results in certain problems. The codebox. ID prefix doesn't cause problems if I change it to codebox_

Should be fixed now. Can you test on the latest commit on master?