From 1026d9102c2567a34136a10770c6eafd16512a1c Mon Sep 17 00:00:00 2001 From: jos Date: Sun, 1 Dec 2019 10:19:07 +0100 Subject: [PATCH] Fixed #855: focus tracker not created when creating an editor without main menu bar --- HISTORY.md | 6 ++++++ src/js/textmode.js | 17 ++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index a466166..9804e5f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,12 @@ 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 - Implemented callbacks `onFocus` and `onBlur` (PR #809, issue #727). diff --git a/src/js/textmode.js b/src/js/textmode.js index 8300726..c8f7e56 100644 --- a/src/js/textmode.js +++ b/src/js/textmode.js @@ -104,6 +104,14 @@ textmode.create = function (container, options = {}) { 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.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 if (this.options.enableSort) { const sort = document.createElement('button')