Ticket #3175: 3175.patch

File 3175.patch, 11.2 KB (added by Frederico Caldeira Knabben, 15 years ago)
  • _source/core/dom/element.js

     
    12071207                                        this.removeClass( 'cke_disabled' );
    12081208                                        break;
    12091209                        }
     1210                },
     1211
     1212                /**
     1213                 * Returns the inner document of this IFRAME element.
     1214                 * @returns {CKEDITOR.dom.document} The inner document.
     1215                 */
     1216                getFrameDocument : function()
     1217                {
     1218                        var $ = this.$;
     1219
     1220                        try
     1221                        {
     1222                                // In IE, with custom document.domain, it may happen that
     1223                                // the iframe is not yet available, resulting in "Access
     1224                                // Denied" for the following property access.
     1225                                void( $.contentWindow.document );
     1226                        }
     1227                        catch ( e )
     1228                        {
     1229                                // Trick to solve this issue, forcing the iframe to get ready
     1230                                // by simply setting its "src" property.
     1231                                $.src = $.src;
     1232
     1233                                // In IE6 though, the above is not enough, so we must pause the
     1234                                // execution for a while, giving it time to think.
     1235                                if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 )
     1236                                {
     1237                                        window.showModalDialog(
     1238                                                'javascript:document.write("' +
     1239                                                        '<script>' +
     1240                                                                'window.setTimeout(' +
     1241                                                                        'function(){window.close();}' +
     1242                                                                        ',50);' +
     1243                                                        '</script>")' );
     1244                                }
     1245                        }
     1246
     1247                        return $ && new CKEDITOR.dom.document( $.contentWindow.document );
    12101248                }
    12111249        });
  • _source/core/env.js

     
    6969                         */
    7070                        mac     : ( agent.indexOf( 'macintosh' ) > -1 ),
    7171
    72                         quirks : ( document.compatMode == 'BackCompat' )
     72                        quirks : ( document.compatMode == 'BackCompat' ),
     73
     74                        isCustomDomain : function()
     75                        {
     76                                return this.ie && document.domain != window.location.hostname;
     77                        }
    7378                };
    7479
    7580                /**
  • _source/plugins/dialog/plugin.js

     
    367367                this.on( 'show', function()
    368368                        {
    369369                                CKEDITOR.document.on( 'keydown', focusKeydownHandler, this, null, 0 );
     370
    370371                                if ( CKEDITOR.env.ie6Compat )
    371372                                {
    372                                         var coverDoc = new CKEDITOR.dom.document( frames( 'cke_dialog_background_iframe' ).document );
     373                                        var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
    373374                                        coverDoc.on( 'keydown', focusKeydownHandler, this, null, 0 );
    374375                                }
    375376                        } );
     
    14481449
    14491450                                if ( CKEDITOR.env.ie6Compat )
    14501451                                {
    1451                                         var coverDoc = new CKEDITOR.dom.document( frames( 'cke_dialog_background_iframe' ).document );
     1452                                        var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
    14521453                                        coverDoc.removeListener( 'mousemove', mouseMoveHandler );
    14531454                                        coverDoc.removeListener( 'mouseup', mouseUpHandler );
    14541455                                }
     
    14641465
    14651466                                        if ( CKEDITOR.env.ie6Compat )
    14661467                                        {
    1467                                                 var coverDoc = new CKEDITOR.dom.document( frames( 'cke_dialog_background_iframe' ).document );
     1468                                                var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
    14681469                                                coverDoc.on( 'mousemove', mouseMoveHandler );
    14691470                                                coverDoc.on( 'mouseup', mouseUpHandler );
    14701471                                        }
     
    15151516
    15161517                                if ( CKEDITOR.env.ie6Compat )
    15171518                                {
    1518                                         var coverDoc = new CKEDITOR.dom.document( frames( 'cke_dialog_background_iframe' ).document );
     1519                                        var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
    15191520                                        coverDoc.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } );
    15201521                                        coverDoc.on( 'mouseup', mouseUpHandler, dialog, { part : partName } );
    15211522                                }
     
    15841585
    15851586                                if ( CKEDITOR.env.ie6Compat )
    15861587                                {
    1587                                         var coverDoc = new CKEDITOR.dom.document( frames( 'cke_dialog_background_iframe' ).document );
     1588                                        var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
    15881589                                        coverDoc.removeListener( 'mouseup', mouseUpHandler );
    15891590                                        coverDoc.removeListener( 'mousemove', mouseMoveHandler );
    15901591                                }
     
    16221623
    16231624                if ( CKEDITOR.env.ie6Compat )
    16241625                {
    1625                         html.push( '<iframe hidefocus="true" frameborder="0" name="cke_dialog_background_iframe" src="javascript: \'\'" ',
    1626                                         'style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; ',
    1627                                         'progid:DXImageTransform.Microsoft.Alpha(opacity=0)" ></iframe>' );
     1626                        // Support for custom document.domain in IE.
     1627                        var isCustomDomain = CKEDITOR.env.isCustomDomain();
     1628
     1629                        html.push(
     1630                                '<iframe' +
     1631                                        ' hidefocus="true"' +
     1632                                        ' frameborder="0"' +
     1633                                        ' id="cke_dialog_background_iframe"' +
     1634                                        ' src="javascript:void(' );
     1635
     1636                        html.push(
     1637                                        isCustomDomain ?
     1638                                                '(function(){' +
     1639                                                        'document.open();' +
     1640                                                        'document.domain=\'' + document.domain + '\';' +
     1641                                                        'document.close();' +
     1642                                                '})()'
     1643                                        :
     1644                                                '0' );
     1645
     1646                        html.push(
     1647                                        ')"' +
     1648                                        ' style="' +
     1649                                                'position:absolute;' +
     1650                                                'left:0;' +
     1651                                                'top:0;' +
     1652                                                'width:100%;' +
     1653                                                'height: 100%;' +
     1654                                                'progid:DXImageTransform.Microsoft.Alpha(opacity=0)">' +
     1655                                '</iframe>' );
    16281656                }
    16291657
    16301658                html.push( '</div>' );
  • _source/plugins/dialogui/plugin.js

     
    1 /*
     1/*
    22Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
     
    641641                                var innerHTML = function()
    642642                                {
    643643                                        _.frameId = CKEDITOR.tools.getNextNumber() + '_fileInput';
    644                                         var html = [ '<iframe frameborder="0" allowtransparency="0" class="cke_dialog_ui_input_file" id="',
    645                                                 _.frameId, '" src="javascript: void(0)" ></iframe>' ];
     644
     645                                        // Support for custom document.domain in IE.
     646                                        var isCustomDomain = CKEDITOR.env.ie && document.domain != window.location.hostname;
     647
     648                                        var html = [
     649                                                '<iframe' +
     650                                                        ' frameborder="0"' +
     651                                                        ' allowtransparency="0"' +
     652                                                        ' class="cke_dialog_ui_input_file"' +
     653                                                        ' id="', _.frameId, '"' +
     654                                                        ' src="javascript:void(' ];
     655
     656                                        html.push(
     657                                                        isCustomDomain ?
     658                                                                '(function(){' +
     659                                                                        'document.open();' +
     660                                                                        'document.domain=\'' + document.domain + '\';' +
     661                                                                        'document.close();' +
     662                                                                '})()'
     663                                                        :
     664                                                                '0' );
     665
     666                                        html.push(
     667                                                        ')">' +
     668                                                '</iframe>' );
     669
    646670                                        return html.join( '' );
    647671                                };
    648672
     
    11931217                                 */
    11941218                                getInputElement : function()
    11951219                                {
    1196                                         return new CKEDITOR.dom.element( CKEDITOR.document.getById( this._.frameId )
    1197                                                 .$.contentWindow.document.forms[0].elements[0] );
     1220                                        return new CKEDITOR.dom.element(
     1221                                                CKEDITOR.document.getById( this._.frameId ).getFrameDocument().$.forms[0].elements[0] );
    11981222                                },
    11991223
    12001224                                /**
     
    12171241                                reset : function()
    12181242                                {
    12191243                                        var frameElement = CKEDITOR.document.getById( this._.frameId ),
    1220                                                 frameDocument = frameElement.$.contentWindow.document,
     1244                                                frameDocument = frameElement.getFrameDocument(),
    12211245                                                elementDefinition = this._.definition,
    12221246                                                buttons = this._.buttons;
    1223                                         frameDocument.open();
    1224                                         frameDocument.write( [ '<html><head><title></title></head><body style="margin: 0; overflow: hidden; background: transparent;">',
     1247
     1248                                        frameDocument.$.open();
     1249
     1250                                        // Support for custom document.domain in IE.
     1251                                        if ( CKEDITOR.env.isCustomDomain() )
     1252                                                frameDocument.$.domain = document.domain;
     1253
     1254                                        frameDocument.$.write( [ '<html><head><title></title></head><body style="margin: 0; overflow: hidden; background: transparent;">',
    12251255                                                        '<form enctype="multipart/form-data" method="POST" action="',
    12261256                                                        CKEDITOR.tools.htmlEncode( elementDefinition.action ),
    12271257                                                        '">',
     
    12321262                                                        '" />',
    12331263                                                        '</form>',
    12341264                                                        '</body></html>' ].join( '' ) );
    1235                                         frameDocument.close();
    12361265
     1266                                        frameDocument.$.close();
     1267
    12371268                                        for ( var i = 0 ; i < buttons.length ; i++ )
    12381269                                                buttons[i].enable();
    12391270                                },
  • _source/plugins/panel/plugin.js

     
    9090                        output.push(
    9191                                                '<iframe id="', id, '_frame"' +
    9292                                                        ' frameborder="0"' +
    93                                                         ' src="javascript:void(0)"' +
    94                                                 '></iframe>' );
     93                                                        ' src="javascript:void(' );
     94
     95                        output.push(
     96                                                        // Support for custom document.domain in IE.
     97                                                        CKEDITOR.env.isCustomDomain() ?
     98                                                                '(function(){' +
     99                                                                        'document.open();' +
     100                                                                        'document.domain=\'' + document.domain + '\';' +
     101                                                                        'document.close();' +
     102                                                                '})()'
     103                                                        :
     104                                                                '0' );
     105
     106                        output.push(
     107                                                ')"></iframe>' );
    95108                }
    96109
    97110                output.push(
     
    109122                {
    110123                        if ( this.forceIFrame || this.css.length )
    111124                        {
    112                                 var iframe = this.document.getById( 'cke_' + this.id + '_frame' );
    113                                 var doc = new CKEDITOR.dom.document( iframe.$.contentWindow.document );
     125                                var iframe = this.document.getById( 'cke_' + this.id + '_frame' ),
     126                                        className = iframe.getParent().getParent().getAttribute( 'class' ),
     127                                        doc = iframe.getFrameDocument();
    114128
    115                                 var className = iframe.getParent().getParent().getAttribute( 'class' );
    116 
    117129                                // Initialize the IFRAME document body.
    118130                                doc.$.open();
     131
     132                                // Support for custom document.domain in IE.
     133                                if ( CKEDITOR.env.isCustomDomain() )
     134                                        doc.$.domain = document.domain;
     135
    119136                                doc.$.write(
    120137                                        '<!DOCTYPE html>' +
    121138                                        '<html>' +
  • _source/plugins/wysiwygarea/plugin.js

     
    104104                                                isPendingFocus,
    105105                                                fireMode;
    106106
    107                                         // The following information is needed for IE only.
    108                                         var isCustomDomain = CKEDITOR.env.ie && document.domain != window.location.hostname;
     107                                        // Support for custom document.domain in IE.
     108                                        var isCustomDomain = CKEDITOR.env.isCustomDomain();
    109109
    110110                                        // Creates the iframe that holds the editable document.
    111111                                        var createIFrame = function()
     
    343343
    344344                                                        getData : function()
    345345                                                        {
    346                                                                 var data = iframe.$.contentWindow.document.body.innerHTML;
     346                                                                var data = iframe.getFrameDocument().getBody().getHtml();
    347347
    348348                                                                if ( editor.dataProcessor )
    349349                                                                        data = editor.dataProcessor.toDataFormat( data, ( editor.config.enterMode != CKEDITOR.ENTER_BR ) );
     
    353353
    354354                                                        getSnapshotData : function()
    355355                                                        {
    356                                                                 return iframe.$.contentWindow.document.body.innerHTML;
     356                                                                return iframe.getFrameDocument().getBody().getHtml();
    357357                                                        },
    358358
    359359                                                        loadSnapshotData : function( data )
    360360                                                        {
    361                                                                 iframe.$.contentWindow.document.body.innerHTML = data;
     361                                                                iframe.getFrameDocument().getBody().setHtml( data );
    362362                                                        },
    363363
    364364                                                        unload : function( holderElement )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy