Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions inst/templates/widget_r.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ ${name} <- function(message, width = NULL, height = NULL, elementId = NULL) {
)
}

#' Called by HTMLWidgets to produce the widget's root element.
#' @noRd
widget_html.${name} <- function(id, style, class, ...) {
htmltools::tagList(
# Necessary for RStudio viewer version < 1.2
reactR::html_dependency_corejs(),
reactR::html_dependency_react(),
reactR::html_dependency_reacttools(),
htmltools::tags$div(id = id, class = class, style = style)
)
}

#' Shiny bindings for ${name}
#'
#' Output and render functions for using ${name} within Shiny
Expand Down Expand Up @@ -48,15 +60,3 @@ render${capName} <- function(expr, env = parent.frame(), quoted = FALSE) {
if (!quoted) { expr <- substitute(expr) } # force quoted
htmlwidgets::shinyRenderWidget(expr, ${name}Output, env, quoted = TRUE)
}

#' Called by HTMLWidgets to produce the widget's root element.
#' @noRd
${name}_html <- function(id, style, class, ...) {
htmltools::tagList(
# Necessary for RStudio viewer version < 1.2
reactR::html_dependency_corejs(),
reactR::html_dependency_react(),
reactR::html_dependency_reacttools(),
htmltools::tags$div(id = id, class = class, style = style)
)
}