Skip to content

Commit

Permalink
Fix #21 and #38
Browse files Browse the repository at this point in the history
  • Loading branch information
ACTom committed Apr 7, 2019
1 parent 8ad96fc commit e8620e6
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 128 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source_dir=$(build_dir)/source
sign_dir=$(build_dir)/sign
package_name=$(app_name)
cert_dir=$(CURDIR)/../../key
version+=0.0.10
version+=0.0.12

all: appstore

Expand Down
11 changes: 8 additions & 3 deletions appinfo/app.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
<?php

namespace OCA\Files_MindMap\AppInfo;

use OC\Security\CSP\ContentSecurityPolicy;

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

if (\OC::$server->getUserSession()->isLoggedIn()) {
$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function() {
OCP\Util::addStyle('files_mindmap', 'style');
OCP\Util::addScript('files_mindmap', 'mindmap');
\OCP\Util::addStyle('files_mindmap', 'style');
\OCP\Util::addScript('files_mindmap', 'mindmap');
});
}

$cspManager = \OC::$server->getContentSecurityPolicyManager();
$csp = new ContentSecurityPolicy();
$csp->addAllowedChildSrcDomain("'self'");
$csp->addAllowedFrameDomain("data:");
$cspManager->addDefaultPolicy($csp);
$cspManager->addDefaultPolicy($csp);

$app = new Application();
$app->registerProvider();
14 changes: 3 additions & 11 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,19 @@
<name>Mind Map</name>
<summary>A Mind map editor</summary>
<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>
<version>0.0.10</version>
<version>0.0.12</version>
<licence>agpl</licence>
<author mail="[email protected]" homepage="https://actom.me">Jingtao Yan</author>
<namespace>Files_MindMap</namespace>
<category>files</category>
<category>office</category>
<bugs>https://github.com/ACTom/files_mindmap/issues</bugs>
<repository type="git">https://github.com/ACTom/files_mindmap.git</repository>
<website>https://github.com/ACTom/files_mindmap</website>
<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>
<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>
<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>
<dependencies>
<php min-version="5.6"/>
<nextcloud min-version="14" max-version="15"/>
<nextcloud min-version="14" max-version="16"/>
</dependencies>
<repair-steps>
<install>
<step>OCA\Files_MindMap\Migration\InstallStep</step>
</install>
<uninstall>
<step>OCA\Files_MindMap\Migration\UninstallStep</step>
</uninstall>
</repair-steps>
</info>
7 changes: 6 additions & 1 deletion js/mindmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ var FilesMindMap = {

// replace the controls with our own
$('#app-content #controls').removeClass('hidden');

this._fileList.addAndFetchFileInfo(this._file.dir + '/' + this._file.name, '');
},

/**
Expand Down Expand Up @@ -53,6 +55,9 @@ var FilesMindMap = {

$('#mmframe').load(function(){
var iframe = $('#mmframe').contents();

OC.Apps.hideAppSidebar();

iframe.save = function() {
alert('save');
};
Expand Down Expand Up @@ -187,7 +192,7 @@ FilesMindMap.NewFileMenuPlugin = {
displayName: t('files_mindmap', 'New mind map file'),
templateName: t('files_mindmap', 'New mind map.km'),
iconClass: 'icon-link',
fileType: 'mindmap',
fileType: 'application/km',
actionHandler: function(name) {
var dir = fileList.getCurrentDirectory();
fileList.createFile(name).then(function() {
Expand Down
5 changes: 5 additions & 0 deletions js/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ redirectIfNotDisplayedInFrame();
}
},
loadData: function() {
var self = this;
window.parent.OCA.FilesMindMap.load(function(data){
var obj = {"root":
{"data":
Expand All @@ -134,6 +135,10 @@ redirectIfNotDisplayedInFrame();
}
}
minder.importJson(obj);
if (data === ' ') {
self._changed = true;
self.save();
}
self._loadStatus = true;
self._changed = false;
}, function(msg){
Expand Down
25 changes: 25 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace OCA\Files_MindMap\AppInfo;

use OC\Files\Type\Detection;
use OCP\AppFramework\App;

class Application extends App {
const APPNAME = 'files_mindmap';

public function __construct(array $urlParams = array()) {
parent::__construct(self::APPNAME, $urlParams);
}


public function registerProvider() {
$container = $this->getContainer();

// Register mimetypes
/** @var Detection $detector */
$detector = $container->query(\OCP\Files\IMimeTypeDetector::class);
$detector->getAllMappings();
$detector->registerType('km','application/km');
}
}
55 changes: 0 additions & 55 deletions lib/Migration/InstallStep.php

This file was deleted.

55 changes: 0 additions & 55 deletions lib/Migration/UninstallStep.php

This file was deleted.

4 changes: 2 additions & 2 deletions vendor/kityminder-editor/kityminder.editor.min.js

Large diffs are not rendered by default.

0 comments on commit e8620e6

Please sign in to comment.