From 0839ed253a5c75aff0c695531f5869e7d5299f2c Mon Sep 17 00:00:00 2001 From: Andre Kampert Date: Tue, 19 Aug 2014 08:22:36 +0200 Subject: [PATCH] Use the format uri from the JSON Schema spec with an upload option for binary upload --- examples/upload.html | 7 +++++-- src/defaults.js | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/upload.html b/examples/upload.html index fadf479f4..65493c982 100644 --- a/examples/upload.html +++ b/examples/upload.html @@ -43,9 +43,12 @@

JSON Editor Upload Example

type: "object", title: "Image", properties: { - href: { + uri: { type: "string", - format: "uploadUri" + format: "uri", + options: { + upload: true + } }, name: { type: "string" diff --git a/src/defaults.js b/src/defaults.js index 23971ab8c..26fe08766 100644 --- a/src/defaults.js +++ b/src/defaults.js @@ -205,8 +205,7 @@ JSONEditor.defaults.resolvers.unshift(function(schema) { }); // Editor for uploading files JSONEditor.defaults.resolvers.unshift(function(schema) { - // If the schema can be of any type - if(schema.type === "string" && schema.format === "uploadUri") { + if(schema.type === "string" && schema.format === "uri" && schema.options && schema.options.upload === true) { return "upload"; } });