From 68c89f4e33aa0b09e7e9cd18f9e82210912a2021 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 6 Dec 2017 15:35:17 +0100 Subject: [PATCH] lazy format to JSON --- src/app/files/basicReadOnlyExplorer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/files/basicReadOnlyExplorer.js b/src/app/files/basicReadOnlyExplorer.js index f210c5ca63..f6f7d09bb6 100644 --- a/src/app/files/basicReadOnlyExplorer.js +++ b/src/app/files/basicReadOnlyExplorer.js @@ -36,6 +36,9 @@ class BasicReadOnlyExplorer { } addReadOnly (path, content) { + try { // lazy try to format JSON + content = JSON.stringify(JSON.parse(content), null, '\t') + } catch (e) {} this.files[this.type + '/' + path] = content this.event.trigger('fileAdded', [this.type + '/' + path, true]) return true