From 4fdf90fb38b283887f0b43d548e746342c9be537 Mon Sep 17 00:00:00 2001 From: josdejong Date: Mon, 27 Apr 2020 13:44:43 +0200 Subject: [PATCH] Unescape HTML input text --- src/JSONNode.svelte | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/JSONNode.svelte b/src/JSONNode.svelte index 16c280d..4e587c2 100644 --- a/src/JSONNode.svelte +++ b/src/JSONNode.svelte @@ -3,9 +3,10 @@ import { faCaretDown, faCaretRight } from '@fortawesome/free-solid-svg-icons' import { SEARCH_PROPERTY, SEARCH_VALUE } from './search' import classnames from 'classnames' - import { isUrl, valueType } from './utils/typeUtils' + import { isUrl, stringConvert, valueType } from './utils/typeUtils' import { escapeHTML } from './utils/stringUtils.js' import { createUpdateProps } from './utils/updateProps.js' + import { unescapeHTML } from './utils/stringUtils' export let key = undefined export let value @@ -53,13 +54,14 @@ } function handleKeyInput (event) { - const newKey = event.target.innerText + const newKey = unescapeHTML(event.target.innerText) onChangeKey(newKey, key) } function handleValueInput (event) { - const value = event.target.innerText - onChangeValue(value, key) + const valueText = unescapeHTML(event.target.innerText) + const newValue = stringConvert(valueText) // TODO: implement support for type "string" + onChangeValue(newValue, key) } function handleChangeKey (newChildKey, oldChildKey) {