mirror of
https://github.com/marktext/marktext.git
synced 2025-05-01 15:20:18 +08:00
Upgrade Electron to v17 (#3138)
This commit is contained in:
parent
c841facdfa
commit
51f5f4c70c
22
.eslintrc.js
22
.eslintrc.js
@ -2,7 +2,7 @@ module.exports = {
|
||||
root: true,
|
||||
parserOptions: {
|
||||
parser: '@babel/eslint-parser',
|
||||
ecmaVersion: 8,
|
||||
ecmaVersion: 11,
|
||||
ecmaFeatures: {
|
||||
impliedStrict: true
|
||||
},
|
||||
@ -25,29 +25,23 @@ module.exports = {
|
||||
},
|
||||
plugins: ['html', 'vue'],
|
||||
rules: {
|
||||
// Two spaces but disallow semicolons
|
||||
indent: ['error', 2, { 'SwitchCase': 1, 'ignoreComments': true }],
|
||||
semi: [2, 'never'],
|
||||
'no-return-await': 'error',
|
||||
'no-return-assign': 'error',
|
||||
'no-new': 'error',
|
||||
// allow paren-less arrow functions
|
||||
'arrow-parens': 'off',
|
||||
// allow async-await
|
||||
'generator-star-spacing': 'off',
|
||||
// allow console
|
||||
'no-console': 'off',
|
||||
// allow debugger during development
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||
'no-return-assign': 'warn',
|
||||
'no-new': 'warn',
|
||||
// disallow semicolons
|
||||
semi: [2, 'never'],
|
||||
'require-atomic-updates': 'off',
|
||||
// TODO: fix these errors someday
|
||||
'prefer-const': 'off',
|
||||
'no-new': 'off',
|
||||
'no-mixed-operators': 'off',
|
||||
'no-prototype-builtins': 'off',
|
||||
'no-return-await': 'off',
|
||||
'accessor-pairs': 'off',
|
||||
// Workaround #2422.
|
||||
'template-curly-spacing': 'off',
|
||||
indent: 'off'
|
||||
'no-prototype-builtins': 'off'
|
||||
},
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
|
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
@ -33,7 +33,7 @@ jobs:
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
node-version: 16
|
||||
check-latest: true
|
||||
cache: yarn
|
||||
cache-dependency-path: yarn.lock
|
||||
@ -50,21 +50,21 @@ jobs:
|
||||
id: cacheNodeModules
|
||||
with:
|
||||
path: ${{ github.workspace }}/node_modules
|
||||
key: ${{ runner.os }}-node_modules-cache-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node_modules-cache-
|
||||
${{ runner.os }}-node_modules-cache-v1-
|
||||
|
||||
- name: Cache Electron
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.HOME }}/.cache/electron
|
||||
key: ${{ runner.os }}-electron-cache-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||
key: ${{ runner.os }}-electron-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||
|
||||
- name: Cache Electron-Builder
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.HOME }}/.cache//electron-builder
|
||||
key: ${{ runner.os }}-electron-builder-cache-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||
key: ${{ runner.os }}-electron-builder-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||
|
||||
- name: Install dependencies
|
||||
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
|
||||
@ -100,7 +100,7 @@ jobs:
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
node-version: 16
|
||||
check-latest: true
|
||||
cache: yarn
|
||||
cache-dependency-path: yarn.lock
|
||||
@ -118,21 +118,21 @@ jobs:
|
||||
id: cacheNodeModules
|
||||
with:
|
||||
path: ${{ github.workspace }}\node_modules
|
||||
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node_modules-cache-v1-
|
||||
${{ runner.os }}-node_modules-cache-v2-
|
||||
|
||||
- name: Cache Electron
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.LOCALAPPDATA }}\electron\Cache
|
||||
key: ${{ runner.os }}-electron-cache-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||
key: ${{ runner.os }}-electron-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||
|
||||
- name: Cache Electron-Builder
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.LOCALAPPDATA }}\electron-builder\cache
|
||||
key: ${{ runner.os }}-electron-builder-cache-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||
key: ${{ runner.os }}-electron-builder-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||
|
||||
- name: Install dependencies
|
||||
# Windows worker fail sometimes because a module cannot be found.
|
||||
|
20
.github/workflows/release.yml
vendored
20
.github/workflows/release.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
node-version: 16
|
||||
check-latest: true
|
||||
cache: yarn
|
||||
cache-dependency-path: yarn.lock
|
||||
@ -44,21 +44,21 @@ jobs:
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ github.workspace }}/node_modules
|
||||
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node_modules-cache-v1-
|
||||
${{ runner.os }}-node_modules-cache-v2-
|
||||
|
||||
- name: Cache Electron
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.HOME }}/.cache/electron
|
||||
key: ${{ runner.os }}-electron-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||
key: ${{ runner.os }}-electron-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||
|
||||
- name: Cache Electron-Builder
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.HOME }}/.cache//electron-builder
|
||||
key: ${{ runner.os }}-electron-builder-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||
key: ${{ runner.os }}-electron-builder-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --check-files --frozen-lockfile
|
||||
@ -123,7 +123,7 @@ jobs:
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
node-version: 16
|
||||
check-latest: true
|
||||
cache: yarn
|
||||
cache-dependency-path: yarn.lock
|
||||
@ -140,21 +140,21 @@ jobs:
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ github.workspace }}\node_modules
|
||||
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node_modules-cache-v1-
|
||||
${{ runner.os }}-node_modules-cache-v2-
|
||||
|
||||
- name: Cache Electron
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.LOCALAPPDATA }}\electron\Cache
|
||||
key: ${{ runner.os }}-electron-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||
key: ${{ runner.os }}-electron-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||
|
||||
- name: Cache Electron-Builder
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.LOCALAPPDATA }}\electron-builder\cache
|
||||
key: ${{ runner.os }}-electron-builder-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||
key: ${{ runner.os }}-electron-builder-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --check-files --frozen-lockfile
|
||||
|
52
package.json
52
package.json
@ -34,18 +34,18 @@
|
||||
"deobfuscateStackTrace": "node tools/deobfuscateStackTrace.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron/remote": "^2.0.4",
|
||||
"@electron/remote": "^2.0.8",
|
||||
"@hfelix/electron-localshortcut": "^4.0.1",
|
||||
"@hfelix/electron-spellchecker": "^2.0.0",
|
||||
"@marktext/file-icons": "^1.0.6",
|
||||
"@octokit/rest": "^18.12.0",
|
||||
"arg": "^5.0.1",
|
||||
"axios": "^0.26.0",
|
||||
"axios": "^0.26.1",
|
||||
"ced": "^2.0.0",
|
||||
"chokidar": "^3.5.3",
|
||||
"codemirror": "^5.65.1",
|
||||
"codemirror": "^5.65.2",
|
||||
"command-exists": "^1.2.9",
|
||||
"dayjs": "^1.10.7",
|
||||
"dayjs": "^1.11.0",
|
||||
"dom-autoscroller": "^2.3.4",
|
||||
"dompurify": "^2.3.6",
|
||||
"dragula": "^3.7.3",
|
||||
@ -64,11 +64,11 @@
|
||||
"iconv-lite": "^0.6.3",
|
||||
"iso-639-1": "^2.1.13",
|
||||
"joplin-turndown-plugin-gfm": "^1.0.12",
|
||||
"katex": "^0.15.2",
|
||||
"katex": "^0.15.3",
|
||||
"keytar": "^7.9.0",
|
||||
"mermaid": "^8.14.0",
|
||||
"minizlib": "^2.1.2",
|
||||
"native-keymap": "^3.2.1",
|
||||
"native-keymap": "^3.3.0",
|
||||
"plist": "^3.0.4",
|
||||
"popper.js": "^1.16.1",
|
||||
"prismjs": "^1.27.0",
|
||||
@ -78,7 +78,7 @@
|
||||
"turndown": "^7.1.1",
|
||||
"underscore": "^1.13.2",
|
||||
"unsplash-js": "^7.0.15",
|
||||
"vega": "^5.21.0",
|
||||
"vega": "^5.22.0",
|
||||
"vega-embed": "^6.20.8",
|
||||
"vega-lite": "^5.2.0",
|
||||
"vscode-ripgrep": "^1.12.1",
|
||||
@ -89,7 +89,7 @@
|
||||
"webfontloader": "^1.6.28"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.17.5",
|
||||
"@babel/core": "^7.17.7",
|
||||
"@babel/eslint-parser": "^7.17.0",
|
||||
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
||||
"@babel/plugin-proposal-export-default-from": "^7.16.7",
|
||||
@ -98,10 +98,10 @@
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-transform-runtime": "^7.17.0",
|
||||
"@babel/preset-env": "^7.16.11",
|
||||
"@babel/register": "^7.17.0",
|
||||
"@babel/runtime": "^7.17.2",
|
||||
"@markedjs/html-differ": "^4.0.0",
|
||||
"@playwright/test": "^1.19.1",
|
||||
"@babel/register": "^7.17.7",
|
||||
"@babel/runtime": "^7.17.7",
|
||||
"@markedjs/html-differ": "^4.0.1",
|
||||
"@playwright/test": "^1.20.0",
|
||||
"babel-loader": "^8.2.3",
|
||||
"babel-plugin-component": "^1.1.1",
|
||||
"babel-plugin-istanbul": "^6.1.1",
|
||||
@ -111,16 +111,16 @@
|
||||
"cheerio": "^1.0.0-rc.10",
|
||||
"copy-webpack-plugin": "^10.2.4",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^6.6.0",
|
||||
"css-loader": "^6.7.1",
|
||||
"del": "^6.0.0",
|
||||
"devtron": "^1.4.0",
|
||||
"dotenv": "^10.0.0",
|
||||
"electron": "^15.4.0",
|
||||
"dotenv": "^16.0.0",
|
||||
"electron": "^17.1.2",
|
||||
"electron-builder": "^22.14.13",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"electron-rebuild": "^3.2.7",
|
||||
"electron-updater": "^4.6.5",
|
||||
"eslint": "^8.9.0",
|
||||
"eslint": "^8.11.0",
|
||||
"eslint-config-standard": "^16.0.3",
|
||||
"eslint-friendly-formatter": "^4.0.1",
|
||||
"eslint-import-resolver-alias": "^1.1.2",
|
||||
@ -129,14 +129,14 @@
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^6.0.0",
|
||||
"eslint-plugin-standard": "^4.1.0",
|
||||
"eslint-plugin-vue": "^8.4.1",
|
||||
"eslint-plugin-vue": "^8.5.0",
|
||||
"eslint-webpack-plugin": "^3.1.1",
|
||||
"esm": "^3.2.25",
|
||||
"file-loader": "^6.2.0",
|
||||
"git-revision-webpack-plugin": "^5.0.0",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"imports-loader": "^0.8.0",
|
||||
"karma": "^6.3.16",
|
||||
"karma": "^6.3.17",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-coverage": "^2.2.0",
|
||||
"karma-electron": "^7.1.0",
|
||||
@ -147,15 +147,15 @@
|
||||
"license-checker": "^25.0.1",
|
||||
"listr": "^0.14.3",
|
||||
"marked": "^1.2.9",
|
||||
"mini-css-extract-plugin": "^2.5.3",
|
||||
"mocha": "^8.4.0",
|
||||
"node-fetch": "^2.6.6",
|
||||
"mini-css-extract-plugin": "^2.6.0",
|
||||
"mocha": "^9.2.2",
|
||||
"node-fetch": "^2.6.7",
|
||||
"node-loader": "^2.0.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"playwright": "^1.19.1",
|
||||
"postcss": "^8.4.6",
|
||||
"playwright": "^1.20.0",
|
||||
"postcss": "^8.4.12",
|
||||
"postcss-loader": "^6.2.1",
|
||||
"postcss-preset-env": "^7.4.1",
|
||||
"postcss-preset-env": "^7.4.2",
|
||||
"raw-loader": "^4.0.2",
|
||||
"require-dir": "^1.2.0",
|
||||
"stacktrace-parser": "^0.1.10",
|
||||
@ -169,7 +169,7 @@
|
||||
"vue-loader": "^15.9.8",
|
||||
"vue-style-loader": "^4.1.3",
|
||||
"vue-template-compiler": "^2.6.14",
|
||||
"webpack": "^5.69.1",
|
||||
"webpack": "^5.70.0",
|
||||
"webpack-bundle-analyzer": "^4.5.0",
|
||||
"webpack-cli": "^4.9.2",
|
||||
"webpack-dev-server": "^4.7.4",
|
||||
@ -178,7 +178,7 @@
|
||||
},
|
||||
"resolutions": {
|
||||
"cld": "^2.7.1",
|
||||
"node-abi": "^3.5.0"
|
||||
"node-abi": "^3.8.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -579,7 +579,7 @@ class App {
|
||||
|
||||
ipcMain.handle('mt::keybinding-save-user-keybindings', async (event, userKeybindings) => {
|
||||
const { keybindings } = this._accessor
|
||||
return await keybindings.setUserKeybindings(userKeybindings)
|
||||
return keybindings.setUserKeybindings(userKeybindings)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -11,21 +11,21 @@ export default function htmlRuby (h, cursor, block, token, outerClass) {
|
||||
const previewSelector = `span.${CLASS_OR_ID.AG_RUBY_RENDER}`
|
||||
|
||||
return children
|
||||
? [
|
||||
h(`span.${className}.${CLASS_OR_ID.AG_RUBY}`, [
|
||||
h(`span.${CLASS_OR_ID.AG_INLINE_RULE}.${CLASS_OR_ID.AG_RUBY_TEXT}`, content),
|
||||
h(previewSelector, {
|
||||
attrs: {
|
||||
contenteditable: 'false',
|
||||
spellcheck: 'false'
|
||||
}
|
||||
}, vNode)
|
||||
])
|
||||
? [
|
||||
h(`span.${className}.${CLASS_OR_ID.AG_RUBY}`, [
|
||||
h(`span.${CLASS_OR_ID.AG_INLINE_RULE}.${CLASS_OR_ID.AG_RUBY_TEXT}`, content),
|
||||
h(previewSelector, {
|
||||
attrs: {
|
||||
contenteditable: 'false',
|
||||
spellcheck: 'false'
|
||||
}
|
||||
}, vNode)
|
||||
])
|
||||
// if children is empty string, no need to render ruby charactors...
|
||||
]
|
||||
: [
|
||||
h(`span.${className}.${CLASS_OR_ID.AG_RUBY}`, [
|
||||
h(`span.${CLASS_OR_ID.AG_INLINE_RULE}.${CLASS_OR_ID.AG_RUBY_TEXT}`, content)
|
||||
])
|
||||
]
|
||||
]
|
||||
: [
|
||||
h(`span.${className}.${CLASS_OR_ID.AG_RUBY}`, [
|
||||
h(`span.${CLASS_OR_ID.AG_INLINE_RULE}.${CLASS_OR_ID.AG_RUBY_TEXT}`, content)
|
||||
])
|
||||
]
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class QuickOpenCommand {
|
||||
}
|
||||
|
||||
await timeout
|
||||
return await this._doSearch(query)
|
||||
return this._doSearch(query)
|
||||
}
|
||||
|
||||
run = async () => {
|
||||
|
@ -64,7 +64,7 @@ export default {
|
||||
SourceCode,
|
||||
TabNotifications
|
||||
},
|
||||
computed: {
|
||||
computed: {
|
||||
...mapState({
|
||||
showSideBar: state => state.layout.showSideBar,
|
||||
sideBarWidth: state => state.layout.sideBarWidth
|
||||
|
@ -260,6 +260,7 @@ export default {
|
||||
if (isRegexp) {
|
||||
// Handle invalid regexp.
|
||||
try {
|
||||
// eslint-disable-next-line no-new
|
||||
new RegExp(searchValue)
|
||||
this.searchErrorMsg = ''
|
||||
} catch (err) {
|
||||
|
@ -49,5 +49,5 @@ export const downloadHunspellDictionary = async lang => {
|
||||
* @param {string} lang The language to remove.
|
||||
*/
|
||||
export const deleteHunspellDictionary = async lang => {
|
||||
return await fs.remove(path.join(getDictionaryPath(), `${lang}.bdic`))
|
||||
return fs.remove(path.join(getDictionaryPath(), `${lang}.bdic`))
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ export class SpellChecker {
|
||||
* @param {string} word The word to add.
|
||||
*/
|
||||
async addToDictionary (word) {
|
||||
return await this.provider.addToDictionary(word)
|
||||
return this.provider.addToDictionary(word)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -276,7 +276,7 @@ export class SpellChecker {
|
||||
* @param {string} word The word to remove.
|
||||
*/
|
||||
async removeFromDictionary (word) {
|
||||
return await this.provider.removeFromDictionary(word)
|
||||
return this.provider.removeFromDictionary(word)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -430,7 +430,7 @@ export class SpellChecker {
|
||||
if (!this.isMisspelled(word)) {
|
||||
return []
|
||||
}
|
||||
return await this.provider.getCorrectionsForMisspelling(word)
|
||||
return this.provider.getCorrectionsForMisspelling(word)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -500,7 +500,7 @@ export class SpellChecker {
|
||||
async _switchLanguage (lang) {
|
||||
const result = await this.provider.switchLanguage(lang)
|
||||
if (!result) {
|
||||
return await this._tryRecover()
|
||||
return this._tryRecover()
|
||||
}
|
||||
return this.lang
|
||||
}
|
||||
|
@ -11,18 +11,18 @@ import { isWindows } from './index'
|
||||
|
||||
export const create = async (pathname, type) => {
|
||||
return type === 'directory'
|
||||
? await fs.ensureDir(pathname)
|
||||
: await fs.outputFile(pathname, '')
|
||||
? fs.ensureDir(pathname)
|
||||
: fs.outputFile(pathname, '')
|
||||
}
|
||||
|
||||
export const paste = async ({ src, dest, type }) => {
|
||||
return type === 'cut'
|
||||
? await fs.move(src, dest)
|
||||
: await fs.copy(src, dest)
|
||||
? fs.move(src, dest)
|
||||
: fs.copy(src, dest)
|
||||
}
|
||||
|
||||
export const rename = async (src, dest) => {
|
||||
return await fs.move(src, dest)
|
||||
return fs.move(src, dest)
|
||||
}
|
||||
|
||||
export const getHash = (content, encoding, type) => {
|
||||
|
Loading…
Reference in New Issue
Block a user