News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

[4890] 2.0 RC3 WYSIWYG horrible problems

Started by ActivePatriot, April 23, 2010, 11:12:34 AM

Previous topic - Next topic

ActivePatriot

2.0 RC3  WYSIWYG horrible problems in forum posts and articles

I do a lot of this Edit-->  It does it here on your site also, "I do a lot of this" is supposed to 12 point, just changed it again

and unpredictably, but quite constantly I get this output.

Supposed to be 12 point

12 point font   bold underline blue
content black font

sometimes it'll drop the underline tags, put the closing or opening tag somewhere else, I'll get list tags show up when i didn't even select a list.  Sometimes it'll misplace the color closing tag and I'll have a whole paragraph in Blue.

Can't blame IE as it happens in Firefox also.

I need a WYSIWYG so disabling it and just using BB is not an option.

I did a complete vanilla RC3 install, it used to work just fine with RC2

Do I have bad files for the WYSIWYG?  What all files should I replace and from where?

Somewhere it said RC3 alot of tweaks to the WYSIWYG, so it does sound like my problem is the RC3 because I had the same mod setup as now back in RC2 with no problems

Mods
Global H&F
Treasury
SMF articles
PortaMx



Isthmus

If it helps, I have an older thread running on these issues in the bug section:

http://www.simplemachines.org/community/index.php?topic=369364.0

I posted a link back to this thread so the developers can see the problems you are having as well.

lala1

I can confirm bugs in RTE in both RC2 and RC3. I've got a chance to use ffox 3.6 with both flavors. They screw formatting constantly and the description made here or on the other topic mentioned are consistent with my observations.

More than that, it seems to me that there are some problems with bold, italics, underline. They are visually enabled only after I start typing the text, but not right after clicking on that icon or pressing the shortcut (ctrl-b, ctrl-i, ctrl-u). And if one tries to paste formatted text into quotes: good luck! The only workaround for me is copy text, paste in notepad, copy again, paste in SMF, reformat as needed. Plus, sometimes even if I'm editing my very own and original text, it screws up if there are multiple brackets involved, but I cannot describe a pattern.

ActivePatriot

#3
From your thread, it sounds like there is no solution yet.

The developers can see on the SMF site too by:

       
  • toggling WYSIWYG
  • type text
  • highlight text
  • select underline
  • select fontsize 12, 14 whatever
  • select color   I do blue alot
  • post
many, even most times, post will show up underlined and blue with no size format. 
That alone sounds like no big deal but, when you start doing longer, more complex posts with lists, images, highlights and links, the code starts getting all jumbled up.  This is not just copy and pasted material put stuff entered in directly.
For me it's a total nightmare because I post long articles and have a twitter feed for the forum. 
When I post in the forum, I have to scramble to check the unpredictable formatting and quickly correct it because users will immediately see the twitter feed and look at the post.... which looks like garbage because I lost 20% of my formatting.  Very embarrassing.

I need a solution to this or maybe a different WYSIWYG editor.  Will the FCkeditor work with RC3?  Has anyone tried to integrate it into the forum and article posts?

ActivePatriot

The above shows exactly what happens to me happens here also.

Quotemany,   even most times, post will show up underlined and blue with no size   format.
was supposed to be 12 pt underlined blue.

Tags got all screwy and made everything else blue and underlined and, I had no 12 pt where I was supposed to.

Please help, I can't be posting stuff like this, makes me look retarded or something.


Norv

I'll be moving this thread at Bug reports as well, to have the dev team analyze it. Thank you for all details.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

emanuele

#6
I'm not sure what the original problem was, but I see here two things:
1) the font size drop down is misleading, it gives sizes in pt, but when using the WYSIWYG editor the sizes are set without any measure or in em;
2) when there is a size tag included in an u tag, then if a new line of text is added and the size is set to something different toggling the editor from WYSIWYG to normal (or post the message) will result in including a closing size tag just before the 2nd opening tag and another one after the 2nd closing size tag...example:
[u][size=1.45em]Switched to WYSIWYG, I'm typing now some text.[/size][/u]

[size=4]another line[/size]

WYSIWYG on => WYSIWYG off, the final code is:
[u][size=1.45em]Switched to WYSIWYG, I'm typing now some text.[/size][/u]

[/size][size=4]another line[/size][size=1.45em]

It seems to happen only with the "u" tag.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

emanuele

Okay, the first is easy to fix and I did.

The second is a bit less straightforward.

The problem is in this block of code from Subs-Editor.php:

// Note that IE doesn't understand spans really - make them something "legacy"
$working_html = array(
'~<del>(.+?)</del>~i' => '<strike>$1</strike>',
'~<span\sclass="bbc_u">(.+?)</span>~i' => '<u>$1</u>',
'~<span\sstyle="color:\s*([#\d\w]+);" class="bbc_color">(.+?)</span>~i' => '<font color="$1">$2</font>',
'~<span\sstyle="font-family:\s*([#\d\w\s]+);" class="bbc_font">(.+?)</span>~i' => '<font face="$1">$2</font>',
'~<div\sstyle="text-align:\s*(left|right);">(.+?)</div>~i' => '<p align="$1">$2</p>',
);
$text = preg_replace(array_keys($working_html), array_values($working_html), $text);


With the bbcode posted above the resultin html from parse_bbc is:
<span class="bbc_u"><span style="font-size: 14pt;" class="bbc_size">test full editor</span></span>

<span style="font-size: 10pt;" class="bbc_size">dsads</span>


And "of course" the preg_replace transforms it into:
<u><span style="font-size: 14pt;" class="bbc_size">test full editor</u></span>

<span style="font-size: 10pt;" class="bbc_size">dsads</span>

then it is placed in the WYSIWYG editor.
When this is converted back to bbcode all the unnecessary tags are added.

I've found only a very inelegant solution: add a html comment to the 'u' closing tag in parse_bbc and change the regex to find the comment...I don't think it's worth fixing it that way at the moment.

Opinions?


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Oldiesmann

That's probably the only thing you can do really. Otherwise it doesn't know which </span> to replace.
Michael Eshom
Christian Metal Fans

emanuele

#9
Well, there could be another fix, something like this should work:
// Note that IE doesn't understand spans really - make them something "legacy"
$working_html = array(
'~<span\sclass="bbc_u">(.*?<span\sstyle="color:\s*[#\d\w]+;" class="bbc_color">.+?</span>.*?)</span>~i' => '<u>$1</u>',
'~<span\sclass="bbc_u">(.*?<span\sstyle="font-family:\s*[#\d\w\s]+;" class="bbc_font">.+?</span>.*?)</span>~i' => '<u>$1</u>',
'~<span\sclass="bbc_u">(.*?<span\sstyle="font-size:\s*[\d\w\s]+;" class="bbc_size">.+?</span>.*?)</span>~i' => '<u>$1</u>',

'~<del>(.+?)</del>~i' => '<strike>$1</strike>',
'~<span\sclass="bbc_u">(.+?)</span>~i' => '<u>$1</u>',
'~<span\sstyle="color:\s*([#\d\w]+);" class="bbc_color">(.+?)</span>~i' => '<font color="$1">$2</font>',
'~<span\sstyle="font-family:\s*([#\d\w\s]+);" class="bbc_font">(.+?)</span>~i' => '<font face="$1">$2</font>',
'~<div\sstyle="text-align:\s*(left|right);">(.+?)</div>~i' => '<p align="$1">$2</p>',
);
$text = preg_replace(array_keys($working_html), array_values($working_html), $text);


Not sure if the first two regex are necessary or not...probably no.

ETA: fixed the fix (I had problems with quick edit) and can confirm that the three are all necessary.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Advertisement: