2007-04-14 14:21:09 +02:00
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
2006-11-07 19:18:22 +01:00
|
|
|
|
<!--
|
2007-04-14 14:21:09 +02:00
|
|
|
|
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
|
|
|
|
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
|
|
|
|
|
*
|
|
|
|
|
* == BEGIN LICENSE ==
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the terms of any of the following licenses at your
|
|
|
|
|
* choice:
|
|
|
|
|
*
|
|
|
|
|
* - GNU General Public License Version 2 or later (the "GPL")
|
|
|
|
|
* http://www.gnu.org/licenses/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
|
|
|
|
* http://www.gnu.org/licenses/lgpl.html
|
|
|
|
|
*
|
|
|
|
|
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
|
|
|
|
* http://www.mozilla.org/MPL/MPL-1.1.html
|
|
|
|
|
*
|
|
|
|
|
* == END LICENSE ==
|
|
|
|
|
*
|
|
|
|
|
* This dialog is shown when, for some reason (usually security settings),
|
|
|
|
|
* the user is not able to paste data from the clipboard to the editor using
|
|
|
|
|
* the toolbar buttons or the context menu.
|
2006-11-07 19:18:22 +01:00
|
|
|
|
-->
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
|
<head>
|
|
|
|
|
<title></title>
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
|
<meta name="robots" content="noindex, nofollow" />
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
var oEditor = window.parent.InnerDialogLoaded() ;
|
2007-04-14 14:21:09 +02:00
|
|
|
|
var FCK = oEditor.FCK;
|
|
|
|
|
var FCKTools = oEditor.FCKTools ;
|
|
|
|
|
var FCKConfig = oEditor.FCKConfig ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
|
|
|
|
|
window.onload = function ()
|
|
|
|
|
{
|
|
|
|
|
// First of all, translate the dialog box texts
|
|
|
|
|
oEditor.FCKLanguageManager.TranslatePage(document) ;
|
|
|
|
|
|
2007-04-14 14:21:09 +02:00
|
|
|
|
var sPastingType = window.parent.dialogArguments.CustomValue ;
|
|
|
|
|
|
|
|
|
|
if ( sPastingType == 'Word' || sPastingType == 'Security' )
|
2006-11-07 19:18:22 +01:00
|
|
|
|
{
|
2007-04-14 14:21:09 +02:00
|
|
|
|
if ( sPastingType == 'Security' )
|
|
|
|
|
document.getElementById( 'xSecurityMsg' ).style.display = '' ;
|
|
|
|
|
|
|
|
|
|
var oFrame = document.getElementById('frmData') ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
oFrame.style.display = '' ;
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
|
|
|
|
if ( oFrame.contentDocument )
|
2006-11-07 19:18:22 +01:00
|
|
|
|
oFrame.contentDocument.designMode = 'on' ;
|
|
|
|
|
else
|
|
|
|
|
oFrame.contentWindow.document.body.contentEditable = true ;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
document.getElementById('txtData').style.display = '' ;
|
|
|
|
|
}
|
|
|
|
|
|
2007-04-14 14:21:09 +02:00
|
|
|
|
if ( sPastingType != 'Word' )
|
|
|
|
|
document.getElementById('oWordCommands').style.display = 'none' ;
|
|
|
|
|
|
|
|
|
|
window.parent.SetOkButton( true ) ;
|
|
|
|
|
window.parent.SetAutoSize( true ) ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Ok()
|
|
|
|
|
{
|
|
|
|
|
var sHtml ;
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
|
|
|
|
var sPastingType = window.parent.dialogArguments.CustomValue ;
|
|
|
|
|
|
|
|
|
|
if ( sPastingType == 'Word' || sPastingType == 'Security' )
|
2006-11-07 19:18:22 +01:00
|
|
|
|
{
|
|
|
|
|
var oFrame = document.getElementById('frmData') ;
|
2007-04-14 14:21:09 +02:00
|
|
|
|
var oBody ;
|
|
|
|
|
|
|
|
|
|
if ( oFrame.contentDocument )
|
|
|
|
|
oBody = oFrame.contentDocument.body ;
|
|
|
|
|
else
|
|
|
|
|
oBody = oFrame.contentWindow.document.body ;
|
|
|
|
|
|
|
|
|
|
if ( sPastingType == 'Word' )
|
|
|
|
|
{
|
|
|
|
|
// If a plugin creates a FCK.CustomCleanWord function it will be called instead of the default one
|
|
|
|
|
if ( typeof( FCK.CustomCleanWord ) == 'function' )
|
|
|
|
|
sHtml = FCK.CustomCleanWord( oBody, document.getElementById('chkRemoveFont').checked, document.getElementById('chkRemoveStyles').checked ) ;
|
|
|
|
|
else
|
|
|
|
|
sHtml = CleanWord( oBody, document.getElementById('chkRemoveFont').checked, document.getElementById('chkRemoveStyles').checked ) ;
|
|
|
|
|
}
|
2006-11-07 19:18:22 +01:00
|
|
|
|
else
|
2007-04-14 14:21:09 +02:00
|
|
|
|
sHtml = oBody.innerHTML ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
|
2007-04-14 14:21:09 +02:00
|
|
|
|
// Fix relative anchor URLs (IE automatically adds the current page URL).
|
|
|
|
|
var re = new RegExp( window.location + "#", "g" ) ;
|
|
|
|
|
sHtml = sHtml.replace( re, '#') ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2007-04-14 14:21:09 +02:00
|
|
|
|
sHtml = oEditor.FCKTools.HTMLEncode( document.getElementById('txtData').value ) ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
sHtml = sHtml.replace( /\n/g, '<BR>' ) ;
|
|
|
|
|
}
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
oEditor.FCK.InsertHtml( sHtml ) ;
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
return true ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function CleanUpBox()
|
|
|
|
|
{
|
|
|
|
|
var oFrame = document.getElementById('frmData') ;
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
|
|
|
|
if ( oFrame.contentDocument )
|
2006-11-07 19:18:22 +01:00
|
|
|
|
oFrame.contentDocument.body.innerHTML = '' ;
|
|
|
|
|
else
|
|
|
|
|
oFrame.contentWindow.document.body.innerHTML = '' ;
|
|
|
|
|
}
|
|
|
|
|
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
|
|
|
|
// This function will be called from the PasteFromWord dialog (fck_paste.html)
|
|
|
|
|
// Input: oNode a DOM node that contains the raw paste from the clipboard
|
|
|
|
|
// bIgnoreFont, bRemoveStyles booleans according to the values set in the dialog
|
|
|
|
|
// Output: the cleaned string
|
|
|
|
|
function CleanWord( oNode, bIgnoreFont, bRemoveStyles )
|
2006-11-07 19:18:22 +01:00
|
|
|
|
{
|
2007-04-14 14:21:09 +02:00
|
|
|
|
var html = oNode.innerHTML ;
|
|
|
|
|
|
|
|
|
|
html = html.replace(/<o:p>\s*<\/o:p>/g, '') ;
|
|
|
|
|
html = html.replace(/<o:p>.*?<\/o:p>/g, ' ') ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
|
|
|
|
|
// Remove mso-xxx styles.
|
2007-04-14 14:21:09 +02:00
|
|
|
|
html = html.replace( /\s*mso-[^:]+:[^;"]+;?/gi, '' ) ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
|
|
|
|
|
// Remove margin styles.
|
2007-04-14 14:21:09 +02:00
|
|
|
|
html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*;/gi, '' ) ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*"/gi, "\"" ) ;
|
|
|
|
|
|
2007-04-14 14:21:09 +02:00
|
|
|
|
html = html.replace( /\s*TEXT-INDENT: 0cm\s*;/gi, '' ) ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
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, "\"" ) ;
|
|
|
|
|
|
2007-04-14 14:21:09 +02:00
|
|
|
|
html = html.replace( /\s*tab-stops:[^;"]*;?/gi, '' ) ;
|
|
|
|
|
html = html.replace( /\s*tab-stops:[^"]*/gi, '' ) ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
|
|
|
|
|
// Remove FONT face attributes.
|
|
|
|
|
if ( bIgnoreFont )
|
|
|
|
|
{
|
2007-04-14 14:21:09 +02:00
|
|
|
|
html = html.replace( /\s*face="[^"]*"/gi, '' ) ;
|
|
|
|
|
html = html.replace( /\s*face=[^ >]*/gi, '' ) ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
|
2007-04-14 14:21:09 +02:00
|
|
|
|
html = html.replace( /\s*FONT-FAMILY:[^;"]*;?/gi, '' ) ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
}
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
// Remove Class attributes
|
|
|
|
|
html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
|
|
|
|
|
|
|
|
|
|
// Remove styles.
|
|
|
|
|
if ( bRemoveStyles )
|
|
|
|
|
html = html.replace( /<(\w[^>]*) style="([^\"]*)"([^>]*)/gi, "<$1$3" ) ;
|
|
|
|
|
|
|
|
|
|
// Remove empty styles.
|
|
|
|
|
html = html.replace( /\s*style="\s*"/gi, '' ) ;
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
html = html.replace( /<SPAN\s*[^>]*>\s* \s*<\/SPAN>/gi, ' ' ) ;
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
html = html.replace( /<SPAN\s*[^>]*><\/SPAN>/gi, '' ) ;
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
// Remove Lang attributes
|
|
|
|
|
html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
html = html.replace( /<SPAN\s*>(.*?)<\/SPAN>/gi, '$1' ) ;
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
html = html.replace( /<FONT\s*>(.*?)<\/FONT>/gi, '$1' ) ;
|
|
|
|
|
|
|
|
|
|
// Remove XML elements and declarations
|
2007-04-14 14:21:09 +02:00
|
|
|
|
html = html.replace(/<\\?\?xml[^>]*>/gi, '' ) ;
|
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
// Remove Tags with XML namespace declarations: <o:p><\/o:p>
|
2007-04-14 14:21:09 +02:00
|
|
|
|
html = html.replace(/<\/?\w+:[^>]*>/gi, '' ) ;
|
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
// Remove comments [SF BUG-1481861].
|
2007-04-14 14:21:09 +02:00
|
|
|
|
html = html.replace(/<\!--.*-->/g, '' ) ;
|
|
|
|
|
|
|
|
|
|
html = html.replace( /<(U|I|STRIKE)> <\/\1>/g, ' ' ) ;
|
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
html = html.replace( /<H\d>\s*<\/H\d>/gi, '' ) ;
|
|
|
|
|
|
2007-04-14 14:21:09 +02:00
|
|
|
|
// Remove "display:none" tags.
|
|
|
|
|
html = html.replace( /<(\w+)[^>]*\sstyle="[^"]*DISPLAY\s?:\s?none(.*?)<\/\1>/ig, '' ) ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
|
2007-04-14 14:21:09 +02:00
|
|
|
|
if ( FCKConfig.CleanWordKeepsStructure )
|
|
|
|
|
{
|
|
|
|
|
// The original <Hn> tag send from Word is something like this: <Hn style="margin-top:0px;margin-bottom:0px">
|
|
|
|
|
html = html.replace( /<H(\d)([^>]*)>/gi, '<h$1>' ) ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
|
2007-04-14 14:21:09 +02:00
|
|
|
|
// Word likes to insert extra <font> tags, when using MSIE. (Wierd).
|
|
|
|
|
html = html.replace( /<(H\d)><FONT[^>]*>(.*?)<\/FONT><\/\1>/gi, '<$1>$2</$1>' );
|
|
|
|
|
html = html.replace( /<(H\d)><EM>(.*?)<\/EM><\/\1>/gi, '<$1>$2</$1>' );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
html = html.replace( /<H1([^>]*)>/gi, '<div$1><b><font size="6">' ) ;
|
|
|
|
|
html = html.replace( /<H2([^>]*)>/gi, '<div$1><b><font size="5">' ) ;
|
|
|
|
|
html = html.replace( /<H3([^>]*)>/gi, '<div$1><b><font size="4">' ) ;
|
|
|
|
|
html = html.replace( /<H4([^>]*)>/gi, '<div$1><b><font size="3">' ) ;
|
|
|
|
|
html = html.replace( /<H5([^>]*)>/gi, '<div$1><b><font size="2">' ) ;
|
|
|
|
|
html = html.replace( /<H6([^>]*)>/gi, '<div$1><b><font size="1">' ) ;
|
2006-11-07 19:18:22 +01:00
|
|
|
|
|
2007-04-14 14:21:09 +02:00
|
|
|
|
html = html.replace( /<\/H\d>/gi, '<\/font><\/b><\/div>' ) ;
|
|
|
|
|
|
|
|
|
|
// Transform <P> to <DIV>
|
|
|
|
|
var re = new RegExp( '(<P)([^>]*>.*?)(<\/P>)', 'gi' ) ; // Different because of a IE 5.0 error
|
|
|
|
|
html = html.replace( re, '<div$2<\/div>' ) ;
|
|
|
|
|
|
|
|
|
|
// Remove empty tags (three times, just to be sure).
|
|
|
|
|
// This also removes any empty anchor
|
|
|
|
|
html = html.replace( /<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g, '' ) ;
|
|
|
|
|
html = html.replace( /<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g, '' ) ;
|
|
|
|
|
html = html.replace( /<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g, '' ) ;
|
|
|
|
|
}
|
2006-11-07 19:18:22 +01:00
|
|
|
|
|
|
|
|
|
return html ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
2007-04-14 14:21:09 +02:00
|
|
|
|
|
2006-11-07 19:18:22 +01:00
|
|
|
|
</head>
|
|
|
|
|
<body style="overflow: hidden">
|
|
|
|
|
<table cellspacing="0" cellpadding="0" width="100%" border="0" style="height: 98%">
|
|
|
|
|
<tr>
|
|
|
|
|
<td>
|
2007-04-14 14:21:09 +02:00
|
|
|
|
<div id="xSecurityMsg" style="display: none">
|
|
|
|
|
<span fcklang="DlgPasteSec">Because of your browser security settings,
|
|
|
|
|
the editor is not able to access your clipboard data directly. You are required
|
|
|
|
|
to paste it again in this window.</span><br />
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<span fcklang="DlgPasteMsg2">Please paste inside the following box using the keyboard
|
|
|
|
|
(<strong>Ctrl+V</strong>) and hit <strong>OK</strong>.</span><br />
|
|
|
|
|
|
|
|
|
|
</div>
|
2006-11-07 19:18:22 +01:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top" height="100%" style="border-right: #000000 1px solid; border-top: #000000 1px solid;
|
|
|
|
|
border-left: #000000 1px solid; border-bottom: #000000 1px solid">
|
|
|
|
|
<textarea id="txtData" cols="80" rows="5" style="border: #000000 1px; display: none;
|
|
|
|
|
width: 99%; height: 98%"></textarea>
|
|
|
|
|
<iframe id="frmData" src="javascript:void(0)" height="98%" width="99%" frameborder="0"
|
|
|
|
|
style="border-right: #000000 1px; border-top: #000000 1px; display: none; border-left: #000000 1px;
|
|
|
|
|
border-bottom: #000000 1px; background-color: #ffffff"></iframe>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr id="oWordCommands">
|
|
|
|
|
<td>
|
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
|
|
|
<tr>
|
|
|
|
|
<td nowrap="nowrap">
|
|
|
|
|
<input id="chkRemoveFont" type="checkbox" checked="checked" />
|
|
|
|
|
<label for="chkRemoveFont" fcklang="DlgPasteIgnoreFont">
|
|
|
|
|
Ignore Font Face definitions</label>
|
|
|
|
|
<br />
|
|
|
|
|
<input id="chkRemoveStyles" type="checkbox" />
|
|
|
|
|
<label for="chkRemoveStyles" fcklang="DlgPasteRemoveStyles">
|
|
|
|
|
Remove Styles definitions</label>
|
|
|
|
|
</td>
|
|
|
|
|
<td align="right" valign="top">
|
|
|
|
|
<input type="button" fcklang="DlgPasteCleanBox" value="Clean Up Box" onclick="CleanUpBox()" />
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|