includes/clientside/tinymce/plugins/paste/editor_plugin_src.js
changeset 459 31c23016ab62
parent 395 fa4c5ecb7c9a
child 476 f26a69c40431
equal deleted inserted replaced
458:c433348f3628 459:31c23016ab62
     1 /**
     1 /**
     2  * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
     2  * $Id: editor_plugin_src.js 615 2008-02-20 23:18:01Z spocke $
     3  *
     3  *
     4  * @author Moxiecode
     4  * @author Moxiecode
     5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
     5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
     6  */
     6  */
     7 
     7 
   158 
   158 
   159 			if (content && content.length > 0) {
   159 			if (content && content.length > 0) {
   160 				// Cleanup Word content
   160 				// Cleanup Word content
   161 				var bull = String.fromCharCode(8226);
   161 				var bull = String.fromCharCode(8226);
   162 				var middot = String.fromCharCode(183);
   162 				var middot = String.fromCharCode(183);
   163 				var cb;
   163 
   164 
   164 				if (ed.getParam('paste_insert_word_content_callback'))
   165 				if ((cb = this.editor.getParam("paste_insert_word_content_callback", "")) != "")
   165 					content = ed.execCallback('paste_insert_word_content_callback', 'before', content);
   166 					content = eval(cb + "('before', content)");
   166 
   167 
   167 				var rl = ed.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
   168 				var rl = this.editor.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
       
   169 				for (var i=0; i<rl.length; i+=2)
   168 				for (var i=0; i<rl.length; i+=2)
   170 					content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
   169 					content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
   171 
   170 
   172 				if (this.editor.getParam("paste_convert_headers_to_strong", false)) {
   171 				if (this.editor.getParam("paste_convert_headers_to_strong", false)) {
   173 					content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
   172 					content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
   243 					content = content.replace(/^(&nbsp;)*/gi, '');
   242 					content = content.replace(/^(&nbsp;)*/gi, '');
   244 				}
   243 				}
   245 
   244 
   246 				content = content.replace(/--list--/gi, ""); // Remove --list--
   245 				content = content.replace(/--list--/gi, ""); // Remove --list--
   247 
   246 
   248 				if ((cb = this.editor.getParam("paste_insert_word_content_callback", "")) != "")
   247 				if (ed.getParam('paste_insert_word_content_callback'))
   249 					content = eval(cb + "('after', content)");
   248 					content = ed.execCallback('paste_insert_word_content_callback', 'after', content);
   250 
   249 
   251 				// Insert cleaned content
   250 				// Insert cleaned content
   252 				this.editor.execCommand("mceInsertContent", false, content);
   251 				this.editor.execCommand("mceInsertContent", false, content);
   253 
   252 
   254 				if (this.editor.getParam('paste_force_cleanup_wordpaste', true)) {
   253 				if (this.editor.getParam('paste_force_cleanup_wordpaste', true)) {