From de71499269c1d2ae3b54ae547427729211ffa5f7 Mon Sep 17 00:00:00 2001 From: jos Date: Sat, 16 Sep 2017 16:17:31 +0200 Subject: [PATCH] Fixed JSONEditor not working without having a schema defined --- .gitignore | 1 + src/js/Node.js | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 46dc97c..363c86a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea +.vscode build downloads node_modules diff --git a/src/js/Node.js b/src/js/Node.js index e3a9d4b..abc9c30 100644 --- a/src/js/Node.js +++ b/src/js/Node.js @@ -1998,7 +1998,9 @@ Node.prototype._updateSchema = function () { //Locating the schema of the node and checking for any enum type if(this.editor && this.editor.options) { // find the part of the json schema matching this nodes path - this.schema = Node._findSchema(this.editor.options.schema, this.getPath()); + this.schema = this.editor.options.schema + ? Node._findSchema(this.editor.options.schema, this.getPath()) + : null; if (this.schema) { this.enum = Node._findEnum(this.schema); } @@ -2301,11 +2303,11 @@ Node.prototype.onEvent = function (event) { break; case 'click': - if (event.ctrlKey || !this.editable.value) { - if (util.isUrl(this.value)) { - window.open(this.value, '_blank'); - } + if (event.ctrlKey || !this.editable.value) { + if (util.isUrl(this.value)) { + window.open(this.value, '_blank'); } + } break; case 'keyup':