This is an experiment at more intuitive rich-text support. We may need to revert or tweak if it causes serious issues. Basically support markdown AND bbcode simultaneously

in a way that attempts to preserve the unique source syntax of each when editing.
This commit is contained in:
nobody 2020-10-14 18:04:49 -07:00
parent 07fc840f41
commit 0cdc5f3781

View file

@ -3,6 +3,7 @@
use Zotlabs\Lib\Apps;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\SvgSanitizer;
use Michelf\MarkdownExtra;
/**
* @file include/bbcode.php
@ -1248,17 +1249,15 @@ function bbcode($Text, $options = []) {
// Convert new line chars to html <br> tags
// nlbr seems to be hopelessly messed up
// $Text = nl2br($Text);
// We'll emulate it.
$Text = str_replace("\r\n", "\n", $Text);
$Text = str_replace(array("\r", "\n"), array('<br>', '<br>'), $Text);
if ($preserve_nl)
$Text = str_replace(array("\n", "\r"), array('', ''), $Text);
$Text = MarkdownExtra::DefaultTransform($Text);
$Text = str_replace(">\n", '><br>', $Text);
//$Text = str_replace(array("\r", "\n"), array('<br>', '<br>'), $Text);
// if ($preserve_nl)
// $Text = str_replace(array("\n", "\r"), array('', ''), $Text);
$Text = str_replace(array("\t", " "), array("&nbsp;&nbsp;&nbsp;&nbsp;", "&nbsp;&nbsp;"), $Text);