jdtrat/shinymarkdown

how can I add some texts into markdown editor?

Opened this issue · 1 comments

for example, click a button and then add some texts into shinymarkdown editor?

Hi @skyrealman ,
I needed to add a markdown input to my Shiny app, and found this great package. Unfortunately, it seems to be no longer maintained, so I forked it and placed some updates. You can find the {shinymarkdown} I am working on at https://github.com/jcrodriguez1989/shinymarkdown/ where I added the updateMarkdownEditorInput function which might solve your needs.
Install the package with remotes::install_github("jcrodriguez1989/shinymarkdown").
And here's an example of the updateMarkdownEditorInput function:

library(shiny)
library(shinymarkdown)

ui <- fluidPage(
  useShinyMarkdownEditor(),
  actionButton("reset", "Reset"),
  markdownEditorInput(inputId = "editor")
)

server <- function(input, output, session) {
  observeEvent(input$reset, updateMarkdownEditorInput(session, "editor", ""))
}

shinyApp(ui, server)