svelte-jsoneditor icon indicating copy to clipboard operation
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

Open cloydlau opened this issue 10 months ago • 17 comments

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>

cloydlau avatar Apr 14 '24 10:04 cloydlau