Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: angelclawdust on March 24, 2012, 05:58:26 AM

Title: Post formatting changes upon hittin save
Post by: angelclawdust on March 24, 2012, 05:58:26 AM
hello there
im not sure if it is a bug tbh but well soon see :D
in a post on my forum i have a list of names and teams next to each other
the names are one colour and the teams another colour
whenever i need to go edit the names in this post i click save and uit then changes the colours around and mixes them up
i then edit it bck to how it should look and upon next click it moves them all onto the same line and also displays the [/b] - ie end tags of bb code randomly in the post

is this an actual bug or is it something to do with my host server - or simply the browser (im using firefox latest version - other admin uses chrome with no issues)
latest forum version also
and default theme
Title: Re: Post formatting changes upon hittin save
Post by: emanuele on March 24, 2012, 08:18:58 AM
Hello angelclawdust,

thanks for the report.

A couple of questions:
1) are you using the WYSIWYG editor?
2) can you post (within the [code][/code] tags) an example of what you have in your post and maybe the result after the edit?
Title: Re: Post formatting changes upon hittin save
Post by: angelclawdust on April 02, 2012, 09:44:57 AM
hello
yes currently using the wysig editor

an example is - i goto post the following
hello there and welcome to the test post
this will test to see how it all goes upon hitting post

so we shall colour this part red and bold it
man utd
man city
leeds
notts forest
sweden
germany

bold this part
bob
sam
tom
ian
frankie


and this shall stay normal unformatted text


but upon hitting save it outputs the following
hello there and welcome to the test post
this will test to see how it all goes upon hitting post

so we shall colour this part and bold it
man utd[/color]man cityleedsnotts forestswedengermany

bold this part
bobsamtomianfrankie


and this shall stay normal unformatted text


and then upon modify again itll either post correctly of mess up some more
Title: Re: Post formatting changes upon hittin save
Post by: emanuele on April 09, 2012, 08:07:19 AM
Welcome to the WYSIWYG mess with browsers! :P

Forgot to say:
/me hates WYSIWYG editor!! :P

Confirmed with Firefox 11, not tested with previous versions.

/me goes check with the development version too

ETA: yep, confirmed in devel too...
Title: Re: Post formatting changes upon hittin save
Post by: emanuele on April 09, 2012, 11:03:56 AM
Okay, here there are two things that need fixes.
In html_to_bbc:
1) this (and all the other similar)
$curCloseTags .= '[/b]';
$replacement .= '[b]';

should be instead:
$curCloseTags = '[/b]' . $curCloseTags;
$replacement .= '[b]';

2) FF11 apparently (don't know if previous versions too) applies styles line-by-line, that means something like:
so we shall colour this part red and bold it<br>
<span style="color: red; font-weight: bold;">man utd</span><br style="color: red; font-weight: bold;">
<span style="color: red; font-weight: bold;">man city</span><br style="color: red; font-weight: bold;">
<span style="color: red; font-weight: bold;">leeds</span><br style="color: red; font-weight: bold;">
<span style="color: red; font-weight: bold;">notts forest</span><br style="color: red; font-weight: bold;">
<span style="color: red; font-weight: bold;">sweden</span><br style="color: red; font-weight: bold;">
<span style="color: red; font-weight: bold;">germany</span>

while all the other browsers (apparently, tested only Opera :P) applies a single span over multiple lines, so in order to try to fix this I did:
Code (find) Select
if ($matches[5] === '/')
continue;
else
{

Code (replace with) Select
if ($matches[5] === '/')
continue;
elseif ($matches[2] === 'br')
$replacement .= '<br />';
else
{

Of course I have no idea if this breaks other things...most likely yes...

/me wonders why he didn't track all the WYSIWYG issues so that he could test them for "regressions"... ::)