@@ -65,20 +65,29 @@ rangeslider <- function(p, ...) {
65
65
66
66
config <- function (p , ... ) {
67
67
attrs <- list (... )
68
- # accumulate these attributes
68
+ # make sure we have the right defaults
69
+ p $ x $ config <- p $ x $ config %|| % list ()
70
+ p $ x $ config [[" modeBarButtonsToRemove" ]] <-
71
+ p $ x $ config [[" modeBarButtonsToRemove" ]] %|| % ' sendDataToCloud'
72
+ p $ x $ config [[" modeBarButtonsToAdd" ]] <-
73
+ p $ x $ config [[" modeBarButtonsToAdd" ]] %|| % list (sharingButton())
74
+
75
+ # now accumulate
76
+ p $ x $ config [[" modeBarButtonsToAdd" ]] <- c(
77
+ p $ x $ config [[" modeBarButtonsToAdd" ]],
78
+ attrs [[" modeBarButtonsToAdd" ]]
79
+ )
69
80
p $ x $ config [[" modeBarButtonsToRemove" ]] <- c(
70
- p $ x $ config [[" modeBarButtonsToRemove" ]] % || % ' sendDataToCloud ' ,
81
+ p $ x $ config [[" modeBarButtonsToRemove" ]],
71
82
attrs [[" modeBarButtonsToRemove" ]]
72
83
)
73
- # include the plotly book collaboration link?
74
- removeCollab <- " Collaborate " %in% p $ x $ config [[ " modeBarButtonsToRemove " ]]
75
- if (length(p $ x $ config [[" modeBarButtonsToRemove" ]])) {
84
+
85
+ # ensure array
86
+ if (length(p $ x $ config [[" modeBarButtonsToRemove" ]]) == 1 ) {
76
87
p $ x $ config [[" modeBarButtonsToRemove" ]] <- list (p $ x $ config [[" modeBarButtonsToRemove" ]])
77
88
}
78
- p $ x $ config [[" modeBarButtonsToAdd" ]] <- c(
79
- if (! removeCollab ) list (sharingButton()),
80
- attrs [[" modeBarButtonsToAdd" ]]
81
- )
89
+
90
+ # overwrite the other arguments
82
91
attrs <- attrs [! grepl(" modeBarButtonsTo" , names(attrs ))]
83
92
p $ x $ config <- modify_list(p $ x $ config , attrs )
84
93
p
0 commit comments