/* Import plugin specific language pack */ \r
-tinyMCE.importPluginLanguagePack('paste', 'en,sv,cs,zh_cn,fr_ca,da,he,no,de,hu'); \r
+tinyMCE.importPluginLanguagePack('paste', 'en,sv,cs,zh_cn,fr_ca,da,he,nb,de,hu,ru,ru_KOI8-R,ru_UTF-8,nn,fi,es,cy,is,pl,nl,fr,pt_br');\r
\r
function TinyMCE_paste_getInfo() {\r
return {\r
\r
function TinyMCE_paste_getControlHTML(control_name) { \r
switch (control_name) { \r
- case "pastetext": \r
- return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcePasteText\', true);" target="_self" onmousedown="return false;"><img id="{$editor_id}pastetext" src="{$pluginurl}/images/pastetext.gif" title="{$lang_paste_text_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreClass(this);" /></a>'; \r
+ case "pastetext":\r
+ var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcePasteText\', true);return false;';\r
+ return '<a href="javascript:' + cmd + '" onclick="' + cmd + '" target="_self" onmousedown="return false;"><img id="{$editor_id}pastetext" src="{$pluginurl}/images/pastetext.gif" title="{$lang_paste_text_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreClass(this);" /></a>'; \r
\r
- case "pasteword": \r
- return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcePasteWord\', true);" target="_self" onmousedown="return false;"><img id="{$editor_id}pasteword" src="{$pluginurl}/images/pasteword.gif" title="{$lang_paste_word_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreClass(this);" /></a>'; \r
+ case "pasteword":\r
+ var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcePasteWord\', true);return false;';\r
+ return '<a href="javascript:' + cmd + '" onclick="' + cmd + '" target="_self" onmousedown="return false;"><img id="{$editor_id}pasteword" src="{$pluginurl}/images/pasteword.gif" title="{$lang_paste_word_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreClass(this);" /></a>'; \r
\r
- case "selectall": \r
- return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSelectAll\');" target="_self" onmousedown="return false;"><img id="{$editor_id}selectall" src="{$pluginurl}/images/selectall.gif" title="{$lang_selectall_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreClass(this);" /></a>'; \r
+ case "selectall":\r
+ var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSelectAll\');return false;';\r
+ return '<a href="javascript:' + cmd + '" onclick="' + cmd + '" target="_self" onmousedown="return false;"><img id="{$editor_id}selectall" src="{$pluginurl}/images/selectall.gif" title="{$lang_selectall_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreClass(this);" /></a>'; \r
} \r
\r
return ''; \r
switch (command) { \r
case "mcePasteText": \r
if (user_interface) {\r
- if (tinyMCE.isMSIE && !tinyMCE.getParam('paste_use_dialog', false))\r
+ if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false))\r
TinyMCE_paste__insertText(clipboardData.getData("Text"), true); \r
else { \r
var template = new Array(); \r
\r
case "mcePasteWord": \r
if (user_interface) {\r
- if (tinyMCE.isMSIE && !tinyMCE.getParam('paste_use_dialog', false)) {\r
+ if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) {\r
var html = TinyMCE_paste__clipboardHTML();\r
\r
if (html && html.length > 0)\r
if (content && content.length > 0) {\r
if (bLinebreaks) { \r
// Special paragraph treatment \r
- if (tinyMCE.getParam("plaintext_create_paragraphs", true)) { \r
+ if (tinyMCE.getParam("paste_create_paragraphs", true)) {\r
+ var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');\r
+ for (var i=0; i<rl.length; i+=2)\r
+ content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);\r
+\r
content = tinyMCE.regexpReplace(content, "\r\n\r\n", "</p><p>", "gi"); \r
content = tinyMCE.regexpReplace(content, "\r\r", "</p><p>", "gi"); \r
content = tinyMCE.regexpReplace(content, "\n\n", "</p><p>", "gi"); \r
} \r
} \r
\r
- content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi"); \r
- content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi"); \r
- content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi"); \r
+ if (tinyMCE.getParam("paste_create_linebreaks", true)) {\r
+ content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi"); \r
+ content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi"); \r
+ content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi"); \r
+ }\r
} \r
\r
tinyMCE.execCommand("mceInsertRawHTML", false, content); \r
var bull = String.fromCharCode(8226);\r
var middot = String.fromCharCode(183);\r
\r
+ var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');\r
+ for (var i=0; i<rl.length; i+=2)\r
+ content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);\r
+\r
if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {\r
content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');\r
}\r
content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks\r
content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments\r
content = content.replace(/<\/?span[^>]*>/gi, "");\r
- content = content.replace(new RegExp('<(\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");\r
+ content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");\r
content = content.replace(/<\/?font[^>]*>/gi, "");\r
- content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");\r
+\r
+ // Strips class attributes.\r
+ switch (tinyMCE.getParam("paste_strip_class_attributes", "all")) {\r
+ case "all":\r
+ content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");\r
+ break;\r
+\r
+ case "mso":\r
+ content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");\r
+ break;\r
+ }\r
+\r
+ content = content.replace(new RegExp('href="?' + TinyMCE_paste__reEscape("" + document.location) + '', 'gi'), 'href="' + tinyMCE.settings['document_base_url']);\r
content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");\r
content = content.replace(/<\\?\?xml[^>]*>/gi, "");\r
content = content.replace(/<\/?\w+:[^>]*>/gi, "");\r
}\r
}\r
\r
+function TinyMCE_paste__reEscape(s) {\r
+ var l = "?.\\*[](){}+^$:";\r
+ var o = "";\r
+\r
+ for (var i=0; i<s.length; i++) {\r
+ var c = s.charAt(i);\r
+\r
+ if (l.indexOf(c) != -1)\r
+ o += '\\' + c;\r
+ else\r
+ o += c;\r
+ }\r
+\r
+ return o;\r
+}\r
+\r
function TinyMCE_paste_convertMiddots(div, search, class_name) {\r
var mdot = String.fromCharCode(183);\r
var bull = String.fromCharCode(8226);\r