/*
Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.dialog.add( 'pastefromword', function( editor )
{
return {
title : editor.lang.pastefromword.title,
minWidth : CKEDITOR.env.ie && CKEDITOR.env.quirks ? 370 : 350,
minHeight : CKEDITOR.env.ie && CKEDITOR.env.quirks ? 270 : 260,
htmlToLoad : '
',
cleanWord : function( editor, html, ignoreFont, removeStyles )
{
// Remove comments [SF BUG-1481861].
html = html.replace(/<\!--[\s\S]*?-->/g, '' ) ;
html = html.replace(/\s*<\/o:p>/g, '') ;
html = html.replace(/[\s\S]*?<\/o:p>/g, ' ') ;
// Remove mso-xxx styles.
html = html.replace( /\s*mso-[^:]+:[^;"]+;?/gi, '' ) ;
// Remove margin styles.
html = html.replace( /\s*MARGIN: 0(?:cm|in) 0(?:cm|in) 0pt\s*;/gi, '' ) ;
html = html.replace( /\s*MARGIN: 0(?:cm|in) 0(?:cm|in) 0pt\s*"/gi, "\"" ) ;
html = html.replace( /\s*TEXT-INDENT: 0cm\s*;/gi, '' ) ;
html = html.replace( /\s*TEXT-INDENT: 0cm\s*"/gi, "\"" ) ;
html = html.replace( /\s*TEXT-ALIGN: [^\s;]+;?"/gi, "\"" ) ;
html = html.replace( /\s*PAGE-BREAK-BEFORE: [^\s;]+;?"/gi, "\"" ) ;
html = html.replace( /\s*FONT-VARIANT: [^\s;]+;?"/gi, "\"" ) ;
html = html.replace( /\s*tab-stops:[^;"]*;?/gi, '' ) ;
html = html.replace( /\s*tab-stops:[^"]*/gi, '' ) ;
// Remove FONT face attributes.
if ( ignoreFont )
{
html = html.replace( /\s*face="[^"]*"/gi, '' ) ;
html = html.replace( /\s*face=[^ >]*/gi, '' ) ;
html = html.replace( /\s*FONT-FAMILY:[^;"]*;?/gi, '' ) ;
}
// Remove Class attributes
html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
// Remove styles.
if ( removeStyles )
html = html.replace( /<(\w[^>]*) style="([^\"]*)"([^>]*)/gi, "<$1$3" ) ;
// Remove style, meta and link tags
html = html.replace( /