src/element.js
/**
  * download a single svg
  *
  * @param object The svg element
  * @param string The svg name
  * @return a complete frames cfg
  */
download a single svg
@param object The svg element
@param string The svg name
@return a complete frames cfg
download a single svg @param object The svg element @param string The svg name @return a complete frames cfg
exportSvg(svgEl, name) {
    svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
    var svgData = svgEl.outerHTML;
    var preface = '<?xml version="1.0" standalone="no"?>\r\n';
    var svgBlob = new Blob([preface, svgData], {type:"image/svg+xml;charset=utf-8"});
    var svgUrl = URL.createObjectURL(svgBlob);
    var downloadLink = document.createElement("a");
    downloadLink.href = svgUrl;
    downloadLink.download = name;
    document.body.appendChild(downloadLink);
    downloadLink.click();
    document.body.removeChild(downloadLink);
  }
exportSvg ( svgEl , name ) { svgEl . setAttribute ( "xmlns" , "http://www.w3.org/2000/svg" ) ; var svgData = svgEl . outerHTML ; var preface = '<?xml version="1.0" standalone="no"?>\r\n' ; var svgBlob = new Blob ( [ preface , svgData ] , { type : "image/svg+xml;charset=utf-8" } ) ; var svgUrl = URL . createObjectURL ( svgBlob ) ; var downloadLink = document . createElement ( "a" ) ; downloadLink . href = svgUrl ; downloadLink . download = name ; document . body . appendChild ( downloadLink ) ; downloadLink . click ( ) ; document . body . removeChild ( downloadLink ) ; }
download a single svg
 @param object The svg element
 @param string The svg name
 @return a complete frames cfg
download a single svg @param object The svg element @param string The svg name @return a complete frames cfg