-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A HTML widget viewer for the webR application, similar to `browseURL(…
…)` (#449) * Resize canvas device in empty environment Avoids leaking `devices` and `idx` into the global environment. * Switch to COEP: credentialless * Add viewer output message to webr support package * Add HTML widget viewer to webR application * Update NEWS.md
- Loading branch information
1 parent
6e7ac09
commit f2f079a
Showing
11 changed files
with
250 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#' Generate an output message when a URL is browsed to | ||
#' | ||
#' @description | ||
#' When enabled, the R `viewer` option is set so that a request to display | ||
#' a URL generates a webR output message. The request is forwarded to the main | ||
#' thread to be handled by the application loading webR. | ||
#' | ||
#' This does the equivalent of the base R function `utils::browseURL()`. | ||
#' | ||
#' @export | ||
viewer_install <- function() { | ||
options( | ||
viewer = function(url, ...) { | ||
webr::eval_js(paste0( | ||
"chan.write({", | ||
" type: 'browse',", | ||
" data: { url: '", url, "' },", | ||
"});" | ||
)) | ||
invisible(NULL) | ||
} | ||
) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.