TinyMCE fixes. Reinstate "More..." button. Filter trailing br. fixes #1789
git-svn-id: https://develop.svn.wordpress.org/trunk@2964 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6ffbef60a5
commit
71ee10cc3b
|
@ -87,7 +87,7 @@ tinyMCE.init({
|
||||||
textarea_trigger : "title",
|
textarea_trigger : "title",
|
||||||
width : "100%",
|
width : "100%",
|
||||||
theme : "advanced",
|
theme : "advanced",
|
||||||
theme_advanced_buttons1 : "bold,italic,strikethrough,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,image,emotions,separator,undo,redo,wordpress,code",
|
theme_advanced_buttons1 : "bold,italic,strikethrough,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,image,emotions,separator,wordpress,separator,undo,redo,code",
|
||||||
theme_advanced_buttons2 : "",
|
theme_advanced_buttons2 : "",
|
||||||
theme_advanced_buttons3 : "",
|
theme_advanced_buttons3 : "",
|
||||||
theme_advanced_toolbar_location : "top",
|
theme_advanced_toolbar_location : "top",
|
||||||
|
@ -99,8 +99,9 @@ tinyMCE.init({
|
||||||
theme_advanced_resize_horizontal : false,
|
theme_advanced_resize_horizontal : false,
|
||||||
entity_encoding : "raw",
|
entity_encoding : "raw",
|
||||||
relative_urls : false,
|
relative_urls : false,
|
||||||
|
remove_script_host : false,
|
||||||
valid_elements : "a[href|title],strong/b,em/i,strike,u,p[class|align],ol,ul,li,br,img[class|src|alt|title|width|height|align],sub,sup,blockquote,table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],div[dir|class|align],span[class|align],pre[class],address,h1[class|align],h2[class|align],h3[class|align],h4[class|align],h5[class|align],h6[class|align],hr",
|
valid_elements : "a[href|title],strong/b,em/i,strike,u,p[class|align],ol,ul,li,br,img[class|src|alt|title|width|height|align],sub,sup,blockquote,table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],div[dir|class|align],span[class|align],pre[class],address,h1[class|align],h2[class|align],h3[class|align],h4[class|align],h5[class|align],h6[class|align],hr",
|
||||||
plugins : "autosave, contextmenu"
|
plugins : "contextmenu,wordpress"
|
||||||
<?php do_action('mce_options'); ?>
|
<?php do_action('mce_options'); ?>
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -9,7 +9,7 @@ function TinyMCE_wordpress_initInstance(inst) {
|
||||||
function TinyMCE_wordpress_getControlHTML(control_name) {
|
function TinyMCE_wordpress_getControlHTML(control_name) {
|
||||||
switch (control_name) {
|
switch (control_name) {
|
||||||
case "wordpress":
|
case "wordpress":
|
||||||
return '<img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="More..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\');" /><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="...Page..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\');" />';
|
return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="More..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a><!--<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="...Page..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
@ -65,58 +65,58 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
|
||||||
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
|
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle commands
|
// Handle commands
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case "mcewordpressmore":
|
case "mcewordpressmore":
|
||||||
var name = "";
|
var flag = "";
|
||||||
var template = new Array();
|
var template = new Array();
|
||||||
var inst = tinyMCE.getInstanceById(editor_id);
|
var inst = tinyMCE.getInstanceById(editor_id);
|
||||||
var focusElm = inst.getFocusElement();
|
var focusElm = inst.getFocusElement();
|
||||||
|
|
||||||
// Is selection a image
|
// Is selection a image
|
||||||
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
|
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
|
||||||
name = getAttrib(focusElm, 'name');
|
flag = getAttrib(focusElm, 'class');
|
||||||
|
|
||||||
if (name != 'mce_plugin_wordpress_more') // Not a wordpress
|
if (flag != 'mce_plugin_wordpress_more') // Not a wordpress
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
action = "update";
|
action = "update";
|
||||||
}
|
}
|
||||||
|
|
||||||
html = ''
|
html = ''
|
||||||
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
|
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
|
||||||
+ ' width="100%" height="10px" '
|
+ ' width="100%" height="10px" '
|
||||||
+ 'alt="More..." title="More..." class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
|
+ 'alt="More..." title="More..." class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
|
||||||
tinyMCE.execCommand("mceInsertContent",true,html);
|
tinyMCE.execCommand("mceInsertContent",true,html);
|
||||||
tinyMCE.selectedInstance.repaint();
|
tinyMCE.selectedInstance.repaint();
|
||||||
return true;
|
return true;
|
||||||
case "mcewordpresspage":
|
case "mcewordpresspage":
|
||||||
var name = "";
|
var flag = "";
|
||||||
var template = new Array();
|
var template = new Array();
|
||||||
var inst = tinyMCE.getInstanceById(editor_id);
|
var inst = tinyMCE.getInstanceById(editor_id);
|
||||||
var focusElm = inst.getFocusElement();
|
var focusElm = inst.getFocusElement();
|
||||||
|
|
||||||
// Is selection a image
|
// Is selection a image
|
||||||
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
|
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
|
||||||
name = getAttrib(focusElm, 'name');
|
flag = getAttrib(focusElm, 'name');
|
||||||
|
|
||||||
if (name != 'mce_plugin_wordpress_page') // Not a wordpress
|
if (flag != 'mce_plugin_wordpress_page') // Not a wordpress
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
action = "update";
|
action = "update";
|
||||||
}
|
}
|
||||||
|
|
||||||
html = ''
|
html = ''
|
||||||
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
|
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
|
||||||
+ ' width="100%" height="10px" '
|
+ ' width="100%" height="10px" '
|
||||||
+ 'alt="More..." title="More..." class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
|
+ 'alt="More..." title="More..." class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
|
||||||
tinyMCE.execCommand("mceInsertContent",true,html);
|
tinyMCE.execCommand("mceInsertContent",true,html);
|
||||||
tinyMCE.selectedInstance.repaint();
|
tinyMCE.selectedInstance.repaint();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass to next handler in chain
|
// Pass to next handler in chain
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function TinyMCE_wordpress_cleanup(type, content) {
|
function TinyMCE_wordpress_cleanup(type, content) {
|
||||||
|
@ -130,9 +130,9 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
||||||
// Insert image
|
// Insert image
|
||||||
var contentAfter = content.substring(startPos + 11);
|
var contentAfter = content.substring(startPos + 11);
|
||||||
content = content.substring(0, startPos);
|
content = content.substring(0, startPos);
|
||||||
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
|
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
|
||||||
content += ' width="100%" height="10px" ';
|
content += ' width="100%" height="10px" ';
|
||||||
content += 'alt="More..." title="More..." class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
|
content += 'alt="More..." title="More..." class="mce_plugin_wordpress_more" />';
|
||||||
content += contentAfter;
|
content += contentAfter;
|
||||||
|
|
||||||
startPos++;
|
startPos++;
|
||||||
|
@ -144,9 +144,9 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
||||||
// Insert image
|
// Insert image
|
||||||
var contentAfter = content.substring(startPos + 15);
|
var contentAfter = content.substring(startPos + 15);
|
||||||
content = content.substring(0, startPos);
|
content = content.substring(0, startPos);
|
||||||
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
|
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
|
||||||
content += ' width="100%" height="10px" ';
|
content += ' width="100%" height="10px" ';
|
||||||
content += 'alt="...Next Page..." title="...Next Page..." class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
|
content += 'alt="...Next Page..." title="...Next Page..." class="mce_plugin_wordpress_page" />';
|
||||||
content += contentAfter;
|
content += contentAfter;
|
||||||
|
|
||||||
startPos++;
|
startPos++;
|
||||||
|
@ -160,7 +160,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
||||||
var endPos = content.indexOf('/>', startPos);
|
var endPos = content.indexOf('/>', startPos);
|
||||||
var attribs = TinyMCE_wordpress_parseAttributes(content.substring(startPos + 4, endPos));
|
var attribs = TinyMCE_wordpress_parseAttributes(content.substring(startPos + 4, endPos));
|
||||||
|
|
||||||
if (attribs['name'] == "mce_plugin_wordpress_more") {
|
if (attribs['class'] == "mce_plugin_wordpress_more") {
|
||||||
endPos += 2;
|
endPos += 2;
|
||||||
|
|
||||||
var embedHTML = '<!--more-->';
|
var embedHTML = '<!--more-->';
|
||||||
|
@ -170,7 +170,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
||||||
chunkAfter = content.substring(endPos);
|
chunkAfter = content.substring(endPos);
|
||||||
content = chunkBefore + embedHTML + chunkAfter;
|
content = chunkBefore + embedHTML + chunkAfter;
|
||||||
}
|
}
|
||||||
if (attribs['name'] == "mce_plugin_wordpress_page") {
|
if (attribs['class'] == "mce_plugin_wordpress_page") {
|
||||||
endPos += 2;
|
endPos += 2;
|
||||||
|
|
||||||
var embedHTML = '<!--nextpage-->';
|
var embedHTML = '<!--nextpage-->';
|
||||||
|
@ -181,6 +181,14 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
||||||
content = chunkBefore + embedHTML + chunkAfter;
|
content = chunkBefore + embedHTML + chunkAfter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle TinyMCE weirdness without messing up the core
|
||||||
|
//alert("Content before TinyMCE_wordpress_cleanup\n\n'"+content+"'");
|
||||||
|
|
||||||
|
// Strip any trailing <br /> and whitespace.
|
||||||
|
content = content.replace(new RegExp('<br ?/?>[ \t]*$', ''), '');
|
||||||
|
|
||||||
|
//alert("Content after TinyMCE_wordpress_cleanup\n\n'"+content+"'");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,11 +208,11 @@ function TinyMCE_wordpress_handleNodeChange(editor_id, node, undo_index, undo_le
|
||||||
return;
|
return;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'name').indexOf('mce_plugin_wordpress_more') == 0)
|
if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'class').indexOf('mce_plugin_wordpress_more') == 0)
|
||||||
tinyMCE.switchClassSticky(editor_id + '_wordpress_more', 'mceButtonSelected');
|
tinyMCE.switchClassSticky(editor_id + '_wordpress_more', 'mceButtonSelected');
|
||||||
if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'name').indexOf('mce_plugin_wordpress_page') == 0)
|
if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'class').indexOf('mce_plugin_wordpress_page') == 0)
|
||||||
tinyMCE.switchClassSticky(editor_id + '_wordpress_page', 'mceButtonSelected');
|
tinyMCE.switchClassSticky(editor_id + '_wordpress_page', 'mceButtonSelected');
|
||||||
} while ((node = node.parentNode));
|
} while ((node = node.parentNode));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -9,7 +9,7 @@ function TinyMCE_wordpress_initInstance(inst) {
|
||||||
function TinyMCE_wordpress_getControlHTML(control_name) {
|
function TinyMCE_wordpress_getControlHTML(control_name) {
|
||||||
switch (control_name) {
|
switch (control_name) {
|
||||||
case "wordpress":
|
case "wordpress":
|
||||||
return '<img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="More..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\');" /><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="...Page..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\');" />';
|
return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="More..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a><!--<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="...Page..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
@ -65,58 +65,58 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
|
||||||
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
|
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle commands
|
// Handle commands
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case "mcewordpressmore":
|
case "mcewordpressmore":
|
||||||
var name = "";
|
var flag = "";
|
||||||
var template = new Array();
|
var template = new Array();
|
||||||
var inst = tinyMCE.getInstanceById(editor_id);
|
var inst = tinyMCE.getInstanceById(editor_id);
|
||||||
var focusElm = inst.getFocusElement();
|
var focusElm = inst.getFocusElement();
|
||||||
|
|
||||||
// Is selection a image
|
// Is selection a image
|
||||||
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
|
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
|
||||||
name = getAttrib(focusElm, 'name');
|
flag = getAttrib(focusElm, 'class');
|
||||||
|
|
||||||
if (name != 'mce_plugin_wordpress_more') // Not a wordpress
|
if (flag != 'mce_plugin_wordpress_more') // Not a wordpress
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
action = "update";
|
action = "update";
|
||||||
}
|
}
|
||||||
|
|
||||||
html = ''
|
html = ''
|
||||||
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
|
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
|
||||||
+ ' width="100%" height="10px" '
|
+ ' width="100%" height="10px" '
|
||||||
+ 'alt="More..." title="More..." class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
|
+ 'alt="More..." title="More..." class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
|
||||||
tinyMCE.execCommand("mceInsertContent",true,html);
|
tinyMCE.execCommand("mceInsertContent",true,html);
|
||||||
tinyMCE.selectedInstance.repaint();
|
tinyMCE.selectedInstance.repaint();
|
||||||
return true;
|
return true;
|
||||||
case "mcewordpresspage":
|
case "mcewordpresspage":
|
||||||
var name = "";
|
var flag = "";
|
||||||
var template = new Array();
|
var template = new Array();
|
||||||
var inst = tinyMCE.getInstanceById(editor_id);
|
var inst = tinyMCE.getInstanceById(editor_id);
|
||||||
var focusElm = inst.getFocusElement();
|
var focusElm = inst.getFocusElement();
|
||||||
|
|
||||||
// Is selection a image
|
// Is selection a image
|
||||||
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
|
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
|
||||||
name = getAttrib(focusElm, 'name');
|
flag = getAttrib(focusElm, 'name');
|
||||||
|
|
||||||
if (name != 'mce_plugin_wordpress_page') // Not a wordpress
|
if (flag != 'mce_plugin_wordpress_page') // Not a wordpress
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
action = "update";
|
action = "update";
|
||||||
}
|
}
|
||||||
|
|
||||||
html = ''
|
html = ''
|
||||||
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
|
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
|
||||||
+ ' width="100%" height="10px" '
|
+ ' width="100%" height="10px" '
|
||||||
+ 'alt="More..." title="More..." class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
|
+ 'alt="More..." title="More..." class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
|
||||||
tinyMCE.execCommand("mceInsertContent",true,html);
|
tinyMCE.execCommand("mceInsertContent",true,html);
|
||||||
tinyMCE.selectedInstance.repaint();
|
tinyMCE.selectedInstance.repaint();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass to next handler in chain
|
// Pass to next handler in chain
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function TinyMCE_wordpress_cleanup(type, content) {
|
function TinyMCE_wordpress_cleanup(type, content) {
|
||||||
|
@ -130,9 +130,9 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
||||||
// Insert image
|
// Insert image
|
||||||
var contentAfter = content.substring(startPos + 11);
|
var contentAfter = content.substring(startPos + 11);
|
||||||
content = content.substring(0, startPos);
|
content = content.substring(0, startPos);
|
||||||
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
|
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
|
||||||
content += ' width="100%" height="10px" ';
|
content += ' width="100%" height="10px" ';
|
||||||
content += 'alt="More..." title="More..." class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
|
content += 'alt="More..." title="More..." class="mce_plugin_wordpress_more" />';
|
||||||
content += contentAfter;
|
content += contentAfter;
|
||||||
|
|
||||||
startPos++;
|
startPos++;
|
||||||
|
@ -144,9 +144,9 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
||||||
// Insert image
|
// Insert image
|
||||||
var contentAfter = content.substring(startPos + 15);
|
var contentAfter = content.substring(startPos + 15);
|
||||||
content = content.substring(0, startPos);
|
content = content.substring(0, startPos);
|
||||||
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
|
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
|
||||||
content += ' width="100%" height="10px" ';
|
content += ' width="100%" height="10px" ';
|
||||||
content += 'alt="...Next Page..." title="...Next Page..." class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
|
content += 'alt="...Next Page..." title="...Next Page..." class="mce_plugin_wordpress_page" />';
|
||||||
content += contentAfter;
|
content += contentAfter;
|
||||||
|
|
||||||
startPos++;
|
startPos++;
|
||||||
|
@ -160,7 +160,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
||||||
var endPos = content.indexOf('/>', startPos);
|
var endPos = content.indexOf('/>', startPos);
|
||||||
var attribs = TinyMCE_wordpress_parseAttributes(content.substring(startPos + 4, endPos));
|
var attribs = TinyMCE_wordpress_parseAttributes(content.substring(startPos + 4, endPos));
|
||||||
|
|
||||||
if (attribs['name'] == "mce_plugin_wordpress_more") {
|
if (attribs['class'] == "mce_plugin_wordpress_more") {
|
||||||
endPos += 2;
|
endPos += 2;
|
||||||
|
|
||||||
var embedHTML = '<!--more-->';
|
var embedHTML = '<!--more-->';
|
||||||
|
@ -170,7 +170,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
||||||
chunkAfter = content.substring(endPos);
|
chunkAfter = content.substring(endPos);
|
||||||
content = chunkBefore + embedHTML + chunkAfter;
|
content = chunkBefore + embedHTML + chunkAfter;
|
||||||
}
|
}
|
||||||
if (attribs['name'] == "mce_plugin_wordpress_page") {
|
if (attribs['class'] == "mce_plugin_wordpress_page") {
|
||||||
endPos += 2;
|
endPos += 2;
|
||||||
|
|
||||||
var embedHTML = '<!--nextpage-->';
|
var embedHTML = '<!--nextpage-->';
|
||||||
|
@ -181,6 +181,14 @@ function TinyMCE_wordpress_cleanup(type, content) {
|
||||||
content = chunkBefore + embedHTML + chunkAfter;
|
content = chunkBefore + embedHTML + chunkAfter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle TinyMCE weirdness without messing up the core
|
||||||
|
//alert("Content before TinyMCE_wordpress_cleanup\n\n'"+content+"'");
|
||||||
|
|
||||||
|
// Strip any trailing <br /> and whitespace.
|
||||||
|
content = content.replace(new RegExp('<br ?/?>[ \t]*$', ''), '');
|
||||||
|
|
||||||
|
//alert("Content after TinyMCE_wordpress_cleanup\n\n'"+content+"'");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,11 +208,11 @@ function TinyMCE_wordpress_handleNodeChange(editor_id, node, undo_index, undo_le
|
||||||
return;
|
return;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'name').indexOf('mce_plugin_wordpress_more') == 0)
|
if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'class').indexOf('mce_plugin_wordpress_more') == 0)
|
||||||
tinyMCE.switchClassSticky(editor_id + '_wordpress_more', 'mceButtonSelected');
|
tinyMCE.switchClassSticky(editor_id + '_wordpress_more', 'mceButtonSelected');
|
||||||
if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'name').indexOf('mce_plugin_wordpress_page') == 0)
|
if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'class').indexOf('mce_plugin_wordpress_page') == 0)
|
||||||
tinyMCE.switchClassSticky(editor_id + '_wordpress_page', 'mceButtonSelected');
|
tinyMCE.switchClassSticky(editor_id + '_wordpress_page', 'mceButtonSelected');
|
||||||
} while ((node = node.parentNode));
|
} while ((node = node.parentNode));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
Loading…
Reference in New Issue