JSONEditor.AbstractTheme.extend is not a function
See original GitHub issueGeneral information
- json-editor version: 2.2.1
Expected behavior
Adjust custom theme on e.g. bootstrap4
Actual behavior
Error
Uncaught TypeError: JSONEditor.AbstractTheme.extend is not a function
at JsonEditor.js:25
Steps to reproduce the behavior
<html>
<head>
</head>
<body>
<div id="editor_holder"></div>
<script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
<script>
const defaultSchema = {
'title': 'Person',
'type': 'object',
'required': [
'name'
],
'properties': {
'name': {
'type': 'string',
'description': 'First and Last name',
'minLength': 4,
'default': 'Jeremy Dorn'
}
}
}
JSONEditor.defaults.themes.mytheme = JSONEditor.AbstractTheme.extend({
getTable: function () {
// Base function creates an empty <table> DOM element
var el = this._super();
// Modify this base element
el.style.fontSize = '50px';
return el;
}
});
const element = document.getElementById('editor_holder');
const options = {
schema: defaultSchema,
theme: 'mytheme'
}
const editor = new JSONEditor(element, options);
</script>
</body>
</html>
Issue Analytics
- State:
- Created 3 years ago
- Comments:13
Top Results From Across the Web
extend is not a function - jquery - Stack Overflow
The problem is (as far as I can see from the source code), that the editor directly accesses the global $ (instead of...
Read more >@json-editor/json-editor | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >jsoneditor.min.js - Fisheye 4.8.5 - OpenLMIS
Listen for 'ready' event before setting the value";return this.root.setValue(a),this},validate:function(a){if(!this.ready)throw"JSON Editor not ready yet.
Read more >JSON Editor - Plunker
setValue(value); return this; }, validate: function(value) { if(!this.ready) throw "JSON Editor not ready yet. Listen for 'ready' event before validating"; ...
Read more >drupal-swagger-ui-formatter-support-swagger-ui-3.0-2958783 ...
+ + When we speak of free software, we are referring to freedom, not +price. ... AbstractTheme.extend({getRangeInput:function(a,b,c){return this.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So an update to the docs might be needed to clarify the new way of customize the schema editor.
Had the same problem when updating from v 2.2.
Thanks for the clarification!
For anyone else stumbling across. I also took a moment to realize I will need to change ‘super’ calls to get the inherited elements when overwriting functions.
Before I did
Now it is