https://github.com/timelyportfolio/excalidrawr
Excalidraw for R
https://github.com/timelyportfolio/excalidrawr
Last synced: 2 months ago
JSON representation
Excalidraw for R
- Host: GitHub
- URL: https://github.com/timelyportfolio/excalidrawr
- Owner: timelyportfolio
- Created: 2020-12-21T12:55:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-22T15:12:04.000Z (over 4 years ago)
- Last Synced: 2025-02-01T21:05:44.428Z (3 months ago)
- Language: R
- Size: 681 KB
- Stars: 22
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
- jimsghstars - timelyportfolio/excalidrawr - Excalidraw for R (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# excalidrawrQuick experiment to wrap [Excalidraw](https://excalidraw.com/) for use in R.
## Installation
``` r
remotes::install_github("timelyportfolio/excalidrawr")
```## Example
Currently, the package does very little except open an `Excalidraw` instance ready for your creative adventures.
``` r
library(excalidrawr)excalidraw()
```We can also use the `onChange` prop to communicate with Shiny.
``` r
library(htmltools)
library(shiny)
library(excalidrawr)ui <- excalidraw(
onChange = htmlwidgets::JS(
"
function(elements, state) {
if(Shiny && Shiny.setInputValue) {
Shiny.setInputValue('excal1', {elements})
}
}
"
),
elementId = "excal1"
)server <- function(input, output, session) {
draw <- reactive({
input$excal1
})
draw_d <- debounce(draw, 1000)
observe({
str(draw_d())
})
}shinyApp(ui, server)
```