editor-proxy-show-hide | R Documentation |
Show/hide an editor
editor_proxy_show(proxy)
editor_proxy_hide(proxy)
proxy |
A |
A editor_proxy
object.
Other editor proxy methods:
editor_proxy()
,
editor_proxy_change_preview()
,
editor_proxy_insert()
library(shiny)
library(toastui)
ui <- fluidPage(
tags$h2("Use editor's proxy"),
fluidRow(
column(
width = 4,
radioButtons(
inputId = "changePreviewStyle",
label = "change preview style",
choices = c("tab", "vertical")
),
checkboxInput(
inputId = "showhide",
label = "Show/hide editor",
value = TRUE
),
textInput(
inputId = "text",
label = "Text to insert:",
width = "100%"
),
actionButton("insert", "Insert text")
),
column(
width = 8,
editorOutput("my_editor")
)
)
)
server <- function(input, output, session) {
output$my_editor <- renderEditor({
editor()
})
observeEvent(input$changePreviewStyle, {
editor_proxy_change_preview("my_editor", input$changePreviewStyle)
}, ignoreInit = TRUE)
observeEvent(input$showhide, {
if (input$showhide) {
editor_proxy_show("my_editor")
} else {
editor_proxy_hide("my_editor")
}
}, ignoreInit = TRUE)
observeEvent(input$insert, {
editor_proxy_insert("my_editor", text = input$text)
})
}
if (interactive())
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.