mirror of
https://github.com/marktext/marktext.git
synced 2025-05-04 05:29:44 +08:00
Opti: little optimization
This commit is contained in:
parent
2c3215affe
commit
2d5ccd7575
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "marktext",
|
"name": "marktext",
|
||||||
"version": "0.8.4",
|
"version": "0.8.8",
|
||||||
"author": "Jocs <luoran1988@126.com>",
|
"author": "Jocs <luoran1988@126.com>",
|
||||||
"description": "Next generation markdown editor",
|
"description": "Next generation markdown editor",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -6,7 +6,7 @@ import path from 'path'
|
|||||||
import { app, dialog, ipcMain, BrowserWindow } from 'electron'
|
import { app, dialog, ipcMain, BrowserWindow } from 'electron'
|
||||||
import createWindow, { windows } from '../createWindow'
|
import createWindow, { windows } from '../createWindow'
|
||||||
import { EXTENSIONS, EXTENSION_HASN } from '../config'
|
import { EXTENSIONS, EXTENSION_HASN } from '../config'
|
||||||
import { getPath, log } from '../utils'
|
import { getPath, log, isMarkdownFile } from '../utils'
|
||||||
import userPreference from '../preference'
|
import userPreference from '../preference'
|
||||||
|
|
||||||
const watchAndReload = (pathname, win) => { // when i build, and failed.
|
const watchAndReload = (pathname, win) => { // when i build, and failed.
|
||||||
@ -124,6 +124,15 @@ ipcMain.on('AGANI::close-window', e => {
|
|||||||
forceClose(win)
|
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) => {
|
export const exportFile = (win, type) => {
|
||||||
win.webContents.send('AGANI::export', { type })
|
win.webContents.send('AGANI::export', { type })
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
import './globalSetting'
|
import './globalSetting'
|
||||||
import { app, ipcMain, Menu } from 'electron'
|
import { app, Menu } from 'electron'
|
||||||
import configureMenu, { dockMenu } from './menus'
|
import configureMenu, { dockMenu } from './menus'
|
||||||
import createWindow, { windows } from './createWindow'
|
import createWindow, { windows } from './createWindow'
|
||||||
import { isMarkdownFile } from './utils'
|
import { isMarkdownFile } from './utils'
|
||||||
// import { autoUpdater } from "electron-updater"
|
|
||||||
|
|
||||||
let openFilesCache = []
|
let openFilesCache = []
|
||||||
|
|
||||||
@ -59,12 +58,3 @@ app.on('activate', () => {
|
|||||||
onReady()
|
onReady()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('AGANI::window::drop', (e, fileList) => {
|
|
||||||
for (const file of fileList) {
|
|
||||||
if (isMarkdownFile(file)) {
|
|
||||||
createWindow(file)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
@ -66,7 +66,6 @@ ipcMain.on('AGANI::ask-for-user-preference', e => {
|
|||||||
|
|
||||||
ipcMain.on('AGANI::set-user-preference', (e, pre) => {
|
ipcMain.on('AGANI::set-user-preference', (e, pre) => {
|
||||||
Object.keys(pre).map(key => {
|
Object.keys(pre).map(key => {
|
||||||
console.log(key, pre[key])
|
|
||||||
preference.setItem(key, pre[key])
|
preference.setItem(key, pre[key])
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch(log)
|
.catch(log)
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
BottomBar,
|
BottomBar,
|
||||||
SourceCode,
|
SourceCode,
|
||||||
UploadImage,
|
UploadImage,
|
||||||
AboutDialog
|
AboutDialog,
|
||||||
Font
|
Font
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
<div class="text">Copyright © 2018 Jocs</div>
|
<div class="text">Copyright © 2018 Jocs</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -61,6 +62,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.about-dialog .logo {
|
.about-dialog .logo {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
display: inherit;
|
display: inherit;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import store from './store'
|
|||||||
import './assets/symbolIcon'
|
import './assets/symbolIcon'
|
||||||
import './index.css'
|
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:
|
// In the renderer process:
|
||||||
// var webFrame = require('electron').webFrame
|
// var webFrame = require('electron').webFrame
|
||||||
// var SpellCheckProvider = require('electron-spell-check-provider')
|
// var SpellCheckProvider = require('electron-spell-check-provider')
|
||||||
@ -48,6 +48,8 @@ Vue.use(Tooltip)
|
|||||||
Vue.use(Upload)
|
Vue.use(Upload)
|
||||||
Vue.use(Slider)
|
Vue.use(Slider)
|
||||||
Vue.use(ColorPicker)
|
Vue.use(ColorPicker)
|
||||||
|
Vue.use(Col)
|
||||||
|
Vue.use(Row)
|
||||||
|
|
||||||
if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
|
if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
|
||||||
Vue.http = Vue.prototype.$http = axios
|
Vue.http = Vue.prototype.$http = axios
|
||||||
|
Loading…
Reference in New Issue
Block a user