Opened 18 years ago
Closed 14 years ago
#993 closed New Feature (fixed)
Preserve formatting of ProtectedSource elements
Reported by: | Anusha | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | FCKeditor 2.4.3 |
Keywords: | HasPatch | Cc: |
Description
The FCK.GetXHTML() displays the content in a dirty format(no new line characters). It is different from what the user actually sees in the actual file. It would be good if FCK editor did not mess around with the format of the file and leave the content as it is. This can be enabled as a configurable property in the FCKConfig.js file so that any user who wants the editor to handle formatting can enable it too.
Anusha
Attachments (1)
Change History (8)
comment:1 Changed 18 years ago by
Keywords: | Pending added; FCK.GetXHTML() removed |
---|
comment:2 Changed 18 years ago by
Hi alfonso,
Thanks for the reply. I have these property already set in FCKConfig.js. I have attached the file I have been using to test the formatting with this ticket. I have the property FCKConfig.FullPage = false ;. I guess this property is invovled in the formattting function too. I have also tried this on the FCK demo site and switching between source mode and wysiwyg mode messes the format.
Thanks
Anusha
comment:3 Changed 18 years ago by
The only problem that I see is that the new lines after the comments aren't preserved, but I'm not sure that treating all comments as block elements in the formatting would please everybody as some comments might be placed inline.
The rest of the content looks like it has been properly formatted (although it might not be what the user set initially, but it's impossible to keep the original format and doing a WYSIWYG edition based on a browser)
comment:4 Changed 18 years ago by
The file that i attached when edited by the editor messes up all the content format. Apart from the commented lines, the body content also gets messed up.. There is no alignment at all(Neither what the user set nor does the editor set any format). So what do the following properties do?
FCKConfig.FormatSource = true ; FCKConfig.FormatOutput = true ;
Anusha
comment:5 Changed 17 years ago by
Keywords: | Pending removed |
---|---|
Summary: | FCK.GetXHTML() to handle formatting → Preserve formatting of ProtectedSource elements |
I had an idea about this. The regexp for protected source could be modified to include any extra whitespaces after those elements:
// Initialize the regex array with the default ones. FCKConfig.ProtectedSource.RegexEntries = [ // First of any other protection, we must protect all comments to avoid // loosing them (of course, IE related). /<!--[\s\S]*?-->\s*/g , // Script tags will also be forced to be protected, otherwise IE will execute them. /<script[\s\S]*?<\/script>\s*/gi, // <noscript> tags (get lost in IE and messed up in FF). /<noscript[\s\S]*?<\/noscript>\s*/gi, // Protect <object> tags. See #359. /<object[\s\S]+?<\/object>\s*/gi ] ;
That way after reverting them they will keep their original new lines if they had them, so several scripts in different lines will look fine. But now the problem is that after one of those scripts with the preserved new lines, a <p> will generate an extra new line, so the code formatter would need to be adjusted to don't format tags that are just before or after a comment. And now I don't have the time to check the proper change.
comment:6 Changed 17 years ago by
Keywords: | HasPatch added |
---|
comment:7 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
The protectedSource config is now available in CKEditor.
You might have messed something up, because those settings already exist and they default to format properly the source code: