Ticket #3905: 3905_3.patch

File 3905_3.patch, 4.8 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    242242                                        var isCustomDomain = CKEDITOR.env.isCustomDomain();
    243243
    244244                                        // Creates the iframe that holds the editable document.
    245                                         var createIFrame = function()
     245                                        var createIFrame = function( data )
    246246                                        {
    247247                                                if ( iframe )
    248248                                                        iframe.remove();
     
    250250                                                        fieldset.remove();
    251251
    252252                                                frameLoaded = 0;
    253                                                 // The document domain must be set within the src
    254                                                 // attribute;
    255                                                 // Defer the script execution until iframe
    256                                                 // has been added to main window, this is needed for some
    257                                                 // browsers which will begin to load the frame content
    258                                                 // prior to it's presentation in DOM.(#3894)
    259                                                 var src = 'void( '
    260                                                                 + ( CKEDITOR.env.gecko ? 'setTimeout' : '' ) + '( function(){' +
    261                                                                 'document.open();' +
    262                                                                 ( CKEDITOR.env.ie && isCustomDomain ? 'document.domain="' + document.domain + '";' : '' ) +
    263                                                                 'document.write( window.parent[ "_cke_htmlToLoad_' + editor.name + '" ] );' +
    264                                                                 'document.close();' +
    265                                                                 'window.parent[ "_cke_htmlToLoad_' + editor.name + '" ] = null;' +
    266                                                                 '}'
    267                                                                 + ( CKEDITOR.env.gecko ? ', 0 )' : ')()' )
    268                                                                 + ' )';
    269253
    270                                                 // Loading via src attribute does not work in Opera.
    271                                                 if ( CKEDITOR.env.opera )
    272                                                         src = 'void(0);';
    273 
    274254                                                iframe = CKEDITOR.dom.element.createFromHtml( '<iframe' +
    275                                                                 ' style="width:100%;height:100%"' +
    276                                                                 ' frameBorder="0"' +
    277                                                                 ' tabIndex="-1"' +
    278                                                                 ' allowTransparency="true"' +
    279                                                                 ' src="javascript:' + encodeURIComponent( src ) + '"' +
    280                                                                 '></iframe>' );
     255                                                        ' style="width:100%;height:100%"' +
     256                                                        ' frameBorder="0"' +
     257                                                        // Support for custom document.domain in IE.
     258                                                        ( isCustomDomain ?
     259                                                                ' src="javascript:void((function(){' +
     260                                                                        'document.open();' +
     261                                                                        'document.domain=\'' + document.domain + '\';' +
     262                                                                        'document.close();' +
     263                                                                '})())"' : '' ) +
     264                                                        ' tabIndex="-1"' +
     265                                                        ' allowTransparency="true"' +
     266                                                        '></iframe>' );
    281267
     268                                                // Register onLoad event for iframe element, which
     269                                                // will fill it with content and set custom domain.
     270                                                iframe.on( 'load', function( e )
     271                                                {
     272                                                        e.removeListener();
     273                                                        var doc = iframe.getFrameDocument().$;
     274
     275                                                        // Custom domain handling is needed after each document.open().
     276                                                        doc.open();
     277                                                        if ( isCustomDomain )
     278                                                                doc.domain = document.domain;
     279                                                        doc.write( data );
     280                                                        doc.close();
     281
     282                                                } );
     283
    282284                                                var accTitle = editor.lang.editorTitle.replace( '%1', editor.name );
    283285
    284286                                                if ( CKEDITOR.env.gecko )
    285287                                                {
    286                                                         // Double checking the iframe will be loaded properly(#4058).
    287                                                         iframe.on( 'load', function( ev )
    288                                                         {
    289                                                                 ev.removeListener();
    290                                                                 contentDomReady( iframe.$.contentWindow );
    291                                                         } );
    292 
    293288                                                        // Accessibility attributes for Firefox.
    294289                                                        mainElement.setAttributes(
    295290                                                                {
     
    571566                                                                        '</html>' +
    572567                                                                        activationScript;
    573568
    574                                                                 window[ '_cke_htmlToLoad_' + editor.name ] = data;
    575569                                                                CKEDITOR._[ 'contentDomReady' + editor.name ] = contentDomReady;
    576                                                                 createIFrame();
    577 
    578                                                                 // Opera must use the old method for loading contents.
    579                                                                 if ( CKEDITOR.env.opera )
    580                                                                 {
    581                                                                         var doc = iframe.$.contentWindow.document;
    582                                                                         doc.open();
    583                                                                         doc.write( data );
    584                                                                         doc.close();
    585                                                                 }
     570                                                                createIFrame( data );
    586571                                                        },
    587572
    588573                                                        getData : function()
  • _source/core/_bootstrap.js

     
    1212        // Check is High Contrast is active by creating a temporary element with a
    1313        // background image.
    1414
    15         var testImage = ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 ) ? ( CKEDITOR.basePath + 'images/spacer.gif' ) : 'about:blank';
     15        var useSpacer = CKEDITOR.env.ie && CKEDITOR.env.version < 7,
     16                useBlank = CKEDITOR.env.ie && CKEDITOR.env.version == 7;
    1617
     18
     19        var backgroundImageUrl = useSpacer ? ( CKEDITOR.basePath + 'images/spacer.gif' ) :
     20                                                         useBlank ? 'about:blank' : 'data:image/png;base64,';
     21
    1722        var hcDetect = CKEDITOR.dom.element.createFromHtml(
    1823                '<div style="width:0px;height:0px;' +
    1924                        'position:absolute;left:-10000px;' +
    20                         'background-image:url(' + testImage + ')"></div>', CKEDITOR.document );
     25                        'background-image:url(' + backgroundImageUrl + ')"></div>', CKEDITOR.document );
    2126
    2227        hcDetect.appendTo( CKEDITOR.document.getHead() );
    2328
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy