Fixed #855: focus tracker not created when creating an editor without main menu bar

This commit is contained in:
jos 2019-12-01 10:19:07 +01:00
parent c1d2f124c2
commit 1026d9102c
2 changed files with 14 additions and 9 deletions

View File

@ -3,6 +3,12 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## not yet published, version 7.3.1
- Fixed #855: focus tracker (for `onFocus` and `onBlur) not created when
creating an editor without main menu bar.
## 2019-11-27, version 7.3.0 ## 2019-11-27, version 7.3.0
- Implemented callbacks `onFocus` and `onBlur` (PR #809, issue #727). - Implemented callbacks `onFocus` and `onBlur` (PR #809, issue #727).

View File

@ -104,6 +104,14 @@ textmode.create = function (container, options = {}) {
me._onKeyDown(event) me._onKeyDown(event)
} }
// setting the FocusTracker on 'this.frame' to track the editor's focus event
const focusTrackerConfig = {
target: this.frame,
onFocus: this.options.onFocus || null,
onBlur: this.options.onBlur || null
}
this.frameFocusTracker = new FocusTracker(focusTrackerConfig)
this.content = document.createElement('div') this.content = document.createElement('div')
this.content.className = 'jsoneditor-outer' this.content.className = 'jsoneditor-outer'
@ -145,15 +153,6 @@ textmode.create = function (container, options = {}) {
} }
} }
// setting the FocusTracker on 'this.frame' to track the editor's focus event
const focusTrackerConfig = {
target: this.frame,
onFocus: this.options.onFocus || null,
onBlur: this.options.onBlur || null
}
this.frameFocusTracker = new FocusTracker(focusTrackerConfig)
// create sort button // create sort button
if (this.options.enableSort) { if (this.options.enableSort) {
const sort = document.createElement('button') const sort = document.createElement('button')