Skip to content

Commit 1d38179

Browse files
committed
Fixed the problem that cannot be opened after creating a new file(#94)
1 parent f906989 commit 1d38179

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ source_dir=$(build_dir)/source
77
sign_dir=$(build_dir)/sign
88
package_name=$(app_name)
99
cert_dir=$(CURDIR)/../../key
10-
version+=0.0.19
10+
version+=0.0.20
1111

1212
all: appstore
1313

appinfo/info.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<name>Mind Map</name>
66
<summary>A Mind map editor</summary>
77
<description><![CDATA[This application enables Nextcloud users to open, save and edit mind map files in the web browser. If enabled, an entry in the New button at the top of the web browser the Mindmap file entry appears. When clicked, a new mindmap file opens in the browser and the file can be saved into the current Nextcloud directory.]]></description>
8-
<version>0.0.19</version>
8+
<version>0.0.20</version>
99
<licence>agpl</licence>
1010
<author mail="[email protected]" homepage="https://actom.me">Jingtao Yan</author>
1111
<namespace>Files_MindMap</namespace>

js/mindmap.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ var FilesMindMap = {
216216
}
217217

218218
plugin.decode(data.filecontents).then(function(kmdata){
219-
data.filecontents = JSON.stringify(kmdata);
219+
data.filecontents = typeof kmdata === 'object' ? JSON.stringify(kmdata) : kmdata;
220220
data.supportedWrite = true;
221221
if (plugin.encode === null) {
222222
data.writeable = false;
@@ -318,7 +318,11 @@ FilesMindMap.Extensions.KM = {
318318
},
319319
decode: function(data) {
320320
return new Promise(function(resolve, reject) {
321-
resolve(JSON.parse(data));
321+
try {
322+
resolve(JSON.parse(data));
323+
} catch (e) {
324+
resolve(data);
325+
}
322326
});
323327
}
324328
};

0 commit comments

Comments
 (0)