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

+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.14
10+
version+=0.0.15
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.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

+41
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

+4-1
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

+4-1
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

+4-1
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

+4-1
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

+4-1
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

+4-1
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

+4-1
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/sk.json

+4-1
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/zh_CN.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ OC.L10N.register(
1717
"The file is locked.":"文件被锁定",
1818
"Share not found":"共享未找到",
1919
"You are not authorized to open this share":"您没有权限打开这个共享",
20-
"Could not write to file.":"无法写入文件。"
20+
"Could not write to file.":"无法写入文件。",
21+
"Export to Markdown":"导出为Markdown文本",
22+
"Export to Text":"导出为Text文本",
23+
"Export to PDF":"导出为PDF文件"
2124
},"nplurals=1; plural=0;"
2225
);

l10n/zh_CN.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"The file is locked.":"文件被锁定",
1717
"Share not found":"共享未找到",
1818
"You are not authorized to open this share":"您没有权限打开这个共享",
19-
"Could not write to file.":"无法写入文件。"
19+
"Could not write to file.":"无法写入文件。",
20+
"Export to Markdown":"导出为Markdown文本",
21+
"Export to Text":"导出为Text文本",
22+
"Export to PDF":"导出为PDF文件"
2023
},"pluralForm" :"nplurals=1; plural=0;"
2124
}

templates/viewer.php

+11
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ class="btn btn-default export-caption dropdown-toggle"
127127
<li>
128128
<a id="export-svg" href"><?php p($l->t('Export to SVG')); ?></a>
129129
</li>
130+
<li>
131+
<a id="export-pdf" href"><?php p($l->t('Export to PDF')); ?></a>
132+
</li>
133+
<li>
134+
<a id="export-markdown" href"><?php p($l->t('Export to Markdown')); ?></a>
135+
</li>
136+
<li>
137+
<a id="export-text" href"><?php p($l->t('Export to Text')); ?></a>
138+
</li>
130139
</ul>
131140
</div>
132141
<kityminder-editor id="viewer" on-init="initEditor(editor, minder)"></kityminder-editor>
@@ -155,5 +164,7 @@ class="btn btn-default export-caption dropdown-toggle"
155164
<script nonce="<?=$nonce?>" src="<?php p($urlGenerator->linkTo('files_mindmap', 'vendor/kityminder-editor/kityminder.editor.min.js')) ?>?v=<?php p($version) ?>"></script>
156165

157166
<script nonce="<?=$nonce?>" src="<?php p($urlGenerator->linkTo('files_mindmap', 'js/viewer.js')) ?>?v=<?php p($version) ?>"></script>
167+
<script nonce="<?=$nonce?>" src="<?php p($urlGenerator->linkTo('files_mindmap', 'vendor/jsPDF/dist/jspdf.min.js')) ?>?v=<?php p($version) ?>"></script>
168+
<script nonce="<?=$nonce?>" src="<?php p($urlGenerator->linkTo('files_mindmap', 'vendor/svg2pdf.js/dist/svg2pdf.min.js')) ?>?v=<?php p($version) ?>"></script>
158169
</html>
159170

vendor/jsPDF/dist/jspdf.min.js

+286
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)