Skip to content

Commit cb6b3e1

Browse files
authoredJul 5, 2021
Merge pull request #11 from BUPTlhuanyu/restructure
fix(menu & search empty): menu & search empty
2 parents 4d18f77 + 632d6ee commit cb6b3e1

File tree

7 files changed

+28
-9
lines changed

7 files changed

+28
-9
lines changed
 

‎packages/views/src/pages/editor/components/sider/index.scss

+8
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@
6161
display: flex;
6262
flex-direction: column;
6363
justify-content: space-between;
64+
&-empty {
65+
display: flex;
66+
flex: 1;
67+
height: 100%;
68+
justify-content: center;
69+
align-items: center;
70+
color: #7a7a7a;
71+
}
6472
&-header {
6573
line-height: 30px;
6674
height: 30px;

‎packages/views/src/pages/editor/components/sider/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,15 @@ export default React.forwardRef(function Sider(props: ISiderProps, ref: any) {
569569
}
570570
/>
571571
</div>
572-
{searchResult.length > 0 && (
572+
{searchResult.length > 0 ?
573573
<SearchList
574574
data={searchResult}
575575
className="sider-panel-content"
576576
onSelect={onSearchSelect}
577577
onLineSelect={onLineSelect}
578578
/>
579-
)}
579+
: <div className="sider-panel-empty">没有匹配结果</div>
580+
}
580581
</div>
581582
)}
582583
{showToc && (

‎packages/views/src/pages/home/container/content/index.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
padding: 10px;
6969
box-sizing: border-box;
7070
&:hover {
71-
box-shadow: 2px 2px 6px #ffffff;
71+
box-shadow: rgba(243, 240, 239, 0.7) 0px 8px 24px;
72+
transform: rotate(1deg);
7273
}
7374
&-img {
7475
width: 200px;

‎packages/views/src/pages/home/container/footer/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import * as React from 'react';
77
function Footer() {
88
return (
99
<div className="pandora-home-footer">
10-
点击跳转
1110
</div>
1211
);
1312
}

‎packages/workbench-electron/main/editor/editorMain.ts

+14-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import {ICommandService, CommandService} from 'services/command';
1919
import 'services/search/electron-browser/searchServices';
2020

2121
const MODE = process.env.NODE_ENV === 'production';
22-
function createWindow() {
22+
// TODO:封装成类,提供 close 等事件注册
23+
function createWindow(dispose: Function) {
2324
const html = MODE
2425
? `file://${path.resolve(app.getAppPath(), './dist/index.html')}`
2526
: `http://localhost:${DEVELOP_PORT}/index.html`;
@@ -55,19 +56,29 @@ function createWindow() {
5556
IPC_CHANNEL.forEach((item: string) => {
5657
ipcMain.removeHandler(item);
5758
});
58-
Menu.setApplicationMenu(new Menu());
59+
dispose();
5960
});
6061
}
6162

6263
export class CodeMain {
64+
private oldMenus: Menu | null;
6365
constructor() {
6466
this.initServices();
67+
const oldMenu = Menu.getApplicationMenu();
68+
this.oldMenus = null;
69+
if (oldMenu) {
70+
this.oldMenus = oldMenu;
71+
}
6572
}
6673
async startUp(): Promise<void> {
67-
createWindow();
74+
createWindow(this.resetMenu.bind(this));
6875
registerContextMenuListener();
6976
}
7077

78+
private resetMenu () {
79+
this.oldMenus && Menu.setApplicationMenu(this.oldMenus);
80+
}
81+
7182
private initServices() {
7283
const injector = new Injector();
7384

‎packages/workbench-electron/main/main.ts

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ function createHome() {
5151

5252
class Home {
5353
constructor () {
54-
Menu.setApplicationMenu(new Menu());
5554
this.registerListeners();
5655
}
5756
private registerListeners () {

‎packages/workbench-electron/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "workbench-electron",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "Pandora Workbench",
55
"productName": "Pandora Workbench",
66
"private": true,

0 commit comments

Comments
 (0)
Please sign in to comment.