juicy-jsoneditor
juicy-jsoneditor copied to clipboard
json editor set schema
Can you please post a working example of getting access to the actual editor
field? I'd like to set a schema on it. I can't see how it is exposed, nor events being fired when it is initialised.
Many thanks for the lib. Good work.
Edit: modes='["code", "form", "text", "tree", "view"]
' is the new syntax in Polymer. The examples use: modes="['code', 'form', 'text', 'tree', 'view']"
.
Thanks for the feedback! :)
Regarding the access to the editor itself, once element is attached to your DOM, you should be able to do just:
var aceEditorInstance = document.querySelector('juicy-jsoneditor').editor;
then you can perform anything josdejong/jsoneditor API allows.
Is that what you want, or do need to access just the input field?
I was hoping I would bind to the editor
field directly.
Any reason why we can't have, either or both:
- push the editor to the property so parent can bind to it.
- fire an event when ready.
The first requires less code. Second is equally acceptable.
An aside:
<link rel="import" href="../polymer/polymer.html">
Do you mind changing that to to something like: http://stackoverflow.com/a/31484427, i.e., base href support.
Regarding:
-
editor
is already a property. Do you mean you would like to make it Polymer-observable property? I'm a little bit afraid of performance cost, of putting live JSON Editor (+ACE Editor) object into Polymer notification protocol, which is known to be prone to bugs.
It would be great if you could provide your use case as a code sample, so I could get better understanding of your needs. 2. Great idea, I have created a separate issue for that https://github.com/Juicy/juicy-jsoneditor/issues/10 (PRs welcome ;) )
Regarding aside: I would rather avoid such change. <link rel="import" href="../polymer/polymer.html">
is common practice across Polymer and Vanilla Custom Elements - conventional path make it also easier to handle de-duplication of dependencies. Moreover, we do use <juicy-jsoneditor>
on production, and RawGit as a free service gives no uptime guarantees.