Yes, a little too late, but better late than never.
Finally, here is the updated version of the ServerPreview plugin.
As mentioned in the original release, this is a very simple plugin, and the new version is even simpler. I've removed the need to add a new button and the plugin just replaces the original preview command, so the only thing that you need to make it work is:
- Extract the plugin to your plugins folder
- Like the rest of plugins, add it to your instance: FCKConfig.Plugins.Add( 'serverPreview' ) ;
- Set the url of the page that will receive the data: FCKConfig.ServerPreviewPath
Then you just put all the server code that you want in that page, and read the data that is sent in the 'htmlData' field. You can change the plugin to add more fields if you need to. It could be possible to write a generic code to send all the current fields to the server, but I've never found enough time to write it (it just took me 6 months to write this post)
You can see a demo at the Google maps demo (due to the use of document.write the normal preview fails, so this plugin is really useful for that situation)
I haven't write a specific demo page for this plugin or other detailed installation instructions, so just go to SourceForge and get it.
5 comments:
Thanks for the script. It is exactly what I was looking for.
Just one question. If I wanted to have no menu, scroll bar, etc for the preview window, do I configure it in your plugin js file or in the Fckeditor files?
IIRC the preview is launched by creating a form with target="_blank", that doesn't allow to specify which features you want in the new window.
And a popup with scrollbars disabled is evil.
Well, evil is my middle name (Scroll Bar is my girl friends name)
:p
Thanks
I'm also looking a way to open ServerPreview in a new popup, but I could't figure out how to modify line: theForm.target='_blank';.
Can you help me to open popup with specified width and height?
Thanks, amuse
There's nothing special there, it's just a simple form, so you can use whatever technique that you want.
Test with a simple html page, and when you get the exact behavior that you want then you add it to the plugin code.
Anyway, I must add an important warning: this plugin can be a source of XSS if you aren't careful and anyone can use the server page that it's used to render the preview. The example is just dumping whatever html is sent to it, so it would be extremely easy for an attacker to create a big problem if you are using this plugin (or anything similar) and you don't add proper security measures around this.
Post a Comment