includes/clientside/tinymce/plugins/paste/editor_plugin_src.js
changeset 778 57ce13805b6f
parent 588 20484deb89cd
child 1193 e3b94bd055dc
--- a/includes/clientside/tinymce/plugins/paste/editor_plugin_src.js	Sun Dec 21 15:35:46 2008 -0500
+++ b/includes/clientside/tinymce/plugins/paste/editor_plugin_src.js	Sun Dec 21 16:28:00 2008 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js 862 2008-06-02 20:09:06Z spocke $
+ * $Id: editor_plugin_src.js 919 2008-09-08 20:31:23Z spocke $
  *
  * @author Moxiecode
  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -107,6 +107,10 @@
 			content = this.editor.dom.encode(content);
 
 			if (content && content.length > 0) {
+				// Delete any highlighted text before pasting
+				if (!this.editor.selection.isCollapsed())
+					this.editor.execCommand("Delete"); 
+
 				if (bLinebreaks) { 
 					// Special paragraph treatment 
 					if (this.editor.getParam("paste_create_paragraphs", true)) {
@@ -172,7 +176,7 @@
 				if (ed.getParam('paste_insert_word_content_callback'))
 					content = ed.execCallback('paste_insert_word_content_callback', 'before', content);
 
-				var rl = ed.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
+				var rl = ed.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\x93|\x94|\u201c|\u201d,",\x60|\x91|\x92|\u2018|\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
 				for (var i=0; i<rl.length; i+=2)
 					content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
 
@@ -185,7 +189,8 @@
 				content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
 				content = content.replace(/<o:p><\/o:p>/gi, "");
 				content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
-				content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), "");  // Word comments
+				content = content.replace(/<!--([\s\S]*?)-->|<style>[\s\S]*?<\/style>/g, "");  // Word comments
+				content = content.replace(/<(meta|link)[^>]+>/g, ""); // Header elements
 
 				if (this.editor.getParam("paste_remove_spans", true))
 					content = content.replace(/<\/?span[^>]*>/gi, "");