Fixed property names not being escaped when rendering

This commit is contained in:
jos 2016-08-26 12:25:51 +02:00
parent 7280239771
commit 9350debba2
1 changed files with 5 additions and 1 deletions

View File

@ -175,12 +175,14 @@ export default class JSONNode extends Component {
}, prop) }, prop)
} }
else { // object property else { // object property
const escapedProp = escapeHTML(prop)
return h('div', { return h('div', {
class: 'jsoneditor-property' + (prop.length === 0 ? ' jsoneditor-empty' : ''), class: 'jsoneditor-property' + (prop.length === 0 ? ' jsoneditor-empty' : ''),
contentEditable: 'true', contentEditable: 'true',
spellCheck: 'false', spellCheck: 'false',
onBlur: this.handleChangeProperty onBlur: this.handleChangeProperty
}, prop) }, escapedProp)
} }
} }
else { else {
@ -520,12 +522,14 @@ export default class JSONNode extends Component {
const parentPath = this.props.parent.getPath() const parentPath = this.props.parent.getPath()
const oldProp = this.props.prop const oldProp = this.props.prop
const newProp = unescapeHTML(getInnerText(event.target)) const newProp = unescapeHTML(getInnerText(event.target))
console.log('newProp', newProp)
this.props.events.onChangeProperty(parentPath, oldProp, newProp) this.props.events.onChangeProperty(parentPath, oldProp, newProp)
} }
handleChangeValue (event) { handleChangeValue (event) {
const value = this._getValueFromEvent(event) const value = this._getValueFromEvent(event)
console.log('value', value)
this.props.events.onChangeValue(this.getPath(), value) this.props.events.onChangeValue(this.getPath(), value)
} }