Skip to content

Commit

Permalink
Include workaround in example
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien authored and sebastien committed Jul 29, 2017
1 parent 61ae92a commit e8952e7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e8952e7

Please sign in to comment.