Skip to content

Commit 3dede73

Browse files
committed
feat: use css var in plugins
1 parent 00c2bf8 commit 3dede73

File tree

3 files changed

+56
-62
lines changed

3 files changed

+56
-62
lines changed

src/plugin/contextMenu.less

Lines changed: 52 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,52 @@
1-
.mind-elixir .context-menu {
2-
// TODO use CSS variables
3-
position: fixed;
4-
top: 0;
5-
left: 0;
6-
width: 100%;
7-
height: 100%;
8-
z-index: 99;
9-
.menu-list {
10-
position: fixed;
11-
list-style: none;
12-
margin: 0;
13-
padding: 0;
14-
font: 300 15px 'Roboto', sans-serif;
15-
color: #333;
16-
box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.2);
17-
* {
18-
transition: color 0.4s, background-color 0.4s;
19-
}
20-
li {
21-
min-width: 150px;
22-
overflow: hidden;
23-
white-space: nowrap;
24-
padding: 6px 10px;
25-
background-color: #fff;
26-
border-bottom: 1px solid #ecf0f1;
27-
a {
28-
color: #333;
29-
text-decoration: none;
30-
}
31-
&.disabled {
32-
color: rgb(94, 94, 94);
33-
background-color: rgb(247, 247, 247);
34-
&:hover {
35-
cursor: default;
36-
background-color: rgb(247, 247, 247);
37-
}
38-
}
39-
&:hover {
40-
cursor: pointer;
41-
background-color: #ecf0f1;
42-
}
43-
&:first-child {
44-
border-radius: 5px 5px 0 0;
45-
}
46-
&:last-child {
47-
border-bottom: 0;
48-
border-radius: 0 0 5px 5px;
49-
}
50-
span:last-child {
51-
float: right;
52-
}
53-
}
54-
}
55-
}
1+
.mind-elixir .context-menu {
2+
position: fixed;
3+
top: 0;
4+
left: 0;
5+
width: 100%;
6+
height: 100%;
7+
z-index: 99;
8+
.menu-list {
9+
position: fixed;
10+
list-style: none;
11+
margin: 0;
12+
padding: 0;
13+
font: 300 15px 'Roboto', sans-serif;
14+
color: var(--panel-color);
15+
box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.2);
16+
li {
17+
min-width: 200px;
18+
overflow: hidden;
19+
white-space: nowrap;
20+
padding: 10px 14px;
21+
background: var(--panel-bgcolor);
22+
border-bottom: 1px solid var(--panel-border-color);
23+
a {
24+
color: #333;
25+
text-decoration: none;
26+
}
27+
&.disabled {
28+
display: none;
29+
color: rgb(94, 94, 94);
30+
background-color: rgb(247, 247, 247);
31+
&:hover {
32+
cursor: default;
33+
background-color: rgb(247, 247, 247);
34+
}
35+
}
36+
&:hover {
37+
cursor: pointer;
38+
filter: brightness(0.9);
39+
}
40+
&:first-child {
41+
border-radius: 5px 5px 0 0;
42+
}
43+
&:last-child {
44+
border-bottom: 0;
45+
border-radius: 0 0 5px 5px;
46+
}
47+
span:last-child {
48+
float: right;
49+
}
50+
}
51+
}
52+
}

src/plugin/contextMenu.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ export default function (mind: MindElixirInstance, option: any) {
7676
focus.className = 'disabled'
7777
up.className = 'disabled'
7878
down.className = 'disabled'
79+
add_parent.className = 'disabled'
7980
add_sibling.className = 'disabled'
8081
remove_child.className = 'disabled'
8182
} else {
8283
focus.className = ''
8384
up.className = ''
8485
down.className = ''
86+
add_parent.className = ''
8587
add_sibling.className = ''
8688
remove_child.className = ''
8789
}

src/plugin/toolBar.less

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
@media (prefers-color-scheme: dark) {
2-
.mind-elixir-toolbar {
3-
background: #2d3748 !important;
4-
color: #fff !important;
5-
}
6-
}
71
.mind-elixir-toolbar {
82
font-family: iconfont;
93
position: absolute;
10-
background: #fff;
4+
color: var(--panel-color);
5+
background: var(--panel-bgcolor);
116
padding: 10px;
127
border-radius: 5px;
138
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.2);

0 commit comments

Comments
 (0)