Skip to content

Commit d028573

Browse files
author
Jeffrey Shen
committed
Support renderValue within iframe
1 parent 2368c0c commit d028573

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

inst/htmlwidgets/plotly.js

+8
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ HTMLWidgets.widget({
155155
x.config.modeBarButtonsToRemove.push("sendDataToCloud");
156156
}
157157

158+
// if the object was passed in from another window, plotly will falsely think it isn't a "plain object"
159+
if (inIframe())
160+
Object.setPrototypeOf(x, Object.prototype);
161+
158162
// if no plot exists yet, create one with a particular configuration
159163
if (!instance.plotly) {
160164

@@ -832,6 +836,10 @@ function isPlainObject(obj) {
832836
);
833837
}
834838

839+
function inIframe() {
840+
return window && window.self !== window.top;
841+
}
842+
835843
function subsetArrayAttrs(obj, indices) {
836844
var newObj = {};
837845
Object.keys(obj).forEach(function(k) {

0 commit comments

Comments
 (0)