Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1775 from adobe/jasonsanjose/issue-1774
Browse files Browse the repository at this point in the history
Fix for #1774 - _currentEditor is saved synchronously
  • Loading branch information
redmunds committed Oct 5, 2012
2 parents f1147ac + 2bddeca commit d344dd0
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/editor/EditorManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,27 +342,27 @@ define(function (require, exports, module) {
* @private
*/
function _doFocusedEditorChanged(current, previous) {
// Skip if the new editor is already the focused editor.
// This may happen if the window loses then regains focus.
if (previous === current) {
return;
}

// if switching to no-editor, hide the last full editor
if (_currentEditor && !current) {
_currentEditor.setVisible(false);
}

// _currentEditor must be a full editor or null (show no editor).
// _currentEditor must not be an inline editor
if (!current || (current && !current._visibleRange)) {
_currentEditor = current;
}

// Fire focusedEditorChange asynchronously to allow CodeMirror to
// completely update focused state. CodeMirror fires it's "onFocus"
// event prior to setting it's internal state.
window.setTimeout(function () {
// Skip if the new editor is already the focused editor.
// This may happen if the window loses then regains focus.
if (previous === current) {
return;
}

// if switching to no-editor, hide the last full editor
if (_currentEditor && !current) {
_currentEditor.setVisible(false);
}

// _currentEditor must be a full editor or null (show no editor).
// _currentEditor must not be an inline editor
if (!current || (current && !current._visibleRange)) {
_currentEditor = current;
}

// Window may have been resized since last time editor was visible, so kick it now
if (_currentEditor) {
_currentEditor.setVisible(true);
Expand Down Expand Up @@ -536,7 +536,7 @@ define(function (require, exports, module) {
}
}

return _currentEditor;
return null;
}

/**
Expand Down

0 comments on commit d344dd0

Please sign in to comment.