mirror of
https://github.com/marktext/marktext.git
synced 2025-05-03 12:10:38 +08:00

* rewrite notice module * optimization: show some notification when export html or pdf * optimization: style of open project button * little bug fix * style: uniform titlebar hight to remove some style error
71 lines
1.9 KiB
JavaScript
71 lines
1.9 KiB
JavaScript
import Vue from 'vue'
|
|
import axios from 'axios'
|
|
import { ipcRenderer } from 'electron'
|
|
import lang from 'element-ui/lib/locale/lang/en'
|
|
import locale from 'element-ui/lib/locale'
|
|
import App from './app'
|
|
import store from './store'
|
|
import './assets/symbolIcon'
|
|
import './index.css'
|
|
import { Dialog, Form, FormItem, InputNumber, Button, Tooltip, Upload, Slider, ColorPicker, Col, Row } from 'element-ui'
|
|
import services from './services'
|
|
|
|
// import notice from './services/notification'
|
|
// In the renderer process:
|
|
// var webFrame = require('electron').webFrame
|
|
// var SpellCheckProvider = require('electron-spell-check-provider')
|
|
|
|
// webFrame.setSpellCheckProvider('en-US', true, new SpellCheckProvider('en-US').on('misspelling', function (suggestions) {
|
|
// console.log(suggestions)
|
|
// }))
|
|
|
|
// prevent Chromium's default behavior and try to open the first file
|
|
window.addEventListener('dragover', function (e) {
|
|
e.preventDefault()
|
|
if (e.dataTransfer.types.indexOf('Files') >= 0) {
|
|
e.dataTransfer.dropEffect = 'copy'
|
|
} else {
|
|
e.stopPropagation()
|
|
e.dataTransfer.dropEffect = 'none'
|
|
}
|
|
}, false)
|
|
window.addEventListener('drop', function (e) {
|
|
e.preventDefault()
|
|
if (e.dataTransfer.files) {
|
|
const fileList = []
|
|
for (const file of e.dataTransfer.files) {
|
|
fileList.push(file.path)
|
|
}
|
|
ipcRenderer.send('AGANI::window::drop', fileList)
|
|
}
|
|
}, false)
|
|
|
|
locale.use(lang)
|
|
|
|
Vue.use(Dialog)
|
|
Vue.use(Form)
|
|
Vue.use(FormItem)
|
|
Vue.use(InputNumber)
|
|
Vue.use(Button)
|
|
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
|
|
Vue.config.productionTip = false
|
|
|
|
services.forEach(s => {
|
|
Vue.prototype['$' + s.name] = s[s.name]
|
|
})
|
|
|
|
/* eslint-disable no-new */
|
|
new Vue({
|
|
components: { App },
|
|
store,
|
|
template: '<App/>'
|
|
}).$mount('#app')
|