diff --git a/README.md b/README.md index 722cfb78..ba269985 100644 --- a/README.md +++ b/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. - - - diff --git a/TODO.md b/TODO.md index 77fd4379..4d6cbfcb 100644 --- a/TODO.md +++ b/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) diff --git a/package.json b/package.json index 13cfeb6c..16098390 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aganippe", - "version": "0.0.2", + "version": "0.2.0", "author": "Jocs ", "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/**/*" ], diff --git a/src/main/createWindow.js b/src/main/createWindow.js index 2de12f99..742650e7 100644 --- a/src/main/createWindow.js +++ b/src/main/createWindow.js @@ -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() diff --git a/src/main/index.js b/src/main/index.js index da15d690..f9de1635 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -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', () => {