Ticket #3175: 3175.patch
File 3175.patch, 11.2 KB (added by , 15 years ago) |
---|
-
_source/core/dom/element.js
1207 1207 this.removeClass( 'cke_disabled' ); 1208 1208 break; 1209 1209 } 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 ); 1210 1248 } 1211 1249 }); -
_source/core/env.js
69 69 */ 70 70 mac : ( agent.indexOf( 'macintosh' ) > -1 ), 71 71 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 } 73 78 }; 74 79 75 80 /** -
_source/plugins/dialog/plugin.js
367 367 this.on( 'show', function() 368 368 { 369 369 CKEDITOR.document.on( 'keydown', focusKeydownHandler, this, null, 0 ); 370 370 371 if ( CKEDITOR.env.ie6Compat ) 371 372 { 372 var coverDoc = new CKEDITOR.dom.document( frames( 'cke_dialog_background_iframe' ).document);373 var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument(); 373 374 coverDoc.on( 'keydown', focusKeydownHandler, this, null, 0 ); 374 375 } 375 376 } ); … … 1448 1449 1449 1450 if ( CKEDITOR.env.ie6Compat ) 1450 1451 { 1451 var coverDoc = new CKEDITOR.dom.document( frames( 'cke_dialog_background_iframe' ).document);1452 var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument(); 1452 1453 coverDoc.removeListener( 'mousemove', mouseMoveHandler ); 1453 1454 coverDoc.removeListener( 'mouseup', mouseUpHandler ); 1454 1455 } … … 1464 1465 1465 1466 if ( CKEDITOR.env.ie6Compat ) 1466 1467 { 1467 var coverDoc = new CKEDITOR.dom.document( frames( 'cke_dialog_background_iframe' ).document);1468 var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument(); 1468 1469 coverDoc.on( 'mousemove', mouseMoveHandler ); 1469 1470 coverDoc.on( 'mouseup', mouseUpHandler ); 1470 1471 } … … 1515 1516 1516 1517 if ( CKEDITOR.env.ie6Compat ) 1517 1518 { 1518 var coverDoc = new CKEDITOR.dom.document( frames( 'cke_dialog_background_iframe' ).document);1519 var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument(); 1519 1520 coverDoc.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } ); 1520 1521 coverDoc.on( 'mouseup', mouseUpHandler, dialog, { part : partName } ); 1521 1522 } … … 1584 1585 1585 1586 if ( CKEDITOR.env.ie6Compat ) 1586 1587 { 1587 var coverDoc = new CKEDITOR.dom.document( frames( 'cke_dialog_background_iframe' ).document);1588 var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument(); 1588 1589 coverDoc.removeListener( 'mouseup', mouseUpHandler ); 1589 1590 coverDoc.removeListener( 'mousemove', mouseMoveHandler ); 1590 1591 } … … 1622 1623 1623 1624 if ( CKEDITOR.env.ie6Compat ) 1624 1625 { 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>' ); 1628 1656 } 1629 1657 1630 1658 html.push( '</div>' ); -
_source/plugins/dialogui/plugin.js
1 /*1 /* 2 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ … … 641 641 var innerHTML = function() 642 642 { 643 643 _.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 646 670 return html.join( '' ); 647 671 }; 648 672 … … 1193 1217 */ 1194 1218 getInputElement : function() 1195 1219 { 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] ); 1198 1222 }, 1199 1223 1200 1224 /** … … 1217 1241 reset : function() 1218 1242 { 1219 1243 var frameElement = CKEDITOR.document.getById( this._.frameId ), 1220 frameDocument = frameElement. $.contentWindow.document,1244 frameDocument = frameElement.getFrameDocument(), 1221 1245 elementDefinition = this._.definition, 1222 1246 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;">', 1225 1255 '<form enctype="multipart/form-data" method="POST" action="', 1226 1256 CKEDITOR.tools.htmlEncode( elementDefinition.action ), 1227 1257 '">', … … 1232 1262 '" />', 1233 1263 '</form>', 1234 1264 '</body></html>' ].join( '' ) ); 1235 frameDocument.close();1236 1265 1266 frameDocument.$.close(); 1267 1237 1268 for ( var i = 0 ; i < buttons.length ; i++ ) 1238 1269 buttons[i].enable(); 1239 1270 }, -
_source/plugins/panel/plugin.js
90 90 output.push( 91 91 '<iframe id="', id, '_frame"' + 92 92 ' 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>' ); 95 108 } 96 109 97 110 output.push( … … 109 122 { 110 123 if ( this.forceIFrame || this.css.length ) 111 124 { 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(); 114 128 115 var className = iframe.getParent().getParent().getAttribute( 'class' );116 117 129 // Initialize the IFRAME document body. 118 130 doc.$.open(); 131 132 // Support for custom document.domain in IE. 133 if ( CKEDITOR.env.isCustomDomain() ) 134 doc.$.domain = document.domain; 135 119 136 doc.$.write( 120 137 '<!DOCTYPE html>' + 121 138 '<html>' + -
_source/plugins/wysiwygarea/plugin.js
104 104 isPendingFocus, 105 105 fireMode; 106 106 107 // The following information is needed for IE only.108 var isCustomDomain = CKEDITOR.env.i e && document.domain != window.location.hostname;107 // Support for custom document.domain in IE. 108 var isCustomDomain = CKEDITOR.env.isCustomDomain(); 109 109 110 110 // Creates the iframe that holds the editable document. 111 111 var createIFrame = function() … … 343 343 344 344 getData : function() 345 345 { 346 var data = iframe. $.contentWindow.document.body.innerHTML;346 var data = iframe.getFrameDocument().getBody().getHtml(); 347 347 348 348 if ( editor.dataProcessor ) 349 349 data = editor.dataProcessor.toDataFormat( data, ( editor.config.enterMode != CKEDITOR.ENTER_BR ) ); … … 353 353 354 354 getSnapshotData : function() 355 355 { 356 return iframe. $.contentWindow.document.body.innerHTML;356 return iframe.getFrameDocument().getBody().getHtml(); 357 357 }, 358 358 359 359 loadSnapshotData : function( data ) 360 360 { 361 iframe. $.contentWindow.document.body.innerHTML = data;361 iframe.getFrameDocument().getBody().setHtml( data ); 362 362 }, 363 363 364 364 unload : function( holderElement )