Skip to content

Commit

Permalink
enter/escape key handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
aronatkins committed Jul 21, 2015
1 parent 9ae06e4 commit c053412
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R/params.R
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,16 @@ knit_params_ask <- function(file = NULL,
shiny::fluidRow(shiny::column(12,shiny::tags$ul(lapply(unconfigurable, function(param) { shiny::tags$li(param$name) })))))
}
contents <- shiny::tagAppendChild(contents, shiny::fluidRow(shiny::column(12,shiny::textOutput("values"))))

ui <- shiny::fluidPage(
shiny::tags$head(shiny::tags$style(".container-fluid .shiny-input-container { width: auto; }",
"button.rmd-action { margin-left: 10px; }")),
"button.rmd-action { margin-left: 10px; }"),
## Escape is "cancel" and Enter is "save".
shiny::tags$script(shiny::HTML("$(document).keyup(function(e) {\n",
"if (e.which == 13) { $('#save').click(); } // enter\n",
"if (e.which == 27) { $('#cancel').click(); } // esc\n",
"});"
))),
contents)

shiny_app <- shiny::shinyApp(ui = ui, server = server)
Expand Down

0 comments on commit c053412

Please sign in to comment.