some minor fixes & docu

This commit is contained in:
Meir Rotstein 2018-04-02 11:18:32 +03:00
parent 3b186633e7
commit e1f91cb1ac
2 changed files with 8 additions and 8 deletions

View File

@ -221,12 +221,12 @@ Constructs a new JSONEditor.
* @param {SerializableNode=} start * @param {SerializableNode=} start
* @param {SerializableNode=} end * @param {SerializableNode=} end
*/ */
function onSelectionChange(nodes) { function onSelectionChange(start, end) {
... ...
} }
``` ```
Only applicable when `mode` is 'tree'. Only applicable when `mode` is 'tree'.
- `{string} language` - `{string} language`
The default language comes from the browser navigator, but you can force a specific language. So use here string as 'en' or 'pt-BR'. Built-in languages: `en`, `pt-BR`. Other translations can be specified via the option `languages`. The default language comes from the browser navigator, but you can force a specific language. So use here string as 'en' or 'pt-BR'. Built-in languages: `en`, `pt-BR`. Other translations can be specified via the option `languages`.
@ -407,7 +407,7 @@ Get the current selected nodes, Only applicable for mode 'tree'.
Set selection for a range of nodes, Only applicable for mode 'tree'. Set selection for a range of nodes, Only applicable for mode 'tree'.
- If no parameters sent - the current selection will be removed, if exists. - If no parameters sent - the current selection will be removed, if exists.
- For single node selecion send only the `startNode` parameter. - For single node selecion send only the `start` parameter.
- If the nodes are not from the same level the first common parent will be selected - If the nodes are not from the same level the first common parent will be selected
*Parameters:* *Parameters:*
@ -425,7 +425,7 @@ Set selection for a range of nodes, Only applicable for mode 'tree'.
A utility function for getting a list of `Node` instances under certain range. A utility function for getting a list of `Node` instances under certain range.
This function can be used as complementary to `getSelection` and `onSelectionChange` if a list of __all__ the selected nodes is required This function can be used as complementary to `getSelection` and `onSelectionChange` if a list of __all__ the selected nodes is required.
*Parameters:* *Parameters:*

View File

@ -140,7 +140,7 @@ treemode._setOptions = function (options) {
if (options.onSelectionChange) { if (options.onSelectionChange) {
this.onSelectionChange(options.onSelectionChange); this.onSelectionChange(options.onSelectionChange);
} }
setLanguages(this.options.languages); setLanguages(this.options.languages);
setLanguage(this.options.language) setLanguage(this.options.language)
}; };
@ -1399,7 +1399,7 @@ treemode.setSelection = function (start, end) {
// check for old usage // check for old usage
if (start && start.dom && start.range) { if (start && start.dom && start.range) {
console.warn('setSelection/getSelection usage for text selection is depracated and should not be used, see documantaion for supported selection options'); console.warn('setSelection/getSelection usage for text selection is depracated and should not be used, see documantaion for supported selection options');
this.setDomSelection(startNode); this.setDomSelection(start);
} }
var nodes = this.getNodesByRange(start, end); var nodes = this.getNodesByRange(start, end);
@ -1412,8 +1412,8 @@ treemode.setSelection = function (start, end) {
/** /**
* Returns a set of Nodes according to a range of selection * Returns a set of Nodes according to a range of selection
* @param {{path: Array.<String>}} start object contains the path for selection start * @param {{path: Array.<String>}} start object contains the path for range start
* @param {{path: Array.<String>}=} end object contains the path for selection end * @param {{path: Array.<String>}=} end object contains the path for range end
* @return {Array.<Node>} Node intances on the given range * @return {Array.<Node>} Node intances on the given range
*/ */
treemode.getNodesByRange = function (start, end) { treemode.getNodesByRange = function (start, end) {