Skip to content

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

editorJSON - new promise api

Borislav Sapundzhievc87eb0c2e6f8
diff --git a/data/ext/editorJSON/extension.js b/data/ext/editorJSON/extension.js
index 098e4d853..aa8f31264 100644
--- a/data/ext/editorJSON/extension.js
+++ b/data/ext/editorJSON/extension.js
@@ -38,7 +38,13 @@ define(function(require, exports, module) {
change: contentChanged
};
jsonEditor = new JSONEditor(document.getElementById("jsonEditor"), options);
- TSCORE.IO.loadTextFile(filePath);
+ TSCORE.IO.loadTextFilePromise(filePath).then(function(content) {
+ exports.setContent(content);
+ }, function(error) {
+ TSCORE.hideLoadingAnimation();
+ TSCORE.showAlertDialog("Loading " + filePath + " failed.");
+ console.error("Loading file " + filePath + " failed " + error);
+ });
});
};