forked from josdejong/jsoneditor
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue josdejong#473. Enum works properly now
- Loading branch information
1 parent
698102c
commit 6b396e7
Showing
4 changed files
with
378 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>JSONEditor | template + enums</title> | ||
|
||
<link href="../dist/jsoneditor.css" rel="stylesheet" type="text/css"> | ||
<script src="../dist/jsoneditor.js"></script> | ||
|
||
<style type="text/css"> | ||
#jsoneditor { | ||
width: 500px; | ||
height: 700px; | ||
background: white; | ||
} | ||
|
||
p { | ||
width: 500px; | ||
font-family: sans; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div id="jsoneditor"></div> | ||
|
||
<script> | ||
var schema = { | ||
"title": "Example Schema", | ||
"type": "object", | ||
"properties": { | ||
"firstName": { | ||
"type": "string", | ||
"enum": ["a", "b"] | ||
}, | ||
"testObj": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string", | ||
"enum": ["a", "b"] | ||
}, | ||
} | ||
}, | ||
"required": ["firstName"] | ||
}; | ||
|
||
|
||
var json = | ||
{ | ||
firstName: 'a', | ||
testObj: {}, | ||
}; | ||
|
||
var options = { | ||
schema: schema | ||
}; | ||
|
||
// create the editor | ||
var container = document.getElementById('jsoneditor'); | ||
var editor = new JSONEditor(container, options, json); | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.