svelte-jsoneditor
svelte-jsoneditor copied to clipboard
fix: when resetting `mode` to the default value (`undefined`), the mode switches successfully, but the corresponding menu item is not selected
Hello Jos, I've found a small issue and I'm sending a PR for your review.
Minimal reproduction for the small issue:
<!doctype html>
<html lang="en">
<body>
<div id="jsoneditor"></div>
<button onclick="resetMode()">reset mode</button>
<script type="module">
import { JSONEditor } from 'https://cdn.jsdelivr.net/npm/vanilla-jsoneditor/standalone.js'
const editor = new JSONEditor({
target: document.getElementById('jsoneditor'),
props: {
content: {
text: '',
},
mode: 'text',
},
})
window.resetMode = () => {
editor.updateProps({
mode: undefined,
})
}
</script>
</body>
</html>