Cleanup some unused code. Minor update in the readme and examples
This commit is contained in:
parent
ea06b877b8
commit
ee85fb099d
|
@ -157,16 +157,16 @@ Constructs a new JSONEditor.
|
|||
|
||||
Indicate the KeyCodes for trigger confirm completion, by default those keys are: [39, 35, 9] which are the code for [right, end, tab]
|
||||
|
||||
- `{Function} getOptions (editor: object, text: string, path: string[], input: string)`
|
||||
- `{Function} getOptions (text: string, path: string[], input: string, editor: JSONEditor)`
|
||||
|
||||
This function will return your possible options for create the autocomplete selection, you can control dynamically which options you want to display according to the current active editing node.
|
||||
|
||||
*Parameters:*
|
||||
|
||||
- `text` : The text in the current node part. (basically the text that the user is editing)
|
||||
- `path` : The path of the node that is being edited.
|
||||
- `path` : The path of the node that is being edited as an array with strings.
|
||||
- `input` : Can be "field" or "value" depending if the user is editing a field name or a value of a node.
|
||||
- `editor` : The editor instance object that the node belongs to.
|
||||
- `editor` : The editor instance object that is being edited.
|
||||
|
||||
*Returns:*
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
// create the editor
|
||||
var container = document.getElementById('jsoneditor');
|
||||
var options = {
|
||||
modes: ['text', 'tree'],
|
||||
autocomplete: {
|
||||
getOptions: function () {
|
||||
return ['apple', 'cranberry', 'raspberry', 'pie', 'mango', 'mandarine', 'melon', 'appleton'];
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
// create the editor
|
||||
var container = document.getElementById('jsoneditor');
|
||||
var options = {
|
||||
modes: ['text', 'tree'],
|
||||
autocomplete: {
|
||||
applyTo:['value'],
|
||||
getOptions: function (text, path, input, editor) {
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
var container = document.getElementById('jsoneditor');
|
||||
var activationChar = '*';
|
||||
var options = {
|
||||
modes: ['text', 'tree'],
|
||||
autocomplete: {
|
||||
confirmKeys: [39, 35, 9, 190], // Confirm Autocomplete Keys: [right, end, tab, '.'] // By default are only [right, end, tab]
|
||||
|
||||
|
|
|
@ -372,34 +372,6 @@ Node.prototype.getLevel = function() {
|
|||
return (this.parent ? this.parent.getLevel() + 1 : 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get path of the root node till the current node
|
||||
* @return {String} Returns a jsonpath of the current node in the form: node1.child1.child2, node1.array1[0].child, etc.
|
||||
*/
|
||||
Node.prototype.getNodeJsonPath = function () {
|
||||
var path = this.parent ? this.parent.getNodePath() : [];
|
||||
path.push(this);
|
||||
var strPath = '';
|
||||
path.forEach(function (node) {
|
||||
strPath += !node.parent
|
||||
? '$' // do not add an (optional) field name of the root node
|
||||
: (node.parent.type != 'array')
|
||||
? '.' + node.field
|
||||
: '[' + node.index + ']';
|
||||
});
|
||||
return strPath;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get jsonpath of the current node
|
||||
* @return {Node[]} Returns an array with nodes
|
||||
*/
|
||||
Node.prototype.getNodePath = function () {
|
||||
var path = this.parent ? this.parent.getNodePath() : [];
|
||||
path.push(this);
|
||||
return path;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a clone of a node
|
||||
* The complete state of a clone is copied, including whether it is expanded or
|
||||
|
|
Loading…
Reference in New Issue