Opti: little optimization

This commit is contained in:
Jocs 2018-03-23 19:27:07 +08:00
parent 2c3215affe
commit 2d5ccd7575
7 changed files with 19 additions and 16 deletions

View File

@ -1,6 +1,6 @@
{
"name": "marktext",
"version": "0.8.4",
"version": "0.8.8",
"author": "Jocs <luoran1988@126.com>",
"description": "Next generation markdown editor",
"license": "MIT",

View File

@ -6,7 +6,7 @@ import path from 'path'
import { app, dialog, ipcMain, BrowserWindow } from 'electron'
import createWindow, { windows } from '../createWindow'
import { EXTENSIONS, EXTENSION_HASN } from '../config'
import { getPath, log } from '../utils'
import { getPath, log, isMarkdownFile } from '../utils'
import userPreference from '../preference'
const watchAndReload = (pathname, win) => { // when i build, and failed.
@ -124,6 +124,15 @@ ipcMain.on('AGANI::close-window', e => {
forceClose(win)
})
ipcMain.on('AGANI::window::drop', (e, fileList) => {
for (const file of fileList) {
if (isMarkdownFile(file)) {
createWindow(file)
break
}
}
})
export const exportFile = (win, type) => {
win.webContents.send('AGANI::export', { type })
}

View File

@ -1,11 +1,10 @@
'use strict'
import './globalSetting'
import { app, ipcMain, Menu } from 'electron'
import { app, Menu } from 'electron'
import configureMenu, { dockMenu } from './menus'
import createWindow, { windows } from './createWindow'
import { isMarkdownFile } from './utils'
// import { autoUpdater } from "electron-updater"
let openFilesCache = []
@ -59,12 +58,3 @@ app.on('activate', () => {
onReady()
}
})
ipcMain.on('AGANI::window::drop', (e, fileList) => {
for (const file of fileList) {
if (isMarkdownFile(file)) {
createWindow(file)
break
}
}
})

View File

@ -66,7 +66,6 @@ ipcMain.on('AGANI::ask-for-user-preference', e => {
ipcMain.on('AGANI::set-user-preference', (e, pre) => {
Object.keys(pre).map(key => {
console.log(key, pre[key])
preference.setItem(key, pre[key])
.then(() => {})
.catch(log)

View File

@ -58,7 +58,7 @@
BottomBar,
SourceCode,
UploadImage,
AboutDialog
AboutDialog,
Font
},
data () {

View File

@ -19,6 +19,7 @@
<div class="text">Copyright © 2018 Jocs</div>
</el-col>
</el-row>
</el-dialog>
</div>
</template>
@ -61,6 +62,8 @@
}
.about-dialog .logo {
width: 100px;
height: 100px;
display: inherit;
margin: 0 auto;
}

View File

@ -9,7 +9,7 @@ import store from './store'
import './assets/symbolIcon'
import './index.css'
import { Dialog, Form, FormItem, InputNumber, Button, Tooltip, Upload, Slider, ColorPicker } from 'element-ui'
import { Dialog, Form, FormItem, InputNumber, Button, Tooltip, Upload, Slider, ColorPicker, Col, Row } from 'element-ui'
// In the renderer process:
// var webFrame = require('electron').webFrame
// var SpellCheckProvider = require('electron-spell-check-provider')
@ -48,6 +48,8 @@ Vue.use(Tooltip)
Vue.use(Upload)
Vue.use(Slider)
Vue.use(ColorPicker)
Vue.use(Col)
Vue.use(Row)
if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
Vue.http = Vue.prototype.$http = axios