Skip to contents

Create a tiddlywiki widget from htmlwidget

Usage

tw_widget(widget)

Arguments

widget

an object of htmlwidget

Value

a new tiddlywiki widget

Examples

library(leaflet)
content <- paste(sep = "<br/>",
                 "<b><a href='http://www.samurainoodle.com'>Samurai Noodle</a></b>",
                 "606 5th Ave. S",
                 "Seattle, WA 98138"
)

widget <- leaflet() %>% addTiles() %>%
    addPopups(-122.327298, 47.597131, content,
                  options = popupOptions(closeButton = FALSE)
    )
tw_widget(widget)
#> <$htmlwidgets type="leaflet" uuid="htmlwidget-540b81f1cc5994583999" data="""{"x":{"options":{"crs":{"crsClass":"L.CRS.EPSG3857","code":null,"proj4def":null,"projectedBounds":null,"options":{}}},"calls":[{"method":"addTiles","args":["https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",null,null,{"minZoom":0,"maxZoom":18,"tileSize":256,"subdomains":"abc","errorTileUrl":"","tms":false,"noWrap":false,"zoomOffset":0,"zoomReverse":false,"opacity":1,"zIndex":1,"detectRetina":false,"attribution":"&copy; <a href=\"https://openstreetmap.org\">OpenStreetMap<\/a> contributors, <a href=\"https://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA<\/a>"}]},{"method":"addPopups","args":[47.597131,-122.327298,"<b><a href='http://www.samurainoodle.com'>Samurai Noodle<\/a><\/b><br/>606 5th Ave. S<br/>Seattle, WA 98138",null,null,{"maxWidth":300,"minWidth":50,"autoPan":true,"keepInView":false,"closeButton":false,"className":""}]}],"limits":{"lat":[47.597131,47.597131],"lng":[-122.327298,-122.327298]}},"evals":[],"jsHooks":[]}"""/>
#> [1] "<$htmlwidgets type=\"leaflet\" uuid=\"htmlwidget-540b81f1cc5994583999\" data=\"\"\"{\"x\":{\"options\":{\"crs\":{\"crsClass\":\"L.CRS.EPSG3857\",\"code\":null,\"proj4def\":null,\"projectedBounds\":null,\"options\":{}}},\"calls\":[{\"method\":\"addTiles\",\"args\":[\"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\",null,null,{\"minZoom\":0,\"maxZoom\":18,\"tileSize\":256,\"subdomains\":\"abc\",\"errorTileUrl\":\"\",\"tms\":false,\"noWrap\":false,\"zoomOffset\":0,\"zoomReverse\":false,\"opacity\":1,\"zIndex\":1,\"detectRetina\":false,\"attribution\":\"&copy; <a href=\\\"https://openstreetmap.org\\\">OpenStreetMap<\\/a> contributors, <a href=\\\"https://creativecommons.org/licenses/by-sa/2.0/\\\">CC-BY-SA<\\/a>\"}]},{\"method\":\"addPopups\",\"args\":[47.597131,-122.327298,\"<b><a href='http://www.samurainoodle.com'>Samurai Noodle<\\/a><\\/b><br/>606 5th Ave. S<br/>Seattle, WA 98138\",null,null,{\"maxWidth\":300,\"minWidth\":50,\"autoPan\":true,\"keepInView\":false,\"closeButton\":false,\"className\":\"\"}]}],\"limits\":{\"lat\":[47.597131,47.597131],\"lng\":[-122.327298,-122.327298]}},\"evals\":[],\"jsHooks\":[]}\"\"\"/>"