PDA

View Full Version : openWYSIWYG generates extraneous HTML



IdRatherBeDesigning
09-11-2007, 09:08 PM
1) Script Title:
openWYSIWYG

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex16/openwysiwyg/index.htm

3) Describe problem:
Upon submitting, openWYSIWYG appears to add extra <span> and <br> tags to the user input.

I'm not sure at what point this is happening, but I also have a live preview that gets the text from the iframe element and displays it in a popup window so that the user can actually see what the page will look like on the final web page. I view the source on that preview and everything appears fine there, it is only after submitting that I see the extra code. Note -- the extra code doesn't appear to impact the updated display, I just see it in the source. I didn't realize this was happening until I was trying to implement a spell checker and it was picking up the duplicate <span> and </span> tags.

It seems to add more and more beginning and end <span> tags each time you update and submit.

Has anybody else had the same trouble?

Here's an example:

Original text, after formatting and BEFORE submitting:


<span style="font-size: 10pt; font-family: arial;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<br><br>
<span style="font-weight: bold;">Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</span>
<br><br>
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
</span>


becomes this AFTER submitting:



<span>
<span style="font-family: arial; font-size: 10pt;">
<span>
<span style="font-size: 10pt; font-family: arial;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<br><br>
<span style="font-weight: bold;">Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</span>
<br><br>
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
</span></span></span></span>


Any help at all would be appreciated.

Thanks!

tech_support
09-12-2007, 06:42 AM
That's why I use TinyMCE (http://tinymce.moxiecode.com/).

IdRatherBeDesigning
09-13-2007, 03:41 PM
Thanks for your non-help...

djr33
09-13-2007, 04:36 PM
Heh. It is helpful.

I used OpenWYSIWYG on a site, and I got fed up with a few of the problems in it.

It's a very cool script in theory and works very well... in some ways. But it is has some very strange "features".

It's a huge script to go through and rewrite and was originally created by someone not directly associated with this site. I wrote them a while ago and I don't remember getting a helpful reply. (I can't say for certain that I didn't get a reply, but if so, it was that they might try to include that in the next release.)

http://www.dynamicdrive.com/forums/showthread.php?t=9295 is the old post I mentioned.


As for Tech_Support's "non" help, he gave you a reasonable alternative. This script is very complex and a lot to work through. I really doubt anyone is going to take the time to fix it up at this point.
On top of that, no WYSIWYG editor (especially javascript-based) is going to have perfect html.

We're trying to help, so don't react harshly when we offer advice that may differ from what you wanted exactly.

By the way, have you even looked at the source code? There's a lot of it, and it's a pain to work though :p

The problem with the script is that it is complex, which makes it cool, but also buggy and hard to troubleshoot. Unfortunately, it pretty much comes as-is.

IdRatherBeDesigning
12-18-2007, 05:04 PM
Thanks for the response, and more non-help ;)

Of course I looked at the source code. My name says I'd rather be designing but at present I'm a developer, and a pretty decent one... And I agree -- the source is a beast that I really have no interest picking through, either. I'd love to investigate other wysiwyg alternatives, but this is what I'm working with. Somehow it's become a pseudo-standard at my company until we move to a fully integrated CMS (I'm def willing to take suggestions for that! ASP.NET C# compatible... =) ).

I posted hoping that I might find someone who had the same issue and was able to figure something out. As to my "harsh" response -- what good is it to just post alternatives? If everyone just posted another recommendation to my fellow frustrated coders...wtf? We (well, some of us, ha) have reasons/requirements/whatever for doing what we're doing.

The funny part is... after living with the icky openWYSIWYG tool, I'm starting to look at TinyMCE, and whether it'd be easier to start anew or "fix" the former. We shall see.

Cheers, and thanks for the non-(non-help), after all.
L

djr33
12-18-2007, 05:09 PM
Help doesn't always come in the form you want. Ask a question, and sometimes the answer will be that there is no answer.

The answer you want will only be always given by one person-- you. The reason we ask others is to confirm that we're right, or to discover something we didn't realize before, to get a different perspective.

Would you prefer, rather than an alternative, that we post no reply?

The code is complex and I don't know anyone here who wants to go through it. Considering, that means we can do one of three things: 1. Post saying there is no answer, 2. post an alternative, and 3. not post at all.


And, as you said, you're now looking at TinyMCE. Doesn't that mean the phrase "told ya so" would kinda fit?
I don't mean it in a rude way, but realize we're trying to help, as best we can, even if you don't like how we do that.

Remember, in a forum like this, most of the time it's like asking the expert, not to say that everyone here is an expert, but the community base is strong from experience, both in general and with these specific scripts. What you asked was related to what we've gone through before, so it's the consensus-- you'll do better using another script.

I hope this clears things up.

IdRatherBeDesigning
12-18-2007, 05:15 PM
No, I don't believe an "I told you so" is in order at all. Suggestions are great, but sometimes it's how you go about them.


That's why I use TinyMCE.

...isn't a friendly suggestion. It says, "you're a dumbass".

Take your I told you so's elsewhere.

djr33
12-18-2007, 05:27 PM
I don't mean "told you so" in a taunting way. I mean, you argued with us, but in the end the result was, "oh, well, yeah, I'm going to use what you said"-- in other words, despite your arguments, he was probably right... helpful.

It's hard on the internet in just text to express tone. Literally, there's nothing rude about his post. In fact, "That's why" implies "Exactly! You're right. Because of what you just said which is right....", and he suggested using another script which could solve your problem.

We usually try to problem solve, not just answer questions. "Oh, I can't figure out how to use this function on my page"... well, we find out it's not possible, then try to find an alternative.

If you really don't want other suggestions, go ahead and post, "here is my question, but if you don't answer yes don't post any alternatives".


On the other hand, his post was quite short, and I'll mention it to him (though he'll see the thread soon enough anyway).
Don't hate us, though, because our replies are sometimes short or even blunt-- there are lots of questions, and frequently the same questions over and over, so it gets a bit monotonous answering the same thing. Not your fault, of course, but remember we're trying to help.

I have the smiley face in my signature for a reason-- everything I say is with good intent.

IdRatherBeDesigning
12-18-2007, 05:37 PM
Hah, I don't hate, I really do appreciate [ most ] any response.

I think also the

have you even looked at the source code?

... put me in defensive mode ;)

Cheers, thanks to both for being moderators.

djr33
12-18-2007, 05:48 PM
You don't need to thank us for being mods, that's a side job to helping on the forum. We're just here a lot, so we help keep the spam away and such.


Ah, I see what you mean. I wasn't accusing you of anything. What I meant is that if you see the source code you'll understand why no one wants to touch it ;)