Using the visual CSS editor with Rails project, images are not shown (in fact, there is an exception without the trunk version of xhtmlrenderer).
I use absolute path for the image, "url(/images/rails.png)" for instance. For a Rails project it refers to the file public/images/rails.png.
It would be great to set the root path of every absolute references to the public directory of the rails project.
For the moment, the path seems to be incorrect :
WARNING [plumbing.exception]: item at URI file:/home/eric/Projets/mr10percent/maquette/public/application/private/stylesheets//application/private/stylesheets/img/offre_sprite.png not found
For url(/application/private/stylesheets/img/offre_sprite.png), the file in my project is public/application/private/stylesheets/img/offre_sprite.png
Similar issue as the 182357. Once the ProjectWebRootProvider impl is available for rails project, I'll try to plug somehow to the Flying Saucer and do some resources resolving.
The FS's XHTMLPanel component is currently set to use an URL as a base to resolve relative links. I haven't found a simple way how to force FS to resolve absolute links to another (different URL). In case of an absolute link FS tries to resolve it against the given URL which of course doesn't work if the resource is not underneath the rendered files's folder.
Created attachment 95893 [details]
Start some implementation of a workaround
I may have found a workaround. I've attached a patch for it (this is for trunk version of flying saucer).
I spent one hour trying to understand why "edited" variable is null in my code :
FileObject edited = FileUtil.toFileObject(FileUtil.normalizeFile(new File(getBaseURL())));
where getBaseURL is the url for the current editing css.
But I did not find a clue. Do you have an idea ?
ehartmann, thanks for the patch and the investigations. You helped me a lot!
I've reimplemented the resolveURI(...) method from your patch, but the you pointed me to the correct place!
I would also appreciate if you verify the change.
Thank you very much again!
fixed in web-main: http://hg.netbeans.org/web-main/rev/20f64c202d4d
I've just tested your modifications.
Works fine for me with Rails projects (so I updated the status).
If you plan to upgrade flying saucer to trunk version, the fix does not work as the path does not contains //. For instance, the uri given is :
for r7 : file:/home/eric/Projets/mr10percent/maquette/public/application/admin/stylesheets//application/admin/stylesheets/images/elbow-minus-nl.gif
for trunk : /application/admin/stylesheets/images/elbow-minus-nl.gif
Thanks Eric for the information. I'm not sure if I'll update the FS to the newest version or not for now (6.9), more likely I wont. Once FS is updated in next release I'll use your patch.
Community contributed patch. Marking with appropriate keyword.
Integrated into 'main-golden', will be available in build *201004020200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Marek Fukala <email@example.com>
Log: #182359 - Image are not shown in CSS editor with Rails project