From a121aa348ad8bc7bbaea572be0c630e3b5183d98 Mon Sep 17 00:00:00 2001 From: tanknee Date: Sat, 28 Nov 2020 11:16:51 +0800 Subject: [PATCH] =?UTF-8?q?202001128=201.=20=E4=BF=AE=E5=A4=8D=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=8D=E4=B8=AD=E5=B8=A6=E6=9C=89=E9=9D=9E=E6=B3=95?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E6=97=A0=E6=B3=95=E5=AF=BC=E5=87=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E5=BD=93=E5=89=8D=E7=9A=84=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E6=98=AF=E5=BD=93=E5=87=BA=E7=8E=B0=E9=9D=9E=E6=B3=95?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=EF=BC=9A'/'=E4=B9=8B=E6=B5=81=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E8=87=AA=E5=8A=A8=E5=8E=BB=E6=8E=89=EF=BC=8C=E6=88=91?= =?UTF-8?q?=E8=BF=99=E9=87=8C=E4=BD=BF=E7=94=A8=E4=BA=86`sanitize-filename?= =?UTF-8?q?`=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 7 ++----- package.json | 3 ++- src-electron/main-process/Api.js | 3 +++ src-electron/main-process/electron-main.js | 1 - src/i18n/zh-cn/components/Header.js | 2 +- src/i18n/zh-cn/components/ui/NoteItem.js | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index c5c5c1c..74edbb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "neeto.vue.electron", - "version": "0.0.17", + "version": "0.0.18", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -12886,7 +12886,6 @@ "version": "1.6.3", "resolved": "https://registry.npm.taobao.org/sanitize-filename/download/sanitize-filename-1.6.3.tgz", "integrity": "sha1-dV69dSBFkxl34wsgJdNA18kJA3g=", - "dev": true, "requires": { "truncate-utf8-bytes": "^1.0.0" } @@ -14600,7 +14599,6 @@ "version": "1.0.2", "resolved": "https://registry.npm.taobao.org/truncate-utf8-bytes/download/truncate-utf8-bytes-1.0.2.tgz", "integrity": "sha1-QFkjkJWS1W94pYGENLC3hInKXys=", - "dev": true, "requires": { "utf8-byte-length": "^1.0.1" } @@ -15081,8 +15079,7 @@ "utf8-byte-length": { "version": "1.0.4", "resolved": "https://registry.npm.taobao.org/utf8-byte-length/download/utf8-byte-length-1.0.4.tgz", - "integrity": "sha1-9F8VDExm7uloGGUFq5P8u4rWv2E=", - "dev": true + "integrity": "sha1-9F8VDExm7uloGGUFq5P8u4rWv2E=" }, "util": { "version": "0.11.1", diff --git a/package.json b/package.json index 4e27fc2..f9f1b22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "neeto.vue.electron", - "version": "0.0.18", + "version": "0.0.19", "description": "An Awesome WizNote Desktop Application", "productName": "Neeto-Vue", "author": "tanknee ", @@ -34,6 +34,7 @@ "lodash": "^4.17.20", "node-schedule": "^1.3.2", "quasar": "^1.0.0", + "sanitize-filename": "^1.6.3", "turndown": "^6.0.0", "vditor": "^3.6.6", "vue-i18n": "^8.0.0" diff --git a/src-electron/main-process/Api.js b/src-electron/main-process/Api.js index 7623fa1..9759b60 100644 --- a/src-electron/main-process/Api.js +++ b/src-electron/main-process/Api.js @@ -2,6 +2,8 @@ // import i18n from 'boot/i18n' const { ipcMain, app, dialog } = require('electron') +const sanitize = require('sanitize-filename') + const fs = require('fs-extra') /** @@ -62,6 +64,7 @@ export default { }).then((result) => { if (result.canceled) return const promises = contents.map(({ content, title }) => { + title = sanitize(title) return fs.writeFile(`${result.filePaths[0]}/${title}.md`, content).catch(err => throw err) }) Promise.all(promises).catch(err => throw err) diff --git a/src-electron/main-process/electron-main.js b/src-electron/main-process/electron-main.js index c9fb06b..48cc910 100644 --- a/src-electron/main-process/electron-main.js +++ b/src-electron/main-process/electron-main.js @@ -91,7 +91,6 @@ function createWindow () { event.preventDefault() shell.openExternal(linkUrl) }) - console.log('Begin register handler') registerApiHandler() if (isMac) { enforceMacOSAppLocation() diff --git a/src/i18n/zh-cn/components/Header.js b/src/i18n/zh-cn/components/Header.js index 27e5e71..8c8794e 100644 --- a/src/i18n/zh-cn/components/Header.js +++ b/src/i18n/zh-cn/components/Header.js @@ -5,7 +5,7 @@ export default { search: '搜索', settings: '设置', logout: '登出', - logoutHint: '你确定要立刻注销登录吗?', + logoutHint: '确定要立刻注销登录吗?', cancel: '取消', switchView: '切换界面视图', changed: '已修改' diff --git a/src/i18n/zh-cn/components/ui/NoteItem.js b/src/i18n/zh-cn/components/ui/NoteItem.js index 04b56ec..e9c9838 100644 --- a/src/i18n/zh-cn/components/ui/NoteItem.js +++ b/src/i18n/zh-cn/components/ui/NoteItem.js @@ -1,5 +1,5 @@ export default { modifiedAt: '修改于 {date}', discardNote: '丢弃当前笔记的修改', - discardNoteHint: '你是否要丢弃对当前笔记对修改并切换笔记?' + discardNoteHint: '是否丢弃对当前笔记的修改并切换笔记?' }