From 982448e7074933bd71d68894f304cb97463d5da5 Mon Sep 17 00:00:00 2001 From: Jack Date: Fri, 31 Aug 2018 11:18:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E4=BA=9B=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AF=BC=E5=87=BA=E7=9B=B8=E5=85=B3=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/History.md | 7 +++++++ package.json | 10 +++++----- src/js/common.js | 19 +++++++++++++------ version.js | 2 +- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/doc/History.md b/doc/History.md index b8e08a6..ba42778 100644 --- a/doc/History.md +++ b/doc/History.md @@ -4,6 +4,13 @@ ## 更新记录 +### 1.0.3 / 2018-8-31 + +- 修复 导出文件不出现在`最近的文件`中 +- 修复 另存为时默认采用`根节点的文字`为文件名称 +- 修复 新建文件弹出的提示从`覆盖当前文件`改为`关闭当前文件` +- 新增 导出默认采用`根节点的文字`为文件名称 + ### 1.0.2 / 2018-8-30 - 新增 图片双击放大 diff --git a/package.json b/package.json index ac04fb6..e16685d 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "name": "desktopnaotu", - "version": "1.0.2", + "version": "1.0.3", "description": "桌面版脑图", "main": "main.js", "scripts": { "start": "gulp default && electron main.js", - "packwin32": "electron-packager ./ DesktopNaotu --platform=win32 --arch=ia32 --out=../OutApp --icon=favicon.ico --electron-version=2.0.2 --app-version=1.0.2 --ignore=\"(.git|node_modules|screenshot|doc|src|bower_components|electron-packager)\" --overwrite --prune", - "packwin64": "electron-packager ./ DesktopNaotu --platform=win32 --arch=x64 --out=../OutApp --icon=favicon.ico --electron-version=2.0.2 --app-version=1.0.2 --ignore=\"(.git|node_modules|screenshot|doc|src|bower_components|electron-packager)\" --overwrite --prune", - "packosx": "electron-packager ./ DesktopNaotu --platform=darwin --arch=x64 --out=../OutApp --icon=favicon.icns --electron-version=2.0.2 --app-version=1.0.2 --ignore=\"(.git|node_modules|screenshot|doc|src|bower_components|electron-packager)\" --overwrite --prune", - "packlinux": "electron-packager ./ DesktopNaotu --platform=linux --arch=x64 --out=../OutApp --icon=favicon.png --electron-version=2.0.2 --app-version=1.0.2 --ignore=\"(.git|node_modules|screenshot|doc|src|bower_components|electron-packager)\" --overwrite --prune" + "packwin32": "electron-packager ./ DesktopNaotu --platform=win32 --arch=ia32 --out=../OutApp --icon=favicon.ico --electron-version=2.0.2 --app-version=1.0.3 --ignore=\"(.git|node_modules|screenshot|doc|src|bower_components|electron-packager)\" --overwrite --prune", + "packwin64": "electron-packager ./ DesktopNaotu --platform=win32 --arch=x64 --out=../OutApp --icon=favicon.ico --electron-version=2.0.2 --app-version=1.0.3 --ignore=\"(.git|node_modules|screenshot|doc|src|bower_components|electron-packager)\" --overwrite --prune", + "packosx": "electron-packager ./ DesktopNaotu --platform=darwin --arch=x64 --out=../OutApp --icon=favicon.icns --electron-version=2.0.2 --app-version=1.0.3 --ignore=\"(.git|node_modules|screenshot|doc|src|bower_components|electron-packager)\" --overwrite --prune", + "packlinux": "electron-packager ./ DesktopNaotu --platform=linux --arch=x64 --out=../OutApp --icon=favicon.png --electron-version=2.0.2 --app-version=1.0.3 --ignore=\"(.git|node_modules|screenshot|doc|src|bower_components|electron-packager)\" --overwrite --prune" }, "repository": { "type": "git", diff --git a/src/js/common.js b/src/js/common.js index 87c495d..91d73ad 100644 --- a/src/js/common.js +++ b/src/js/common.js @@ -27,7 +27,7 @@ function readFile(fileName) { saveRecords(defaultPath); } -function writeFile(fileName, content) { +function writeFile(fileName, content, isExport) { if (!fileName) return; fs.writeFile(fileName, content, function (err) { @@ -38,13 +38,15 @@ function writeFile(fileName, content) { } }); - saveRecords(fileName); + if(!isExport){ + saveRecords(fileName); + } } function newDialog() { if (hasData()) { bootbox.confirm({ - message: '新建文件会覆盖当前文件,是否继续?', + message: '新建文件会关闭当前文件,是否继续?', callback: function (result) { if (result) { initRoot(); @@ -104,10 +106,12 @@ function saveDialog() { } function saveAsDialog() { + var newPath = path.join(getUserDataDir(), '/' + minder.getRoot().data.text + '.km'); + dialog.showSaveDialog( { title: "保存 KityMinder 文件", - defaultPath: defaultPath, + defaultPath: newPath, filters: [{ name: 'KityMinder', extensions: ['km'] }] }, (fileName) => { @@ -123,6 +127,8 @@ function saveAsDialog() { } function exportDialog() { + var newPath = path.join(getUserDataDir(), '/' + minder.getRoot().data.text); + var filters = []; var pool = kityminder.data.getRegisterProtocol(); for (var name in pool) { @@ -134,6 +140,7 @@ function exportDialog() { dialog.showSaveDialog( { title: "导出 KityMinder 文件", + defaultPath: newPath, filters: filters }, (fileName) => { @@ -295,13 +302,13 @@ function exportFile(protocol, filename) { minder.exportData(protocol.name, options).then(function (data) { switch (protocol.dataType) { case 'text': - writeFile(filename, data); + writeFile(filename, data, true); break; case 'base64': var base64Data = data.replace(/^data:image\/\w+;base64,/, ""); var dataBuffer = new Buffer(base64Data, 'base64'); - writeFile(filename, dataBuffer); + writeFile(filename, dataBuffer, true); break; case 'blob': break; diff --git a/version.js b/version.js index bfe8f31..3b81bc4 100644 --- a/version.js +++ b/version.js @@ -1 +1 @@ -exports.version = [1, 0, 2, 326]; \ No newline at end of file +exports.version = [1, 0, 3, 331]; \ No newline at end of file