File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,18 @@ HTMLWidgets.widget({
156
156
}
157
157
}
158
158
159
+ // remove "sendDataToCloud", unless user has specified they want it
160
+ x . config = x . config || { } ;
161
+ if ( ! x . config . cloud ) {
162
+ x . config . modeBarButtonsToRemove = x . config . modeBarButtonsToRemove || [ ] ;
163
+ x . config . modeBarButtonsToRemove . push ( "sendDataToCloud" ) ;
164
+ }
165
+
166
+ // if the object was passed in from another window, plotly will falsely think it isn't a "plain object"
167
+ // to get around this, we have to create a deep copy of the object
168
+ if ( inIframe ( ) && ! isPlainObject ( x ) )
169
+ x = JSON . parse ( JSON . stringify ( x ) )
170
+
159
171
// if no plot exists yet, create one with a particular configuration
160
172
if ( ! instance . plotly ) {
161
173
@@ -876,6 +888,10 @@ function isPlainObject(obj) {
876
888
) ;
877
889
}
878
890
891
+ function inIframe ( ) {
892
+ return window && window . self !== window . top ;
893
+ }
894
+
879
895
function subsetArrayAttrs ( obj , indices ) {
880
896
var newObj = { } ;
881
897
Object . keys ( obj ) . forEach ( function ( k ) {
You can’t perform that action at this time.
0 commit comments