diff --git a/NEWS b/NEWS index 328a080dd..ada331c17 100644 --- a/NEWS +++ b/NEWS @@ -6,8 +6,6 @@ BUG FIXES and IMPROVEMENTS * Update jQuery to utilize `{jquerylib}`. (#817) -* `leafletOutput()`'s `height` and `width` now defaults to `NULL`, allowing it have more flexible default sizing behavior, which will be primarily useful in combination with `{bslib}`'s new `card()` API. (#2192) - * Use `xfun::base64_uri()` for base64 encoding instead of **markdown** and **base64enc**. (#823) leaflet 2.1.1 diff --git a/R/shiny.R b/R/shiny.R index 91708a11a..1da88f1fa 100644 --- a/R/shiny.R +++ b/R/shiny.R @@ -18,7 +18,7 @@ #' ) #' #' \donttest{if (interactive()) app} -leafletOutput <- function(outputId, width = NULL, height = NULL) { +leafletOutput <- function(outputId, width = "100%", height = 400) { htmltools::attachDependencies( htmlwidgets::shinyWidgetOutput(outputId, "leaflet", width, height, "leaflet"), leafletBindingDependencies(), diff --git a/inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css b/inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css index 61edf1fb4..c10d2f113 100644 --- a/inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css +++ b/inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css @@ -39,8 +39,3 @@ Fix for https://github.com/rstudio/rmarkdown/issues/1949 */ max-width: none !important; max-height: none !important; } - -.leaflet.html-widget { - height: 400px; - width: 100%; -} diff --git a/man/map-shiny.Rd b/man/map-shiny.Rd index 0e7e004dc..5ee740b98 100644 --- a/man/map-shiny.Rd +++ b/man/map-shiny.Rd @@ -5,7 +5,7 @@ \alias{renderLeaflet} \title{Wrapper functions for using \pkg{leaflet} in \pkg{shiny}} \usage{ -leafletOutput(outputId, width = NULL, height = NULL) +leafletOutput(outputId, width = "100\%", height = 400) renderLeaflet(expr, env = parent.frame(), quoted = FALSE) }