From eb28fc368198a8978e4bcc9fd1f8f343662ed319 Mon Sep 17 00:00:00 2001
From: "arsenij.ustjanzew" <arsenij.ustjanzew@mpi-bn.mpg.de>
Date: Mon, 2 Mar 2020 14:54:11 +0100
Subject: [PATCH 1/2] implemented workaround for plotly dependencies issue

---
 inst/templates/vis_object.Rmd | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/inst/templates/vis_object.Rmd b/inst/templates/vis_object.Rmd
index 425765a..a43ef1c 100644
--- a/inst/templates/vis_object.Rmd
+++ b/inst/templates/vis_object.Rmd
@@ -7,7 +7,20 @@ if (!requireNamespace("<% package %>", quietly = TRUE)) {
     stop('The package <% package %> is needed to embed objects of class <% class %>.', call. = FALSE)
 }
 
-readRDS(file.path(datadir, '<% component_id %>.rds'))
+vis_<% component_id %> <- readRDS(file.path(datadir, '<% component_id %>.rds'))
+
+# workaround for plotly dependencies issue (https://github.com/ropensci/plotly/issues/1044)
+# 
+fix_dependency <- function(dependency){
+  if(dependency$name == "jquery") dependency$src$file <- file.path(system.file(package ="crosstalk"), "lib/jquery")
+  if(dependency$name == "crosstalk") dependency$src$file <- file.path(system.file(package ="crosstalk"), "www")
+  return(dependency)
+}
+if ("<% package %>" == "plotly"){
+  vis_<% component_id %>$dependencies <- lapply(vis_<% component_id %>$dependencies, fix_dependency)  
+}
+
+vis_<% component_id %>
 ```
 
 
-- 
GitLab


From 3740532899fd2218512fa1cd61391e01b9f53c8a Mon Sep 17 00:00:00 2001
From: "arsenij.ustjanzew" <arsenij.ustjanzew@mpi-bn.mpg.de>
Date: Mon, 2 Mar 2020 15:03:17 +0100
Subject: [PATCH 2/2] added crosstalk to Suggests in the DESCRIPTION

---
 DESCRIPTION | 1 +
 1 file changed, 1 insertion(+)

diff --git a/DESCRIPTION b/DESCRIPTION
index 842c233..674c5f7 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -25,6 +25,7 @@ Imports:
 Suggests: 
     highcharter,
     plotly,
+    crosstalk,
     gt,
     ggplot2,
     DT,
-- 
GitLab