displayCodeModal {shinymeta}R Documentation

Display a shinyAce code editor via shiny modal

Description

Show a shinyAce::aceEditor() in a shiny::modalDialog().

Usage

displayCodeModal(
  code,
  title = NULL,
  clip = "clipboard",
  footer = shiny::modalButton("Dismiss"),
  size = c("m", "s", "l"),
  easyClose = TRUE,
  fade = TRUE,
  session = shiny::getDefaultReactiveDomain(),
  ...
)

Arguments

code

Either a language object or a character string.

title

An optional title for the dialog.

clip

An icon() name that a user can press to copy code to the clipboard. If you wish to not have an icon, specify clip = NULL.

footer

UI for footer. Use NULL for no footer.

size

One of "s" for small, "m" (the default) for medium, or "l" for large.

easyClose

If TRUE, the modal dialog can be dismissed by clicking outside the dialog box, or be pressing the Escape key. If FALSE (the default), the modal dialog can't be dismissed in those ways; instead it must be dismissed by clicking on a modalButton(), or from a call to removeModal() on the server.

fade

If FALSE, the modal dialog will have no fade-in animation (it will simply appear rather than fade in to view).

session

a shiny session object (the default should almost always be used).

...

arguments passed along to shinyAce::aceEditor()

Value

nothing. Call this function for its side effects.

See Also

outputCodeButton

Examples


if (interactive()) {
  library(shiny)
  ui <- fluidPage(
    sliderInput("n", label = "Number of samples", min = 10, max = 100, value = 30),
    actionButton("code", icon("code")),
    plotOutput("p")
  )
  server <- function(input, output) {
    output$p <- metaRender(renderPlot, {
      plot(sample(..(input$n)))
    })
    observeEvent(input$code, {
      code <- expandChain(output$p())
      displayCodeModal(code)
    })
  }
  shinyApp(ui, server)
}


[Package shinymeta version 0.2.0.3 Index]