/* Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ CKEDITOR.dialog.add("paste",function(e){function t(t){var a=new CKEDITOR.dom.document(t.document),o=a.getBody(),s=a.getById("cke_actscrpt");s&&s.remove(),o.setAttribute("contenteditable",!0),o.on(i.mainPasteEvent,function(e){e=i.initPasteDataTransfer(e),n?e!=n&&(n=i.initPasteDataTransfer()):n=e}),CKEDITOR.env.ie&&8>CKEDITOR.env.version&&a.getWindow().on("blur",function(){a.$.selection.empty()}),a.on("keydown",function(e){e=e.data;var t;switch(e.getKeystroke()){case 27:this.hide(),t=1;break;case 9:case CKEDITOR.SHIFT+9:this.changeFocus(1),t=1}t&&e.preventDefault()},this),e.fire("ariaWidget",new CKEDITOR.dom.element(t.frameElement)),a.getWindow().getFrame().removeCustomData("pendingFocus")&&o.focus()}var n,a=e.lang.clipboard,i=CKEDITOR.plugins.clipboard;return e.on("pasteDialogCommit",function(t){t.data&&e.fire("paste",{type:"auto",dataValue:t.data.dataValue,method:"paste",dataTransfer:t.data.dataTransfer||i.initPasteDataTransfer()})},null,null,1e3),{title:a.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=!1},onLoad:function(){(CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat)&&"rtl"==e.lang.dir&&this.parts.contents.setStyle("overflow","hidden")},onOk:function(){this.commitContent()},contents:[{id:"general",label:e.lang.common.generalTab,elements:[{type:"html",id:"pasteMsg",html:'
'+a.pasteMsg+"
"},{type:"html",id:"editing_area",style:"width:100%;height:100%",html:"",focus:function(){var e=this.getInputElement(),t=e.getFrameDocument().getBody();!t||t.isReadOnly()?e.setCustomData("pendingFocus",1):t.focus()},setup:function(){var i=this.getDialog(),o='",s=CKEDITOR.env.air?"javascript:void(0)":CKEDITOR.env.ie&&!CKEDITOR.env.edge?"javascript:void((function(){"+encodeURIComponent("document.open();("+CKEDITOR.tools.fixDomain+")();document.close();")+'})())"':"",r=CKEDITOR.dom.element.createFromHtml('');if(n=null,r.on("load",function(n){n.removeListener(),n=r.getFrameDocument(),n.write(o),e.focusManager.add(n.getBody()),CKEDITOR.env.air&&t.call(this,n.getWindow().$)},i),r.setCustomData("dialog",i),i=this.getElement(),i.setHtml(""),i.append(r),CKEDITOR.env.ie&&!CKEDITOR.env.edge){var d=CKEDITOR.dom.element.createFromHtml('');d.on("focus",function(){setTimeout(function(){r.$.contentWindow.focus()})}),i.append(d),this.focus=function(){d.focus(),this.fire("focus")}}this.getInputElement=function(){return r},CKEDITOR.env.ie&&(i.setStyle("display","block"),i.setStyle("height",r.$.offsetHeight+2+"px"))},commit:function(){var e=this.getDialog().getParentEditor(),t=this.getInputElement().getFrameDocument().getBody(),a=t.getBogus();a&&a.remove(),t=t.getHtml(),this.getDialog()._.committed=!0,e.fire("pasteDialogCommit",{dataValue:t,dataTransfer:n||i.initPasteDataTransfer()})}}]}]}});