JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.2.2
[ckeditor.git] / plugins / clipboard / dialogs / paste.js
index dab4b89..53205c6 100644 (file)
@@ -1,7 +1,7 @@
 /*\r
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
-CKEDITOR.dialog.add('paste',function(a){var b=CKEDITOR.env.isCustomDomain();return{title:a.lang.clipboard.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?370:350,minHeight:CKEDITOR.env.quirks?250:245,htmlToLoad:'<!doctype html><script type="text/javascript">window.onload = function(){if ( '+CKEDITOR.env.ie+' ) '+'document.body.contentEditable = "true";'+'else '+'document.designMode = "on";'+'var iframe = new window.parent.CKEDITOR.dom.element( frameElement );'+'var dialog = iframe.getCustomData( "dialog" );'+''+'iframe.getFrameDocument().on( "keydown", function( e )\t\t\t\t\t\t{\t\t\t\t\t\t\tif ( e.data.getKeystroke() == 27 )\t\t\t\t\t\t\t\tdialog.hide();\t\t\t\t\t\t});'+'};'+'</script><style>body { margin: 3px; height: 95%; } </style><body></body>',onShow:function(){var h=this;if(CKEDITOR.env.ie)h.getParentEditor().document.getBody().$.contentEditable='false';h.parts.dialog.$.offsetHeight;var c=h.getContentElement('general','editing_area').getElement(),d=CKEDITOR.dom.element.createFromHtml('<iframe src="javascript:void(0)" frameborder="0" allowtransparency="1"></iframe>'),e=h.getParentEditor().lang;d.setStyles({width:'346px',height:'130px','background-color':'white',border:'1px solid black'});d.setCustomData('dialog',h);var f=e.editorTitle.replace('%1',e.clipboard.title);if(CKEDITOR.env.ie)c.setHtml('<legend style="position:absolute;top:-1000000px;left:-1000000px;">'+CKEDITOR.tools.htmlEncode(f)+'</legend>');else{c.setHtml('');c.setAttributes({role:'region',title:f});d.setAttributes({role:'region',title:' '});}c.append(d);if(CKEDITOR.env.ie)c.setStyle('height',d.$.offsetHeight+2+'px');if(b){CKEDITOR._cke_htmlToLoad=h.definition.htmlToLoad;d.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 g=d.$.contentWindow.document;g.open();g.write(h.definition.htmlToLoad);g.close();}},onHide:function(){if(CKEDITOR.env.ie)this.getParentEditor().document.getBody().$.contentEditable='true';},onLoad:function(){if((CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat)&&(a.lang.dir=='rtl'))this.parts.contents.setStyle('overflow','hidden');},onOk:function(){var c=this.getContentElement('general','editing_area').getElement(),d=c.getElementsByTag('iframe').getItem(0),e=this.getParentEditor(),f=d.$.contentWindow.document.body.innerHTML;setTimeout(function(){e.insertHtml(f);},0);},contents:[{id:'general',label:a.lang.common.generalTab,elements:[{type:'html',id:'securityMsg',html:'<div style="white-space:normal;width:340px;">'+a.lang.clipboard.securityMsg+'</div>'},{type:'html',id:'pasteMsg',html:'<div style="white-space:normal;width:340px;">'+a.lang.clipboard.pasteMsg+'</div>'},{type:'html',id:'editing_area',style:'width: 100%; height: 100%;',html:'<fieldset></fieldset>',focus:function(){var c=this.getElement(),d=c.getElementsByTag('iframe');\r
-if(d.count()<1)return;d=d.getItem(0);setTimeout(function(){d.$.contentWindow.focus();},500);}}]}]};});\r
+CKEDITOR.dialog.add('paste',function(a){var b=a.lang.clipboard,c=CKEDITOR.env.isCustomDomain();function d(e){var f=new CKEDITOR.dom.document(e.document),g=f.$;f.getById('cke_actscrpt').remove();CKEDITOR.env.ie?g.body.contentEditable='true':g.designMode='on';if(CKEDITOR.env.ie&&CKEDITOR.env.version<8)f.getWindow().on('blur',function(){g.selection.empty();});f.on('keydown',function(h){var i=h.data,j=i.getKeystroke(),k;switch(j){case 27:this.hide();k=1;break;case 9:case CKEDITOR.SHIFT+9:this.changeFocus(true);k=1;}k&&i.preventDefault();},this);a.fire('ariaWidget',new CKEDITOR.dom.element(e.frameElement));};return{title:b.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?370:350,minHeight:CKEDITOR.env.quirks?250:245,onShow:function(){this.parts.dialog.$.offsetHeight;var e='<html dir="'+a.config.contentsLangDirection+'"'+' lang="'+(a.config.contentsLanguage||a.langCode)+'">'+'<head><style>body { margin: 3px; height: 95%; } </style></head><body>'+'<script id="cke_actscrpt" type="text/javascript">'+'window.parent.CKEDITOR.tools.callFunction( '+CKEDITOR.tools.addFunction(d,this)+', this );'+'</script></body>'+'</html>',f=CKEDITOR.dom.element.createFromHtml('<iframe frameborder="0"  allowTransparency="true"'+(c?" src=\"javascript:void((function(){document.open();document.domain='"+document.domain+"';"+'document.close();'+'})())"':'')+' role="region"'+' aria-label="'+b.pasteArea+'"'+' aria-describedby="'+this.getContentElement('general','pasteMsg').domId+'"'+' aria-multiple="true"'+'></iframe>');f.on('load',function(j){j.removeListener();var k=f.getFrameDocument().$;k.open();if(c)k.domain=document.domain;k.write(e);k.close();},this);f.setStyles({width:'346px',height:'130px','background-color':'white',border:'1px solid black'});f.setCustomData('dialog',this);var g=this.getContentElement('general','editing_area'),h=g.getElement();h.setHtml('');h.append(f);if(CKEDITOR.env.ie){var i=CKEDITOR.dom.element.createFromHtml('<span tabindex="-1" style="position:absolute;" role="presentation"></span>');i.on('focus',function(){f.$.contentWindow.focus();});h.append(i);g.focus=function(){i.focus();this.fire('focus');};}g.getInputElement=function(){return f;};if(CKEDITOR.env.ie){h.setStyle('display','block');h.setStyle('height',f.$.offsetHeight+2+'px');}},onHide:function(){if(CKEDITOR.env.ie)this.getParentEditor().document.getBody().$.contentEditable='true';},onLoad:function(){if((CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat)&&a.lang.dir=='rtl')this.parts.contents.setStyle('overflow','hidden');\r
+},onOk:function(){var e=this.getContentElement('general','editing_area').getElement(),f=e.getElementsByTag('iframe').getItem(0),g=this.getParentEditor(),h=f.$.contentWindow.document.body.innerHTML;setTimeout(function(){g.fire('paste',{html:h});},0);},contents:[{id:'general',label:a.lang.common.generalTab,elements:[{type:'html',id:'securityMsg',html:'<div style="white-space:normal;width:340px;">'+b.securityMsg+'</div>'},{type:'html',id:'pasteMsg',html:'<div style="white-space:normal;width:340px;">'+b.pasteMsg+'</div>'},{type:'html',id:'editing_area',style:'width: 100%; height: 100%;',html:'',focus:function(){var e=this.getInputElement().$.contentWindow;setTimeout(function(){e.focus();},500);}}]}]};});\r