@@ -49,35 +49,6 @@ export class EmbedBlockComponent extends React.Component<IProps> {
4949 this . onChangeDescription = this . onChangeDescription . bind ( this ) ;
5050 }
5151
52- /**
53- * @name EmbedBlockComponent#runScripts
54- * @param {string } html
55- * @description Runs and imports all the scripts in the given HTML.
56- */
57- runScripts ( html ) {
58- const tree = $ ( '<div />' ) . html ( html ) ;
59-
60- tree . find ( 'script' ) . each ( ( i , s ) => {
61- if ( s . hasAttribute ( 'src' ) ) {
62- let url = s . getAttribute ( 'src' ) ;
63- const async = s . hasAttribute ( 'async' ) ;
64-
65- if ( url . startsWith ( 'http' ) ) {
66- url = url . substring ( url . indexOf ( ':' ) + 1 ) ;
67- }
68-
69- return $ . ajax ( { url : url , async : async , dataType : 'script' } ) ;
70- }
71-
72- try {
73- // eslint-disable-next-line no-eval
74- eval ( s . innerHTML ) ;
75- } catch ( e ) {
76- /* carry on */
77- }
78- } ) ;
79- }
80-
8152 getEntityKey ( ) {
8253 const { block} = this . props ;
8354
@@ -159,10 +130,6 @@ export class EmbedBlockComponent extends React.Component<IProps> {
159130 const isQumu = isQumuWidget ( html ) ;
160131 const { readOnly} = this . props ;
161132
162- if ( isQumu !== true ) {
163- this . runScripts ( html ) ;
164- }
165-
166133 const setLocked = ( ) => {
167134 this . props . dispatch ( actions . setLocked ( true ) ) ;
168135 } ;
@@ -187,7 +154,20 @@ export class EmbedBlockComponent extends React.Component<IProps> {
187154 {
188155 isQumu
189156 ? < QumuWidget html = { html } />
190- : < div className = "embed-block__wrapper" dangerouslySetInnerHTML = { { __html : html } } />
157+ : (
158+ < div className = "embed-block__wrapper" >
159+ < iframe
160+ srcDoc = { html }
161+ style = { { border : 0 } }
162+ onLoad = { ( event ) => {
163+ const iframe = event . currentTarget ;
164+
165+ // set the height of the iframe to the content height
166+ iframe . height = iframe . contentWindow . document . body . scrollHeight + 'px' ;
167+ } }
168+ />
169+ </ div >
170+ )
191171 }
192172
193173 < Textarea
0 commit comments