X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=plugins%2Fpastefromword%2Fdialogs%2Fpastefromword.js;h=4c62a98495ee87506a07534d78420650576c8ae0;hp=9f7ef3d65bac261fd9d2f4efa33edfe2df67d2f6;hb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d;hpb=8761695d9b70afe75905deaac88f78c1f8aeb32d diff --git a/plugins/pastefromword/dialogs/pastefromword.js b/plugins/pastefromword/dialogs/pastefromword.js index 9f7ef3d..4c62a98 100644 --- a/plugins/pastefromword/dialogs/pastefromword.js +++ b/plugins/pastefromword/dialogs/pastefromword.js @@ -5,4 +5,4 @@ For licensing, see LICENSE.html or http://ckeditor.com/license CKEDITOR.dialog.add('pastefromword',function(a){return{title:a.lang.pastefromword.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?370:350,minHeight:CKEDITOR.env.ie&&CKEDITOR.env.quirks?270:260,htmlToLoad:'',cleanWord:function(b,c,d,e){c=c.replace(/<\!--[\s\S]*?-->/g,'');c=c.replace(/\s*<\/o:p>/g,'');c=c.replace(/[\s\S]*?<\/o:p>/g,' ');c=c.replace(/\s*mso-[^:]+:[^;"]+;?/gi,'');c=c.replace(/\s*MARGIN: 0(?:cm|in) 0(?:cm|in) 0pt\s*;/gi,'');c=c.replace(/\s*MARGIN: 0(?:cm|in) 0(?:cm|in) 0pt\s*"/gi,'"');c=c.replace(/\s*TEXT-INDENT: 0cm\s*;/gi,'');c=c.replace(/\s*TEXT-INDENT: 0cm\s*"/gi,'"');c=c.replace(/\s*TEXT-ALIGN: [^\s;]+;?"/gi,'"');c=c.replace(/\s*PAGE-BREAK-BEFORE: [^\s;]+;?"/gi,'"');c=c.replace(/\s*FONT-VARIANT: [^\s;]+;?"/gi,'"');c=c.replace(/\s*tab-stops:[^;"]*;?/gi,'');c=c.replace(/\s*tab-stops:[^"]*/gi,'');if(d){c=c.replace(/\s*face="[^"]*"/gi,'');c=c.replace(/\s*face=[^ >]*/gi,'');c=c.replace(/\s*FONT-FAMILY:[^;"]*;?/gi,'');}c=c.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,'<$1$3');if(e)c=c.replace(/<(\w[^>]*) style="([^\"]*)"([^>]*)/gi,'<$1$3');c=c.replace(/]*>[\s\S]*?<\/STYLE[^>]*>/gi,'');c=c.replace(/<(?:META|LINK)[^>]*>\s*/gi,'');c=c.replace(/\s*style="\s*"/gi,'');c=c.replace(/]*>\s* \s*<\/SPAN>/gi,' ');c=c.replace(/]*><\/SPAN>/gi,'');c=c.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,'<$1$3');c=c.replace(/([\s\S]*?)<\/SPAN>/gi,'$1');c=c.replace(/([\s\S]*?)<\/FONT>/gi,'$1');c=c.replace(/<\\?\?xml[^>]*>/gi,'');c=c.replace(/]*>[\s\S]*?<\/w:[^>]*>/gi,'');c=c.replace(/<\/?\w+:[^>]*>/gi,'');c=c.replace(/<(U|I|STRIKE)> <\/\1>/g,' ');c=c.replace(/\s*<\/H\d>/gi,'');c=c.replace(/<(\w+)[^>]*\sstyle="[^"]*DISPLAY\s?:\s?none[\s\S]*?<\/\1>/ig,'');c=c.replace(/<(\w[^>]*) language=([^ |>]*)([^>]*)/gi,'<$1$3');c=c.replace(/<(\w[^>]*) onmouseover="([^\"]*)"([^>]*)/gi,'<$1$3');c=c.replace(/<(\w[^>]*) onmouseout="([^\"]*)"([^>]*)/gi,'<$1$3'); if(b.config.pasteFromWordKeepsStructure){c=c.replace(/]*)>/gi,'');c=c.replace(/<(H\d)>]*>([\s\S]*?)<\/FONT><\/\1>/gi,'<$1>$2');c=c.replace(/<(H\d)>([\s\S]*?)<\/EM><\/\1>/gi,'<$1>$2');}else{c=c.replace(/]*)>/gi,'');c=c.replace(/]*)>/gi,'');c=c.replace(/]*)>/gi,'');c=c.replace(/]*)>/gi,'');c=c.replace(/]*)>/gi,'');c=c.replace(/]*)>/gi,'');c=c.replace(/<\/H\d>/gi,'');var f=new RegExp('(]*>[\\s\\S]*?)(

)','gi');c=c.replace(f,'');c=c.replace(/<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g,'');c=c.replace(/<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g,'');c=c.replace(/<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g,'');}return c;},onShow:function(){var g=this;if(CKEDITOR.env.ie)g.getParentEditor().document.getBody().$.contentEditable='false';g.parts.dialog.$.offsetHeight;var b=g.getContentElement('general','editing_area').getElement(),c=CKEDITOR.dom.element.createFromHtml(''),d=g.getParentEditor().lang;c.setStyles({width:'346px',height:'152px','background-color':'white',border:'1px solid black'});c.setCustomData('dialog',g);var e=d.editorTitle.replace('%1',d.pastefromword.title);if(CKEDITOR.env.ie)b.setHtml(''+CKEDITOR.tools.htmlEncode(e)+'');else{b.setHtml('');b.setAttributes({role:'region',title:e});c.setAttributes({role:'region',title:' '});}b.append(c);if(CKEDITOR.env.ie)b.setStyle('height',c.$.offsetHeight+2+'px');if(CKEDITOR.env.isCustomDomain()){CKEDITOR._cke_htmlToLoad=g.definition.htmlToLoad;c.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 f=c.$.contentWindow.document;f.open();f.write(g.definition.htmlToLoad);f.close();}},onOk:function(){var b=this.getContentElement('general','editing_area').getElement(),c=b.getElementsByTag('iframe').getItem(0),d=this.getParentEditor(),e=this.definition.cleanWord(d,c.$.contentWindow.document.body.innerHTML,this.getValueOf('general','ignoreFontFace'),this.getValueOf('general','removeStyle'));setTimeout(function(){d.insertHtml(e);},0);},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');},contents:[{id:'general',label:a.lang.pastefromword.title,elements:[{type:'html',style:'white-space:normal;width:346px;display:block',onShow:function(){if(CKEDITOR.env.webkit)this.getElement().getAscendant('table').setStyle('table-layout','fixed');},html:a.lang.pastefromword.advice},{type:'html',id:'editing_area',style:'width: 100%; height: 100%;',html:'
',focus:function(){var b=this.getElement(),c=b.getElementsByTag('iframe');if(c.count()<1)return;c=c.getItem(0);setTimeout(function(){c.$.contentWindow.focus();},500);}},{type:'vbox',padding:0,children:[{type:'checkbox',id:'ignoreFontFace',label:a.lang.pastefromword.ignoreFontFace,'default':a.config.pasteFromWordIgnoreFontFace},{type:'checkbox',id:'removeStyle',label:a.lang.pastefromword.removeStyle,'default':a.config.pasteFromWordRemoveStyle}]}]}]};}); +},onLoad:function(){if((CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat)&&a.lang.dir=='rtl')this.parts.contents.setStyle('overflow','hidden');},contents:[{id:'general',label:a.lang.pastefromword.title,elements:[{type:'html',style:'white-space:normal;width:346px;display:block',onShow:function(){if(CKEDITOR.env.webkit)this.getElement().getAscendant('table').setStyle('table-layout','fixed');},html:a.lang.pastefromword.advice},{type:'html',id:'editing_area',style:'width: 100%; height: 100%;',html:'
',focus:function(){var b=this.getElement(),c=b.getElementsByTag('iframe');if(c.count()<1)return;c=c.getItem(0);setTimeout(function(){c.$.contentWindow.focus();},500);}},{type:'vbox',padding:0,children:[{type:'checkbox',id:'ignoreFontFace',label:a.lang.pastefromword.ignoreFontFace,'default':a.config.pasteFromWordIgnoreFontFace},{type:'checkbox',id:'removeStyle',label:a.lang.pastefromword.removeStyle,'default':a.config.pasteFromWordRemoveStyle}]}]}]};});