2010-05-10 Javascript
I still havenāt learnt Javascript. Right now Iām trying to integrate svg-edit and Oddmuse. This requires some Javascript voodoo that escapes me.
If you upload a SVGĀ file to http://www.emacswiki.org/test/SVG_Test, youāll be able to look at it. Iām using an iframe to do that.
http://www.emacswiki.org/test/SVG_Test
If you then click on *Edit this page* and then on *Edit image in the browser*, youāll get the SVGĀ editor.
What Iām lacking is loading and saving the image!
If you look around the svg-edit projectās pages, youāll note example code like the following:
What I donāt understand is where this code runs and how svgEditor is set.
If I simply add the following to the top of the page, inside the header, then Firebug will tell me that the svgEditor object does not exist.
What now? Is this a variable āinsideā the iframe? Is this something I need to initialize by calling a function? Which one?
*Update*: Perhaps Iām running into some cross-site scripting protection. The site runs on www.emacswiki.org, the SVG editor runs on svg-edit.googlecode.com. Using Firebug, I run `document.getElementsByName('svgEditor')[0].getSVGDocument().setUserData('fd')` and get an error message. ā
ā#Javascript ā#SVG ā#Wikis
Comments
(Please contact me if you want to remove your comment.)
ā
This site is great!
ā Kate 2010-05-13 10:38 UTC
---
It looks like youāre not including the javascript library that provides the SVG editing functions.
ā Harald 2010-05-13 12:32 UTC
---
Hah, Iām seeing the light. Copying the script over to localhost has fixed this. Iāve come a long way. Now I need MIME encoding in Javascript, and probably a cool Save dialog ā or a little rewrite.
ā Alex Schroeder 2010-05-13 20:41 UTC
---
- Instructions: EditSVG on Community Wiki
- Test page to try it: test.svg on Community Wiki
- Things that still donāt work (please add user interface issues): Comments on SVG Editor Extension on Oddmuse Wiki
- - Alex Schroeder 2010-05-13 23:20 UTC