+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\r
-<!--\r
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
- * Copyright (C) 2003-2009 Frederico Caldeira Knabben\r
- *\r
- * == BEGIN LICENSE ==\r
- *\r
- * Licensed under the terms of any of the following licenses at your\r
- * choice:\r
- *\r
- * - GNU General Public License Version 2 or later (the "GPL")\r
- * http://www.gnu.org/licenses/gpl.html\r
- *\r
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
- * http://www.gnu.org/licenses/lgpl.html\r
- *\r
- * - Mozilla Public License Version 1.1 or later (the "MPL")\r
- * http://www.mozilla.org/MPL/MPL-1.1.html\r
- *\r
- * == END LICENSE ==\r
- *\r
- * This dialog is shown when, for some reason (usually security settings),\r
- * the user is not able to paste data from the clipboard to the editor using\r
- * the toolbar buttons or the context menu.\r
--->\r
-<html xmlns="http://www.w3.org/1999/xhtml">\r
-<head>\r
- <title></title>\r
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
- <meta name="robots" content="noindex, nofollow" />\r
- <script src="common/fck_dialog_common.js" type="text/javascript"></script>\r
- <script type="text/javascript">\r
-var dialog = window.parent ;\r
-var oEditor = dialog.InnerDialogLoaded() ;\r
-var FCK = oEditor.FCK;\r
-var FCKTools = oEditor.FCKTools ;\r
-var FCKConfig = oEditor.FCKConfig ;\r
-var FCKBrowserInfo = oEditor.FCKBrowserInfo ;\r
-\r
-window.onload = function ()\r
-{\r
- // First of all, translate the dialog box texts\r
- oEditor.FCKLanguageManager.TranslatePage(document) ;\r
-\r
- var sPastingType = dialog.Args().CustomValue ;\r
-\r
- if ( sPastingType == 'Word' || sPastingType == 'Security' )\r
- {\r
- if ( sPastingType == 'Security' )\r
- document.getElementById( 'xSecurityMsg' ).style.display = '' ;\r
-\r
- // For document.domain compatibility (#123) we must do all the magic in\r
- // the URL for IE.\r
- var sFrameUrl = !oEditor.FCK_IS_CUSTOM_DOMAIN || !FCKBrowserInfo.IsIE ?\r
- 'javascript:void(0)' :\r
- 'javascript:void( (function(){' +\r
- 'document.open() ;' +\r
- 'document.domain=\'' + document.domain + '\' ;' +\r
- 'document.write(\'<html><head><script>window.onerror = function() { return true ; };<\/script><\/head><body><\/body><\/html>\') ;' +\r
- 'document.close() ;' +\r
- 'document.body.contentEditable = true ;' +\r
- 'window.focus() ;' +\r
- '})() )' ;\r
-\r
- var eFrameSpace = document.getElementById( 'xFrameSpace' ) ;\r
- eFrameSpace.innerHTML = '<iframe id="frmData" src="' + sFrameUrl + '" ' +\r
- 'height="98%" width="99%" frameborder="0" style="border: #000000 1px; background-color: #ffffff"><\/iframe>' ;\r
-\r
- var oFrame = eFrameSpace.firstChild ;\r
-\r
- if ( !oEditor.FCK_IS_CUSTOM_DOMAIN || !FCKBrowserInfo.IsIE )\r
- {\r
- // Avoid errors if the pasted content has any script that fails: #389\r
- var oDoc = oFrame.contentWindow.document ;\r
- oDoc.open() ;\r
- oDoc.write('<html><head><script>window.onerror = function() { return true ; };<\/script><\/head><body><\/body><\/html>') ;\r
- oDoc.close() ;\r
-\r
- if ( FCKBrowserInfo.IsIE )\r
- oDoc.body.contentEditable = true ;\r
- else\r
- oDoc.designMode = 'on' ;\r
-\r
- oFrame.contentWindow.focus();\r
- }\r
- }\r
- else\r
- {\r
- document.getElementById('txtData').style.display = '' ;\r
- SelectField( 'txtData' ) ;\r
- }\r
-\r
- if ( sPastingType != 'Word' )\r
- document.getElementById('oWordCommands').style.display = 'none' ;\r
-\r
- dialog.SetOkButton( true ) ;\r
- dialog.SetAutoSize( true ) ;\r
-}\r
-\r
-function Ok()\r
-{\r
- // Before doing anything, save undo snapshot.\r
- oEditor.FCKUndo.SaveUndoStep() ;\r
-\r
- var sHtml ;\r
-\r
- var sPastingType = dialog.Args().CustomValue ;\r
-\r
- if ( sPastingType == 'Word' || sPastingType == 'Security' )\r
- {\r
- var oFrame = document.getElementById('frmData') ;\r
- var oBody ;\r
-\r
- if ( oFrame.contentDocument )\r
- oBody = oFrame.contentDocument.body ;\r
- else\r
- oBody = oFrame.contentWindow.document.body ;\r
-\r
- if ( sPastingType == 'Word' )\r
- {\r
- // If a plugin creates a FCK.CustomCleanWord function it will be called instead of the default one\r
- if ( typeof( FCK.CustomCleanWord ) == 'function' )\r
- sHtml = FCK.CustomCleanWord( oBody, document.getElementById('chkRemoveFont').checked, document.getElementById('chkRemoveStyles').checked ) ;\r
- else\r
- sHtml = CleanWord( oBody, document.getElementById('chkRemoveFont').checked, document.getElementById('chkRemoveStyles').checked ) ;\r
- }\r
- else\r
- sHtml = oBody.innerHTML ;\r
-\r
- // Fix relative anchor URLs (IE automatically adds the current page URL).\r
- var re = new RegExp( window.location + "#", "g" ) ;\r
- sHtml = sHtml.replace( re, '#') ;\r
- }\r
- else\r
- {\r
- sHtml = oEditor.FCKTools.HTMLEncode( document.getElementById('txtData').value ) ;\r
- sHtml = FCKTools.ProcessLineBreaks( oEditor, FCKConfig, sHtml ) ;\r
-\r
- // FCK.InsertHtml() does not work for us, since document fragments cannot contain node fragments. :(\r
- // Use the marker method instead. It's primitive, but it works.\r
- var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ;\r
- var oDoc = oEditor.FCK.EditorDocument ;\r
- dialog.Selection.EnsureSelection() ;\r
- range.MoveToSelection() ;\r
- range.DeleteContents() ;\r
- var marker = [] ;\r
- for ( var i = 0 ; i < 5 ; i++ )\r
- marker.push( parseInt(Math.random() * 100000, 10 ) ) ;\r
- marker = marker.join( "" ) ;\r
- range.InsertNode ( oDoc.createTextNode( marker ) ) ;\r
- var bookmark = range.CreateBookmark() ;\r
-\r
- // Now we've got a marker indicating the paste position in the editor document.\r
- // Find its position in the HTML code.\r
- var htmlString = oDoc.body.innerHTML ;\r
- var index = htmlString.indexOf( marker ) ;\r
-\r
- // Split it the HTML code up, add the code we generated, and put them back together.\r
- var htmlList = [] ;\r
- htmlList.push( htmlString.substr( 0, index ) ) ;\r
- htmlList.push( sHtml ) ;\r
- htmlList.push( htmlString.substr( index + marker.length ) ) ;\r
- htmlString = htmlList.join( "" ) ;\r
-\r
- if ( oEditor.FCKBrowserInfo.IsIE )\r
- oEditor.FCK.SetInnerHtml( htmlString ) ;\r
- else\r
- oDoc.body.innerHTML = htmlString ;\r
-\r
- range.MoveToBookmark( bookmark ) ;\r
- range.Collapse( false ) ;\r
- range.Select() ;\r
- range.Release() ;\r
- return true ;\r
- }\r
-\r
- oEditor.FCK.InsertHtml( sHtml ) ;\r
-\r
- return true ;\r
-}\r
-\r
-// This function will be called from the PasteFromWord dialog (fck_paste.html)\r
-// Input: oNode a DOM node that contains the raw paste from the clipboard\r
-// bIgnoreFont, bRemoveStyles booleans according to the values set in the dialog\r
-// Output: the cleaned string\r
-function CleanWord( oNode, bIgnoreFont, bRemoveStyles )\r
-{\r
- var html = oNode.innerHTML ;\r
-\r
- html = html.replace(/<o:p>\s*<\/o:p>/g, '') ;\r
- html = html.replace(/<o:p>[\s\S]*?<\/o:p>/g, ' ') ;\r
-\r
- // Remove mso-xxx styles.\r
- html = html.replace( /\s*mso-[^:]+:[^;"]+;?/gi, '' ) ;\r
-\r
- // Remove margin styles.\r
- html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*;/gi, '' ) ;\r
- html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*"/gi, "\"" ) ;\r
-\r
- html = html.replace( /\s*TEXT-INDENT: 0cm\s*;/gi, '' ) ;\r
- html = html.replace( /\s*TEXT-INDENT: 0cm\s*"/gi, "\"" ) ;\r
-\r
- html = html.replace( /\s*TEXT-ALIGN: [^\s;]+;?"/gi, "\"" ) ;\r
-\r
- html = html.replace( /\s*PAGE-BREAK-BEFORE: [^\s;]+;?"/gi, "\"" ) ;\r
-\r
- html = html.replace( /\s*FONT-VARIANT: [^\s;]+;?"/gi, "\"" ) ;\r
-\r
- html = html.replace( /\s*tab-stops:[^;"]*;?/gi, '' ) ;\r
- html = html.replace( /\s*tab-stops:[^"]*/gi, '' ) ;\r
-\r
- // Remove FONT face attributes.\r
- if ( bIgnoreFont )\r
- {\r
- html = html.replace( /\s*face="[^"]*"/gi, '' ) ;\r
- html = html.replace( /\s*face=[^ >]*/gi, '' ) ;\r
-\r
- html = html.replace( /\s*FONT-FAMILY:[^;"]*;?/gi, '' ) ;\r
- }\r
-\r
- // Remove Class attributes\r
- html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;\r
-\r
- // Remove styles.\r
- if ( bRemoveStyles )\r
- html = html.replace( /<(\w[^>]*) style="([^\"]*)"([^>]*)/gi, "<$1$3" ) ;\r
-\r
- // Remove style, meta and link tags\r
- html = html.replace( /<STYLE[^>]*>[\s\S]*?<\/STYLE[^>]*>/gi, '' ) ;\r
- html = html.replace( /<(?:META|LINK)[^>]*>\s*/gi, '' ) ;\r
-\r
- // Remove empty styles.\r
- html = html.replace( /\s*style="\s*"/gi, '' ) ;\r
-\r
- html = html.replace( /<SPAN\s*[^>]*>\s* \s*<\/SPAN>/gi, ' ' ) ;\r
-\r
- html = html.replace( /<SPAN\s*[^>]*><\/SPAN>/gi, '' ) ;\r
-\r
- // Remove Lang attributes\r
- html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;\r
-\r
- html = html.replace( /<SPAN\s*>([\s\S]*?)<\/SPAN>/gi, '$1' ) ;\r
-\r
- html = html.replace( /<FONT\s*>([\s\S]*?)<\/FONT>/gi, '$1' ) ;\r
-\r
- // Remove XML elements and declarations\r
- html = html.replace(/<\\?\?xml[^>]*>/gi, '' ) ;\r
-\r
- // Remove w: tags with contents.\r
- html = html.replace( /<w:[^>]*>[\s\S]*?<\/w:[^>]*>/gi, '' ) ;\r
-\r
- // Remove Tags with XML namespace declarations: <o:p><\/o:p>\r
- html = html.replace(/<\/?\w+:[^>]*>/gi, '' ) ;\r
-\r
- // Remove comments [SF BUG-1481861].\r
- html = html.replace(/<\!--[\s\S]*?-->/g, '' ) ;\r
-\r
- html = html.replace( /<(U|I|STRIKE)> <\/\1>/g, ' ' ) ;\r
-\r
- html = html.replace( /<H\d>\s*<\/H\d>/gi, '' ) ;\r
-\r
- // Remove "display:none" tags.\r
- html = html.replace( /<(\w+)[^>]*\sstyle="[^"]*DISPLAY\s?:\s?none[\s\S]*?<\/\1>/ig, '' ) ;\r
-\r
- // Remove language tags\r
- html = html.replace( /<(\w[^>]*) language=([^ |>]*)([^>]*)/gi, "<$1$3") ;\r
-\r
- // Remove onmouseover and onmouseout events (from MS Word comments effect)\r
- html = html.replace( /<(\w[^>]*) onmouseover="([^\"]*)"([^>]*)/gi, "<$1$3") ;\r
- html = html.replace( /<(\w[^>]*) onmouseout="([^\"]*)"([^>]*)/gi, "<$1$3") ;\r
-\r
- if ( FCKConfig.CleanWordKeepsStructure )\r
- {\r
- // The original <Hn> tag send from Word is something like this: <Hn style="margin-top:0px;margin-bottom:0px">\r
- html = html.replace( /<H(\d)([^>]*)>/gi, '<h$1>' ) ;\r
-\r
- // Word likes to insert extra <font> tags, when using MSIE. (Wierd).\r
- html = html.replace( /<(H\d)><FONT[^>]*>([\s\S]*?)<\/FONT><\/\1>/gi, '<$1>$2<\/$1>' );\r
- html = html.replace( /<(H\d)><EM>([\s\S]*?)<\/EM><\/\1>/gi, '<$1>$2<\/$1>' );\r
- }\r
- else\r
- {\r
- html = html.replace( /<H1([^>]*)>/gi, '<div$1><b><font size="6">' ) ;\r
- html = html.replace( /<H2([^>]*)>/gi, '<div$1><b><font size="5">' ) ;\r
- html = html.replace( /<H3([^>]*)>/gi, '<div$1><b><font size="4">' ) ;\r
- html = html.replace( /<H4([^>]*)>/gi, '<div$1><b><font size="3">' ) ;\r
- html = html.replace( /<H5([^>]*)>/gi, '<div$1><b><font size="2">' ) ;\r
- html = html.replace( /<H6([^>]*)>/gi, '<div$1><b><font size="1">' ) ;\r
-\r
- html = html.replace( /<\/H\d>/gi, '<\/font><\/b><\/div>' ) ;\r
-\r
- // Transform <P> to <DIV>\r
- var re = new RegExp( '(<P)([^>]*>[\\s\\S]*?)(<\/P>)', 'gi' ) ; // Different because of a IE 5.0 error\r
- html = html.replace( re, '<div$2<\/div>' ) ;\r
-\r
- // Remove empty tags (three times, just to be sure).\r
- // This also removes any empty anchor\r
- html = html.replace( /<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g, '' ) ;\r
- html = html.replace( /<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g, '' ) ;\r
- html = html.replace( /<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g, '' ) ;\r
- }\r
-\r
- return html ;\r
-}\r
-\r
- </script>\r
-\r
-</head>\r
-<body style="overflow: hidden">\r
- <table cellspacing="0" cellpadding="0" width="100%" border="0" style="height: 98%">\r
- <tr>\r
- <td>\r
- <div id="xSecurityMsg" style="display: none">\r
- <span fcklang="DlgPasteSec">Because of your browser security settings,\r
- the editor is not able to access your clipboard data directly. You are required\r
- to paste it again in this window.</span><br />\r
- \r
- </div>\r
- <div>\r
- <span fcklang="DlgPasteMsg2">Please paste inside the following box using the keyboard\r
- (<strong>Ctrl+V</strong>) and hit <strong>OK</strong>.</span><br />\r
- \r
- </div>\r
- </td>\r
- </tr>\r
- <tr>\r
- <td id="xFrameSpace" valign="top" height="100%" style="border: #000000 1px solid">\r
- <textarea id="txtData" cols="80" rows="5" style="border: #000000 1px; display: none;\r
- width: 99%; height: 98%"></textarea>\r
- </td>\r
- </tr>\r
- <tr id="oWordCommands">\r
- <td>\r
-\r
- <input id="chkRemoveFont" type="checkbox" checked="checked" />\r
- <label for="chkRemoveFont" fcklang="DlgPasteIgnoreFont">\r
- Ignore Font Face definitions</label>\r
- <br />\r
- <input id="chkRemoveStyles" type="checkbox" />\r
- <label for="chkRemoveStyles" fcklang="DlgPasteRemoveStyles">\r
- Remove Styles definitions</label>\r
-\r
- </td>\r
- </tr>\r
- </table>\r
-</body>\r
-</html>\r