/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var React = require("react");
var dashboard_1 = require("../dashboard");
/**
* The Dragable Frame of a Widget.
* Contains generic UI controls, shared by all Widgets
*/
var WidgetIFrame = (function (_super) {
__extends(WidgetIFrame, _super);
function WidgetIFrame(props) {
_super.call(this, props);
}
WidgetIFrame.prototype.componentDidMount = function () {
var element = this.refs['frame'];
var widgetFactory = dashboard_1.default.getInstance().widgetPluginRegistry.getPlugin(this.props.widgetState.type);
var widgetInstance = widgetFactory.getInstance(this.props.widgetState.id);
widgetInstance.iFrame = element;
};
// allow-popups allow-same-origin allow-modals allow-forms
// A sandbox that includes both the allow-same-origin and allow-scripts flags,
// then the framed page can reach up into the parent, and remove the sandbox attribute entirely.
// Only if the framed content comes from the same origin of course.
WidgetIFrame.prototype.render = function () {
return React.createElement("iframe", {id: 'frame-' + this.props.widgetState.id, ref: "frame", src: "widget.html#" + this.props.widgetPluginState.url, frameBorder: "0", width: "100%", height: "100%", scrolling: "no", sandbox: "allow-scripts"}, "Browser does not support iFrames.");
};
;
return WidgetIFrame;
}(React.Component));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = WidgetIFrame;
|