svalvaro / quill

An R interface to QuillJS
4 stars 0 forks source link

An R interface to QuillJS ggplot2 website

R-CMD-check

Quill is an open-source JavaScript library to generate rich text editors. This R package makes it easy to create Quill editors from R.

library(quill)
quill() 

Installation

You can install the development version of quill from GitHub with:

# install.packages("pak")
pak::pak("svalvaro/quill")

Example

Checkout the example shiny app at inst/examples/shiny/app.R.

## basic example of functioning in Shiny
library(quill)

ui <- fluidPage(
  ... 
  quillOutput("text_editor")
  ...
)

server <- function(input, output, ...) {
  ...
  output$text_editor <- renderQuill({
    quill(toolbar = toolbar_options(code = TRUE)) 
  })

  # You can listen what the user is writing in HTML, JSON, and plain text
  observeEvent(input$text_editor_content, {
    get_editor_content(input$text_editor_content, format = "HTML")
  }
  ...
}