-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Live preview for SVG files #5124
Comments
We should also fix #5101 while fixing this (trivial fix and it seems like it's likely to be correct to allow "-" in tag names anyway). |
Sounds like a simple fix. Medium priority to @couzteau |
Sorry, i haven't been further than filling issues and commenting others… i'll someday watch the "pull" process, but so far, @couzteau don't hesitate to do it ! |
Thanks @fr32c Will keep you posted. |
There is an issue with live preview and undefined namespaces on XML-elements, i.e.
error: Namespace prefix xlink for href on image is not defined However, I don't think that this is a live preview issue, because the SVG document should generally declare the tag
|
We probably don't deal with namespaces properly at all when updating attributes. That would be nontrivial to fix, I think. So we might want to hold off on this if there are often going to be namespaced attributes in SVG docs. |
There are a few namespaced tags in SVG: ref: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute#XLink_attributes I don't know how common it is among SVG coders to properly define namespaces. Doing a bit more research. |
Even if they define them properly, I think we might have to make other changes in order to apply any changes to these attributes. We currently always just use |
SVG animations work fine. |
(Although maybe we could just hardcode the namespace URLs for "xlink:" and "xml:". That would be easy.) |
Hi all, i've been reading this conversation today, and i'm thinking you're being very precise and technical with the tool, certainly much more than i expected it, the namespace problem, i didn't even arrive that far in svg, I was just trying to get svg displayed with some js related to that, and that's the reason i needed a "live preview". My trick was "good enough", as long as i was not looking for complicate stuff. Hope i'm not deviating you from other serious work, and i don't know how many user cases this is. (and thanks a lot for digging deeper) |
To be clear, Live Preview does happily serve SVG files, however it's not live as for HTML, where you change attributes in Brackets and see the changes in the browser on the fly. If you make a change to the SVG file you do have to save the file before you can see the change in the preview. That said, I'm with @fr32c and do think the fix is worth taking, because it helps people working on SVG documents. However to get live updating working will probably be a significant amount of extra work. |
Oh! I was assuming we were talking about live as-you-type updating. If it's just preview, yes, that should work :) |
Hey--we have an open pull request for this, and if that pull request doesn't work out we wouldn't scramble to fix this in this sprint. So we're removing the milestone from the bug, but leaving the pull request on the pull request card (that way we're not double-counting). |
Turns out we would need to do more work to suppress live HTML editing for this case, so we can't just merge the simple fix. Removing fix in progress. |
@njx Is this complex enough that we should just MTB it at this point? |
Is this still coming? Would be awesome. |
@thany You can use the SVG Preview extension in the meantime, which shows an inline preview in a panel above the code. |
Yes, that's the one I found too :) On a sidenote: it would be nice if the Live Preview feature would also work for SVG. That way we can live preview svg's in a layout engine other than built-in webkit/blink. |
Changing to 'move to backlog' since this is an enhancement (not a bug) and not trivial to implement. |
The SVG Preview plugin is wonderful (thanks @peterflynn!), but it would be great to have the preview served as Though, maybe this should be solved in some larger bit for the Live Preview architecture. I'd like to use the browser for debugging things like RSS feeds (+XSLT) and other assorted XML that snuck its way into the web at large. (Microsoft's |
Working on svg these days, i installed @peterflynn 's SVG extension which does a great job at displaying static svg.
But since i'm playing with interactive, i need that svg to interact with a .js file, linked via <script language="JavaScript" xlink:href="svg.js"></script>
After reading: Live Preview should work for .xhtml files #5058 , one comment says that to be able to open a file in the live preview, I just needed to update FileUtils.js
So i replaced:
var _staticHtmlFileExts = ["htm", "html"],
by
var _staticHtmlFileExts = ["htm", "html", "svg"],
(and subsequent line, of course)
the svg file structure seems to be ok with that.
Now i can wether display my static svg in brackets via the extension or live preview in chrome at file saving.
PS: i read the guidelines for contributing, i don't know where to start, especially since i added 7 characters in Brackets Sprint 30.app/Contents/www/file/FileUtils.js
The text was updated successfully, but these errors were encountered: