pyrocms/pyrocms — pull request #1188 by canton7 (2012-03-03 15:50:55+00:00)
Title: Images/files inserted using ckeditor contain {{ url:site }} instead of a hard-coded path

This is a fix for #1183, as it appears to be impossible to add code to an existing pull request.

This patchset teaches ckeditor how to parse image src values containing `{{ url:site }}` and `{{ url:base }}`.
This means that ckeditor, when not in 'source mode', will render the image correctly, by replacing `{{ url:site }}` and `{{ url:base }}` with the JS constants `SITE_URL` and `BASE_URL` respectively.

This paves the way for the files and images inserted into ckeditor by the pyrofiles and pyroimages plugins to contain `{{ url:site }}` instead of hard-coding the site url.

The end result is that the src values of images inserted using ckeditor, as stored in the database, contain the template variable `{{ url:site }}` instead of hard-coding this value, allowing the site url of the installation to be changed without breaking all links to files and images.

This has been tested in FF 10.0.2, Chrome 17, and IE 9. The only (minor) bug is that the browser makes a request to the non-rewritten image source (the one containing `{{ url:site }}`) before the ckeditor parser catches up and re-writes it (or, at least, this is what the bug appears to be). This is not apparent to anyone who doesn't have firebug (or equivalent) open.