Skip to content

Commit

Permalink
additional fixes + docu
Browse files Browse the repository at this point in the history
  • Loading branch information
meirotstein committed Apr 22, 2018
1 parent ea93959 commit e80a840
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ Get the current selected nodes, Only applicable for mode 'tree'.

*Returns:*

- `{{start:SerializableNode, end: SerializableNode}}`
- `{start:SerializableNode, end: SerializableNode}`

#### `JSONEditor.setSelection(start, end)`

Expand All @@ -412,28 +412,28 @@ Set selection for a range of nodes, Only applicable for mode 'tree'.

*Parameters:*

- `{{path: Array.<String>}} start`
- `{path: Array.<String>} start`

Path for the start node

- `{{path: Array.<String>}} end`
- `{path: Array.<String>} end`

Path for the end node


#### `JSONEditor.getNodesByRange(start, end)`

A utility function for getting a list of `Node` instances under certain range.
A utility function for getting a list of `SerializableNode` under certain range.

This function can be used as complementary to `getSelection` and `onSelectionChange` if a list of __all__ the selected nodes is required.

*Parameters:*

- `{{path: Array.<String>}} start`
- `{path: Array.<String>} start`

Path for the first node in range

- `{{path: Array.<String>}} end`
- `{path: Array.<String>} end`

Path for the last node in range

Expand Down
2 changes: 1 addition & 1 deletion src/js/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Node.prototype.findNodeByPath = function (path) {

if (path.length && this.childs && this.childs.length) {
for (var i=0; i < this.childs.length; ++i) {
if (path[0] === '' + this.childs[i].getName()) {
if (('' + path[0]) === ('' + this.childs[i].getName())) {
return this.childs[i].findNodeByPath(path.slice(1));
}
}
Expand Down

0 comments on commit e80a840

Please sign in to comment.