Skip to content
This repository was archived by the owner on Jun 21, 2024. It is now read-only.

Commit c1400cd

Browse files
committed
feat: 兼容mac以及暗黑模式
1 parent 5f4a886 commit c1400cd

File tree

13 files changed

+110
-32
lines changed

13 files changed

+110
-32
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.2.1",
44
"private": true,
55
"author": "heiyehk",
6-
"description": "I便笺个人开发者heiyehk独立开发,在Windows中更方便的记录文字。",
6+
"description": "I便笺漂亮的过度效果,允许开启多个窗口方便在桌面端更方便的记录文字",
77
"main": "background.js",
88
"scripts": {
99
"lint": "vue-cli-service lint",

public/css/common.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
/* 设置ol显示格式 */
1717
.module-editor ol {
18-
counter-reset:sectioncounter;
18+
counter-reset: sectioncounter;
1919
}
2020

2121
.module-editor ol li {
@@ -25,7 +25,7 @@
2525

2626
.module-editor ol li::before {
2727
content: counter(sectioncounter) '.';
28-
counter-increment:sectioncounter;
28+
counter-increment: sectioncounter;
2929
margin-right: 10px;
3030
}
3131

public/css/common.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.

public/css/mac.css

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
body {
2+
padding: 0 !important;
3+
}
4+
5+
.search {
6+
box-shadow: 0 0 4px #ddd;
7+
}
8+
9+
.header .drag-header {
10+
margin-top: 0 !important;
11+
}
12+
13+
@media (prefers-color-scheme: dark) {
14+
body,
15+
.header,
16+
body .bg-white,
17+
body .page-index,
18+
body .page-setting,
19+
body .page-editor,
20+
body .bottom-editor-tools,
21+
body .options-container .options-content, /* 遮罩列表 */
22+
#rightClick {
23+
background-color: #333 !important;
24+
color: white !important;
25+
transition: background-color 0.4s;
26+
}
27+
body .options-container .options-content * {
28+
color: white !important;
29+
}
30+
/* 头部 */
31+
.header a {
32+
color: white !important;
33+
}
34+
/* 编辑遮罩 */
35+
body .options-container .options-cover {
36+
background-color: rgba(0, 0, 0, 0.6) !important;
37+
}
38+
/* 右键列表 */
39+
.right-click-menu-list li:hover {
40+
background-color: rgba(0, 0, 0, 0.4) !important;
41+
}
42+
body .about-app-description,
43+
body .disabled-line {
44+
color: #828282;
45+
}
46+
}
47+
48+
@media (prefers-color-scheme: light) {
49+
body {
50+
background-color: #fff !important;
51+
color: black !important;
52+
}
53+
}

public/css/mac.min.css

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

public/index.html

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
<!DOCTYPE html>
22
<html lang="zh">
3-
<head>
4-
<meta charset="utf-8">
5-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6-
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7-
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8-
<title><%= htmlWebpackPlugin.options.title %></title>
9-
<link rel="stylesheet" href="<%= BASE_URL %>font/iconfont.css">
10-
<link rel="stylesheet" href="<%= BASE_URL %>css/style.min.css">
11-
<link rel="stylesheet" href="<%= BASE_URL %>css/common.min.css">
12-
</head>
13-
<body>
14-
<div id="app" class="app app-show" ondragstart="return false"></div>
15-
</body>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
8+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
9+
<title><%= htmlWebpackPlugin.options.title %></title>
10+
<link rel="stylesheet" href="<%= BASE_URL %>font/iconfont.css">
11+
<link rel="stylesheet" href="<%= BASE_URL %>css/style.min.css">
12+
<link rel="stylesheet" href="<%= BASE_URL %>css/common.min.css">
13+
<% if (htmlWebpackPlugin.options.platform === 'darwin') { %>
14+
<link rel="stylesheet" href="<%= BASE_URL %>css/mac.min.css">
15+
<% } %>
16+
</head>
17+
18+
<body>
19+
<div id="app" class="app app-show" ondragstart="return false"></div>
20+
</body>
21+
1622
</html>

src/background.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-empty-function */
2-
'use strict';
3-
41
import { app, protocol, BrowserWindow, globalShortcut } from 'electron';
52
import {
63
createProtocol
@@ -63,6 +60,7 @@ app.on('ready', async () => {
6360
// }
6461
// 快捷键禁用
6562
for (const key of shortcutsKeys) {
63+
// eslint-disable-next-line @typescript-eslint/no-empty-function
6664
globalShortcut.register(key, () => {});
6765
}
6866
createWindow();

src/components/header.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</template>
1616
<!-- 标题拖动 -->
1717
<div class="drag-header flex1 flex-center" :style="computedPaddingLeft">
18-
<transition name="header-fadein">
18+
<transition name="header-fadein" v-if="platformWindows">
1919
<span :key="title">{{ title }}</span>
2020
</transition>
2121
</div>
@@ -49,7 +49,7 @@
4949
</div>
5050
</template>
5151
<!-- 关闭 -->
52-
<button class="icon flex-center close-window" @click="closeWindow" title="关闭">
52+
<button v-if="platformWindows" class="icon flex-center close-window" @click="closeWindow" title="关闭">
5353
<i class="iconfont flex-center icon-close"></i>
5454
</button>
5555
</div>
@@ -95,10 +95,11 @@ export default defineComponent({
9595
return currentRouteName.value === 'index' ? 'padding-left: 40px;' : '';
9696
});
9797
98-
const title = ref(useRoute().meta.title);
98+
const title = ref(useRoute().meta.title as string);
9999
100100
onBeforeRouteUpdate((to, from, next) => {
101-
title.value = to.meta.title;
101+
title.value = to.meta.title as string;
102+
document.title = title.value;
102103
currentRouteName.value = to.name;
103104
next();
104105
});
@@ -121,7 +122,8 @@ export default defineComponent({
121122
closeWindow,
122123
computedPaddingLeft,
123124
isAlwaysOnTop,
124-
title
125+
title,
126+
platformWindows: process.platform === 'win32'
125127
};
126128
}
127129
});

src/components/input.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export default defineComponent({
9292
border: 1px solid @border-color;
9393
height: 24px;
9494
border-radius: 4px;
95+
overflow: hidden;
9596
&-box {
9697
input {
9798
border-radius: 4px;
@@ -102,6 +103,7 @@ export default defineComponent({
102103
box-sizing: border-box;
103104
display: block;
104105
cursor: auto;
106+
background-color: transparent;
105107
}
106108
}
107109
.hy-number-control {

src/components/switch.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default defineComponent({
6363
}
6464
&-core {
6565
border-radius: 10px;
66-
background-color: @gray-color;
66+
background-color: @gray-color !important;
6767
width: 40px;
6868
height: 100%;
6969
cursor: pointer;
@@ -95,7 +95,7 @@ export default defineComponent({
9595
9696
.active {
9797
.hy-switch-core {
98-
background-color: @success-color;
98+
background-color: @success-color !important;
9999
transition: background-color 0.4s;
100100
&:active {
101101
.hy-switch-action {
@@ -110,7 +110,7 @@ export default defineComponent({
110110
transform: translateX(@switchSize);
111111
}
112112
.hy-switch-checked-text {
113-
color: @success-color;
113+
color: @success-color !important;
114114
}
115115
}
116116

0 commit comments

Comments
 (0)