File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -155,10 +155,15 @@ HTMLWidgets.widget({
155
155
x . config . modeBarButtonsToRemove . push ( "sendDataToCloud" ) ;
156
156
}
157
157
158
+ // if the object was passed in from another window, plotly will falsely think it isn't a "plain object"
159
+ // to get around this, we do a deep clone of the object
160
+ if ( inIframe ( ) && ! isPlainObject ( x ) )
161
+ x = $ . extend ( true , { } , x )
162
+
158
163
// if no plot exists yet, create one with a particular configuration
159
164
if ( ! instance . plotly ) {
160
165
161
- var plot = Plotly . plot ( graphDiv , x ) ;
166
+ var plot = Plotly . plot ( graphDiv , { ... x } ) ;
162
167
instance . plotly = true ;
163
168
instance . autosize = x . layout . autosize || true ;
164
169
instance . width = x . layout . width ;
@@ -832,6 +837,10 @@ function isPlainObject(obj) {
832
837
) ;
833
838
}
834
839
840
+ function inIframe ( ) {
841
+ return window && window . self !== window . top ;
842
+ }
843
+
835
844
function subsetArrayAttrs ( obj , indices ) {
836
845
var newObj = { } ;
837
846
Object . keys ( obj ) . forEach ( function ( k ) {
You can’t perform that action at this time.
0 commit comments