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 b65d7ecb0f
commit 18d1735c01
2 changed files with 6 additions and 0 deletions

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
}