Ticket #3401: 3401_3.patch

File 3401_3.patch, 2.0 KB (added by garry.yao, 2 years ago)
  • _source/plugins/image/dialogs/image.js

     
    145145 
    146146        var imageDialog = function( editor, dialogType ) 
    147147        { 
     148                var absoluteURLRegex = /^[\/\\]|:/;; 
     149 
    148150                var onImgLoadEvent = function() 
    149151                { 
    150152                        // Image is ready. 
     
    422424                                                                                                        original.on( 'error', onImgLoadErrorEvent, dialog ); 
    423425                                                                                                        original.on( 'abort', onImgLoadErrorEvent, dialog ); 
    424426                                                                                                        original.setAttribute( 'src', newUrl ); 
     427 
     428                                                                                                        // Prepend base href for non-absolute url. 
     429                                                                                                        if( !absoluteURLRegex.test( newUrl ) ) 
     430                                                                                                                newUrl = editor.config.baseHref + '/' + newUrl; 
     431 
    425432                                                                                                        dialog.preview.setAttribute( 'src', newUrl ); 
    426433 
    427434                                                                                                        updatePreview( dialog ); 
  • _source/plugins/flash/dialogs/flash.js

     
    177177                        '<div id="FlashPreviewLoader" style="display:none"><div class="loading">&nbsp;</div></div>' + 
    178178                        '<div id="FlashPreviewBox"></div></div>'; 
    179179 
     180                var absoluteURLRegex = /^[\/\\]|:/; 
     181 
    180182                return { 
    181183                        title : editor.lang.flash.title, 
    182184                        minWidth : 420, 
     
    315317                                                                                        setup : loadValue, 
    316318                                                                                        commit : commitValue, 
    317319                                                                                        onLoad : function() 
    318                                                                                         { 
    319320                                                                                                var dialog = this.getDialog(), 
    320321                                                                                                updatePreview = function( src ){ 
    321322 
     323                                                                                                        // Prepend base href for non-absolute url. 
     324                                                                                                        if( !absoluteURLRegex.test( src ) ) 
     325                                                                                                                src = editor.config.baseHref + '/' + src; 
     326 
    322327                                                                                                        dialog.preview.setHtml( '<embed height="100%" width="100%" src="' 
    323328                                                                                                                + CKEDITOR.tools.htmlEncode( src ) 
    324329                                                                                                                + '" type="application/x-shockwave-flash"></embed>' ); 
© 2003 – 2011 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy