Fixed #763: `autocomplete.trigger: 'focus'` throws an error when opening the context menu

This commit is contained in:
jos 2019-08-15 10:29:15 +02:00
parent 2b76640611
commit 16e46878ba
2 changed files with 3 additions and 1 deletions

View File

@ -9,6 +9,8 @@ https://github.com/josdejong/jsoneditor
- When duplicating an object property, move focus to the field and do not - When duplicating an object property, move focus to the field and do not
immediately add the ` (copy)` suffix. See #766. immediately add the ` (copy)` suffix. See #766.
- Fixed #769: option `name` not working anymore. Regression since `v6.1.0`. - Fixed #769: option `name` not working anymore. Regression since `v6.1.0`.
- Fixed #763: `autocomplete.trigger: 'focus'` throws an error when opening the
context menu. Thanks @Thaina.
## 2019-08-01, version 6.2.1 ## 2019-08-01, version 6.2.1

View File

@ -1493,7 +1493,7 @@ treemode._showAutoComplete = function (element) {
var self = this; var self = this;
setTimeout(function () { setTimeout(function () {
if (self.options.autocomplete.trigger === 'focus' || element.innerText.length > 0) { if (node && (self.options.autocomplete.trigger === 'focus' || element.innerText.length > 0)) {
var result = self.options.autocomplete.getOptions(element.innerText, node.getPath(), jsonElementType, node.editor); var result = self.options.autocomplete.getOptions(element.innerText, node.getPath(), jsonElementType, node.editor);
if (result === null) { if (result === null) {
self.autocomplete.hideDropDown(); self.autocomplete.hideDropDown();