toCanvasBtn {drawer}R Documentation

Screenshot HTML elements to canvas button

Description

A bootstrap button that allows users to take a screenshot of specified HTML element (usually an image) and send it to the drawer canvas for editing. In addition, you can download it as "png" or "jpg" by opening up the dropdown menu.

Usage

toCanvasBtn(
  dom,
  canvasID,
  isID = TRUE,
  id = "",
  label = "To Canvas",
  color_class = "primary"
)

Arguments

dom

a HTML DOM selector, mostly common is to select the element by ID: e.g. a plot with ID "plot1", to select, use dom = "plot1" to select the plot if isID = TRUE. If isID = FALSE, use dom = "#plot1"

Other complex selector is supported. First turn isID = FALSE, then try things like dom = ".btn i" selects an icon inside an element with "btn" class. If more than one element is matched, only the first one will be screenshoted.

canvasID

string, the ID of canvas. Unlike dom, you should not add "#" for canvasID even if isID=FALSE

isID

bool, TRUE if you want to select the dom by HTML ID, FALSE if the selector is other than ID.

id

string, ID for this button, optional

label

label of this button, optional

color_class

bootstrap button color class suffix, usually one of 'default', 'primary', 'info', 'success', 'warning', 'danger'

Details

This component will not work unless a drawer canvas has been loaded on current document.

Value

a button

Examples

# see example of "canvas", `?canvas`

[Package drawer version 0.2.0.0 Index]