I have an aceEditor
with a rclipboard
button. This app works fine, I mean, the code inside the aceEditor
is copied into the clipboard when I click the button:
library(shiny)
library(shinyAce)
library(rclipboard)
ui<-basicPage(
rclipboardSetup()
,aceEditor(
outputId = "aceEdId",
mode="java",
theme="cobalt",
readOnly = F,
height = "300px",
tabSize = 1,
value = "some code"
)
,uiOutput("clip")
)
server <- function(input, output) {
output$clip <- renderUI({
rclipButton(
inputId = "clipbtn",
label = "rclipButton Copy",
clipText = input[["aceEdId"]],
icon = icon("clipboard"),
tooltip = "Click me... I dare you!",
placement = "top",
options = list(delay = list(show = 800, hide = 100), trigger = "hover")
)
})
}
shinyApp(ui, server)
Now, I want the aceEditor
to be generated inside a Modal
:
library(shiny)
library(shinyAce)
library(rclipboard)
ui<-basicPage(
actionButton("btnId","Button")
)
server <- function(input, output) {
observeEvent(input$btnId,{
showModal(modalDialog(
aceEditor(
outputId = "aceEdId",
mode="java",
theme="cobalt",
readOnly = F,
height = "300px",
tabSize = 1,
value = "some code"
)
,uiOutput("clip")
,footer=tagList(
modalButton('Cancel')
)
))
})
output$clip <- renderUI({
rclipButton(
inputId = "clipbtn",
label = "rclipButton Copy",
clipText = input[["aceEdId"]],
icon = icon("clipboard"),
tooltip = "Click me... I dare you!",
placement = "top",
options = list(delay = list(show = 800, hide = 100), trigger = "hover")
)
})
}
shinyApp(ui, server)
but in this case, the button to copy into the clipboard does not work. It does not show any error, just copy nothing. Any suggestions?