question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

not able to implement readonly or not editable functionaliy.

See original GitHub issue

When i try to implement onEditable getting the below error ERROR TypeError: this.editorOptions.onEditable is not a function at JsonEditorComponent

  • json-editor version: 1.10.5

Expected behavior

Actual behavior

Steps to reproduce the behavior

Implement the onEditable in Angular

would like know how to implement the below part

{function} onEditable({ path, field, value })

Set a callback function to determine whether individual nodes are editable or read-only. Only applicable when option mode is tree, text, or code.

In case of mode tree, the callback is invoked as editable(node), where the first parameter is an object:

{
  field: string,
  value: string,
  path: string[]
}
The function must either return a boolean value to set both the nodes field and value editable or read-only, or return an object {field: boolean, value: boolean} to set set the read-only attribute for field and value individually.

In modes text and code, the callback is invoked as editable(node) where node is an empty object (no field, value, or path). In that case the function can return false to make the text or code editor completely read-only.

with an example will be really hepful

@josdejong expecting a reply .

Thanks in advance 

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
pruchaycommented, May 19, 2022

If I good understand your need it’s possible by using the disable method.

const element = document.getElementById('editor_holder');
const editor = new JSONEditor(element, options);

editor.getEditor('root.location').disable();

Please check this link for more details https://github.com/json-editor/json-editor#enable-and-disable-the-editor.

1reaction
schmunk42commented, Apr 1, 2022

ping @amk0

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML attribute: readonly - HTML: HyperText Markup Language
The Boolean readonly attribute, when present, makes the element not mutable, meaning the user can not edit the control.
Read more >
React - Why is input field still readonly (i.e. not editable) even ...
The input field remains readonly and onChange won't fire despite my varied and increasingly desperate attempts to coax it into behaving like the...
Read more >
HTML5 Forms: Readonly Type Attribute - Wufoo
The readonly attribute makes a form control non-editable (or “read only”). A read-only field can't be modified, but, unlike disabled , you can...
Read more >
Make a document read only - Microsoft Support
Make a document read-only by restricting editing and formatting. ... a read-only file means that the document can be read or copied but...
Read more >
HTML input readonly Attribute - W3Schools
The readonly attribute is a boolean attribute. When present, it specifies that an input field is read-only. A read-only input field cannot be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found