Commit a0e92aba authored by Boris Kocherov's avatar Boris Kocherov

demo/with_monaco: use local schema7

parent 7e79da6c
......@@ -59,27 +59,26 @@ importScripts('https://unpkg.com/monaco-editor@0.14.3/min/vs/base/worker/workerM
let modelUri = monaco.Uri.parse("tmp://xxx.json"); // a made up unique URI for our model
let model = monaco.editor.createModel("{\n}", "json", modelUri);
const getSchema = relativeUrl => {
const schemaUrl = new URL(relativeUrl, baseUrl);
const getSchema = (schemaUrl, mappedUrl)=> {
return fetch(schemaUrl)
.then(resp => {
return resp.json();
})
.then(s => {
return {
uri: relativeUrl,
uri: mappedUrl || schemaUrl,
schema: s,
schema_url: schemaUrl.toString()
schema_url: mappedUrl || schemaUrl
};
});
};
Promise.all([
getSchema(mainSchema).then(s => {
getSchema(baseUrl + mainSchema).then(s => {
s.fileMatch = [modelUri.toString()]; // this is the main schema associated to the model
return s;
}),
getSchema("http://json-schema.org/draft-07/schema")
getSchema("../../json-schema/schema7.json", "http://json-schema.org/draft-07/schema")
]).then(schemas => {
gadget.getDeclaredGadget("rjs_json_form").then(g => {
return g.render({
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment