josdejong / svelte-jsoneditor

A web-based tool to view, edit, format, repair, query, transform, and validate JSON
https://jsoneditoronline.org
Other
818 stars 108 forks source link

Read-only mode #456

Closed ashkov closed 3 days ago

ashkov commented 3 days ago

Hello! Can I get just formatted JSON without possibility to edit it and without menus?

Thank a lot.

ashkov commented 3 days ago
      const editor = new JSONEditor({
        target: document.getElementById('jsoneditor'),
        props: {
          content,
          mainMenuBar: false,
          statusBar:false,
          readOnly:true,
          mode:'text',
        }
      })
josdejong commented 2 days ago

That will indeed show readonly JSON data with code highlighting.

If you just need highlighted code though I think using svelte-jsoneditor is overkill. Using a code highligher like PrismJS or highlight.js will be more lightweight I expect.