From e8952e7c21f734c3aa8b833d081b2ef079fe9b70 Mon Sep 17 00:00:00 2001 From: sebastien Date: Sat, 29 Jul 2017 05:21:16 -0400 Subject: [PATCH] Include workaround in example --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e048bc7..e98e0fd 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,13 @@ reactive copy-to-clipboard UI button component, called `rclipButton`, for ### Example -This example only works when deployed on a Shiny server. If this app is run from -RStudio, the UI displays correctly but the rclipButton UI button is not functional. -A workaround is to also include an observeEvent associated to the rclipButton and -use the clipr function from the clipr package (this function only works when the app -is run locally, eg from RStudio, and not when deployed on a server). +This example works when deployed on a Shiny server or when it is run from +RStudio. However, because of limitations in the web engine of current RStudio +versions, the rclipButton does not work natively when the application is run +locally. A workaround must be implemented in the form of an observeEvent associated +to the rclipButton and using the clipr function from the clipr package. Note that +this function only works when the application is run locally and not when deployed +on a server. ```R @@ -44,6 +46,9 @@ server <- function(input, output) { rclipButton("clipbtn", "rclipButton Copy", input$copytext, icon("clipboard")) }) + # Workaround for execution within RStudio + observeEvent(input$clipbtn, clipr::write_clip(input$copytext)) + } shinyApp(ui = ui, server = server)