Skip to content

Commit e8620e6

Browse files
committed
Fix #21 and #38
1 parent 8ad96fc commit e8620e6

File tree

9 files changed

+50
-128
lines changed

9 files changed

+50
-128
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.10
10+
version+=0.0.12
1111

1212
all: appstore
1313

appinfo/app.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
<?php
22

3+
namespace OCA\Files_MindMap\AppInfo;
4+
35
use OC\Security\CSP\ContentSecurityPolicy;
46

57
$eventDispatcher = \OC::$server->getEventDispatcher();
68

79
if (\OC::$server->getUserSession()->isLoggedIn()) {
810
$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function() {
9-
OCP\Util::addStyle('files_mindmap', 'style');
10-
OCP\Util::addScript('files_mindmap', 'mindmap');
11+
\OCP\Util::addStyle('files_mindmap', 'style');
12+
\OCP\Util::addScript('files_mindmap', 'mindmap');
1113
});
1214
}
1315

1416
$cspManager = \OC::$server->getContentSecurityPolicyManager();
1517
$csp = new ContentSecurityPolicy();
1618
$csp->addAllowedChildSrcDomain("'self'");
1719
$csp->addAllowedFrameDomain("data:");
18-
$cspManager->addDefaultPolicy($csp);
20+
$cspManager->addDefaultPolicy($csp);
21+
22+
$app = new Application();
23+
$app->registerProvider();

appinfo/info.xml

+3-11
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,19 @@
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.10</version>
8+
<version>0.0.12</version>
99
<licence>agpl</licence>
1010
<author mail="[email protected]" homepage="https://actom.me">Jingtao Yan</author>
1111
<namespace>Files_MindMap</namespace>
1212
<category>files</category>
1313
<category>office</category>
1414
<bugs>https://github.com/ACTom/files_mindmap/issues</bugs>
1515
<repository type="git">https://github.com/ACTom/files_mindmap.git</repository>
16+
<website>https://github.com/ACTom/files_mindmap</website>
1617
<screenshot small-thumbnail="https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/1-small.png">https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/1.png</screenshot>
1718
<screenshot small-thumbnail="https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/2-small.png">https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/2.png</screenshot>
1819
<screenshot small-thumbnail="https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/3-small.png">https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/3.png</screenshot>
1920
<dependencies>
20-
<php min-version="5.6"/>
21-
<nextcloud min-version="14" max-version="15"/>
21+
<nextcloud min-version="14" max-version="16"/>
2222
</dependencies>
23-
<repair-steps>
24-
<install>
25-
<step>OCA\Files_MindMap\Migration\InstallStep</step>
26-
</install>
27-
<uninstall>
28-
<step>OCA\Files_MindMap\Migration\UninstallStep</step>
29-
</uninstall>
30-
</repair-steps>
3123
</info>

js/mindmap.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ var FilesMindMap = {
1818

1919
// replace the controls with our own
2020
$('#app-content #controls').removeClass('hidden');
21+
22+
this._fileList.addAndFetchFileInfo(this._file.dir + '/' + this._file.name, '');
2123
},
2224

2325
/**
@@ -53,6 +55,9 @@ var FilesMindMap = {
5355

5456
$('#mmframe').load(function(){
5557
var iframe = $('#mmframe').contents();
58+
59+
OC.Apps.hideAppSidebar();
60+
5661
iframe.save = function() {
5762
alert('save');
5863
};
@@ -187,7 +192,7 @@ FilesMindMap.NewFileMenuPlugin = {
187192
displayName: t('files_mindmap', 'New mind map file'),
188193
templateName: t('files_mindmap', 'New mind map.km'),
189194
iconClass: 'icon-link',
190-
fileType: 'mindmap',
195+
fileType: 'application/km',
191196
actionHandler: function(name) {
192197
var dir = fileList.getCurrentDirectory();
193198
fileList.createFile(name).then(function() {

js/viewer.js

+5
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ redirectIfNotDisplayedInFrame();
111111
}
112112
},
113113
loadData: function() {
114+
var self = this;
114115
window.parent.OCA.FilesMindMap.load(function(data){
115116
var obj = {"root":
116117
{"data":
@@ -134,6 +135,10 @@ redirectIfNotDisplayedInFrame();
134135
}
135136
}
136137
minder.importJson(obj);
138+
if (data === ' ') {
139+
self._changed = true;
140+
self.save();
141+
}
137142
self._loadStatus = true;
138143
self._changed = false;
139144
}, function(msg){

lib/AppInfo/Application.php

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace OCA\Files_MindMap\AppInfo;
4+
5+
use OC\Files\Type\Detection;
6+
use OCP\AppFramework\App;
7+
8+
class Application extends App {
9+
const APPNAME = 'files_mindmap';
10+
11+
public function __construct(array $urlParams = array()) {
12+
parent::__construct(self::APPNAME, $urlParams);
13+
}
14+
15+
16+
public function registerProvider() {
17+
$container = $this->getContainer();
18+
19+
// Register mimetypes
20+
/** @var Detection $detector */
21+
$detector = $container->query(\OCP\Files\IMimeTypeDetector::class);
22+
$detector->getAllMappings();
23+
$detector->registerType('km','application/km');
24+
}
25+
}

lib/Migration/InstallStep.php

-55
This file was deleted.

lib/Migration/UninstallStep.php

-55
This file was deleted.

vendor/kityminder-editor/kityminder.editor.min.js

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

0 commit comments

Comments
 (0)