Skip to content

TagSpaces is an offline, open source, document manager with tagging support

Refactoring

uggrockf6314b928cc0
diff --git a/data/js/core.api.js b/data/js/core.api.js
index e50c8d568..085863329 100644
--- a/data/js/core.api.js
+++ b/data/js/core.api.js
@@ -41,6 +41,8 @@ UIAPI.TagUtils = undefined;
UIAPI.FileOpener = undefined;
+UIAPI.IO = undefined;
+
UIAPI.setCurrentPath = function(path) {
console.debug("Setting current path to: "+path);
UIAPI.currentPath = path;
diff --git a/data/js/fileopener.js b/data/js/fileopener.js
index 2e480980a..6f5cac0c8 100644
--- a/data/js/fileopener.js
+++ b/data/js/fileopener.js
@@ -2,7 +2,7 @@
* Use of this source code is governed by a AGPL3 license that
* can be found in the LICENSE file. */
define(function(require, exports, module) {
-//"use strict";
+"use strict";
console.debug("Loading FileViewer...");
@@ -76,7 +76,7 @@ console.debug("Loading FileViewer...");
return;
} else {
try {
- require([TSSETTINGS.getExtensionPath()+"/"+editorExt+"/"+"extension.js"], function(editr) {
+ require([TSSETTINGS.getExtensionPath()+"/"+editorExt+"/extension.js"], function(editr) {
tsEditor = editr;
tsEditor.init(filePath, "viewer");
});
@@ -90,7 +90,7 @@ console.debug("Loading FileViewer...");
function saveFile(filePath) {
console.debug("Save current file: "+filePath);
var content = tsEditor.getContent();
- IOAPI.saveTextFile(filePath, content);
+ IOAPI.saveTextFile(filePath, content);
}
function constructFileViewerUI(filePath) {
diff --git a/data/js/main.js b/data/js/main.js
index 9d6afe9fe..3505c8103 100644
--- a/data/js/main.js
+++ b/data/js/main.js
@@ -37,19 +37,22 @@ var initApp = function(){
var layoutContainer = undefined;
require([
+ "js/settings.api",
+ "js/core.api",
"js/tagutils",
"js/perspective.manager",
- "js/settings.api",
"js/fileopener",
- "js/core.ui",
"js/tags.ui",
- "js/core.api",
+ "js/core.ui",
"js/directories.ui",
],
- function(tagutils, viewManager, setting, fileOpener) {
+ function(settings, core, tagutils, perspectiveManager, fileOpener) {
+ //var UIAPI = core;
+
UIAPI.TagUtils = tagutils;
- UIAPI.ViewManager = viewManager;
+ UIAPI.ViewManager = perspectiveManager;
UIAPI.FileOpener = fileOpener;
+ UIAPI.IO = IOAPI;
TagsUI.initContextMenus();
TagsUI.initDialogs();
diff --git a/data/js/tagutils.js b/data/js/tagutils.js
index b396aa791..359be0b44 100644
--- a/data/js/tagutils.js
+++ b/data/js/tagutils.js
@@ -8,8 +8,10 @@ define([
'module'
], function (require, exports, module) {
"use strict";
- // var UIAPI = require("js/core.ui.js"),
-
+
+ // var tsCore = require("js/core.api.js"),
+ var tsCore = UIAPI;
+
console.debug("Loading tagutils.js ...");
var BEGIN_TAG_CONTAINER = "[",
@@ -193,7 +195,7 @@ define([
var newFileName = generateFileName(fileName, extractedTags);
- IOAPI.renameFile(filePath, containingDirectoryPath+DIR_SEPARATOR+newFileName);
+ tsCore.IO.renameFile(filePath, containingDirectoryPath+DIR_SEPARATOR+newFileName);
}
function addTag(filePathArray, tagArray) {
@@ -222,7 +224,7 @@ define([
var newFileName = generateFileName(fileName, extractedTags);
- IOAPI.renameFile(filePath, containingDirectoryPath+DIR_SEPARATOR+newFileName);
+ tsCore.IO.renameFile(filePath, containingDirectoryPath+DIR_SEPARATOR+newFileName);
}
@@ -245,7 +247,7 @@ define([
var newFileName = generateFileName(fileName, newTags);
- IOAPI.renameFile(filePath, containingDirectoryPath+DIR_SEPARATOR+newFileName);
+ tsCore.IO.renameFile(filePath, containingDirectoryPath+DIR_SEPARATOR+newFileName);
}
// Public API definition