How to use the editor/EditorManager.focusEditor function in editor

To help you get started, we’ve selected a few editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adobe / brackets / src / project / FileViewController.js View on Github external
function _selectCurrentDocument() {
        // If fullPath corresonds to the current doc being viewed then opening the file won't
        // trigger a currentDocumentChanged event, so we need to trigger a documentSelectionFocusChange 
        // in this case to signify the selection focus has changed even though the current document has not.
        $(exports).triggerHandler("documentSelectionFocusChange");
        
        // Ensure the editor has focus even though we didn't open a new file.
        EditorManager.focusEditor();
    }
github symbiose / symbiose / usr / lib / brackets / src / document / DocumentCommandHandlers.js View on Github external
// *and* if at least one other view still exists
                        if (!promptOnly && DocumentManager.getOpenDocumentForPath(file.fullPath)) {
                            doRevert(doc)
                                .then(result.resolve, result.reject);
                        } else {
                            result.resolve();
                        }
                    }
                });
            result.always(function () {
                EditorManager.focusEditor();
            });
        } else {
            // File is not open, or IS open but Document not dirty: close immediately
            doClose(file);
            EditorManager.focusEditor();
            result.resolve();
        }
        return promise;
    }
github adobe / brackets / src / search / QuickOpen.js View on Github external
// Nagivate to file and line number
            if (fullPath) {
                CommandManager.execute(Commands.FILE_ADD_TO_WORKING_SET, {fullPath: fullPath})
                    .done(function () {
                        if (!isNaN(gotoLine)) {
                            EditorManager.getCurrentFullEditor().setCursorPos(cursor);
                        }
                    });
            } else if (!isNaN(gotoLine)) {
                EditorManager.getCurrentFullEditor().setCursorPos(cursor);
            }
        }


        this._close();
        EditorManager.focusEditor();
    };
github symbiose / symbiose / usr / lib / brackets / src / widgets / ModalBar.js View on Github external
.insertBefore("#editor-holder");

        if (animate) {
            this._$root.addClass("popout offscreen");
            // Forcing the renderer to do a layout, which will cause it to apply the transform for the "offscreen"
            // class, so it will animate when you remove the class.
            window.getComputedStyle(this._$root.get(0)).getPropertyValue("top");
            this._$root.removeClass("popout offscreen");
        }
        
        // If something *other* than an editor (like another modal bar) has focus, set the focus 
        // to the editor here, before opening up the new modal bar. This ensures that the old
        // focused item has time to react and close before the new modal bar is opened.
        // See bugs #4287 and #3424
        if (!EditorManager.getFocusedEditor()) {
            EditorManager.focusEditor();
        }
        
        if (autoClose) {
            this._autoClose = true;
            this._$root.on("keydown", this._handleKeydown);
            window.document.body.addEventListener("focusin", this._handleFocusChange, true);
                
            // Set focus to the first input field, or the first button if there is no input field.
            // TODO: remove this logic?
            var $firstInput = $("input[type='text']", this._$root).first();
            if ($firstInput.length > 0) {
                $firstInput.focus();
            } else {
                $("button", this._$root).first().focus();
            }
        }
github symbiose / symbiose / usr / lib / brackets / src / project / FileSyncManager.js View on Github external
.always(function () {
                                        if (_restartPending) {
                                            // Restart the sync if needed
                                            _restartPending = false;
                                            _alreadyChecking = false;
                                            syncOpenDocuments();
                                        } else {
                                            // We're really done!
                                            _alreadyChecking = false;
                                            
                                            // If we showed a dialog, restore focus to editor
                                            if (editConflicts.length > 0 || deleteConflicts.length > 0) {
                                                EditorManager.focusEditor();
                                            }
                                            
                                            // (Any errors that ocurred during presentConflicts() have already
                                            // shown UI & been dismissed, so there's no fail() handler here)
                                        }
                                    });
                            });
github rabchev / brackets-server / brackets / search / QuickOpen.js View on Github external
dialogOpen = false;

        var i;
        for (i = 0; i < plugins.length; i++) {
            var plugin = plugins[i];
            plugin.done();
        }

        // Ty TODO: disabled for now while file switching is disabled in _handleItemFocus
        //JSLintUtils.setEnabled(true);
        
        // Make sure Smart Autocomplete knows its popup is getting closed (in cases where there's no
        // editor to give focus to below, it won't notice otherwise).
        this.$searchField.trigger("lostFocus");

        EditorManager.focusEditor();
        
        // Closing the dialog is a little tricky (see #1384): some Smart Autocomplete code may run later (e.g.
        // (because it's a later handler of the event that just triggered _close()), and that code expects to
        // find metadata that it stuffed onto the DOM node earlier. But $.remove() strips that metadata.
        // So, to hide the dialog immediately it's only safe to remove using raw DOM APIs:
        this.dialog[0].parentNode.removeChild(this.dialog[0]);
        var self = this;
        setTimeout(function () {
            // Now that it's safe, call the real jQuery API to clear the metadata & prevent a memory leak
            self.dialog.remove();
        }, 0);
        
        $(".smart_autocomplete_container").remove();

        $(window.document).off("mousedown", this.handleDocumentMouseDown);
    };
github adobe / brackets / src / widgets / ModalBar.js View on Github external
$(this).triggerHandler("close");
        
        function doRemove() {
            self._$root.remove();
            result.resolve();
        }
        
        if (animate) {
            AnimationUtils.animateUsingClass(this._$root.get(0), "offscreen")
                .done(doRemove);
        } else {
            doRemove();
        }
        
        EditorManager.focusEditor();

        return result.promise();
    };
github adobe / brackets / src / language / JSLintUtils.js View on Github external
var clickCallback = function () {
                            if ($selectedRow) {
                                $selectedRow.removeClass("selected");
                            }
                            $row.addClass("selected");
                            $selectedRow = $row;
                            
                            var editor = EditorManager.getCurrentFullEditor();
                            editor.setCursorPos(item.line - 1, item.character - 1);
                            EditorManager.focusEditor();
                        };
                        $row.click(clickCallback);
github symbiose / symbiose / usr / lib / brackets / src / search / FindInFiles.js View on Github external
FindInFilesDialog.prototype._close = function (value) {
        if (this.closed) {
            return;
        }
        
        this.closed = true;
        this.modalBar.close();
        EditorManager.focusEditor();
        this.result.resolve(value);
    };
github adobe / brackets / src / search / FindInFiles.js View on Github external
FindInFilesDialog.prototype._close = function (value) {
        if (this.closed) {
            return;
        }
        
        this.closed = true;
        this.modalBar.close();
        EditorManager.focusEditor();
        this.result.resolve(value);
    };