Page 1 of 2
WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 8:42 am
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?
Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 8:55 am
by Jos
maybe because W3C makes us believe it is invalid to put a <div> inside a <a> element?
Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 9:45 am
by Колючка
So there's some w3c-rules verification works in wysiwyg on/off click? How can I disable it?
Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 10:10 am
by Jean le Chauve
Yes, you must create a new doctype

Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 10:14 am
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

Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 10:40 am
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"?
Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 11:20 am
by bess
PS. With "span" it doesn't spoil but the code also doesn't work.
span.li{
display:block;
... [more css code here] ...
}

Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 11:25 am
by Колючка
Yes, I forget about "display: block", thanks. But I still wonder... Why can't I disable auto-spoil feature? Or can I?
Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 11:31 am
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
Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 1:32 pm
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
Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 3:33 pm
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?
Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 3:53 pm
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"
Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 4:28 pm
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?
Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 5:46 pm
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 ...
you can find this option into the tab "option" of your page

Re: WYSIWYG spoils html code
Posted: Sat Aug 11, 2012 5:59 pm
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.