|
@@ -33,7 +33,7 @@
|
33
|
33
|
// Copy the stylesheets from the whiteboard to the exported SVG
|
34
|
34
|
styleNode.innerHTML = Array.from(document.styleSheets)
|
35
|
35
|
.filter(function (stylesheet) {
|
36
|
|
- if(stylesheet.href && (stylesheet.href.match(/boards\/tools\/.*\.css/)
|
|
36
|
+ if (stylesheet.href && (stylesheet.href.match(/boards\/tools\/.*\.css/)
|
37
|
37
|
|| stylesheet.href.match(/board\.css/))) {
|
38
|
38
|
// This is a Stylesheet from a Tool or the Board itself, so we should include it
|
39
|
39
|
return true;
|
|
@@ -45,28 +45,31 @@
|
45
|
45
|
return Array.from(stylesheet.cssRules).map(
|
46
|
46
|
function (rule) {
|
47
|
47
|
return rule.cssText
|
48
|
|
- }
|
49
|
|
- )}
|
50
|
|
- ).join("\n")
|
|
48
|
+ }
|
|
49
|
+ )
|
|
50
|
+ }
|
|
51
|
+ ).join("\n")
|
51
|
52
|
|
52
|
53
|
canvasCopy.appendChild(styleNode);
|
53
|
|
- downloadContent(new Blob([canvasCopy.outerHTML || new XMLSerializer().serializeToString(canvasCopy)], { type: 'image/svg+xml;charset=utf-8' }), Tools.boardName + ".svg")
|
|
54
|
+ var outerHTML = canvasCopy.outerHTML || new XMLSerializer().serializeToString(canvasCopy);
|
|
55
|
+ var blob = new Blob([outerHTML], { type: 'image/svg+xml;charset=utf-8' });
|
|
56
|
+ downloadContent(blob, Tools.boardName + ".svg");
|
54
|
57
|
}
|
55
|
58
|
|
56
|
|
- function downloadContent(blob, filename){
|
57
|
|
- if (window.navigator.msSaveBlob) {
|
|
59
|
+ function downloadContent(blob, filename) {
|
|
60
|
+ if (window.navigator.msSaveBlob) { // Internet Explorer
|
58
|
61
|
window.navigator.msSaveBlob(blob, filename);
|
59
|
|
- } else {
|
|
62
|
+ } else {
|
60
|
63
|
const url = URL.createObjectURL(blob);
|
61
|
64
|
var element = document.createElement('a');
|
62
|
65
|
element.setAttribute('href', url);
|
63
|
|
- element.setAttribute('download', filename);
|
|
66
|
+ element.setAttribute('download', filename);
|
64
|
67
|
element.style.display = 'none';
|
65
|
68
|
document.body.appendChild(element);
|
66
|
69
|
element.click();
|
67
|
70
|
document.body.removeChild(element);
|
68
|
71
|
window.URL.revokeObjectURL(url);
|
69
|
|
- }
|
|
72
|
+ }
|
70
|
73
|
}
|
71
|
74
|
|
72
|
75
|
Tools.add({ //The new tool
|