fck paste









var oEditor = window.parent.InnerDialogLoaded() ;

window.onload = function ()
{
// First of all, translate the dialog box texts
oEditor.FCKLanguageManager.TranslatePage(document) ;

window.parent.SetOkButton( true ) ;

if ( window.parent.dialogArguments.CustomValue == 'Word' )
{
var oFrame = document.getElementById('frmData')
oFrame.style.display = '' ;

if ( oFrame.contentDocument )
oFrame.contentDocument.designMode = 'on' ;
else
oFrame.contentWindow.document.body.contentEditable = true ;
}
else
{
document.getElementById('txtData').style.display = '' ;
document.getElementById('oWordCommands').style.display = 'none' ;
}
}

function Ok()
{
var sHtml ;

if ( window.parent.dialogArguments.CustomValue == 'Word' )
{
var oFrame = document.getElementById('frmData') ;

if ( oFrame.contentDocument )
sHtml = oFrame.contentDocument.body.innerHTML ;
else
sHtml = oFrame.contentWindow.document.body.innerHTML ;

sHtml = CleanWord( sHtml ) ;
}
else
{
var sHtml = oEditor.FCKTools.HTMLEncode( document.getElementById('txtData').value ) ;
sHtml = sHtml.replace( /\n/g, '' ) ;
}

oEditor.FCK.InsertHtml( sHtml ) ;

return true ;
}

function CleanUpBox()
{
var oFrame = document.getElementById('frmData') ;

if ( oFrame.contentDocument )
oFrame.contentDocument.body.innerHTML = '' ;
else
oFrame.contentWindow.document.body.innerHTML = '' ;
}

function CleanWord( html )
{
var bIgnoreFont = document.getElementById('chkRemoveFont').checked ;
var bRemoveStyles = document.getElementById('chkRemoveStyles').checked ;

html = html.replace(/\s*/g, "") ;
html = html.replace(/.*?/g, " ") ;

// Remove mso-xxx styles.
html = html.replace( /\s*mso-[^:]+:[^;"]+;?/gi, "" ) ;

// Remove margin styles.
html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*;/gi, "" ) ;
html = html.replace( /\s*MARGIN: 0cm 0cm 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 ( bIgnoreFont )
{
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(/]*) class=([^ |>]*)([^>]*)/gi, "]*)/gi, ".*?)()","gi") ; // Different because of a IE 5.0 error
html = html.replace( re, "

Wyszukiwarka