X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fclipboard%2Fdialogs%2Fpaste.js;h=e0813ec9b84628c67f3d5529bb2983a459112faa;hb=4e90e78dc97789709ee7404359a5517540c27553;hp=496b8a6a5872c941efffb12bf4ff3a618fa52cee;hpb=8665a7c6c60586526e32e8941fe2896739b6ebfb;p=ckeditor.git diff --git a/_source/plugins/clipboard/dialogs/paste.js b/_source/plugins/clipboard/dialogs/paste.js index 496b8a6..e0813ec 100644 --- a/_source/plugins/clipboard/dialogs/paste.js +++ b/_source/plugins/clipboard/dialogs/paste.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -10,10 +10,11 @@ CKEDITOR.dialog.add( 'paste', function( editor ) function onPasteFrameLoad( win ) { - var doc = new CKEDITOR.dom.document( win.document ), + var doc = new CKEDITOR.dom.document( win.document ), docElement = doc.$; - doc.getById( "cke_actscrpt" ).remove(); + var script = doc.getById( 'cke_actscrpt' ); + script && script.remove(); CKEDITOR.env.ie ? docElement.body.contentEditable = "true" : @@ -74,17 +75,24 @@ CKEDITOR.dialog.add( 'paste', function( editor ) '' + ''; + var src = + CKEDITOR.env.air ? + 'javascript:void(0)' : + isCustomDomain ? + 'javascript:void((function(){' + + 'document.open();' + + 'document.domain=\'' + document.domain + '\';' + + 'document.close();' + + '})())"' + : + ''; + var iframe = CKEDITOR.dom.element.createFromHtml( '' ); iframe.on( 'load', function( e ) - { - e.removeListener(); - var doc = iframe.getFrameDocument().$; - // Custom domain handling is needed after each document.open(). - doc.open(); - if ( isCustomDomain ) - doc.domain = document.domain; - doc.write( htmlToLoad ); - doc.close(); - }, this ); - - iframe.setStyles( { - width : '346px', - height : '130px', - 'background-color' : 'white', - border : '1px solid black' - } ); + e.removeListener(); + + var doc = iframe.getFrameDocument(); + doc.write( htmlToLoad ); + + if ( CKEDITOR.env.air ) + onPasteFrameLoad.call( this, doc.getWindow().$ ); + }, + this ); + iframe.setCustomData( 'dialog', this ); var field = this.getContentElement( 'general', 'editing_area' ), @@ -163,7 +164,12 @@ CKEDITOR.dialog.add( 'paste', function( editor ) var container = this.getContentElement( 'general', 'editing_area' ).getElement(), iframe = container.getElementsByTag( 'iframe' ).getItem( 0 ), editor = this.getParentEditor(), - html = iframe.$.contentWindow.document.body.innerHTML; + body = iframe.getFrameDocument().getBody(), + bogus = body.getBogus(), + html; + bogus && bogus.remove(); + // Saving the contents in variable so changes until paste is complete will not take place (#7500) + html = body.getHtml(); setTimeout( function(){ editor.fire( 'paste', { 'html' : html } );