Bläddra i källkod

add filter function for stylesheets

Co-authored-by: sents <finn@krein.moe>
dev_h
DanielHabenicht 4 år sedan
förälder
incheckning
9f806fa837
1 ändrade filer med 11 tillägg och 2 borttagningar
  1. 11
    2
      client-data/tools/download/download.js

+ 11
- 2
client-data/tools/download/download.js Visa fil

@@ -31,8 +31,17 @@
31 31
         var styleNode = document.createElement("style");
32 32
 
33 33
         // Copy the stylesheets from the whiteboard to the exported SVG
34
-        styleNode.innerHTML = Array.from(document.styleSheets).map(
35
-            function (stylesheet) {
34
+        styleNode.innerHTML = Array.from(document.styleSheets)
35
+            .filter(function (stylesheet) {
36
+                if(stylesheet.href && (stylesheet.href.match(/boards\/tools\/.*\.css/)
37
+                    || stylesheet.href.match(/board\.css/))) {
38
+                    // This is a Stylesheet from a Tool or the Board itself, so we should include it
39
+                    return true;
40
+                }
41
+                // Not a stylesheet of the tool, so we can ignore it for export
42
+                return false;
43
+            })
44
+            .map(function (stylesheet) {
36 45
                 return Array.from(stylesheet.cssRules).map(
37 46
                     function (rule) {
38 47
                         return rule.cssText

Laddar…
Avbryt
Spara