jupyter-js-notebook
Advanced tools
Comparing version 0.5.10 to 0.5.11
@@ -43,3 +43,6 @@ // Copyright (c) Jupyter Development Team. | ||
this.model = model; | ||
this.model.selected.connect(function () { return _this._editor.focus(); }); | ||
this.model.selected.connect(function () { | ||
if (!_this.model.readOnly) | ||
_this._editor.focus(); | ||
}); | ||
this._editor.on('change', function () { | ||
@@ -46,0 +49,0 @@ _this.model.dirty = true; |
@@ -44,1 +44,9 @@ import { IChangedArgs } from 'phosphor-properties'; | ||
} | ||
/** | ||
* Scroll an element into view if needed. | ||
* | ||
* @param area - The scroll area element. | ||
* | ||
* @param elem - The element of interest. | ||
*/ | ||
export declare function scrollIfNeeded(area: HTMLElement, elem: HTMLElement): void; |
@@ -59,2 +59,3 @@ // Copyright (c) Jupyter Development Team. | ||
cell.rendered = false; | ||
cell.input.textEditor.select(); | ||
} | ||
@@ -103,5 +104,3 @@ }); | ||
newCell.addClass('jp-selected-cell'); | ||
// scroll so the selected cell is in the view | ||
// TODO: replicate scrollIntoViewIfNeeded() | ||
newCell.node.scrollIntoView(); | ||
scrollIfNeeded(this.node, newCell.node); | ||
} | ||
@@ -146,3 +145,4 @@ }; | ||
* @param factory - A function which takes an item from the list and constructs a widget. | ||
*/ function follow(source, sink, factory) { | ||
*/ | ||
function follow(source, sink, factory) { | ||
for (var i = sink.childCount() - 1; i >= 0; i--) { | ||
@@ -184,1 +184,19 @@ sink.childAt(i).dispose(); | ||
} | ||
/** | ||
* Scroll an element into view if needed. | ||
* | ||
* @param area - The scroll area element. | ||
* | ||
* @param elem - The element of interest. | ||
*/ | ||
function scrollIfNeeded(area, elem) { | ||
var ar = area.getBoundingClientRect(); | ||
var er = elem.getBoundingClientRect(); | ||
if (er.top < ar.top) { | ||
area.scrollTop -= ar.top - er.top; | ||
} | ||
else if (er.bottom > ar.bottom) { | ||
area.scrollTop += er.bottom - ar.bottom; | ||
} | ||
} | ||
exports.scrollIfNeeded = scrollIfNeeded; |
{ | ||
"name": "jupyter-js-notebook", | ||
"version": "0.5.10", | ||
"version": "0.5.11", | ||
"description": "Notebook widget for Jupyter", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114102
3539