1
0
mirror of https://github.com/e107inc/e107.git synced 2025-05-02 02:07:52 +02:00

Some TinyMce fixes.

This commit is contained in:
CaMer0n 2012-04-28 08:14:10 +00:00
parent 28710b46b2
commit ba65c4fad1
3 changed files with 68 additions and 23 deletions

View File

@ -9,8 +9,8 @@
if (!defined('e107_INIT')) { exit; }
/**
* Basic usage [h=2]text[/h]
* The same [h]text[/h] as heading number defaults to '2'
* Basic usage [h=2]text[/h] // this will break things.
* The same [h]text[/h] as heading number defaults to '2' // this won't.
* Advanced usage [h=2|class=className&id=element-id&style=some: style; and: moresStyle]text[/h]
* 'class' defaults to 'bbcode' (if left empty)
*/
@ -45,9 +45,12 @@ class bb_h extends e_bb_base
}
if($safe)
{
return '[h='.$h.'|'.eHelper::buildAttr($safe).']'.$code_text.'[/h]';
return '[h'.$h.'|'.eHelper::buildAttr($safe).']'.$code_text.'[/h'.$h.']';
}
return '[h='.$h.']'.$code_text.'[/h]';
return '[h'.$h.']'.$code_text.'[/h'.$h.']';
// IMPORTANT: Using '[h=2]' with a non-matching closing tag etc will cause major issues with TinyMce.
// It is cleaner to use [h2], [h3] etc. TODO - Batch BBcodes. ;-)
}

View File

@ -487,7 +487,8 @@ class e107_db_debug {
$text .= "\$_SERVER['PHP_SELF']: '".$_SERVER['PHP_SELF']."'<br />";
$text .= "\$_SERVER['DOCUMENT_ROOT']: '".$_SERVER['DOCUMENT_ROOT']."'<br />";
$text .= "\$_SERVER['HTTP_HOST']: '".$_SERVER['HTTP_HOST']."'<br />";
$text .= "Active Theme Layout: '".THEME_LAYOUT."'<br />";
$text .= "<pre>";
$text .= htmlspecialchars(print_r($e107,TRUE));

View File

@ -43,25 +43,30 @@
s = s.replace(re, str);
};
// rep(/<td>([\s\S]*?)<\/td>/gim,"[td]$1[/td]\n"); // verified
// rep(/<tr>([\s\S]*?)<\/tr>/gim,"[tr]$1[/tr]\n"); // verified
// rep(/<table>([\s\S]*?)<\/table>/gim,"[table]$1[/table]\n"); // verified
//return s;
rep(/<table(.*)>/gim, "[table]");
rep(/<\/table>/gim, "[/table]");
rep(/<td>/gim, "[td]");
rep(/<\/td>/gim, "[/td]");
rep(/<tr>/gim, "[tr]");
rep(/<\/tr>/gim, "[/tr]");
rep(/<tbody>/gim, "[tbody]");
rep(/<\/tbody>/gim, "[/tbody]");
return s;
rep(/<div style="text-align: center;">([\s\S]*)<\/div>/gi,"[center]$1[/center]"); // verified
rep(/<li>/gi, "[*]"); // verified
rep(/<\/li>/gi, ""); // verified
rep(/<ul>([\s\S]*?)<\/ul>/gim, "[list]$1[/list]\n"); // verified
rep(/<li>/gi,"[*]"); // verified
rep(/<\/li>/gi,""); // verified
rep(/<ul>([\s\S]*?)<\/ul>/gim,"[list]$1[/list]\n"); // verified
rep(/<ol .* style=\'list-style-type:\s*([\w]*).*\'>([\s\S]*)<\/ol>/gim,"[list=$1]$2[/list]\n"); // verified
rep(/<ol>([\s\S]*?)<\/ol>/gim,"[list=decimal]$1[/list]\n"); // verified
rep(/<span style="color: (#?.*?);">([\s\S]*)<\/span>/gi,"[color=$1]$2[/color]"); // verified
rep(/<h2>/gim, "[h]"); // verified
rep(/<\/h2>/gim, "[/h]"); // verified
// example: <strong> to [b]
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[link=$1]$2[/link]");
@ -95,9 +100,17 @@
rep(/<u>/gi,"[u]");
rep(/<blockquote[^>]*>/gi,"[quote]");
rep(/<\/blockquote>/gi,"[/quote]");
rep(/<br \/>/gi,"\n");
rep(/<br\/>/gi,"\n");
rep(/<br>/gi,"\n");
// Compromise - but BC issues for sure.
rep(/<br \/>/gi,"[br]");
rep(/<br\/>/gi,"[br]");
rep(/<br>/gi,"[br]");
// rep(/<br \/>/gi,"\n");
// rep(/<br\/>/gi,"\n");
// rep(/<br>/gi,"\n");
rep(/<p>/gi,"");
rep(/<\/p>/gi,"\n");
rep(/&nbsp;/gi," ");
@ -120,16 +133,42 @@
s = s.replace(re, str);
};
// example: [b] to <strong>
// rep(/<ul>(\r|\n)?/gim, "<ul>"); // remove line-breaks
// rep(/<\/li>(\r|\n)?/gim, "</li>"); // remove line-breaks
// rep(/<\/ul>(\r|\n)?/gim, "</ul>"); // remove line-breaks
rep(/\[table]/gim, "<table>");
rep(/\[\/table]/gim, "</table>");
rep(/\[td]/gim, "<td>");
rep(/\[\/td]/gim, "</td>");
rep(/\[tr]/gim, "<tr>");
rep(/\[\/tr]/gim, "</tr>");
rep(/\[tbody]/gim, "<tbody>");
rep(/\[\/tbody]/gim, "</tbody>");
rep(/(\[list=.*\])\\*([\s\S]*)(\[\/list])/gim,"<ol>$2</ol>"); // verified
rep(/(\[list\])\\*([\s\S]*)(\[\/list])/gim,"<ul>$2</ul>");// verified
rep(/\[h]/gim, "<h2>"); // verified
rep(/\[\/h]/gim, "</h2>"); // verified
// rep(/(\[list=.*\])\\*([\s\S]*)(\[\/list])(\n|\r)/gim,"<ol>$2</ol>"); // verified
rep(/(\[list\])\\*([\s\S]*)(\[\/list])(\n|\r)?/gim,"<ul>$2</ul>");// verified
rep(/^ *?\[\*\](.*)/gim,"<li>$1</li>");
rep(/\[center\]([\s\S]*)\[\/center\]/gi,"<div style=\"text-align:center\">$1</div>"); // verified
rep(/\[color=(.*?)\]([\s\S]*)\[\/color\]/gi,"<span style=\"color: $1;\">$2<\/span>"); // verified
// rep(/\[list](\r|\n)/gim, '[list]'); // remove breaks from [list]
// rep(/\n/gi,"<br \/>"); // breaks lists.. need a regex to exclude everything between [list]...[/list]
rep(/\[br]/gi,"<br />"); // compromise
// rep(/\n/gi,"<br \/>"); // breaks lists.. need a regex to exclude everything between [list]...[/list]
//rep( /(?<!(\[list]))\r|\n/gim,"<br />" )
rep(/\[b\]/gi,"<strong>");
rep(/\[\/b\]/gi,"</strong>");
@ -145,6 +184,8 @@
rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span>&nbsp;");
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span>&nbsp;");
// e107 FIXME!