This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 136136
137137 $data . find ( '.medium-insert-buttons' ) . remove ( ) ;
138138
139+ // Restore original embed code from embed wrapper attribute value.
140+ $data . find ( '[data-embed-code]' ) . each ( function ( ) {
141+ var $this = $ ( this ) ;
142+ $this . html ( $this . attr ( 'data-embed-code' ) ) ;
143+ } ) ;
144+
139145 data [ key ] . value = $data . html ( ) ;
140146 } ) ;
141147
Original file line number Diff line number Diff line change 298298 success : function ( data ) {
299299 var html = data && data . html ;
300300
301- if ( data && ! data . html && data . type === 'photo' && data . url ) {
301+ if ( data && ! html && data . type === 'photo' && data . url ) {
302302 html = '<img src="' + data . url + '" alt="">' ;
303303 }
304304
305+ if ( ! html ) {
306+ // Prevent render empty embed.
307+ $ . proxy ( that , 'convertBadEmbed' , url ) ( ) ;
308+ return ;
309+ }
310+
311+ if ( html && html . indexOf ( '</script>' ) > - 1 ) {
312+ // Store embed code with <script> tag inside wrapper attribute value.
313+ // Make nice attribute value escaping using jQuery.
314+ var $div = $ ( '<div>' )
315+ . attr ( 'data-embed-code' , html )
316+ . html ( html ) ;
317+ html = $ ( '<div>' ) . append ( $div ) . html ( ) ;
318+ }
319+
305320 $ . proxy ( that , 'embed' , html ) ( ) ;
306321 } ,
307322 error : function ( jqXHR , textStatus , errorThrown ) {
You can’t perform that action at this time.
0 commit comments