Skip to content

Commit a221796

Browse files
committed
Add export format pdf,markdown,text
1 parent 866274b commit a221796

File tree

15 files changed

+380
-12
lines changed

15 files changed

+380
-12
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
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.14
10+
version+=0.0.15
1111

1212
all: appstore
1313

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
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.14</version>
8+
<version>0.0.15</version>
99
<licence>agpl</licence>
1010
<author mail="[email protected]" homepage="https://actom.me">Jingtao Yan</author>
1111
<namespace>Files_MindMap</namespace>

js/viewer.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ redirectIfNotDisplayedInFrame();
6969
$('#export-svg').click(function(){
7070
self.exportSVG();
7171
});
72+
$('#export-pdf').click(function(){
73+
self.exportPDF();
74+
});
75+
$('#export-markdown').click(function(){
76+
self.exportMarkdown();
77+
});
78+
$('#export-text').click(function(){
79+
self.exportText();
80+
});
7281
},
7382
startSaveTimer: function() {
7483
var self = this;
@@ -183,6 +192,38 @@ redirectIfNotDisplayedInFrame();
183192
}, function (data){
184193
console.error('export svg fail', data);
185194
});
195+
},
196+
197+
exportMarkdown: function () {
198+
var self = this;
199+
minder.exportData('markdown').then(function (data) {
200+
var url = 'data:text/markdown;base64,' + Base64.encode(data);
201+
self.download(url, 'export.md');
202+
}, function (data){
203+
console.error('export markdown fail', data);
204+
});
205+
},
206+
207+
exportText: function () {
208+
var self = this;
209+
minder.exportData('text').then(function (data) {
210+
var url = 'data:text/plain;base64,' + Base64.encode(data);
211+
self.download(url, 'export.txt');
212+
}, function (data){
213+
console.error('export text fail', data);
214+
});
215+
},
216+
217+
exportPDF: function () {
218+
var self = this;
219+
minder.exportData('png').then(function (data) {
220+
var pdf = new jsPDF('p', 'mm', 'a4', false);
221+
//pdf.addImage(data, 'png', 100, 200, 280, 210, undefined, 'none');
222+
pdf.addImage(data, 'PNG', 5, 10, 200, 0, undefined, 'SLOW');
223+
self.download(pdf.output('datauristring'), 'export.pdf');
224+
}, function (data){
225+
console.error('export png fail', data);
226+
});
186227
}
187228
};
188229

l10n/de.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ OC.L10N.register(
1717
"The file is locked.":"The file is locked.",
1818
"Share not found":"Share not found",
1919
"You are not authorized to open this share":"You are not authorized to open this share",
20-
"Could not write to file.":"Could not write to file."
20+
"Could not write to file.":"Could not write to file.",
21+
"Export to Markdown":"Export to Markdown",
22+
"Export to Text":"Export to Text",
23+
"Export to PDF":"Export to PDF"
2124
},"nplurals=1; plural=0;"
2225
);

l10n/de.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"The file is locked.":"The file is locked.",
1717
"Share not found":"Share not found",
1818
"You are not authorized to open this share":"You are not authorized to open this share",
19-
"Could not write to file.":"Could not write to file."
19+
"Could not write to file.":"Could not write to file.",
20+
"Export to Markdown":"Export to Markdown",
21+
"Export to Text":"Export to Text",
22+
"Export to PDF":"Export to PDF"
2023
},"pluralForm" :"nplurals=1; plural=0;"
2124
}

l10n/fr.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ OC.L10N.register(
1717
"The file is locked.":"The file is locked.",
1818
"Share not found":"Share not found",
1919
"You are not authorized to open this share":"You are not authorized to open this share",
20-
"Could not write to file.":"Could not write to file."
20+
"Could not write to file.":"Could not write to file.",
21+
"Export to Markdown":"Export to Markdown",
22+
"Export to Text":"Export to Text",
23+
"Export to PDF":"Export to PDF"
2124
},"nplurals=1; plural=0;"
2225
);

l10n/fr.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"The file is locked.":"The file is locked.",
1717
"Share not found":"Share not found",
1818
"You are not authorized to open this share":"You are not authorized to open this share",
19-
"Could not write to file.":"Could not write to file."
19+
"Could not write to file.":"Could not write to file.",
20+
"Export to Markdown":"Export to Markdown",
21+
"Export to Text":"Export to Text",
22+
"Export to PDF":"Export to PDF"
2023
},"nplurals=1; plural=0;"
2124
}

l10n/ru.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ OC.L10N.register(
1717
"The file is locked.":"The file is locked.",
1818
"Share not found":"Share not found",
1919
"You are not authorized to open this share":"You are not authorized to open this share",
20-
"Could not write to file.":"Could not write to file."
20+
"Could not write to file.":"Could not write to file.",
21+
"Export to Markdown":"Export to Markdown",
22+
"Export to Text":"Export to Text",
23+
"Export to PDF":"Export to PDF"
2124
},"nplurals=1; plural=0;"
2225
);

l10n/ru.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"The file is locked.":"The file is locked.",
1717
"Share not found":"Share not found",
1818
"You are not authorized to open this share":"You are not authorized to open this share",
19-
"Could not write to file.":"Could not write to file."
19+
"Could not write to file.":"Could not write to file.",
20+
"Export to Markdown":"Export to Markdown",
21+
"Export to Text":"Export to Text",
22+
"Export to PDF":"Export to PDF"
2023
},"pluralForm" :"nplurals=1; plural=0;"
2124
}

l10n/sk.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ OC.L10N.register(
1717
"The file is locked.":"The file is locked.",
1818
"Share not found":"Share not found",
1919
"You are not authorized to open this share":"You are not authorized to open this share",
20-
"Could not write to file.":"Could not write to file."
20+
"Could not write to file.":"Could not write to file.",
21+
"Export to Markdown":"Export to Markdown",
22+
"Export to Text":"Export to Text",
23+
"Export to PDF":"Export to PDF"
2124
},"nplurals=1; plural=0;"
2225
);

0 commit comments

Comments
 (0)