I want to use FCKEditor for a web app. I am working on, and need to be able to put JavaScript code along with HTML in via FCKE. I can put in the JS, save it to the database fine, but when the page refreshes, FCKE crashes if there is JS in the text value.
I did the following to allow inputting php code
I tried this but it didn't work
Any ideas?
I did the following to allow inputting php code
FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code
I tried this but it didn't work
FCKConfig.ProtectedSource.Add( /<\script[\s\S]*?\script>/g ) ; // PHP style server side code
Any ideas?
Re: Javascript code in the editor?
javascript code is automatically protected, so you'll need to explain the problem better.
Re: Javascript code in the editor?
Thank you for replying.
So let's say that in FCKEditor I entered the following:
If I save that, the page refreshes and FCKEditor does not load, I just get this on the page:
This image is for reference so you can see on the page where FCKEditor is usually located:


Now after I save, here is the resulting page, with FCKEditor not being able to create itself:
So it seems that the Javascript that I put in there is killing FCKE. I'd like it to not only be maintained in the post, but in fact I'd also like for FCKE NOT to put <br> tags in the JavaScript - as that causes problems too.
Any further help would be greatly appreciated.
Thanks.
Re: Javascript code in the editor?
Re: Javascript code in the editor?
<! Body> is a dynamic tag - so the Body of the current story is inserted dynamically. I don't see how escaping is going to help - as the only thing that should make it bomb w/o escaping is a single quote or line returns (which are already taken care of when the dynamic tag is replaced with the story body).
How would you escape it?
thanks again.
Re: Javascript code in the editor?
just a nudge to move this back to the top. I hope you are online today alfonso.
Re: Javascript code in the editor?
Re: Javascript code in the editor?
Re: Javascript code in the editor?
For anyone else who has this problem, here is the fix
http://dev.fckeditor.net/ticket/723
So when the value is saved, you want parse it and check for "</script>" in the text. If you find it, change it to "<\/script>"; If you don't do that, FCKEditor will strip out all your JS code, and when you save it again, it'll all be gone.
Re: Javascript code in the editor?
With regards to the server integration: take a look at the _samples folder