Would it be possible to add an option to disable the cleanup function when toggling from Source to WYSIWYG mode?
As it is now all html,meta and body tags are removed even when the preseve source code option is true.
cheers
sf_tex
As it is now all html,meta and body tags are removed even when the preseve source code option is true.
cheers
sf_tex
Re: New Feature: Preserve html,meta,body tags
I'd be interested in anyone else's solutions to this problem as well.
Re: New Feature: Preserve html,meta,body tags
Re: New Feature: Preserve html,meta,body tags
I have a customer that would like to preserve what she typed in source mode exactly for readability issues. She puts in capitalization, and more importantly white space. It is saved into the database correctly when saved from source mode; however, as soon as the editor reloads it or switches from source mode back to wysiwyg mode, the white space and the capitalizations are gone.
I'm using this as the test code
<Div claSS="fck-test-source-mode"> here is the test </diV>
Re: New Feature: Preserve html,meta,body tags
And now explain how a browser based editor will be able to know how the original code looked like.
Re: New Feature: Preserve html,meta,body tags
While it is correct that a browser will not care about whitespace or capitalization, humans often do. I'm not really interested in how the browser is interpreting what the code actually says (as long as it doesn't misinterpret valid XHTML ).
A quick description of my implementation may help here. I have a user control (server side) that imbeds the FCKeditor as on of it's inner controls. My control handles the Save functionality of the page, and writes the FCkeditor.value to the database. Note: there may be other instances of the FCK editor on the page as well as other settings that control the display of the page.
The FCKeditor does report the correct value, and I'm able to store it in the database. Well, correct is a misnomer - lets call it the raw code. What I'd like to do is, whenever a user saves the page while the editor is in SourceMode, capture and store the raw code (Working now). Also, when the user returns to the page, if it was saved in SourceMode, to kick off the editor in SourceMode (my control can recognize this state and hand it off to my interface for the editor, but I haven't succeeded is setting the interior to FCK_EDITMODE_SOURCE) with the raw code from the database (this is where I'm stuck).
I think what I may do is modify the behavior of the SourceMode switch button to write what's in the text area (the raw code) into viewstate. If switching back from wysiswyg mode, rewrite the raw code from viewstate into the text area. Yes this will lose any changes made in wysiswyg mode, but the type of user actually mucking about and caring about specially formatted code will understand the need to preserve it some way. I can also write the raw code from the database into viewstate (if it was stored from SourceMode) and display that when the editor is in FCK_EDITMODE_SOURCE.
So what I need to do is
1. Find a way to force the starting mode of the editor into FCK_EDITMODE_SOURCE.
2. Determine order of event firing, or the proper time to grab the raw code or display it from viewstate
3. Reliably pull the raw code out of the text area before it is formatted - Does getXHTML() pull the raw string out?
Off to the example mines again
Thanks for your response, it definitely helped to clarify my thinking.
Re: New Feature: Preserve html,meta,body tags
Re: New Feature: Preserve html,meta,body tags
then when puling back from database convert ascii code back to a-z,1-9, etc... then send string back to the fckeditor.value ((fckeditor needs to be in source mode))
note code is completely wrong, just giving idea perhaps.
turn fckeditor to source mode
retive fckeditor.value
some loop
databasestring = databasestring + asciicode(subtring(loop,fckeditor.value),0)
end loop
save databasestring to database
retrive databasestring from database
turn fckeditor to source mode
some loop
fckeditor.value = fckeditor.value + asciicode(substring(loop,databasestring),1)
end loop
scince "space" has an ascii code number and so do "hard returns / carriage returns" the white space and line breaks should be kept atleast in how am thinking.
Re: New Feature: Preserve html,meta,body tags
Re: New Feature: Preserve html,meta,body tags
I have a problem related with this issue.
I use xml tags in my CMS.
When I type
<xml:something value="something" />
FCK "correct" it to this:
<xml:something value="somevalue"></xml:something>
This may seem semantically correct anyway, but REAL problem arises when I type something like:
<xml:myplugin param1="a" param2="b" />Any text that follow the tag.
this gets "corrected" as:
<xml:myplugin param1="a" param2="b">Any text that follow the tag.</xml:myplugin>
wich makes the following text an element INSIDE the tag, wich is perfectly wrong.
Sometimes FCK gets too smart about the code I also prefer to have the option to turn off this code auto correction, or to have a exception list that protects specific tags or blank spaces or captioning.
Re: New Feature: Preserve html,meta,body tags
But as you all have already noticed, fckeditor had a tendency to encode html brackets for 'safe viewing'...
I added the following php code to the submit (receiving) page:
that handles all the html tags that would be used on my pages... but you might have more yourself. just add them into the arrays I've defined above. the order does make a difference though.
works like a charm.
-Dave
Re: New Feature: Preserve html,meta,body tags
add the following to your fckeditor\_samples\php\sampleposteddata.php file right after the following line:
here's the code:
this is working for me. hope it helps
-Dave