editor: parse inputs with JSON5 instead of JSON, it's more flexible and will avoid many typing errors
This commit is contained in:
parent
7d477da4e9
commit
141641bd29
4 changed files with 8 additions and 1 deletions
|
|
@ -8,6 +8,8 @@
|
|||
- messages received almost simultaneously are now bundled before being sent to the clients. This helps preserving their order.
|
||||
- widgets
|
||||
- sliders/pads: when receiving feedback while touched, the widget waits to be released before updating to the latest received value.
|
||||
- editor
|
||||
- property fields are now parsed using [JSON5](https://github.com/json5/json5), a more flexible notation. Session files are still using the standard JSON format, this is just a way to avoid typing mistakes when using the editor.
|
||||
|
||||
## 0.20.3
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
"exorcist": "1.0.0",
|
||||
"file-saver": "^1.3.3",
|
||||
"jquery": "3.2.1",
|
||||
"json5": "^0.5.1",
|
||||
"kiwi.js": "1.0.1",
|
||||
"licensify": "3.1.3",
|
||||
"mathjs": "3.16.4",
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ By default, widget resizing / dragging snaps to a 10 pixel wide grid. Its width
|
|||
|
||||
Selected widget's properties are displayed and can be modified in the sidepanel. The [widgets reference](widgets/widgets) section lists the available properties for each widget type. Property fields are all multiline (press `shit + enter` for new line).
|
||||
|
||||
Properties are written in JSON, with some flexibility brought by the [JSON5](https://github.com/json5/json5) format. For example, doubles quotes around object keys are not mandatory. All input will be converted to standard JSON.
|
||||
|
||||
|
||||
## Widget resizing / dragging
|
||||
|
||||
Selected widget can be resized using its south, south-east and east handles. It can be dragged with its north-west handle.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var updateDom = require('./data-workers').updateDom,
|
||||
{widgets, categories} = require('../widgets'),
|
||||
{icon} = require('../utils'),
|
||||
JSON5 = require('json5'),
|
||||
defaults = {}
|
||||
|
||||
for (var k in widgets) {
|
||||
|
|
@ -101,7 +102,7 @@ var editObject = function(container, data, refresh){
|
|||
v
|
||||
|
||||
try {
|
||||
v = JSON.parse(input.val())
|
||||
v = JSON5.parse(input.val())
|
||||
} catch(err) {
|
||||
v = input.val()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue