mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-15 04:00:34 +08:00
contract selection on click
During multi-select, clicking on the current cell collapses the selection back to just that cell.
This commit is contained in:
parent
bf952c1f86
commit
0b8886d6e5
@ -163,8 +163,11 @@ define([
|
|||||||
Cell.prototype._on_click = function (event) {
|
Cell.prototype._on_click = function (event) {
|
||||||
if (!this.selected) {
|
if (!this.selected) {
|
||||||
this.events.trigger('select.Cell', {'cell':this, 'extendSelection':event.shiftKey});
|
this.events.trigger('select.Cell', {'cell':this, 'extendSelection':event.shiftKey});
|
||||||
|
} else {
|
||||||
|
// I'm already part of the selection; contract selection to just me
|
||||||
|
this.events.trigger('select.Cell', {'cell': this});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subclasses can implement override bind_events.
|
* Subclasses can implement override bind_events.
|
||||||
@ -176,7 +179,7 @@ define([
|
|||||||
var that = this;
|
var that = this;
|
||||||
// We trigger events so that Cell doesn't have to depend on Notebook.
|
// We trigger events so that Cell doesn't have to depend on Notebook.
|
||||||
that.element.click(function (event) {
|
that.element.click(function (event) {
|
||||||
that._on_click(event)
|
that._on_click(event);
|
||||||
});
|
});
|
||||||
if (this.code_mirror) {
|
if (this.code_mirror) {
|
||||||
this.code_mirror.on("change", function(cm, change) {
|
this.code_mirror.on("change", function(cm, change) {
|
||||||
|
Loading…
Reference in New Issue
Block a user