mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 05:39:48 +08:00
Upgrade to Electron 7 (#1543)
* Upgrade to Electron 7 * Fix E2E test issue with Electron 7 * Fix native theme event * Remove runtime native theme detection * Update Electron to v7.0.1 * Fix keytar exception
This commit is contained in:
parent
0ced076328
commit
09f920eade
@ -19,6 +19,7 @@ files:
|
||||
- "!node_modules/vega-lite/build/vega-lite*.js.map"
|
||||
# Don't bundle build files
|
||||
- "!node_modules/@felixrieseberg/spellchecker/bin"
|
||||
- "!node_modules/@hfelix/spellchecker/bin"
|
||||
- "!node_modules/ced/bin"
|
||||
- "!node_modules/ced/vendor"
|
||||
- "!node_modules/cld/bin"
|
||||
@ -34,6 +35,7 @@ files:
|
||||
- "!node_modules/ced/build/vendor"
|
||||
# Don't bundle LGPL source files
|
||||
- "!node_modules/@felixrieseberg/spellchecker/vendor"
|
||||
- "!node_modules/@hfelix/spellchecker/vendor"
|
||||
extraFiles:
|
||||
- "LICENSE"
|
||||
- from: "resources/THIRD-PARTY-LICENSES.txt"
|
||||
|
11
package.json
11
package.json
@ -34,7 +34,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@hfelix/electron-localshortcut": "^3.1.1",
|
||||
"@hfelix/electron-spellchecker": "^1.0.0-rc.1",
|
||||
"@hfelix/electron-spellchecker": "^1.0.0-rc.3",
|
||||
"@octokit/rest": "^16.33.1",
|
||||
"arg": "^4.1.1",
|
||||
"axios": "^0.19.0",
|
||||
@ -65,7 +65,7 @@
|
||||
"joplin-turndown-plugin-gfm": "^1.0.11",
|
||||
"katex": "^0.11.1",
|
||||
"keyboard-layout": "^2.0.16",
|
||||
"keytar": "^5.0.0-beta.3",
|
||||
"keytar": "5.0.0-beta.4",
|
||||
"mermaid": "^8.4.0",
|
||||
"plist": "^3.0.1",
|
||||
"popper.js": "^1.16.0",
|
||||
@ -113,7 +113,7 @@
|
||||
"del": "^5.1.0",
|
||||
"devtron": "^1.4.0",
|
||||
"dotenv": "^8.2.0",
|
||||
"electron": "^6.1.0",
|
||||
"electron": "^7.0.1",
|
||||
"electron-builder": "^21.2.0",
|
||||
"electron-devtools-installer": "^2.2.4",
|
||||
"electron-rebuild": "^1.8.6",
|
||||
@ -153,7 +153,7 @@
|
||||
"postcss-preset-env": "^6.6.0",
|
||||
"raw-loader": "^3.1.0",
|
||||
"require-dir": "^1.2.0",
|
||||
"spectron": "^8.0.0",
|
||||
"spectron": "^9.0.0",
|
||||
"style-loader": "^1.0.0",
|
||||
"svg-sprite-loader": "^4.1.6",
|
||||
"svgo": "^1.3.0",
|
||||
@ -171,9 +171,6 @@
|
||||
"webpack-hot-middleware": "^2.25.0",
|
||||
"webpack-merge": "^4.2.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"vscode-windows-registry": "^1.0.2"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:marktext/marktext.git"
|
||||
|
@ -3,7 +3,7 @@ import fse from 'fs-extra'
|
||||
import { exec } from 'child_process'
|
||||
import dayjs from 'dayjs'
|
||||
import log from 'electron-log'
|
||||
import { app, BrowserWindow, clipboard, dialog, ipcMain, systemPreferences } from 'electron'
|
||||
import { app, BrowserWindow, clipboard, dialog, ipcMain, nativeTheme } from 'electron'
|
||||
import { isChildOfDirectory } from 'common/filesystem/paths'
|
||||
import { isLinux, isOsx, isWindows } from '../config'
|
||||
import parseArgs from '../cli/parser'
|
||||
@ -115,7 +115,7 @@ class App {
|
||||
const { paths } = this._accessor
|
||||
ensureDefaultDict(paths.userDataPath)
|
||||
.catch(error => {
|
||||
log.error(error)
|
||||
log.error('Error copying Hunspell dictionary: ', error)
|
||||
})
|
||||
}
|
||||
|
||||
@ -143,7 +143,13 @@ class App {
|
||||
}
|
||||
}
|
||||
|
||||
const { startUpAction, defaultDirectoryToOpen } = preferences.getAll()
|
||||
const {
|
||||
startUpAction,
|
||||
defaultDirectoryToOpen,
|
||||
autoSwitchTheme,
|
||||
theme
|
||||
} = preferences.getAll()
|
||||
|
||||
if (startUpAction === 'folder' && defaultDirectoryToOpen) {
|
||||
const info = normalizeMarkdownPath(defaultDirectoryToOpen)
|
||||
if (info) {
|
||||
@ -151,29 +157,32 @@ class App {
|
||||
}
|
||||
}
|
||||
|
||||
// Set initial native theme for theme in preferences.
|
||||
const isDarkTheme = /dark/i.test(theme)
|
||||
if (autoSwitchTheme === 0 && isDarkTheme !== nativeTheme.shouldUseDarkColors) {
|
||||
selectTheme(nativeTheme.shouldUseDarkColors ? 'dark' : 'light')
|
||||
nativeTheme.themeSource = nativeTheme.shouldUseDarkColors ? 'dark' : 'light'
|
||||
} else {
|
||||
nativeTheme.themeSource = isDarkTheme ? 'dark' : 'light'
|
||||
}
|
||||
|
||||
let isDarkMode = nativeTheme.shouldUseDarkColors
|
||||
ipcMain.on('broadcast-preferences-changed', change => {
|
||||
// Set Chromium's color for native elements after theme change.
|
||||
if (change.theme) {
|
||||
const isDarkTheme = /dark/i.test(change.theme)
|
||||
if (isDarkMode !== isDarkTheme) {
|
||||
isDarkMode = isDarkTheme
|
||||
nativeTheme.themeSource = isDarkTheme ? 'dark' : 'light'
|
||||
} else if (nativeTheme.themeSource === 'system') {
|
||||
// Need to set dark or light theme because we set `system` to get the current system theme.
|
||||
nativeTheme.themeSource = isDarkMode ? 'dark' : 'light'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (isOsx) {
|
||||
app.dock.setMenu(dockMenu)
|
||||
|
||||
// Listen for system theme change and change Mark Text own `dark` and `light`.
|
||||
// In macOS 10.14 Mojave, Apple introduced a new system-wide dark mode for
|
||||
// all macOS computers.
|
||||
systemPreferences.subscribeNotification(
|
||||
'AppleInterfaceThemeChangedNotification',
|
||||
() => {
|
||||
const preferences = this._accessor.preferences
|
||||
const { theme } = preferences.getAll()
|
||||
|
||||
// Application menu is automatically updated via preference manager.
|
||||
if (systemPreferences.isDarkMode() && theme !== 'dark' &&
|
||||
theme !== 'material-dark' && theme !== 'one-dark') {
|
||||
selectTheme('dark')
|
||||
}
|
||||
if (!systemPreferences.isDarkMode() && theme !== 'light' &&
|
||||
theme !== 'ulysses' && theme !== 'graphite') {
|
||||
selectTheme('light')
|
||||
}
|
||||
}
|
||||
)
|
||||
} else if (isWindows) {
|
||||
app.setJumpList([{
|
||||
type: 'recent'
|
||||
|
@ -16,7 +16,7 @@ export const editorWinOptions = {
|
||||
zoomFactor: 1.0
|
||||
}
|
||||
|
||||
export const defaultPreferenceWinOptions = {
|
||||
export const preferencesWinOptions = {
|
||||
width: 950,
|
||||
height: 650,
|
||||
webPreferences: {
|
||||
|
@ -71,7 +71,7 @@ class DataCenter extends EventEmitter {
|
||||
|
||||
return Object.assign(data, encryptObj)
|
||||
} catch (err) {
|
||||
log.error(err)
|
||||
log.error('Failed to decrypt secure keys:', err)
|
||||
return data
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ class DataCenter extends EventEmitter {
|
||||
try {
|
||||
return await keytar.setPassword(serviceName, key, value)
|
||||
} catch (err) {
|
||||
log.error(err)
|
||||
log.error('dataCenter::setItem:', err)
|
||||
}
|
||||
} else {
|
||||
return this.store.set(key, value)
|
||||
|
@ -235,7 +235,7 @@ class Watcher {
|
||||
})
|
||||
}
|
||||
} else {
|
||||
log.error(error)
|
||||
log.error('Error while watching files:', error)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -60,9 +60,7 @@ try {
|
||||
// Catch errors that may come from invalid configuration files like settings.
|
||||
const msgHint = err.message.includes('Config schema violation')
|
||||
? 'This seems to be an issue with your configuration file(s). ' : ''
|
||||
|
||||
log.error(`Loading Mark Text failed during initialization! ${msgHint}`)
|
||||
log.error(err)
|
||||
log.error(`Loading Mark Text failed during initialization! ${msgHint}`, err)
|
||||
|
||||
const EXIT_ON_ERROR = !!process.env.MARKTEXT_EXIT_ON_ERROR
|
||||
const SHOW_ERROR_DIALOG = !process.env.MARKTEXT_ERROR_INTERACTION
|
||||
|
@ -62,7 +62,7 @@ const handleResponseForExport = async (e, { type, content, pathname, title, page
|
||||
}
|
||||
win.webContents.send('AGANI::export-success', { type, filePath })
|
||||
} catch (err) {
|
||||
log.error(err)
|
||||
log.error('Error while exporting:', err)
|
||||
const ERROR_MSG = err.message || `Error happened when export ${filePath}`
|
||||
win.webContents.send('AGANI::show-notification', {
|
||||
title: 'Export failure',
|
||||
@ -80,19 +80,9 @@ const handleResponseForExport = async (e, { type, content, pathname, title, page
|
||||
|
||||
const handleResponseForPrint = e => {
|
||||
const win = BrowserWindow.fromWebContents(e.sender)
|
||||
|
||||
// See GH#749, Electron#16085 and Electron#17523.
|
||||
dialog.showMessageBox(win, {
|
||||
type: 'info',
|
||||
buttons: ['OK'],
|
||||
defaultId: 0,
|
||||
noLink: true,
|
||||
message: 'Printing doesn\'t work',
|
||||
detail: 'Printing is disabled due to an Electron upstream issue. Please export the document as PDF and print the PDF file. We apologize for the inconvenience!'
|
||||
win.webContents.print({ printBackground: true }, () => {
|
||||
removePrintServiceFromWindow(win)
|
||||
})
|
||||
// win.webContents.print({ printBackground: true }, () => {
|
||||
// removePrintServiceFromWindow(win)
|
||||
// })
|
||||
}
|
||||
|
||||
const handleResponseForSave = async (e, { id, filename, markdown, pathname, options, defaultPath }) => {
|
||||
@ -140,7 +130,7 @@ const handleResponseForSave = async (e, { id, filename, markdown, pathname, opti
|
||||
return id
|
||||
})
|
||||
.catch(err => {
|
||||
log.error(err)
|
||||
log.error('Error while saving:', err)
|
||||
win.webContents.send('mt::tab-save-failure', id, err.message)
|
||||
})
|
||||
}
|
||||
@ -185,7 +175,7 @@ const openPandocFile = async (windowId, pathname) => {
|
||||
const data = await converter()
|
||||
ipcMain.emit('app-open-markdown-by-id', windowId, data)
|
||||
} catch (err) {
|
||||
log.error(err)
|
||||
log.error('Error while converting file:', err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,7 +206,7 @@ ipcMain.on('mt::save-and-close-tabs', async (e, unsavedFiles) => {
|
||||
win.send('mt::force-close-tabs-by-id', tabIds)
|
||||
})
|
||||
.catch(err => {
|
||||
log.error(err.error)
|
||||
log.error('Error while save all:', err.error)
|
||||
})
|
||||
} else {
|
||||
const tabIds = unsavedFiles.map(f => f.id)
|
||||
@ -262,7 +252,7 @@ ipcMain.on('AGANI::response-file-save-as', async (e, { id, filename, markdown, p
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
log.error(err)
|
||||
log.error('Error while save as:', err)
|
||||
win.webContents.send('mt::tab-save-failure', id, err.message)
|
||||
})
|
||||
}
|
||||
@ -282,8 +272,7 @@ ipcMain.on('mt::close-window-confirm', async (e, unsavedFiles) => {
|
||||
ipcMain.emit('window-close-by-id', win.id)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
log.error(err)
|
||||
log.error('Error while saving before quit:', err)
|
||||
|
||||
// Notify user about the problem.
|
||||
dialog.showMessageBox(win, {
|
||||
@ -446,19 +435,9 @@ export const importFile = async win => {
|
||||
}
|
||||
|
||||
export const print = win => {
|
||||
if (!win) {
|
||||
return
|
||||
if (win) {
|
||||
win.webContents.send('mt::show-export-dialog', 'print')
|
||||
}
|
||||
// See GH#749, Electron#16085 and Electron#17523.
|
||||
dialog.showMessageBox(win, {
|
||||
type: 'info',
|
||||
buttons: ['OK'],
|
||||
defaultId: 0,
|
||||
noLink: true,
|
||||
message: 'Printing doesn\'t work',
|
||||
detail: 'Printing is disabled due to an Electron upstream issue. Please export the document as PDF and print the PDF file. We apologize for the inconvenience!'
|
||||
})
|
||||
// win.webContents.send('mt::show-export-dialog', 'print')
|
||||
}
|
||||
|
||||
export const openFile = async win => {
|
||||
|
@ -9,13 +9,13 @@ export const toggleAlwaysOnTop = win => {
|
||||
export const zoomIn = win => {
|
||||
const { webContents } = win
|
||||
const zoom = webContents.getZoomFactor()
|
||||
// WORKAROUND: Electron#16018
|
||||
// WORKAROUND: We need to set zoom on the browser window due to Electron#16018.
|
||||
webContents.send('mt::window-zoom', Math.min(2.0, zoom + 0.125))
|
||||
}
|
||||
|
||||
export const zoomOut = win => {
|
||||
const { webContents } = win
|
||||
const zoom = webContents.getZoomFactor()
|
||||
// WORKAROUND: Electron#16018
|
||||
// WORKAROUND: We need to set zoom on the browser window due to Electron#16018.
|
||||
webContents.send('mt::window-zoom', Math.max(1.0, zoom - 0.125))
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class AppMenu {
|
||||
}
|
||||
return recentDocuments
|
||||
} catch (err) {
|
||||
log.error(err)
|
||||
log.error('Error while read recently used documents:', err)
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
@ -17,19 +17,13 @@ export default function (keybindings) {
|
||||
toggleAlwaysOnTop(browserWindow)
|
||||
}
|
||||
}, {
|
||||
// TODO: Disable due GH#1225.
|
||||
visible: false,
|
||||
type: 'separator'
|
||||
}, {
|
||||
// TODO: Disable due GH#1225.
|
||||
visible: false,
|
||||
label: 'Zoom In',
|
||||
click (menuItem, browserWindow) {
|
||||
zoomIn(browserWindow)
|
||||
}
|
||||
}, {
|
||||
// TODO: Disable due GH#1225.
|
||||
visible: false,
|
||||
label: 'Zoom Out',
|
||||
click (menuItem, browserWindow) {
|
||||
zoomOut(browserWindow)
|
||||
|
@ -1,34 +0,0 @@
|
||||
import { isWindows } from '../../config'
|
||||
|
||||
let GetStringRegKey = null
|
||||
if (isWindows) {
|
||||
try {
|
||||
GetStringRegKey = require('vscode-windows-registry').GetStringRegKey
|
||||
} catch (e) {
|
||||
// Ignore webpack build error on macOS and Linux.
|
||||
}
|
||||
}
|
||||
|
||||
export const winHKEY = {
|
||||
HKCU: 'HKEY_CURRENT_USER',
|
||||
HKLM: 'HKEY_LOCAL_MACHINE',
|
||||
HKCR: 'HKEY_CLASSES_ROOT',
|
||||
HKU: 'HKEY_USERS',
|
||||
HKCC: 'HKEY_CURRENT_CONFIG'
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the registry key value.
|
||||
*
|
||||
* @param {winHKEY} hive The registry key
|
||||
* @param {string} path The registry subkey
|
||||
* @param {string} name The registry name
|
||||
* @returns {string|null|undefined} The registry key value or null/undefined.
|
||||
*/
|
||||
export const getStringRegKey = (hive, path, name) => {
|
||||
try {
|
||||
return GetStringRegKey(hive, path, name)
|
||||
} catch (e) {
|
||||
return null
|
||||
}
|
||||
}
|
@ -3,24 +3,12 @@ import fs from 'fs'
|
||||
import path from 'path'
|
||||
import EventEmitter from 'events'
|
||||
import Store from 'electron-store'
|
||||
import { BrowserWindow, ipcMain, systemPreferences } from 'electron'
|
||||
import { BrowserWindow, ipcMain, nativeTheme } from 'electron'
|
||||
import log from 'electron-log'
|
||||
import { isOsx, isWindows } from '../config'
|
||||
import { isWindows } from '../config'
|
||||
import { hasSameKeys } from '../utils'
|
||||
import { getStringRegKey, winHKEY } from '../platform/win32/registry.js'
|
||||
import schema from './schema'
|
||||
|
||||
const isDarkSystemMode = () => {
|
||||
if (isOsx) {
|
||||
return systemPreferences.isDarkMode()
|
||||
} else if (isWindows) {
|
||||
// NOTE: This key is a 32-Bit DWORD but converted to JS string!
|
||||
const buf = getStringRegKey(winHKEY.HKCU, 'Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize', 'AppsUseLightTheme')
|
||||
return buf === '' // zero (0)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const PREFERENCES_FILE_NAME = 'preferences'
|
||||
|
||||
class Preference extends EventEmitter {
|
||||
@ -50,7 +38,9 @@ class Preference extends EventEmitter {
|
||||
let defaultSettings = null
|
||||
try {
|
||||
defaultSettings = fse.readJsonSync(this.staticPath)
|
||||
if (isDarkSystemMode()) {
|
||||
|
||||
// Set best theme on first application start.
|
||||
if (nativeTheme.shouldUseDarkColors) {
|
||||
defaultSettings.theme = 'dark'
|
||||
}
|
||||
} catch (err) {
|
||||
|
@ -247,6 +247,15 @@
|
||||
"description": "Theme--Select the theme used in Mark Text",
|
||||
"type": "string"
|
||||
},
|
||||
"autoSwitchTheme": {
|
||||
"description": "Theme--Automatically adjust application theme according system.",
|
||||
"default": 2,
|
||||
"enum": [
|
||||
0,
|
||||
1,
|
||||
2
|
||||
]
|
||||
},
|
||||
|
||||
"spellcheckerEnabled": {
|
||||
"description": "Spelling--Whether spell checking is enabled.",
|
||||
|
@ -46,8 +46,9 @@ const filesHandler = (files, directory, key) => {
|
||||
|
||||
const rebuild = (directory) => {
|
||||
fs.readdir(directory, (err, files) => {
|
||||
if (err) log.error(err)
|
||||
else {
|
||||
if (err) {
|
||||
log.error('imagePathAutoComplement::rebuild:', err)
|
||||
} else {
|
||||
filesHandler(files, directory)
|
||||
}
|
||||
})
|
||||
|
@ -3,7 +3,7 @@ import { BrowserWindow, ipcMain } from 'electron'
|
||||
import electronLocalshortcut from '@hfelix/electron-localshortcut'
|
||||
import BaseWindow, { WindowLifecycle, WindowType } from './base'
|
||||
import { centerWindowOptions } from './utils'
|
||||
import { TITLE_BAR_HEIGHT, defaultPreferenceWinOptions, isLinux, isOsx } from '../config'
|
||||
import { TITLE_BAR_HEIGHT, preferencesWinOptions, isLinux, isOsx, isWindows } from '../config'
|
||||
|
||||
class SettingWindow extends BaseWindow {
|
||||
/**
|
||||
@ -21,12 +21,18 @@ class SettingWindow extends BaseWindow {
|
||||
*/
|
||||
createWindow (options = {}) {
|
||||
const { menu: appMenu, env, keybindings, preferences } = this._accessor
|
||||
const winOptions = Object.assign({}, defaultPreferenceWinOptions, options)
|
||||
const winOptions = Object.assign({}, preferencesWinOptions, options)
|
||||
centerWindowOptions(winOptions)
|
||||
if (isLinux) {
|
||||
winOptions.icon = path.join(__static, 'logo-96px.png')
|
||||
}
|
||||
|
||||
// WORKAROUND: Electron has issues with different DPI per monitor when
|
||||
// setting a fixed window size.
|
||||
if (isWindows) {
|
||||
winOptions.resizable = true
|
||||
}
|
||||
|
||||
// Enable native or custom/frameless window and titlebar
|
||||
const { titleBarStyle, theme } = preferences.getAll()
|
||||
if (!isOsx) {
|
||||
|
@ -146,6 +146,7 @@ export default {
|
||||
dispatch('LINTEN_FOR_PRINT_SERVICE_CLEARUP')
|
||||
dispatch('LINTEN_FOR_EXPORT_SUCCESS')
|
||||
dispatch('LISTEN_FOR_FILE_CHANGE')
|
||||
dispatch('LISTEN_WINDOW_ZOOM')
|
||||
// module: notification
|
||||
dispatch('LISTEN_FOR_NOTIFICATION')
|
||||
|
||||
|
@ -18,3 +18,14 @@ export const themes = [
|
||||
name: 'one-dark'
|
||||
}
|
||||
]
|
||||
|
||||
export const autoSwitchThemeOptions = [{
|
||||
label: 'Adjust theme at startup', // Always
|
||||
value: 0
|
||||
}, /* {
|
||||
label: 'Only at runtime',
|
||||
value: 1
|
||||
}, */ {
|
||||
label: 'Never',
|
||||
value: 2
|
||||
}]
|
||||
|
@ -4,12 +4,19 @@
|
||||
<section class="offcial-themes">
|
||||
<div v-for="t of themes" :key="t.name" class="theme"
|
||||
:class="[t.name, { 'active': t.name === theme }]"
|
||||
@click="handleSelectTheme(t.name)"
|
||||
@click="onSelectChange('theme', t.name)"
|
||||
>
|
||||
<div v-html="t.html"></div>
|
||||
</div>
|
||||
</section>
|
||||
<separator></separator>
|
||||
<cur-select
|
||||
description="Automatically adjust application theme according system."
|
||||
:value="autoSwitchTheme"
|
||||
:options="autoSwitchThemeOptions"
|
||||
:onChange="value => onSelectChange('autoSwitchTheme', value)"
|
||||
></cur-select>
|
||||
<separator></separator>
|
||||
<section class="import-themes ag-underdevelop">
|
||||
<div>
|
||||
<span>Open the themes folder</span>
|
||||
@ -27,21 +34,25 @@
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import themeMd from './theme.md'
|
||||
import { themes } from './config'
|
||||
import { autoSwitchThemeOptions, themes } from './config'
|
||||
import markdownToHtml from '@/util/markdownToHtml'
|
||||
import CurSelect from '../common/select'
|
||||
import Separator from '../common/separator'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CurSelect,
|
||||
Separator
|
||||
},
|
||||
data () {
|
||||
this.autoSwitchThemeOptions = autoSwitchThemeOptions
|
||||
return {
|
||||
themes: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
autoSwitchTheme: state => state.preferences.autoSwitchTheme,
|
||||
theme: state => state.preferences.theme
|
||||
})
|
||||
},
|
||||
@ -60,11 +71,8 @@ export default {
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
handleSelectTheme (theme) {
|
||||
this.$store.dispatch('SET_SINGLE_PREFERENCE', {
|
||||
type: 'theme',
|
||||
value: theme
|
||||
})
|
||||
onSelectChange (type, value) {
|
||||
this.$store.dispatch('SET_SINGLE_PREFERENCE', { type, value })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -84,7 +92,7 @@ export default {
|
||||
cursor: pointer;
|
||||
width: 250px;
|
||||
height: 100px;
|
||||
margin: 0px 22px 10px 22px;
|
||||
margin: 0px 20px 10px 20px;
|
||||
padding-left: 30px;
|
||||
padding-top: 20px;
|
||||
overflow: hidden;
|
||||
|
@ -44,6 +44,7 @@ const state = {
|
||||
footnote: false,
|
||||
|
||||
theme: 'light',
|
||||
autoSwitchTheme: 2,
|
||||
|
||||
spellcheckerEnabled: false,
|
||||
spellcheckerIsHunspell: false, // macOS only
|
||||
|
@ -41,6 +41,7 @@
|
||||
"footnote": false,
|
||||
|
||||
"theme": "light",
|
||||
"autoSwitchTheme": 2,
|
||||
|
||||
"spellcheckerEnabled": false,
|
||||
"spellcheckerIsHunspell": false,
|
||||
|
115
yarn.lock
115
yarn.lock
@ -852,12 +852,17 @@
|
||||
ajv "^6.1.0"
|
||||
ajv-keywords "^3.1.0"
|
||||
|
||||
"@felixrieseberg/spellchecker@^4.0.10":
|
||||
version "4.0.10"
|
||||
resolved "https://registry.yarnpkg.com/@felixrieseberg/spellchecker/-/spellchecker-4.0.10.tgz#ec4b11bcaa98a45d0f1c768a2f3dfb2b8768ed3f"
|
||||
integrity sha512-b+BlHcBXjx+W7yGNAtoVpAv8dvmAQ8Tp2YhNjqxIgocb6Wq1nKLl4jfu9DG60UWC0hTNvvQ74ny9ojiUFNqGSA==
|
||||
"@electron/get@^1.0.1":
|
||||
version "1.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@electron/get/-/get-1.5.0.tgz#6217d9d18fb71fbd8cd2445a31aa0edc723d19dd"
|
||||
integrity sha512-tafxBz6n08G6SX961F/h8XFtpB/DdwRvJJoDeOH9x78jDSCMQ2G/rRWqSwLFp9oeMFBJf0Pf5Kkw6TKt5w9TWg==
|
||||
dependencies:
|
||||
nan "^2.13.2"
|
||||
debug "^4.1.1"
|
||||
env-paths "^2.2.0"
|
||||
fs-extra "^8.1.0"
|
||||
got "^9.6.0"
|
||||
sanitize-filename "^1.6.2"
|
||||
sumchecker "^3.0.0"
|
||||
|
||||
"@hfelix/electron-localshortcut@^3.1.1":
|
||||
version "3.1.1"
|
||||
@ -869,12 +874,12 @@
|
||||
electron-is-accelerator "^0.1.0"
|
||||
keyboardevents-areequal "^0.2.1"
|
||||
|
||||
"@hfelix/electron-spellchecker@^1.0.0-rc.1":
|
||||
version "1.0.0-rc.1"
|
||||
resolved "https://registry.yarnpkg.com/@hfelix/electron-spellchecker/-/electron-spellchecker-1.0.0-rc.1.tgz#595762825bd77d1dc43cbc38e725e84e5baa989a"
|
||||
integrity sha512-blQCgk2Dw0mep0eQPZzcMG5bYEmf+Zvih48doiGloclgYikxBb8kYR64hKZQycVg+SeXuLeTodL7L2KI5MXn0Q==
|
||||
"@hfelix/electron-spellchecker@^1.0.0-rc.3":
|
||||
version "1.0.0-rc.3"
|
||||
resolved "https://registry.yarnpkg.com/@hfelix/electron-spellchecker/-/electron-spellchecker-1.0.0-rc.3.tgz#6a76eaf16a4c15987cdda00d42bd9896a0590e70"
|
||||
integrity sha512-qG2YxRtoOLycA7vRJENds4POxV7VC8yVmDXi7dIz3czRUZgNJNCQDR5YoRQ9xPXVLWT3oYB/RLwOS3RJRP3AnA==
|
||||
dependencies:
|
||||
"@felixrieseberg/spellchecker" "^4.0.10"
|
||||
"@hfelix/spellchecker" "^4.0.11"
|
||||
bcp47 "^1.1.2"
|
||||
cld "^2.5.1"
|
||||
debug "^4.1.1"
|
||||
@ -888,6 +893,13 @@
|
||||
resolved "https://registry.npmjs.org/@hfelix/keyboardevent-from-electron-accelerator/-/keyboardevent-from-electron-accelerator-1.1.1.tgz#7e1d4fd913759c381b7919cc7faf4c0c641d457c"
|
||||
integrity sha512-1eVkDSqoRQkF2FrPPia2EZ3310c0TvFKYvSuJbaxHpRKbI6eVHcVGKpmOSDli6Qdn3Bu0h7ozfgMZbAEBD+BLQ==
|
||||
|
||||
"@hfelix/spellchecker@^4.0.11":
|
||||
version "4.0.11"
|
||||
resolved "https://registry.yarnpkg.com/@hfelix/spellchecker/-/spellchecker-4.0.11.tgz#bc86881e419c7e12c88ab996a5bbbe78f044385c"
|
||||
integrity sha512-xBVSHB6OPnqD+KBL5cQO0o20/TIezigD0U1a7V+e+5OvAmCnqdWo23IOdZrUDA7bBhNvK2Pml9jF3U7HRo272A==
|
||||
dependencies:
|
||||
nan "^2.13.2"
|
||||
|
||||
"@markedjs/html-differ@^3.0.0":
|
||||
version "3.0.0"
|
||||
resolved "https://registry.npmjs.org/@markedjs/html-differ/-/html-differ-3.0.0.tgz#d7084adc3e9c060fe3f39a7f86f5543bb545d727"
|
||||
@ -1017,10 +1029,10 @@
|
||||
resolved "https://registry.npmjs.org/@types/node/-/node-12.7.5.tgz#e19436e7f8e9b4601005d73673b6dc4784ffcc2f"
|
||||
integrity sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w==
|
||||
|
||||
"@types/node@^10.12.18":
|
||||
version "10.14.22"
|
||||
resolved "https://registry.npmjs.org/@types/node/-/node-10.14.22.tgz#34bcdf6b6cb5fc0db33d24816ad9d3ece22feea4"
|
||||
integrity sha512-9taxKC944BqoTVjE+UT3pQH0nHZlTvITwfsOZqyc+R3sfJuxaTtxWjfn1K2UlxyPcKHf0rnaXcVFrS9F9vf0bw==
|
||||
"@types/node@^12.0.12":
|
||||
version "12.11.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.11.7.tgz#57682a9771a3f7b09c2497f28129a0462966524a"
|
||||
integrity sha512-JNbGaHFCLwgHn/iCckiGSOZ1XYHsKFwREtzPwSGCVld1SGhOlmZw2D4ZI94HQCrBHbADzW9m4LER/8olJTRGHA==
|
||||
|
||||
"@types/q@^1.5.1":
|
||||
version "1.5.2"
|
||||
@ -1892,7 +1904,7 @@ bl@^1.0.0:
|
||||
|
||||
bl@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.npmjs.org/bl/-/bl-3.0.0.tgz#3611ec00579fd18561754360b21e9f784500ff88"
|
||||
resolved "https://registry.yarnpkg.com/bl/-/bl-3.0.0.tgz#3611ec00579fd18561754360b21e9f784500ff88"
|
||||
integrity sha512-EUAyP5UHU5hxF8BPT0LKW8gjYLhq1DQIcneOX/pL/m2Alo+OYDQAJlHq+yseMP50Os2nHXOSic6Ss3vSQeyf4A==
|
||||
dependencies:
|
||||
readable-stream "^3.0.1"
|
||||
@ -3769,7 +3781,7 @@ decompress-response@^3.3.0:
|
||||
|
||||
decompress-response@^4.2.0:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz#414023cc7a302da25ce2ec82d0d5238ccafd8986"
|
||||
resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-4.2.1.tgz#414023cc7a302da25ce2ec82d0d5238ccafd8986"
|
||||
integrity sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==
|
||||
dependencies:
|
||||
mimic-response "^2.0.0"
|
||||
@ -4287,10 +4299,10 @@ electron-builder@^21.2.0:
|
||||
update-notifier "^3.0.1"
|
||||
yargs "^13.3.0"
|
||||
|
||||
electron-chromedriver@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.npmjs.org/electron-chromedriver/-/electron-chromedriver-6.0.0.tgz#a91b940c83f1c42ced52c9ef0605d8721613a8a2"
|
||||
integrity sha512-UIhRl0sN5flfUjqActXsFrZQU1NmBObvlxzPnyeud8vhR67TllXCoqfvhQJmIrJAJJK+5M1DFhJ5iTGT++dvkg==
|
||||
electron-chromedriver@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/electron-chromedriver/-/electron-chromedriver-7.0.0.tgz#204e1bfcdf2dfd56e5a3b8e6f37d19b1433a7937"
|
||||
integrity sha512-7qymT0fn3VTit0peym1iz4Y+fTwq9EPsv1V9Qh+vQdoVqP/4SM9lOHrsBeuFN1JJADZLu7R119ZvMkP6EnLYhw==
|
||||
dependencies:
|
||||
electron-download "^4.1.1"
|
||||
extract-zip "^1.6.7"
|
||||
@ -4305,7 +4317,7 @@ electron-devtools-installer@^2.2.4:
|
||||
rimraf "^2.5.2"
|
||||
semver "^5.3.0"
|
||||
|
||||
electron-download@^4.1.0, electron-download@^4.1.1:
|
||||
electron-download@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.npmjs.org/electron-download/-/electron-download-4.1.1.tgz#02e69556705cc456e520f9e035556ed5a015ebe8"
|
||||
integrity sha512-FjEWG9Jb/ppK/2zToP+U5dds114fM1ZOJqMAR4aXXL5CvyPE9fiqBK/9YcwC9poIFQTEJk/EM/zyRwziziRZrg==
|
||||
@ -4393,13 +4405,13 @@ electron-window-state@^5.0.3:
|
||||
jsonfile "^4.0.0"
|
||||
mkdirp "^0.5.1"
|
||||
|
||||
electron@^6.1.0:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.npmjs.org/electron/-/electron-6.1.0.tgz#f816347cc0b21cb231b829a4ba5133fbfbbbe100"
|
||||
integrity sha512-CGdM6671gA0WUmsQCVO3stqpvm6/x+S+MkKlqgsk2N3GXnIa3KkfR8k4YNp8gnCgLSZQ0yucFQB/DyEYSjrzrA==
|
||||
electron@^7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-7.0.1.tgz#6da2c07aa0513d3d156b5b027f317e0959261d43"
|
||||
integrity sha512-eMFoZIO0+eOAE9FyNC/f0Vp8l/sJziTMK+axEt2XIpGCagom1IZgUKPGwmHUcftZCX5lNKh+Tv53T0GcNnNTKQ==
|
||||
dependencies:
|
||||
"@types/node" "^10.12.18"
|
||||
electron-download "^4.1.0"
|
||||
"@electron/get" "^1.0.1"
|
||||
"@types/node" "^12.0.12"
|
||||
extract-zip "^1.0.3"
|
||||
|
||||
element-resize-detector@^1.2.0:
|
||||
@ -4449,13 +4461,20 @@ encodeurl@~1.0.2:
|
||||
resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
|
||||
integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=
|
||||
|
||||
end-of-stream@^1.0.0, end-of-stream@^1.1.0, end-of-stream@^1.4.1:
|
||||
end-of-stream@^1.0.0, end-of-stream@^1.1.0:
|
||||
version "1.4.1"
|
||||
resolved "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43"
|
||||
integrity sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==
|
||||
dependencies:
|
||||
once "^1.4.0"
|
||||
|
||||
end-of-stream@^1.4.1:
|
||||
version "1.4.4"
|
||||
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
|
||||
integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==
|
||||
dependencies:
|
||||
once "^1.4.0"
|
||||
|
||||
engine.io-client@~3.2.0:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.2.1.tgz#6f54c0475de487158a1a7c77d10178708b6add36"
|
||||
@ -7114,10 +7133,10 @@ keypress@0.1.x:
|
||||
resolved "https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz#4a3188d4291b66b4f65edb99f806aa9ae293592a"
|
||||
integrity sha1-SjGI1CkbZrT2XtuZ+AaqmuKTWSo=
|
||||
|
||||
keytar@^5.0.0-beta.3:
|
||||
version "5.0.0-beta.3"
|
||||
resolved "https://registry.npmjs.org/keytar/-/keytar-5.0.0-beta.3.tgz#326793cd54336152311ba6ee23cba66b35d9c933"
|
||||
integrity sha512-e6zEkaq9AahKi5olNm/cqJAxTD8MNDGEN2Ew2eqTcBSJ+UWDGTp84nWUJ8EyS31vuz+Fcu9tcZzPZB4F94Wqcw==
|
||||
keytar@5.0.0-beta.4:
|
||||
version "5.0.0-beta.4"
|
||||
resolved "https://registry.yarnpkg.com/keytar/-/keytar-5.0.0-beta.4.tgz#273c842780ccfd1fda25b37832e284e8741eec9f"
|
||||
integrity sha512-avv3gNY+y72AYsUCSQn1VdETCgRuTDy1YJ1Pm3kIuIHlfIhaaZzVKrZSRwVLt3omWxQ80aI8I8bHPP1c5zxjqw==
|
||||
dependencies:
|
||||
nan "2.14.0"
|
||||
prebuild-install "5.3.2"
|
||||
@ -7878,7 +7897,7 @@ mimic-response@^1.0.0, mimic-response@^1.0.1:
|
||||
|
||||
mimic-response@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.npmjs.org/mimic-response/-/mimic-response-2.0.0.tgz#996a51c60adf12cb8a87d7fb8ef24c2f3d5ebb46"
|
||||
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.0.0.tgz#996a51c60adf12cb8a87d7fb8ef24c2f3d5ebb46"
|
||||
integrity sha512-8ilDoEapqA4uQ3TwS0jakGONKXVJqpy+RpM+3b7pLdOjghCrEiGp9SRkFbUHAmZW9vdnrENWHjaweIoTIJExSQ==
|
||||
|
||||
mini-css-extract-plugin@^0.8.0:
|
||||
@ -9470,7 +9489,7 @@ posthtml@^0.9.2:
|
||||
|
||||
prebuild-install@5.3.2:
|
||||
version "5.3.2"
|
||||
resolved "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.2.tgz#6392e9541ac0b879ef0f22b3d65037417eb2035e"
|
||||
resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-5.3.2.tgz#6392e9541ac0b879ef0f22b3d65037417eb2035e"
|
||||
integrity sha512-INDfXzTPnhT+WYQemqnAXlP7SvfiFMopMozSgXCZ+RDLb279gKfIuLk4o7PgEawLp3WrMgIYGBpkxpraROHsSA==
|
||||
dependencies:
|
||||
detect-libc "^1.0.3"
|
||||
@ -10526,7 +10545,7 @@ simple-concat@^1.0.0:
|
||||
|
||||
simple-get@^3.0.3:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz#b45be062435e50d159540b576202ceec40b9c6b3"
|
||||
resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.0.tgz#b45be062435e50d159540b576202ceec40b9c6b3"
|
||||
integrity sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==
|
||||
dependencies:
|
||||
decompress-response "^4.2.0"
|
||||
@ -10836,13 +10855,13 @@ spdy@^4.0.1:
|
||||
select-hose "^2.0.0"
|
||||
spdy-transport "^3.0.0"
|
||||
|
||||
spectron@^8.0.0:
|
||||
version "8.0.0"
|
||||
resolved "https://registry.npmjs.org/spectron/-/spectron-8.0.0.tgz#86e83c5dccb174850c052e2e718d5b1158764a52"
|
||||
integrity sha512-MI9+lAamDnw7S0vKaxXjU3g5qaW5KANaFLc+Hgq+QmMCkQbZLt6ukFFGfalmwIuYrmq+yWQPCD4CXgt3VSHrLA==
|
||||
spectron@^9.0.0:
|
||||
version "9.0.0"
|
||||
resolved "https://registry.yarnpkg.com/spectron/-/spectron-9.0.0.tgz#6581780027172095e168353c82ed934212a0c97f"
|
||||
integrity sha512-aMxprQ+5/8hDl27P6FafIuuL8jAueJ7WEc6S6pEEQNU7xGCMcfj0RY6TB1i9BtkazMymIxAkmwqlK233Fbhcgw==
|
||||
dependencies:
|
||||
dev-null "^0.1.1"
|
||||
electron-chromedriver "^6.0.0"
|
||||
electron-chromedriver "^7.0.0"
|
||||
request "^2.87.0"
|
||||
split "^1.0.0"
|
||||
webdriverio "^4.13.0"
|
||||
@ -11107,6 +11126,13 @@ sumchecker@^2.0.2:
|
||||
dependencies:
|
||||
debug "^2.2.0"
|
||||
|
||||
sumchecker@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-3.0.0.tgz#da5457b4605184575c76540e5e99cc777cb8ce4c"
|
||||
integrity sha512-yreseuC/z4iaodVoq07XULEOO9p4jnQazO7mbrnDSvWAU/y2cbyIKs+gWJptfcGu9R+1l27K8Rkj0bfvqnBpgQ==
|
||||
dependencies:
|
||||
debug "^4.1.0"
|
||||
|
||||
supports-color@6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz#76cfe742cf1f41bb9b1c29ad03068c05b4c0e40a"
|
||||
@ -11247,7 +11273,7 @@ tapable@^1.0.0, tapable@^1.1.3:
|
||||
|
||||
tar-fs@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.0.tgz#677700fc0c8b337a78bee3623fdc235f21d7afad"
|
||||
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.0.0.tgz#677700fc0c8b337a78bee3623fdc235f21d7afad"
|
||||
integrity sha512-vaY0obB6Om/fso8a8vakQBzwholQ7v5+uy+tF3Ozvxv1KNezmVQAiWtcNmMHFSFPqL3dJA8ha6gdtFbfX9mcxA==
|
||||
dependencies:
|
||||
chownr "^1.1.1"
|
||||
@ -11270,7 +11296,7 @@ tar-stream@^1.5.0:
|
||||
|
||||
tar-stream@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.0.tgz#d1aaa3661f05b38b5acc9b7020efdca5179a2cc3"
|
||||
resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.1.0.tgz#d1aaa3661f05b38b5acc9b7020efdca5179a2cc3"
|
||||
integrity sha512-+DAn4Nb4+gz6WZigRzKEZl1QuJVOLtAwwF+WUxy1fJ6X63CaGaUAxJRD2KEn1OMfcbCjySTYpNC6WmfQoIEOdw==
|
||||
dependencies:
|
||||
bl "^3.0.0"
|
||||
@ -12419,11 +12445,6 @@ vscode-ripgrep@^1.5.7:
|
||||
resolved "https://registry.npmjs.org/vscode-ripgrep/-/vscode-ripgrep-1.5.7.tgz#acb6b548af488a4bca5d0f1bb5faf761343289ce"
|
||||
integrity sha512-/Vsz/+k8kTvui0q3O74pif9FK0nKopgFTiGNVvxicZANxtSA8J8gUE9GQ/4dpi7D/2yI/YVORszwVskFbz46hQ==
|
||||
|
||||
vscode-windows-registry@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-windows-registry/-/vscode-windows-registry-1.0.2.tgz#b863e704a6a69c50b3098a55fbddbe595b0c124a"
|
||||
integrity sha512-/CLLvuOSM2Vme2z6aNyB+4Omd7hDxpf4Thrt8ImxnXeQtxzel2bClJpFQvQqK/s4oaXlkBKS7LqVLeZM+uSVIA==
|
||||
|
||||
vue-electron@^1.0.6:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.npmjs.org/vue-electron/-/vue-electron-1.0.6.tgz#e798e03180b8933539defe31f92e53b9242b9406"
|
||||
|
Loading…
Reference in New Issue
Block a user