Socket
Socket
Sign inDemoInstall

react-json-editor-ajrm

Package Overview
Dependencies
14
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-json-editor-ajrm

A stylish, editor-like, modular, react component for viewing, editing, and debugging javascript object syntax!


Version published
Maintainers
1
Install size
127 kB
Created

Readme

Source

react-json-editor-ajrm



A stylish, editor-like, modular, react component for viewing, editing, and debugging javascript object syntax!

Installing Dependency

  • Using node package manager:
   $ npm i --save react-json-editor-ajrm

How to Use

    import JSONInput from 'react-json-editor-ajrm';

    <JSONInput
        placeholder = { sampleObject }
        colors      = { darktheme }
        height      = '550px'
    />

Live Demo ? Test it right away!

  1. Clone or fork this Github repository
  2. Go to react-json-editor-ajrm/example/:
    $ cd path/to/repo/react-json-editor-ajrm/example
  1. Install example project dependencies:
    $ npm i
  1. Serve sample website to port 8080:
   $ npm start
  1. Open http://localhost:8080 in the web browser

Latest Release Notes [v2.3.0] - May 22, 2018

  1. Component now rerenders on every keystroke by default, but can be opt-out. Delay can also be customized.
  2. Cursor now gets positioned on the same place it was originally located after the content has been rerendered.
  3. Other code optimizations.

Features

  1. Write as if you are in a text editor.
  2. Checks for syntax mistakes and provides feedback.
  3. You can customize color palette as you please.
  4. Accepts a javascript object in props.placeholder to display after component mounts.
  5. For any valid textContent, calculates and makes available in this.state as plain text, markup text, and javascript object.

Component Properties

NameDescriptionTypeRequired
idA unique id to identify component.stringMandatory
placeholderSend a valid javascript object to be shown once when component is mountedobjectOptional
viewOnlySend true if you would like for content shown not to be editable.booleanOptional
onChangeWhenever onBlur event takes place it will return content valuesobjectOptional
confirmGoodSend false if you would like for the checkmark to confirm good syntax to be hiddenbooleanOptional
heightA shorthand property to set a specific height for the entire componentstringOptional
widthA shorthand property to set a specific width for the entire componentstringOptional
onKeyPressUpdateSend false if you would like for component not to automatically update on key pressbooleanOptional
waitAfterKeyPressAmount of milliseconds to wait before re-rendering content after keypress. Value defaults to 1000 when not specified. In other words, component will update if there is no additional keystroke after the last one within 1 second. Less than 100 milliseconds does not makes a difference.numberOptional
colorsContains the following properties:objectOptional
colors.defaultHex color code for any symbols, like curly braces, and comma.stringOptional
colors.stringHex color code for tokens identified as string values.stringOptional
colors.numberHex color code for tokens identified as integeter, double, or float values.stringOptional
colors.colonHex color code for tokens identified as colon.stringOptional
colors.keysHex color code for tokens identified as keys or property names.stringOptional
colors.keys_whiteSpaceHex color code for tokens identified as keys wrapped in quotes.stringOptional
colors.primitiveHex color code for tokens identified as boolean values and null.stringOptional
colors.errorHex color code for tokens marked with an error tag.stringOptional
colors.backgroundHex color code for component's background.stringOptional
colors.background_warningHex color code for warning message displaying at the top in component.stringOptional
styleContains the following properties:objectOptional
style.outerBoxProperty to modify the default style of the outside container div of componentstringOptional
style.containerProperty to modify the default style of the container of componentstringOptional
style.warningBoxProperty to modify the default style of the container div of the warning messagestringOptional
style.errorMessageProperty to modify the default style of the warning messagestringOptional
style.bodyProperty to modify the default style of the container div of row labels and codestringOptional
style.labelColumnProperty to modify the default style of the container div of row labelsstringOptional
style.labelsProperty to modify the default style of each row labelstringOptional
style.contentBoxProperty to modify the default style of the container div of the codestringOptional

Component Sections

    outerBox
    +-- container
        +--- warningBox
             +---- errorMessage
        +--- body
             +---- labelColumn
                   +----- labels
             +---- contentBox
                   +----- auto generated markup

The distribution version of this component has been transpiled down to ES5, then minified and uglified for maximum compatability and performance. You can check the source code here react-json-editor-ajrm/src/:

Built With

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Keywords

FAQs

Last updated on 23 May 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc