diff --git a/CHANGELOG.md b/CHANGELOG.md index b559e830..94e1b174 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/client/app/editor/edit-field.js b/src/client/app/editor/edit-field.js index bf9f0f7c..4f458fd0 100644 --- a/src/client/app/editor/edit-field.js +++ b/src/client/app/editor/edit-field.js @@ -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 }