Ticket #3171: 3171.patch

File 3171.patch, 3.0 KB (added by Garry Yao, 15 years ago)
  • _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 clearPreview = function( dialog )
     181                {
     182                        if ( dialog.preview )
     183                                dialog.preview.setHtml('');
     184                };
     185               
    180186                return {
    181187                        title : editor.lang.flash.title,
    182188                        minWidth : 400,
     
    285291                                        this.restoreSelection();
    286292                                        editor.insertElement( newFakeImage );
    287293                                }
     294                                clearPreview( this );
     295                        },
     296                       
     297                        onCancel : function()
     298                        {
     299                                clearPreview( this );
    288300                        },
     301                       
    289302                        contents : [
    290303                                {
    291304                                        id : 'info',
     
    317330                                                                                        commit : commitValue,
    318331                                                                                        onLoad : function()
    319332                                                                                        {
    320                                                                                                 var dialog = this.getDialog();
    321                                                                                                 var previewElement = dialog.getContentElement( 'info', 'preview' ).getElement().getChild( 3 );
    322                                                                                                 this.getInputElement().on( 'change', function()
    323                                                                                                         {
    324                                                                                                                 previewElement.setHtml( '<embed height="100%" width="100%" src="'
    325                                                                                                                                 + CKEDITOR.tools.htmlEncode( this.getValue() )
    326                                                                                                                                 + '" type="application/x-shockwave-flash"></embed>' );
     333                                                                                                var dialog = this.getDialog(),
     334                                                                                                updatePreview = function( src ){
     335                                                                                                       
     336                                                                                                        dialog.preview.setHtml( '<embed height="100%" width="100%" src="'
     337                                                                                                                + CKEDITOR.tools.htmlEncode( src )
     338                                                                                                                + '" type="application/x-shockwave-flash"></embed>' );
     339                                                                                                };
     340                                                                                                // Preview element
     341                                                                                                dialog.preview = dialog.getContentElement( 'info', 'preview' ).getElement().getChild( 3 );
     342                                                                                               
     343                                                                                                // Sync on inital value loaded.
     344                                                                                                this.on( 'change', function( evt ){
     345                                                                                                       
     346                                                                                                                if ( evt.data && evt.data.value )
     347                                                                                                                        updatePreview( evt.data.value );
    327348                                                                                                        } );
     349                                                                                                // Sync when input value changed.
     350                                                                                                this.getInputElement().on( 'change', function( evt ){
     351                                                                                                       
     352                                                                                                        updatePreview( this.getValue() );
     353                                                                                                }, this );
    328354                                                                                        }
    329355                                                                                },
    330356                                                                                {
  • _source/plugins/fakeobjects/plugin.js

     
    1212                        $ : function( element, filter )
    1313                        {
    1414                                var realHtml = element.attributes._cke_realelement;
    15                                         realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( realHtml ), filter ),
     15                                        realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml( decodeURIComponent( realHtml ) ),
    1616                                        realElement = realFragment && realFragment.children[ 0 ];
    1717
    1818                                if ( realElement )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy