Seditio Source
Root |
./othercms/dotclear-2.22/plugins/dcCKEditor/js/ckeditor/plugins/clipboard/dialogs/paste.js
CKEDITOR.dialog.add('paste',function(editor){var lang=editor.lang.clipboard,clipboard=CKEDITOR.plugins.clipboard,lastDataTransfer;function onPasteFrameLoad(win){var doc=new CKEDITOR.dom.document(win.document),body=doc.getBody(),script=doc.getById('cke_actscrpt');script&&script.remove();body.setAttribute('contenteditable',true);body.on(clipboard.mainPasteEvent,function(evt){var dataTransfer=clipboard.initPasteDataTransfer(evt);if(!lastDataTransfer){lastDataTransfer=dataTransfer;}else
if(dataTransfer!=lastDataTransfer){lastDataTransfer=clipboard.initPasteDataTransfer();}});if(CKEDITOR.env.ie&&CKEDITOR.env.version<8){doc.getWindow().on('blur',function(){doc.$.selection.empty();});}
doc.on('keydown',function(e){var domEvent=e.data,key=domEvent.getKeystroke(),processed;switch(key){case 27:this.hide();processed=1;break;case 9:case CKEDITOR.SHIFT+9:this.changeFocus(1);processed=1;}
processed&&domEvent.preventDefault();},this);editor.fire('ariaWidget',new CKEDITOR.dom.element(win.frameElement));if(doc.getWindow().getFrame().removeCustomData('pendingFocus'))
body.focus();}
editor.on('pasteDialogCommit',function(evt){if(evt.data){editor.fire('paste',{type:'auto',dataValue:evt.data.dataValue,method:'paste',dataTransfer:evt.data.dataTransfer||clipboard.initPasteDataTransfer()});}},null,null,1000);return{title:lang.paste,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?370:350,minHeight:CKEDITOR.env.quirks?250:245,onShow:function(){this.parts.dialog.$.offsetHeight;this.setupContent();this._.committed=false;},onLoad:function(){if((CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat)&&editor.lang.dir=='rtl')
this.parts.contents.setStyle('overflow','hidden');},onOk:function(){this.commitContent();},contents:[{id:'general',label:editor.lang.common.generalTab,elements:[{type:'html',id:'pasteMsg',html:'<div style="white-space:normal;width:340px">'+lang.pasteMsg+'</div>'},{type:'html',id:'editing_area',style:'width:100%;height:100%',html:'',focus:function(){var iframe=this.getInputElement(),doc=iframe.getFrameDocument(),body=doc.getBody();if(!body||body.isReadOnly())
iframe.setCustomData('pendingFocus',1);else
body.focus();},setup:function(){var dialog=this.getDialog();var htmlToLoad='<html dir="'+editor.config.contentsLangDirection+'"'+' lang="'+(editor.config.contentsLanguage||editor.langCode)+'">'+'<head><style>body{margin:3px;height:95%;word-break:break-all;}</style></head><body>'+'<script id="cke_actscrpt" type="text/javascript">'+'window.parent.CKEDITOR.tools.callFunction('+CKEDITOR.tools.addFunction(onPasteFrameLoad,dialog)+',this);'+'</script></body>'+'</html>';var src=CKEDITOR.env.air?'javascript:void(0)':(CKEDITOR.env.ie&&!CKEDITOR.env.edge)?'javascript:void((function(){'+encodeURIComponent('document.open();'+'('+CKEDITOR.tools.fixDomain+')();'+'document.close();')+'})())"':'';var iframe=CKEDITOR.dom.element.createFromHtml('<iframe'+' class="cke_pasteframe"'+' frameborder="0" '+' allowTransparency="true"'+' src="'+src+'"'+' aria-label="'+lang.pasteArea+'"'+' aria-describedby="'+dialog.getContentElement('general','pasteMsg').domId+'"'+'></iframe>');lastDataTransfer=null;iframe.on('load',function(e){e.removeListener();var doc=iframe.getFrameDocument();doc.write(htmlToLoad);editor.focusManager.add(doc.getBody());if(CKEDITOR.env.air)
onPasteFrameLoad.call(this,doc.getWindow().$);},dialog);iframe.setCustomData('dialog',dialog);var container=this.getElement();container.setHtml('');container.append(iframe);if(CKEDITOR.env.ie&&!CKEDITOR.env.edge){var focusGrabber=CKEDITOR.dom.element.createFromHtml('<span tabindex="-1" style="position:absolute" role="presentation"></span>');focusGrabber.on('focus',function(){setTimeout(function(){iframe.$.contentWindow.focus();});});container.append(focusGrabber);this.focus=function(){focusGrabber.focus();this.fire('focus');};}
this.getInputElement=function(){return iframe;};if(CKEDITOR.env.ie){container.setStyle('display','block');container.setStyle('height',(iframe.$.offsetHeight+2)+'px');}},commit:function(){var editor=this.getDialog().getParentEditor(),body=this.getInputElement().getFrameDocument().getBody(),bogus=body.getBogus(),html;bogus&&bogus.remove();html=body.getHtml();this.getDialog()._.committed=true;editor.fire('pasteDialogCommit',{dataValue:html,dataTransfer:lastDataTransfer||clipboard.initPasteDataTransfer()});}}]}]};});