TagSpaces is an offline, open source, document manager with tagging support
adding readonly mode and on change event handler
Ilian711ef8ce7744
diff --git a/data/ext/editorJSON/extension.js b/data/ext/editorJSON/extension.jsindex 020bd883f..2fa7666b2 100644--- a/data/ext/editorJSON/extension.js+++ b/data/ext/editorJSON/extension.js@@ -22,7 +22,7 @@ define(function(require, exports, module) {var currentContent;var currentFilePath;- exports.init = function(filePath, containerElementID) {+ exports.init = function(filePath, containerElementID, isViewer) {console.log("Initalization JSON Editor...");currentFilePath = filePath;require([@@ -31,18 +31,25 @@ define(function(require, exports, module) {'css!'+extensionDirectory+'/extension.css'], function(JSONEditor) {$("#"+containerElementID).append('<div id="jsonEditor"></div>');- jsonEditor = new JSONEditor(document.getElementById("jsonEditor"));+ var options = {mode: isViewer?'view':'tree', change: contentChanged};+ jsonEditor = new JSONEditor(document.getElementById("jsonEditor"), options);TSCORE.IO.loadTextFile(filePath);});};+ function contentChanged() {+ TSCORE.FileOpener.setFileChanged(true);+ }+exports.setFileType = function(fileType) {console.log("setFileType not supported on this extension");};exports.viewerMode = function(isViewerMode) {if(isViewerMode) {- //jsonEditor.s+ jsonEditor.setMode('view');+ } else {+ jsonEditor.setMode('tree');}};