MyBB.de Forum
MHEditor - Druckversion

+- MyBB.de Forum (https://www.mybb.de/forum)
+-- Forum: Anpassungen (https://www.mybb.de/forum/forum-47.html)
+--- Forum: Plugin-Diskussionen (https://www.mybb.de/forum/forum-38.html)
+--- Thema: MHEditor (/thread-31429.html)

Seiten: Seiten: 1 2 3 4 5 6 7 8 9 10 11 12 13


RE: MHEditor - doylecc - 18.06.2017

Das hat mit dem MHEditor nichts zu tun. Das überflüssige </li> fügt der MyBB-Parser ein , auch beim Standardeditor oder wenn du gar keinen Editor verwendest, sondern nur ein einfaches Textfeld, Beispiel:
Code:
[list]
[*]nr 1
[*]nr2
[*]nr3
[/list]

[list=1]
[*]nr a
[*]nr b
[*]nr c
[/list]

erzeugt:

  • nr 1
  • nr2
  • nr3

  1. nr a
  2. nr b
  3. nr c

Hier ist auch das </li> jeweils nach dem öffnenden <ul> und <ol> vorhanden.


RE: MHEditor - hkkp - 18.06.2017

aha, alles klar. kann man dies trotzdem eliminieren irgendwie oder hat dies eine besondere Funktion?


RE: MHEditor - doylecc - 18.06.2017

Es wird in der class_parser.php jedes
[*] durch </li<\n<li> ersetzt, um das vorherige Element zu schließen und das aktuelle Element zu öffnen. Für das erste
[*] gibt es natürlich kein vorheriges Element, daher das überflüssige </li>

Du könntest es entfernen, in dem du nach diesem Code in inc/class_parser.php suchst:
PHP-Code:
if($type)
 {
    $list "\n<ol type=\"$type\" class=\"mycode_list\">$message</ol>\n";
}
else
{
    $list "<ul class=\"mycode_list\">$message</ul>\n";


und ihn änderst zu:
PHP-Code:
if($type)
 {
    $list "\n<ol type=\"$type\" class=\"mycode_list\">$message</ol>\n";
    $list str_replace("<ol type=\"$type\" class=\"mycode_list\">\n</li>""<ol type=\"$type\" class=\"mycode_list\">\n"$list);
}
else
{
    $list "<ul class=\"mycode_list\">$message</ul>\n";
    $list str_replace("<ul class=\"mycode_list\">\n</li>""<ul class=\"mycode_list\">\n"$list);




RE: MHEditor - hkkp - 18.06.2017

PHP-Code:
if($type)
 {
   $list "\n<ol type=\"$type\" class=\"mycode_list\">$message</ol>\n";
   $list str_replace("<ol type=\"$type\" class=\"mycode_list\">\n</li>""<ol type=\"$type\" class=\"mycode_list\">\n"$list);
}
else
{
   $list "<ul class=\"mycode_list\">$message</ul>\n";
   $list str_replace("<ul class=\"mycode_list\">\n</li>""<ul class=\"mycode_list\">\n"$list);
}
$list preg_replace("#<(ol type=\"$type\"|ul)>\s*</li>#""<$1>"$list);
return 
$list;


ändert sich nichts... grübel... so schaut es aus....


RE: MHEditor - doylecc - 18.06.2017

Sieht auf den ersten Blick richtig aus.
Wenn du in den Quelltext deiner Seite schaust, sollte das überflüssige </li> dort weg sein.


RE: MHEditor - hkkp - 18.06.2017

ist es aber leider nicht, habe dir mal einen link gesendt, damit du es selber siehst...


RE: MHEditor - doylecc - 18.06.2017

Bei dir fehlt der Zeilenumbruch, daher wird die Stelle nicht erkannt. Wie siehst denn deine gesamte Funktion mycode_parse_list in der class_parser.php aus?


RE: MHEditor - hkkp - 18.06.2017

PHP-Code:
/**
 * Parses list MyCode.
*
* @param string $message The message to be parsed
* @param string $type The list type
* @return string The parsed message.
*/
function mycode_parse_list($message$type="")
{
// No list elements? That's invalid HTML
if(strpos($message'
[*]'
) === false)
 {
 
$message "
[*]
{$message}";
 }

 
$message preg_replace("#[^\S\n\r]*\[\*\]\s*#""</li>\n<li>"$message);
 
$message .= "</li>";

/* - PL:patches - /* if($type)
/* - PL:patches - /* {
/* - PL:patches - /* $list = "\n<ol type=\"$type\" class=\"mycode_list\">$message</ol>\n";
/* - PL:patches - /* }
/* - PL:patches - /* else
/* - PL:patches - /* {
/* - PL:patches - /* $list = "<ul class=\"mycode_list\">$message</ul>\n";
/* - PL:patches - /* }
/* + PL:patches + */ 
if($type)
/* + PL:patches + */  {
/* + PL:patches + */     $list "\n<ol type=\"$type\" class=\"mycode_list\">$message</ol>\n";
/* + PL:patches + */     $list str_replace("<ol type=\"$type\" class=\"mycode_list\">\n</li>""<ol type=\"$type\" class=\"mycode_list\">\n"$list);
/* + PL:patches + */ }
/* + PL:patches + */ else
/* + PL:patches + */ {
/* + PL:patches + */     $list "<ul class=\"mycode_list\">$message</ul>\n";
/* + PL:patches + */     $list str_replace("<ul class=\"mycode_list\">\n</li>""<ul class=\"mycode_list\">\n"$list);
/* + PL:patches + */ }
 
$list preg_replace("#<(ol type=\"$type\"|ul)>\s*</li>#""<$1>"$list);
 return 
$list;
 }

 
/**
 * Parses list MyCode.
 *
 * @param array $matches Matches
 * @return string The parsed message.
 */
 
function mycode_parse_list_callback($matches)
 {
 return 
$this->mycode_parse_list($matches[3], $matches[2]);
 } 



RE: MHEditor - doylecc - 18.06.2017

Hm...keine Ahnung warum bei dir der Zeilenumbruch bei der Ausgabe fehlt. Versuche es mal testweise, ob es damit geht:

PHP-Code:
if($type)
{
    $list "\n<ol type=\"$type\" class=\"mycode_list\">$message</ol>\n";
    $list str_replace("<ol type=\"$type\" class=\"mycode_list\">\n</li>""<ol type=\"$type\" class=\"mycode_list\">\n"$list);
    $list str_replace("<ol type=\"$type\" class=\"mycode_list\"></li>""<ol type=\"$type\" class=\"mycode_list\">"$list);
}
else
{
    $list "<ul class=\"mycode_list\">$message</ul>\n";
    $list str_replace("<ul class=\"mycode_list\">\n</li>""<ul class=\"mycode_list\">\n"$list);
    $list str_replace("<ul class=\"mycode_list\"></li>""<ul class=\"mycode_list\">"$list);




RE: MHEditor - hkkp - 18.06.2017

damit erscheint der </li> nicht mehr ....

Danke... werde es trotzdem weiter beobachten...