mirror of
https://github.com/marktext/marktext.git
synced 2025-05-20 02:40:28 +08:00
feat: add aganippe to open with
This commit is contained in:
parent
73edd7b3c5
commit
a396901203
18
README.md
18
README.md
@ -7,7 +7,9 @@
|
||||
### Why write another Markdown editor ?
|
||||
|
||||
1. Typora is so excellent that I love it so much that I cannot bear to part with it. But in the process of using Typora, I still find some small problems. As a programmer, I can't wait to fix these problems, because Typora is not an open source software. So I decided to write a self - used markdown editor and open source for all the people who love markdown.
|
||||
|
||||
2. As mentioned above, Aganippe will be open source indefinitely. It is also hoped that all markdown lovers can contribute their own code, and develop Aganippe into a popular markdown editor.
|
||||
|
||||
3. There are many markdown editors, and each editor has its own characteristics, but it is also difficult to satisfy all makdown users' needs. I hope Aganippe can satisfy markdown users' needs as much as possible. Although the latest **Aganippe** is still not perfect, but we are trying to make it perfect.
|
||||
|
||||
### Features
|
||||
@ -30,18 +32,18 @@
|
||||
|
||||
### Development
|
||||
|
||||
If you wish to build MacDown yourself.
|
||||
If you wish to build Aganippe yourself.
|
||||
|
||||
* first clone this repo.
|
||||
* Run `npm install`
|
||||
* Run `npm run build`
|
||||
* copy the build app to Applications folder.
|
||||
- first clone this repo.
|
||||
|
||||
- Run `npm install`
|
||||
|
||||
- Run `npm run build`
|
||||
|
||||
- copy the build app to Applications folder.
|
||||
|
||||
When you use Aganippe, if you have any questions, you are welcome to write an issue, but I hope you follow the format of issue. Of course, if you can submit a PR directly, it will be appreciated.
|
||||
|
||||
### Last
|
||||
|
||||
If you find Aganippe suitable for your needs, It's my pleasure.
|
||||
|
||||
|
||||
|
||||
|
2
TODO.md
2
TODO.md
@ -4,8 +4,6 @@
|
||||
|
||||
- [ ] 当 codeBlock 在 list item 中, item nextSibling 为 null,但是 list 还有nextSibling。这个时候不应该创建行的 block。(严重 bug)
|
||||
- [ ] codeBlock 在 list item 中时,list style 问题。
|
||||
- [ ] 在通过 Aganippe 打开文件时,无法通过右键选择 Aganippe。(严重 bug)
|
||||
- [ ] 在通过 Aganippe 打开文件时,通过右键选择软件,但是打开无内容。(严重 bug)
|
||||
- [ ] export html: (3) keyframe 和 font-face 以及 bar-top 的样式都可以删除。(4) 打包后的应用 axios 获取样式有问题。(优化)
|
||||
- [ ] table: 如果 table 在 selection 后面,那么删除cell 的时候,会把整个 row 删除了。(小 bug)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "aganippe",
|
||||
"version": "0.0.2",
|
||||
"version": "0.2.0",
|
||||
"author": "Jocs <luoran1988@126.com>",
|
||||
"description": "A markdown editor",
|
||||
"license": "MIT",
|
||||
@ -27,6 +27,9 @@
|
||||
"directories": {
|
||||
"output": "build"
|
||||
},
|
||||
"fileAssociations": {
|
||||
"ext": ["md", "markdown", "txt", "mmd", "text", "mdown", "mdtxt", "mdtext"]
|
||||
},
|
||||
"files": [
|
||||
"dist/electron/**/*"
|
||||
],
|
||||
|
@ -8,6 +8,7 @@ import windowStateKeeper from 'electron-window-state'
|
||||
export const windows = new Map()
|
||||
|
||||
const createWindow = (pathname, options = {}) => {
|
||||
const TITLE_BAR_HEIGHT = 21
|
||||
const mainWindowState = windowStateKeeper({
|
||||
defaultWidth: 1200,
|
||||
defaultHeight: 800
|
||||
@ -27,7 +28,7 @@ const createWindow = (pathname, options = {}) => {
|
||||
: `file://${__dirname}/index.html`
|
||||
|
||||
win.loadURL(winURL)
|
||||
win.setSheetOffset(21) // 21 is the title bar height
|
||||
win.setSheetOffset(TITLE_BAR_HEIGHT) // 21 is the title bar height
|
||||
win.once('ready-to-show', () => {
|
||||
win.show()
|
||||
|
||||
|
@ -4,6 +4,8 @@ import { app, Menu } from 'electron'
|
||||
import configureMenu from './menus'
|
||||
import createWindow, { windows } from './createWindow'
|
||||
|
||||
const openFilesCache = []
|
||||
|
||||
/**
|
||||
* Set `__static` path to static files in production
|
||||
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
|
||||
@ -13,11 +15,28 @@ if (process.env.NODE_ENV !== 'development') {
|
||||
}
|
||||
|
||||
const onReady = () => {
|
||||
createWindow()
|
||||
app.removeListener('open-file', openFile)
|
||||
if (openFilesCache.length) {
|
||||
openFilesCache.forEach(path => createWindow(path))
|
||||
openFilesCache.length = 0 // empty the open file path cache
|
||||
} else {
|
||||
createWindow()
|
||||
}
|
||||
const menu = Menu.buildFromTemplate(configureMenu({ app }))
|
||||
Menu.setApplicationMenu(menu)
|
||||
}
|
||||
|
||||
const openFile = (event, path) => {
|
||||
event.preventDefault()
|
||||
if (app.isReady()) {
|
||||
createWindow(path)
|
||||
} else {
|
||||
openFilesCache.push(path)
|
||||
}
|
||||
}
|
||||
|
||||
app.on('open-file', openFile)
|
||||
|
||||
app.on('ready', onReady)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user