Advertisement:

Author Topic: [4890] 2.0 RC3 WYSIWYG horrible problems  (Read 4134 times)

Offline ActivePatriot

  • Semi-Newbie
  • *
  • Posts: 38
[4890] 2.0 RC3 WYSIWYG horrible problems
« on: April 23, 2010, 11:12:34 AM »
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


« Last Edit: November 20, 2011, 01:50:51 PM by Joshua Dickerson »

Offline Isthmus

  • Semi-Newbie
  • *
  • Posts: 51
Re: 2.0 RC3 WYSIWYG horrible problems
« Reply #1 on: April 23, 2010, 11:40:09 AM »
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.

Offline lala1

  • Semi-Newbie
  • *
  • Posts: 40
    • Zana Maseluta
Re: 2.0 RC3 WYSIWYG horrible problems
« Reply #2 on: April 23, 2010, 12:06:00 PM »
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.

Offline ActivePatriot

  • Semi-Newbie
  • *
  • Posts: 38
Re: 2.0 RC3 WYSIWYG horrible problems
« Reply #3 on: April 23, 2010, 12:23:04 PM »
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?
« Last Edit: April 23, 2010, 12:32:03 PM by ActivePatriot »

Offline ActivePatriot

  • Semi-Newbie
  • *
  • Posts: 38
Re: 2.0 RC3 WYSIWYG horrible problems
« Reply #4 on: April 23, 2010, 12:37:11 PM »
The above shows exactly what happens to me happens here also.

Quote
many,   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.


Offline N. N.

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 18,317
  • Blue Wolf
Re: 2.0 RC3 WYSIWYG horrible problems
« Reply #5 on: April 23, 2010, 01:12:10 PM »
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

Offline emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,836
  • Gender: Male
  • Because Orange is Orange
Re: 2.0 RC3 WYSIWYG horrible problems
« Reply #6 on: November 13, 2011, 03:56:08 PM »
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:
Code: [Select]
[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:
Code: [Select]
[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.
« Last Edit: November 13, 2011, 04:22:11 PM by emanuele »

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

Offline emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,836
  • Gender: Male
  • Because Orange is Orange
Re: [4890] 2.0 RC3 WYSIWYG horrible problems
« Reply #7 on: February 01, 2012, 05:39:10 PM »
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:
Code: [Select]
// 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:
Code: [Select]
<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:
Code: [Select]
<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?

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

Offline Oldiesmann

  • Site Team
  • SMF Super Hero
  • *
  • Posts: 23,200
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: [4890] 2.0 RC3 WYSIWYG horrible problems
« Reply #8 on: February 01, 2012, 06:49:24 PM »
That's probably the only thing you can do really. Otherwise it doesn't know which </span> to replace.

Offline emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,836
  • Gender: Male
  • Because Orange is Orange
Re: [4890] 2.0 RC3 WYSIWYG horrible problems
« Reply #9 on: February 08, 2012, 06:03:08 AM »
Well, there could be another fix, something like this should work:
Code: [Select]
// 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.
« Last Edit: February 08, 2012, 03:44:05 PM by emanuele »

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