forked from marktext/marktext
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtreeOpenedTab.vue
More file actions
82 lines (79 loc) · 1.62 KB
/
treeOpenedTab.vue
File metadata and controls
82 lines (79 loc) · 1.62 KB
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
<template>
<div
class="opened-file"
:title="file.pathname"
@click="selectFile(file)"
:class="[{'active': currentFile.id === file.id, 'unsaved': !file.isSaved }]"
>
<svg class="icon" aria-hidden="true"
@click.stop="removeFileInTab(file)"
>
<use xlink:href="#icon-close-small"></use>
</svg>
<span class="name">{{ file.filename }}</span>
</div>
</template>
<script>
import { mapState } from 'vuex'
import { tabsMixins } from '../../mixins'
export default {
mixins: [tabsMixins],
props: {
file: {
type: Object,
required: true
}
},
computed: {
...mapState({
currentFile: state => state.editor.currentFile
})
}
}
</script>
<style scoped>
.opened-file {
display: flex;
user-select: none;
height: 28px;
line-height: 28px;
padding-left: 35px;
position: relative;
color: var(--sideBarColor);
& > svg {
display: none;
width: 10px;
height: 10px;
position: absolute;
top: 9px;
left: 10px;
}
&:hover > svg {
display: inline-block;
}
&:hover {
background: var(--sideBarItemHoverBgColor);
}
& > span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.opened-file.active {
color: var(--highlightThemeColor);
}
.unsaved.opened-file::before {
content: '';
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--highlightThemeColor);
position: absolute;
top: 11px;
left: 12px;
}
.unsaved.opened-file:hover::before {
content: none;
}
</style>