'); bgneal@45: content = content.replace(/\r\r/g, '
'); bgneal@45: content = content.replace(/\n\n/g, '
'); bgneal@45: bgneal@45: // Has paragraphs bgneal@45: if ((pos = content.indexOf('
')) != -1) { bgneal@45: this.editor.execCommand("Delete"); bgneal@45: bgneal@45: var node = this.editor.selection.getNode(); bgneal@45: bgneal@45: // Get list of elements to break bgneal@45: var breakElms = []; bgneal@45: bgneal@45: do { bgneal@45: if (node.nodeType == 1) { bgneal@45: // Don't break tables and break at body bgneal@45: if (node.nodeName == "TD" || node.nodeName == "BODY") bgneal@45: break; bgneal@45: bgneal@45: breakElms[breakElms.length] = node; bgneal@45: } bgneal@45: } while(node = node.parentNode); bgneal@45: bgneal@45: var before = "", after = "
"; bgneal@45: before += content.substring(0, pos); bgneal@45: bgneal@45: for (var i=0; i";
bgneal@45: content = before + content.substring(pos+7) + after;
bgneal@45: }
bgneal@45: }
bgneal@45:
bgneal@45: if (this.editor.getParam("paste_create_linebreaks", true)) {
bgneal@45: content = content.replace(/\r\n/g, ' $1 " + middot + "$1 <\/p>/gi, ""); // Remove pagebreaks
bgneal@45: content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
bgneal@45:
bgneal@45: // content = content.replace(/\/? */gi, "");
bgneal@45: // content = content.replace(/ <\/p>/gi, '');
bgneal@45:
bgneal@45: if (!this.editor.getParam('force_p_newlines')) {
bgneal@45: content = content.replace('', '' ,'gi');
bgneal@45: content = content.replace(' ');
bgneal@45: content = content.replace(/<\/h[1-6]>/gi, '
');
bgneal@45: content = content.replace(/\r/g, '
');
bgneal@45: content = content.replace(/\n/g, '
');
bgneal@45: }
bgneal@45: }
bgneal@45:
bgneal@45: this.editor.execCommand("mceInsertRawHTML", false, content);
bgneal@45: }
bgneal@45: },
bgneal@45:
bgneal@45: _insertWordContent : function(content) {
bgneal@45: var t = this, ed = t.editor;
bgneal@45:
bgneal@45: if (content && content.length > 0) {
bgneal@45: // Cleanup Word content
bgneal@45: var bull = String.fromCharCode(8226);
bgneal@45: var middot = String.fromCharCode(183);
bgneal@45:
bgneal@45: if (ed.getParam('paste_insert_word_content_callback'))
bgneal@45: content = ed.execCallback('paste_insert_word_content_callback', 'before', content);
bgneal@45:
bgneal@45: var rl = ed.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\x93|\x94|\u201c|\u201d,",\x60|\x91|\x92|\u2018|\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
bgneal@45: for (var i=0; i
", "gi"), "
]+>/g, ""); // Header elements
bgneal@45:
bgneal@45: if (this.editor.getParam("paste_remove_spans", true))
bgneal@45: content = content.replace(/<\/?span[^>]*>/gi, "");
bgneal@45:
bgneal@45: if (this.editor.getParam("paste_remove_styles", true))
bgneal@45: content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
bgneal@45:
bgneal@45: content = content.replace(/<\/?font[^>]*>/gi, "");
bgneal@45:
bgneal@45: // Strips class attributes.
bgneal@45: switch (this.editor.getParam("paste_strip_class_attributes", "all")) {
bgneal@45: case "all":
bgneal@45: content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
bgneal@45: break;
bgneal@45:
bgneal@45: case "mso":
bgneal@45: content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
bgneal@45: break;
bgneal@45: }
bgneal@45:
bgneal@45: content = content.replace(new RegExp('href="?' + this._reEscape("" + document.location) + '', 'gi'), 'href="' + this.editor.documentBaseURI.getURI());
bgneal@45: content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
bgneal@45: content = content.replace(/<\\?\?xml[^>]*>/gi, "");
bgneal@45: content = content.replace(/<\/?\w+:[^>]*>/gi, "");
bgneal@45: content = content.replace(/-- page break --\s*
' ,'gi');
bgneal@45: }
bgneal@45:
bgneal@45: if (!tinymce.isIE && !this.editor.getParam('force_p_newlines')) {
bgneal@45: content = content.replace(/<\/?p[^>]*>/gi, "");
bgneal@45: }
bgneal@45:
bgneal@45: content = content.replace(/<\/?div[^>]*>/gi, "");
bgneal@45:
bgneal@45: // Convert all middlot lists to UL lists
bgneal@45: if (this.editor.getParam("paste_convert_middot_lists", true)) {
bgneal@45: var div = ed.dom.create("div", null, content);
bgneal@45:
bgneal@45: // Convert all middot paragraphs to li elements
bgneal@45: var className = this.editor.getParam("paste_unindented_list_class", "unIndentedList");
bgneal@45:
bgneal@45: while (this._convertMiddots(div, "--list--")) ; // bull
bgneal@45: while (this._convertMiddots(div, middot, className)) ; // Middot
bgneal@45: while (this._convertMiddots(div, bull)) ; // bull
bgneal@45:
bgneal@45: content = div.innerHTML;
bgneal@45: }
bgneal@45:
bgneal@45: // Replace all headers with strong and fix some other issues
bgneal@45: if (this.editor.getParam("paste_convert_headers_to_strong", false)) {
bgneal@45: content = content.replace(/