@jupyter-lsp/code-jumpers
Version:
Implementation underlying the jump to definition functionality in JupyterLab-LSP
18 lines • 595 B
JavaScript
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/**
* Ensure that the notebook has proper focus.
*/
function _ensureFocus(notebook, force = false) {
let activeCell = notebook.activeCell;
if (notebook.mode === 'edit' && activeCell && activeCell.editor) {
if (!activeCell.editor.hasFocus()) {
activeCell.editor.focus();
}
}
if (force && !notebook.node.contains(document.activeElement)) {
notebook.node.focus();
}
}
export { _ensureFocus };
//# sourceMappingURL=notebook_private.js.map