X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fclipboard%2Fdialogs%2Fpaste.js;h=cec04d387972a8038b569a67f25b6bb6e3b734d8;hb=refs%2Ftags%2Fv3.6.4;hp=89038922ea581988dd46fe932cb5532ab4a4ddd2;hpb=941b0a9ba4e673e292510d80a5a86806994b8ea6;p=ckeditor.git diff --git a/_source/plugins/clipboard/dialogs/paste.js b/_source/plugins/clipboard/dialogs/paste.js index 8903892..cec04d3 100644 --- a/_source/plugins/clipboard/dialogs/paste.js +++ b/_source/plugins/clipboard/dialogs/paste.js @@ -1,101 +1,72 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'paste', function( editor ) { + var lang = editor.lang.clipboard; var isCustomDomain = CKEDITOR.env.isCustomDomain(); - return { - title : editor.lang.clipboard.title, + function onPasteFrameLoad( win ) + { + var doc = new CKEDITOR.dom.document( win.document ), + docElement = doc.$; - minWidth : CKEDITOR.env.ie && CKEDITOR.env.quirks ? 370 : 350, - minHeight : CKEDITOR.env.quirks ? 250 : 245, - htmlToLoad : '
', + var script = doc.getById( 'cke_actscrpt' ); + script && script.remove(); - onShow : function() + CKEDITOR.env.ie ? + docElement.body.contentEditable = "true" : + docElement.designMode = "on"; + + // IE before version 8 will leave cursor blinking inside the document after + // editor blurred unless we clean up the selection. (#4716) + if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) { - if ( CKEDITOR.env.ie ) - this.getParentEditor().document.getBody().$.contentEditable = 'false'; + doc.getWindow().on( 'blur', function() + { + docElement.selection.empty(); + } ); + } - // FIREFOX BUG: Force the browser to render the dialog to make the to-be- - // inserted iframe editable. (#3366) - this.parts.dialog.$.offsetHeight; + doc.on( "keydown", function( e ) + { + var domEvent = e.data, + key = domEvent.getKeystroke(), + processed; - var container = this.getContentElement( 'general', 'editing_area' ).getElement(), - iframe = CKEDITOR.dom.element.createFromHtml( '' ); + switch( key ) + { + case 27 : + this.hide(); + processed = 1; + break; + + case 9 : + case CKEDITOR.SHIFT + 9 : + this.changeFocus( 1 ); + processed = 1; + } - var lang = this.getParentEditor().lang; + processed && domEvent.preventDefault(); + }, this ); - iframe.setStyles( - { - width : '346px', - height : '130px', - 'background-color' : 'white', - border : '1px solid black' - } ); - iframe.setCustomData( 'dialog', this ); + editor.fire( 'ariaWidget', new CKEDITOR.dom.element( win.frameElement ) ); + } - var accTitle = lang.editorTitle.replace( '%1', lang.clipboard.title ); + return { + title : lang.title, - if ( CKEDITOR.env.ie ) - container.setHtml( '' ); - else - { - container.setHtml( '' ); - container.setAttributes( - { - role : 'region', - title : accTitle - } ); - iframe.setAttributes( - { - role : 'region', - title : ' ' - } ); - } - container.append( iframe ); - if ( CKEDITOR.env.ie ) - container.setStyle( 'height', ( iframe.$.offsetHeight + 2 ) + 'px' ); + minWidth : CKEDITOR.env.ie && CKEDITOR.env.quirks ? 370 : 350, + minHeight : CKEDITOR.env.quirks ? 250 : 245, + onShow : function() + { + // FIREFOX BUG: Force the browser to render the dialog to make the to-be- + // inserted iframe editable. (#3366) + this.parts.dialog.$.offsetHeight; - if ( isCustomDomain ) - { - CKEDITOR._cke_htmlToLoad = this.definition.htmlToLoad; - iframe.setAttribute( 'src', - 'javascript:void( (function(){' + - 'document.open();' + - 'document.domain="' + document.domain + '";' + - 'document.write( window.parent.CKEDITOR._cke_htmlToLoad );' + - 'delete window.parent.CKEDITOR._cke_htmlToLoad;' + - 'document.close();' + - '})() )' ); - } - else - { - var doc = iframe.$.contentWindow.document; - doc.open(); - doc.write( this.definition.htmlToLoad ); - doc.close(); - } + this.setupContent(); }, onHide : function() @@ -112,15 +83,7 @@ CKEDITOR.dialog.add( 'paste', function( editor ) onOk : function() { - var container = this.getContentElement( 'general', 'editing_area' ).getElement(), - iframe = container.getElementsByTag( 'iframe' ).getItem( 0 ), - editor = this.getParentEditor(), - html = iframe.$.contentWindow.document.body.innerHTML; - - setTimeout( function(){ - editor.fire( 'paste', { 'html' : html } ); - }, 0 ); - + this.commitContent(); }, contents : [ @@ -131,33 +94,126 @@ CKEDITOR.dialog.add( 'paste', function( editor ) { type : 'html', id : 'securityMsg', - html : '