Skip to content

Commit b7d3502

Browse files
committed
quick fix: broken link for css - better option?
1 parent dd7c13a commit b7d3502

File tree

5 files changed

+89
-86
lines changed

5 files changed

+89
-86
lines changed

dist/tag/css/tag.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tag/js/tag.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,87 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<link href="https://fonts.googleapis.com/css?family=Nunito:400,600" rel="stylesheet">
77
<link href="dist/tag/css/tag.min.css" rel="stylesheet">
8+
9+
<style id="svgStyles">
10+
@import url(http://fonts.googleapis.com/css?family=Nunito:400,600);
11+
12+
text {
13+
text-anchor: middle;
14+
}
15+
.row-drag {
16+
stroke-width:2;
17+
stroke-dasharray: 2,1;
18+
stroke:rgba(100,100,100,0.3);
19+
transition: stroke 300ms ease;
20+
cursor: row-resize;
21+
}
22+
.row-drag:hover {
23+
stroke-dasharray:none;
24+
stroke:rgba(100,100,100,0.8);
25+
}
26+
27+
.word text {
28+
font-size:16px;
29+
fill:black;
30+
}
31+
.word path {
32+
stroke:#333;
33+
fill:none;
34+
}
35+
.word .word-text {
36+
cursor: pointer;
37+
}
38+
39+
.word-cluster text,
40+
.word .word-tag {
41+
font-size: 12px;
42+
cursor: text;
43+
}
44+
45+
.word-cluster text,
46+
.word .word-tag {
47+
fill:#333;
48+
}
49+
.word .syntax-tag {
50+
fill: rgb(208, 150, 143);
51+
}
52+
.toggle-syntax .syntax-tag, .toggle-syntax .syntax-link {
53+
display:none;
54+
}
55+
56+
.editing .word-tag,
57+
.editing-text,
58+
.editing text {
59+
fill: #fff !important;
60+
}
61+
62+
.editing-rect,
63+
.editing rect {
64+
fill:#a94442;
65+
}
66+
67+
.link path.polyline {
68+
stroke: #6590b4;
69+
fill: none;
70+
}
71+
.link {
72+
font-size: 12px;
73+
fill:#6590b4;
74+
stroke-width:1.5px;
75+
}
76+
.link.syntax-link {
77+
fill: #999;
78+
}
79+
.syntax-link path.polyline {
80+
stroke: #999;
81+
fill: none;
82+
}
83+
84+
.link:hover {
85+
stroke-width:2.5px;
86+
}
87+
</style>
88+
889
</head>
990

1091
<body>

src/css/app.css

Lines changed: 1 addition & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
@import url(http://fonts.googleapis.com/css?family=Nunito:400,600);
2-
31
#fill {
42
/* ensure body takes up entire window */
53
position:absolute;
@@ -282,79 +280,4 @@ body > #tree-svg #tree-close {
282280
margin-top:100px;
283281
margin-bottom:20px;
284282
position:relative;
285-
}
286-
#main text {
287-
text-anchor: middle;
288-
}
289-
.row-drag {
290-
stroke-width:2;
291-
stroke-dasharray: 2,1;
292-
stroke:rgba(100,100,100,0.3);
293-
transition: stroke 300ms ease;
294-
cursor: row-resize;
295-
}
296-
.row-drag:hover {
297-
stroke-dasharray:none;
298-
stroke:rgba(100,100,100,0.8);
299-
}
300-
301-
.word text {
302-
font-size:16px;
303-
fill:black;
304-
}
305-
.word path {
306-
stroke:#333;
307-
fill:none;
308-
}
309-
.word .word-text {
310-
cursor: pointer;
311-
}
312-
313-
.word-cluster text,
314-
.word .word-tag {
315-
font-size: 12px;
316-
cursor: text;
317-
}
318-
319-
.word-cluster text,
320-
.word .word-tag {
321-
fill:#333;
322-
}
323-
.word .syntax-tag {
324-
fill: rgb(208, 150, 143);
325-
}
326-
.toggle-syntax .syntax-tag, .toggle-syntax .syntax-link {
327-
display:none;
328-
}
329-
330-
.editing .word-tag,
331-
.editing-text,
332-
.editing text {
333-
fill: #fff !important;
334-
}
335-
336-
.editing-rect,
337-
.editing rect {
338-
fill:#a94442;
339-
}
340-
341-
.link path.polyline {
342-
stroke: #6590b4;
343-
fill: none;
344-
}
345-
.link {
346-
font-size: 12px;
347-
fill:#6590b4;
348-
stroke-width:1.5px;
349-
}
350-
.link.syntax-link {
351-
fill: #999;
352-
}
353-
.syntax-link path.polyline {
354-
stroke: #999;
355-
fill: none;
356-
}
357-
358-
.link:hover {
359-
stroke-width:2.5px;
360-
}
283+
}

src/js/main.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ const Main = (function() {
1515
// classes
1616
let parser, lm, rm, tm;
1717

18-
let css;
19-
2018
// main svg element
2119
let svg;
20+
let css = '';
2221

2322
// node-link objects
2423
let words = [];
@@ -52,8 +51,9 @@ const Main = (function() {
5251
tm = new Taxonomy('taxonomy');
5352
tree = new TreeLayout('#tree', svg);
5453

55-
load('/dist/tag/css/tag.min.css')
56-
.then((text) => css = text);
54+
if (document.getElementById('svgStyles')) {
55+
css = document.getElementById('svgStyles').innerHTML;
56+
}
5757

5858
// load and render initial dataset by default
5959
changeDataset();
@@ -252,10 +252,9 @@ const Main = (function() {
252252
function exportFile() {
253253

254254
let exportedSVG = svg.svg();
255-
console.log(css);
256255
let i = exportedSVG.indexOf('</defs>');
257256
exportedSVG = exportedSVG.slice(0, i)
258-
+ '<style>' + css + 'text{text-anchor:middle;}</style>'
257+
+ '<style>' + css + '</style>'
259258
+ exportedSVG.slice(i);
260259
let a = document.getElementById('download');
261260
a.setAttribute('href', 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(exportedSVG));

0 commit comments

Comments
 (0)