Coder Social home page Coder Social logo

glavin001 / ember-jsoneditor Goto Github PK

View Code? Open in Web Editor NEW
18.0 4.0 18.0 3.93 MB

Ember component to view, edit and format JSON.

Home Page: http://glavin001.github.io/ember-jsoneditor/

License: MIT License

JavaScript 76.31% CSS 3.91% HTML 19.78%

ember-jsoneditor's Introduction

ember-jsoneditor npm version

Ember component for JSON Editor to view, edit and format JSON.

Live demo: http://glavin001.github.io/ember-jsoneditor/

Compatibility

  • Ember.js v3.4 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Previous versions compatibility

  • ember-json-editor v9.3 - Ember.js 2.4 and above

Installation

ember install ember-jsoneditor

Usage

<JsonEditor @json={{this.model}} @mode={{this.mode}} @name={{this.name}} />

For Ember versions < 3.4, you need to use classic component invocation:

{{json-editor json=model mode=mode name=name}}

For a complete example, see the dummy test app in tests/dummy/app/.

Documentation

See jsoneditor for configuration details. ember-jsoneditor supports the following jsoneditor options:

Option Description Default
change maps to jsoneditor's onChange event null
error maps to jsoneditor's onError event null
expand if true, renders with json tree expanded false
history Enables history undo/redo button true
indentation number of indentation spaces 2
mode Editor mode - modes tree
modes Drop down to select editor mode. Options: 'tree', 'view', 'form', 'code', 'text' All options
name Field name for the JSON root node, null
search boolean - show editor search box true

Example using event options

{{!-- app/templates/application.hbs --}}

<JsonEditor 
  @json={{this.model}} 
  @mode={{this.mode}} 
  @name={{this.name}} 
  @change={{action 'itChanged'}} 
  @error={{action 'myError'}} 
/>
// app/controllers/application.js
import Controller from '@ember/controller';

export default Controller.extend({
   /// ....
   actions: {
    myError(error){
      alert(`Error: ${error}`)
    },

    itChanged() {
      alert("The Data Changed!");
    }
  }
})

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

ember-jsoneditor's People

Contributors

glavin001 avatar jayphelps avatar jhr007 avatar maxwondercorn avatar nullvoxpopuli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ember-jsoneditor's Issues

How to override the change/onChange hook?

I didn't found a way to attach a specific behaviour on JSON change.
Maybe you know an option for that?

Thank you ๐Ÿ‘

By the way, it seems that some options used in the ember wrapper are deprecated:

screen shot 2016-09-20 at 18 36 34

Chore: Internal cleanup/Updating to Ember 3.12

Upgrade to latest LTS and make internal improvements with new framework features.

  • Merge PR (#24 ) to remove JQuery is step one. JQuery is only required for the complicated selectors in the tests. Release as a patch after the tests are fixed. Compatible with Ember > v2.4

  • Upgrade to Ember 3.8 and release as a minor. Compatible with Ember > v2.18.

  • Upgrade to Ember 3.12 and release as minor. Compatible with Ember version > v3.4

JSON Editor has had two major releases since the last time it was updated in the addon.

  • Move to the latest version and determine if any new editor features should be incorporated into the addon. JSON schema validation is a good candidate. Release as major version

Upgrades to 3.8 and 3.12 should happen pretty quickly. Upgrading and additional JSON Editor features depend on free time available

Error on 6.1 on ember 3.5 - Expected Broccoli node, got undefined for inputNodes[0]

Brocolli throws this when starting

ERROR Summary:

  • broccoliBuilderErrorStack: [undefined]
  • codeFrame: [undefined]
  • errorMessage: BroccoliMergeTrees: Expected Broccoli node, got undefined for inputNodes[0]
  • errorType: [undefined]
  • location:
    • column: [undefined]
    • file: [undefined]
    • line: [undefined]
  • message: BroccoliMergeTrees: Expected Broccoli node, got undefined for inputNodes[0]
  • name: TypeError
  • nodeAnnotation: [undefined]
  • nodeName: [undefined]
  • originalErrorMessage: [undefined]
  • stack: TypeError: BroccoliMergeTrees: Expected Broccoli node, got undefined for inputNodes[0]
    at BroccoliMergeTrees.Plugin (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\broccoli-plugin\index.js:23:13)
    at new BroccoliMergeTrees (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-jsoneditor\node_modules\broccoli-merge-trees\index.js:16:10)
    at Class.treeForVendor (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-jsoneditor\index.js:33:12)
    at Class._treeFor (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-cli\lib\models\addon.js:616:33)
    at Class.treeFor (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-cli\lib\models\addon.js:576:21)
    at project.addons.reduce (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-cli\lib\broccoli\ember-app.js:700:26)
    at Array.reduce ()
    at EmberApp._addonTreesFor (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-cli\lib\broccoli\ember-app.js:698:32)
    at EmberApp.addonTreesFor (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-cli\lib\broccoli\ember-app.js:722:17)
    at EmberApp.getExternalTree (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-cli\lib\broccoli\ember-app.js:1256:30)
    at EmberApp.toArray (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-cli\lib\broccoli\ember-app.js:1620:12)
    at EmberApp.toTree (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-cli\lib\broccoli\ember-app.js:1750:36)
    at module.exports (C:\Work\IBM\git\bluedarwin-robotic-studio\ember-cli-build.js:27:14)
    at Builder.readBuildFile (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-cli\lib\models\builder.js:52:14)
    at Builder.setupBroccoliBuilder (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-cli\lib\models\builder.js:66:22)
    at new Builder (C:\Work\IBM\git\bluedarwin-robotic-studio\node_modules\ember-cli\lib\models\builder.js:32:10)

=================================================================================

This does not happen on 5.x version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.