WYSIWYG spoils html code

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Колючка
Forum Members
Forum Members
Posts: 19
Joined: Tue Jul 17, 2012 8:24 am

WYSIWYG spoils html code

Post by Колючка »

In non-wysiwyg mode there's code:

Code: Select all

<a href="{root_url}/uploads/images/1.jpg">
<div id="il">
<img class="bottom" src="{root_url}/uploads/images/2.jpg">
<img class="top" src="{root_url}/uploads/images/3.jpg">
</div>
</a>
When I turn on / turn off wysiwyg mode this code becomes:

Code: Select all

<div id="il"><img class="bottom" src="{root_url}/uploads/images/2.jpg" alt="" /> <img class="top" src="{root_url}/uploads/images/3.jpg" alt="" /></div>
So wysiwyg mode kills "a href" links. I tried MicroTiny and Tiny MCE editors, and i tried default admin template and "NCleanGrey" - wysiwyg behavior is still the same. Why?
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm

Re: WYSIWYG spoils html code

Post by Jos »

maybe because W3C makes us believe it is invalid to put a <div> inside a <a> element?
Колючка
Forum Members
Forum Members
Posts: 19
Joined: Tue Jul 17, 2012 8:24 am

Re: WYSIWYG spoils html code

Post by Колючка »

So there's some w3c-rules verification works in wysiwyg on/off click? How can I disable it?
Jean le Chauve

Re: WYSIWYG spoils html code

Post by Jean le Chauve »

Yes, you must create a new doctype ;D
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm

Re: WYSIWYG spoils html code

Post by Jos »

Колючка wrote:So there's some w3c-rules verification works in wysiwyg on/off click?
I don't know, didn't test it. You could yourself by replacing div with span?
Колючка wrote:How can I disable it?
Ignoring W3C rules is NOT a good idea. It's like playing soccer with hockey rules. You will never win ;)
Колючка
Forum Members
Forum Members
Posts: 19
Joined: Tue Jul 17, 2012 8:24 am

Re: WYSIWYG spoils html code

Post by Колючка »

With "span" it doesn't spoil, thanks. Was:

Code: Select all

<a href="{root_url}/uploads/images/1.jpg">
<span class="il">
<img class="bottom" src="{root_url}/uploads/images/2.jpg">
<img class="top" src="{root_url}/uploads/images/3.jpg">
</span>
</a>
Became:

Code: Select all

<a href="{root_url}/uploads/images/1.jpg"> <span class="il"> <img class="bottom" src="{root_url}/uploads/images/2.jpg" alt="" /> <img class="top" src="{root_url}/uploads/images/3.jpg" alt="" /> </span> </a>
But this "auto-thing" is a little annoying. Is there any records in documentation about this behavior? I didn't find any...

PS. With "span" it doesn't spoil but the code also doesn't work. And the question is still the same: how can I disable this "feature"?
bess
Language Partners
Language Partners
Posts: 282
Joined: Thu Dec 18, 2008 9:37 am

Re: WYSIWYG spoils html code

Post by bess »

PS. With "span" it doesn't spoil but the code also doesn't work.
span.li{
display:block;
... [more css code here] ...
}

;)
Колючка
Forum Members
Forum Members
Posts: 19
Joined: Tue Jul 17, 2012 8:24 am

Re: WYSIWYG spoils html code

Post by Колючка »

Yes, I forget about "display: block", thanks. But I still wonder... Why can't I disable auto-spoil feature? Or can I?
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm

Re: WYSIWYG spoils html code

Post by Jos »

You can take a look in the admin section of your WYSIWYG editor for a setting, but I doubt there is one. I guess that would be the same as turning off the whole WYSIWYG editor.

We never mess around with code in files
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: WYSIWYG spoils html code

Post by calguy1000 »

And the question is still the same: how can I disable this "feature"?
This question has been asked and answered numerous times:

Answer: You can't

Do your design work in content pages that
a: content editors can't edit
b: Have no wysiwyg
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Колючка
Forum Members
Forum Members
Posts: 19
Joined: Tue Jul 17, 2012 8:24 am

Re: WYSIWYG spoils html code

Post by Колючка »

Jos wrote:Answer: You can't
Pretty sad. But is there any documentation about it, about the what combination of tags I should avoid?
bess
Language Partners
Language Partners
Posts: 282
Joined: Thu Dec 18, 2008 9:37 am

Re: WYSIWYG spoils html code

Post by bess »

WYSIWYG

What you see is what you get

doesn't mean

What you code is what you get

You ask us "how can i use hammer to fly".. what kind of answer do you expect from us except "you can't do this"
Колючка
Forum Members
Forum Members
Posts: 19
Joined: Tue Jul 17, 2012 8:24 am

Re: WYSIWYG spoils html code

Post by Колючка »

bess wrote:You ask us "how can i use hammer to fly".. what kind of answer do you expect from us except "you can't do this"
That's not my point. I just don't like undocumented, unpredictable, "undisablable" thing. See: I make a new page in my web-site, edit it in non-wysiwyg mode for some reason, click "apply", successfully test it, click "save", CMS saves my code to database, it's work all right, everybody happy. Then I notice simple error in a word, open this page in wysiwyg mode (because wysiwyg mode is default), correct error, click "save"... and CMS saves to database auto-spoiled code without any notification. I think it's not right, kinda microsoft-way, don't you think so?
bess
Language Partners
Language Partners
Posts: 282
Joined: Thu Dec 18, 2008 9:37 am

Re: WYSIWYG spoils html code

Post by bess »

damn .. you're right, there is a mistake
open this page in wysiwyg mode (because wysiwyg mode is default),
you have an option to deactivate the WYSIWYG only for this page (definitly), if you don't use this option for a page where you wrote HTML code : this is a HUGE mistake ... :D

you can find this option into the tab "option" of your page ;)
timwhite98
New Member
New Member
Posts: 3
Joined: Sat Aug 11, 2012 5:49 pm

Re: WYSIWYG spoils html code

Post by timwhite98 »

I have (what appears to be) a related problem.

When I'm editing content, I can get to the HTML code by "turning off" WYSIWIG. But this does not give me a popup window for HTML editing. And typically I access HTML via the HTML button... and a popup window appears... from there, I edit HTML.

Is anyone else have problems accessing HTML via the button (that appears with other buttons) just above the content window?

Simply turning off WYSIWIG gives me HTML that *appears* to be different from what I normally see (in the popup window).

Also, I do not recall if -- in the past -- my WYSIWIG button was turned on or off. It never mattered to me, so I ignored it. But now, with the lack of the usual HTML popup window appearing, I'm reading this post and seeing that I probably should have paid attention.
Post Reply

Return to “CMSMS Core”