-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathApp.vue
154 lines (141 loc) · 3.5 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<template>
<div id="app"
style="scroll-behavior: smooth;"
@drop="drop_handler($event);"
@dragover="dragover_handler($event);"
@dragend="dragend_handler($event);">
<cover></cover>
<router-view></router-view>
<Ribbon v-if="hasGithubRibbon"
v-bind="ribbonOptions"
></Ribbon>
</div>
</template>
<script>
import Cover from './components/Cover'
export default {
name: 'app',
components: {
cover: Cover
},
computed: {
hasGithubRibbon: function () {
if (window.lconfig.githubRibbon) {
return true
}
return false
},
ribbonOptions: function () {
return window.lconfig.githubRibbon
}
},
methods: {
// drag and drop a leo file
dragover_handler (ev) {
// Prevent default select and drag behavior
ev.preventDefault()
},
dragend_handler (ev) {
// Remove all of the drag data
var dt = ev.dataTransfer
if (dt.items) {
// Use DataTransferItemList interface to remove the drag data
for (var i = 0; i < dt.items.length; i++) {
dt.items.remove(i)
}
} else {
// Use DataTransfer interface to remove the drag data
ev.dataTransfer.clearData()
}
},
drop_handler (ev) {
ev.preventDefault()
// If dropped items aren't files, reject them
const dt = ev.dataTransfer
let i
let f
if (dt.items) {
// Use DataTransferItemList interface to access the file(s)
for (i = 0; i < dt.items.length; i++) {
if (dt.items[i].kind === 'file') {
f = dt.items[i].getAsFile()
}
}
} else {
// Use DataTransfer interface to access the file(s)
for (i = 0; i < dt.files.length; i++) {
f = dt.files[i]
}
}
const reader = new FileReader()
reader.onload = (xml) => {
const xmlString = xml.srcElement.result
this.$store.dispatch('loadLeoFromXML', {xml: xmlString, route: this.$route})
}
reader.readAsText(f)
}
},
mounted () {
let filename = 'static/docs'
if (window.lconfig.filename) {
filename = window.lconfig.filename
}
if (!this.$store.initializedData) {
this.$store.dispatch('loadLeo', {filename, route: this.$route})
}
this.$store.dispatch('setMessages')
}
}
</script>
<style lang="sass">
@import './assets/global.sass'
@import './assets/vue-instant.css'
@import './assets/wikipedia.css'
@import '~leaflet/dist/leaflet.css'
HTML, BODY
margin: 0
padding: 0
height: 100%
width: 100%
#app
color: $mycolor
margin: 0
padding: 0
height: 100%
.right-pane .text, .inline .text
// margin-top: 20px
border: none
background-color: transparent
resize: none
outline: none
font-size: 16px
// height: 100%
// white-space: pre-line
width: 100%
.directive
color: #990000;
.md
margin-left: 10px
margin-top: 10px
padding-right: 10px
margin-bottom: 80px
.unselectable
-moz-user-select: -moz-none
-khtml-user-select: none
-webkit-user-select: none
// Introduced in IE 10.
// See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/
-ms-user-select: none
user-select: none
A, .link
color: #42b983
cursor: pointer
text-decoration: underline
.flip-container
width: 80%
max-width: 600px
margin-left: 40px
margin-bottom: 60px
SVG
height: inherit !important
</style>