jdtrat / shinymarkdown

Packages JavaScript's Toast UI Markdown Editor for use in R with Shiny.
Other
7 stars 4 forks source link

Added refresh rate #6

Open jdtrat opened 3 years ago

jdtrat commented 3 years ago

Added functionality for debouncing and/or manually sending the editor's contents to Shiny re: #1

jdtrat commented 3 years ago

The new refresh_rate argument can be tested with the following code (assuming devtools::load_all() was run).

library(shiny)
ui <- fluidPage(
  br(),
  mdInput(inputId = "one", refresh_rate = "manual", height = "360px", hide_mode_switch = F),
  br(),
  mdInput(inputId = "two", refresh_rate = 500, height = "360px", hide_mode_switch = F)
)

server <- function(input, output, session) {

  # Print the markdown version of what is typed
  observe({print(input$one_markdown)})

  # Print the HTML version of what is typed
  observe({print(input$one_html)})

  # Print the markdown version of what is typed
  observe({print(input$two_markdown)})

  # Print the HTML version of what is typed
  observe({print(input$two_html)})

}

shinyApp(ui, server)

}

A screenshot from the above app: Screen Shot 2021-03-16 at 10 18 14 PM