Create expand/collapse all buttons

This commit is contained in:
josdejong 2020-06-02 21:53:36 +02:00
parent 61d91c2f9c
commit 637aa62762
1 changed files with 12 additions and 0 deletions

View File

@ -45,6 +45,10 @@
<button id="patchJson">patch json</button>
<input id="loadFile" type="file">
</p>
<p>
<button id="expandAll">expand all</button>
<button id="collapseAll">collapse all</button>
</p>
<script type="module">
import jsoneditor from './dist/es/jsoneditor.js'
@ -153,6 +157,14 @@
}
reader.readAsText(file)
}
document.getElementById('expandAll').onclick = function expandAll () {
testEditor.expandAll()
}
document.getElementById('collapseAll').onclick = function collapseAll () {
testEditor.collapseAll()
}
</script>
</body>
</html>