add js to enable popover and hover message
diff --git a/R/print.R b/R/print.R
index 8ac5e2f..626c00d 100644
--- a/R/print.R
+++ b/R/print.R
@@ -2,7 +2,8 @@
print.kableExtra <- function(x) {
html_header <- htmltools::tags$head(
rmarkdown::html_dependency_jquery(),
- rmarkdown::html_dependency_bootstrap(theme = "simplex")
+ rmarkdown::html_dependency_bootstrap(theme = "simplex"),
+ html_dependency_kePrint()
)
html_table <- htmltools::HTML(as.character(x))
@@ -10,6 +11,13 @@
htmltools::html_print(htmltools::tagList(html_header, html_table))
}
+html_dependency_kePrint <- function() {
+ htmlDependency(name = "kePrint",
+ version = "0.0.1",
+ src = system.file("htmlwidgets/lib/kePrint-0.0.1",
+ package = "kableExtra"),
+ script = "kePrint.js")
+}
#' @export
knit_print.kableExtra <- function(x) {
diff --git a/R/spec_tools.R b/R/spec_tools.R
index b1892b2..76fb7dd 100644
--- a/R/spec_tools.R
+++ b/R/spec_tools.R
@@ -95,7 +95,8 @@
#'
#' @export
spec_tooltip <- function(title, position = "right") {
- position <- match.arg(position, c("right", "bottom", "top", "left", "auto"))
+ position <- match.arg(position, c("right", "bottom", "top", "left", "auto"),
+ several.ok = TRUE)
tooltip_options <- paste(
'data-toggle="tooltip"',
paste0('data-placement="', position, '"'),
diff --git a/inst/htmlwidgets/lib/kePrint-0.0.1/kePrint.js b/inst/htmlwidgets/lib/kePrint-0.0.1/kePrint.js
new file mode 100644
index 0000000..4f9728d
--- /dev/null
+++ b/inst/htmlwidgets/lib/kePrint-0.0.1/kePrint.js
@@ -0,0 +1,4 @@
+$(document).ready(function(){
+ $('[data-toggle="tooltip"]').tooltip();
+ $('[data-toggle="popover"]').popover();
+});