mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Adding Cell.grow back to fix bug.
This can go away once we star to use CodeMirror for TextCells.
This commit is contained in:
parent
8207ecc086
commit
10963a588e
@ -51,6 +51,22 @@ var IPython = (function (IPython) {
|
||||
});
|
||||
};
|
||||
|
||||
Cell.prototype.grow = function(element) {
|
||||
// Grow the cell by hand. This is used upon reloading from JSON, when the
|
||||
// autogrow handler is not called.
|
||||
var dom = element.get(0);
|
||||
var lines_count = 0;
|
||||
// modified split rule from
|
||||
// http://stackoverflow.com/questions/2035910/how-to-get-the-number-of-lines-in-a-textarea/2036424#2036424
|
||||
var lines = dom.value.split(/\r|\r\n|\n/);
|
||||
lines_count = lines.length;
|
||||
if (lines_count >= 1) {
|
||||
dom.rows = lines_count;
|
||||
} else {
|
||||
dom.rows = 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Subclasses must implement create_element.
|
||||
Cell.prototype.create_element = function () {};
|
||||
|
Loading…
Reference in New Issue
Block a user