-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(client): add
SidePanel
file directory (#554)
* feat(client): add `SidePanel` file directory chore(client): upgrade dependent version fix(client): `CherryMarkdown ` mounting refactor(client): `menu` files * chore(client): v0.0.4 * feat(client): default size of the client window chore(client): removed some toolbar features chore(client): renamed the file name of the store
- Loading branch information
Showing
20 changed files
with
778 additions
and
928 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { app, BrowserWindow, dialog, ipcMain, Menu, MenuItem, MenuItemConstructorOptions, shell } from "electron" | ||
import packageInfo from "../../../../package.json" | ||
|
||
/** | ||
* @description 版本信息 | ||
*/ | ||
export const info = () => { | ||
dialog.showMessageBox({ | ||
title: ' Cherry Noted', | ||
type: 'info', | ||
message: '一个桌面端Markdown Noted', | ||
detail: `版本信息:${packageInfo.version}\n说明:测试版`, | ||
noLink: true, | ||
buttons: ['确定', '项目地址'], | ||
}).then((res) => { | ||
if (res.response === 1) { | ||
shell.openExternal('https://github.com/Tencent/cherry-markdown') | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { BrowserWindow, ipcMain } from "electron"; | ||
|
||
/** | ||
* @description 打开目录面板 | ||
*/ | ||
export const showDirectoryPanel = () => { | ||
const win = BrowserWindow.getAllWindows()[0]; | ||
win.webContents.send('show-directory-panel') | ||
return true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import { app, ipcMain, Menu, MenuItem, MenuItemConstructorOptions } from "electron" | ||
import { showDirectoryPanel } from "./category/view"; | ||
import { newFile, openFile, saveFileAs, saveFile } from "./category/file"; | ||
import { info } from "./category/other"; | ||
|
||
// @description 监听文本是否改变 | ||
ipcMain.on('is-text-change', () => { | ||
const menu = Menu.getApplicationMenu(); | ||
const saveFileBtn = menu.getMenuItemById('save-file'); | ||
saveFileBtn.enabled = true | ||
}) | ||
|
||
/** | ||
* @description 判断是否显示目录面板 | ||
*/ | ||
let isShowSidePanel = false | ||
|
||
/** | ||
* @desc 判断是否为Mac | ||
* @doc [process.platform](https://nodejs.org/api/process.html#processplatform) | ||
*/ | ||
const isMac = process.platform === 'darwin'; | ||
/** | ||
* @desc 判断是否为生产环境 | ||
*/ | ||
const isPackaged: boolean = app.isPackaged | ||
|
||
const menuConfig: Array<MenuItemConstructorOptions | MenuItem> = [ | ||
{ | ||
label: '文件', | ||
submenu: [ | ||
{ | ||
id: "new-file", | ||
label: '新建文件', | ||
click: () => newFile(), | ||
}, | ||
{ | ||
id: "open-file", | ||
label: '打开文件...', | ||
click: () => openFile(), | ||
}, | ||
{ | ||
id: "save-file-as", | ||
label: '另存为...', | ||
click: () => saveFileAs(), | ||
}, | ||
{ | ||
id: "save-file", | ||
label: '保存', | ||
click: () => saveFile(), | ||
enabled: false | ||
}, | ||
{ | ||
id: "quit-close", | ||
label: '退出', | ||
role: isMac ? "quit" : 'close' | ||
}, | ||
|
||
] | ||
}, | ||
{ | ||
label: '编辑', | ||
submenu: [ | ||
{ | ||
label: '在文件中查找', | ||
enabled: false, | ||
} | ||
] | ||
}, | ||
{ | ||
label: '视图', | ||
submenu: [ | ||
{ | ||
label: '目录', | ||
click: () => showDirectoryPanel(), | ||
enabled: true, | ||
type: 'checkbox', | ||
checked: !isShowSidePanel, | ||
}, | ||
] | ||
}, | ||
{ | ||
label: '其他', | ||
submenu: [ | ||
{ | ||
label: '设置', | ||
enabled: false, | ||
}, { | ||
label: '检测版本更新', | ||
enabled: false, | ||
}, { | ||
label: '关于', | ||
click: () => info(), | ||
} | ||
] | ||
}, | ||
] | ||
|
||
isPackaged ? [] : menuConfig.push({ | ||
label: "打开DevTools", | ||
role: 'toggleDevTools' | ||
}) | ||
|
||
export { | ||
menuConfig | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
<template> | ||
<CherryMarkdown></CherryMarkdown> | ||
<Home/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import CherryMarkdown from "./components/CherryMarkdown.vue" | ||
import Home from "@/pages/home.vue" | ||
</script> | ||
|
Oops, something went wrong.