editor: don't eat backslashes in enquoted strings (#515)

This commit is contained in:
jean-emmanuel 2019-04-19 05:59:50 +02:00
parent 61bdaa0ae8
commit 8de0318612
2 changed files with 6 additions and 0 deletions

View file

@ -5,6 +5,7 @@
- bug fixes
- bottom horizontal scrollbar not responding on small screens
- remote file browser: hitting a letter to select a file based on its name was looping on the first two matches only
- editor: preserve backslashes in enquoted strings (not in objects/arrays)
- widgets
- `logScale` can be set to a number to use a logarithm base different from the default
- knob: `compact` mode is back

View file

@ -103,6 +103,11 @@ module.exports = function editField(editor, widget, propName, defaultValue){
try {
v = JSON.parseFlex(input.value)
if (typeof v === 'string') {
// escape backslashes in simple strings only
v = JSON.parseFlex(input.value.replace(/\\/g, '__BACKSLASH__'))
v = v.replace(/__BACKSLASH__/g, '\\')
}
} catch(err) {
v = input.value
}