Show More
@@ -51,6 +51,22 b' var IPython = (function (IPython) {' | |||||
51 | }); |
|
51 | }); | |
52 | }; |
|
52 | }; | |
53 |
|
53 | |||
|
54 | Cell.prototype.grow = function(element) { | |||
|
55 | // Grow the cell by hand. This is used upon reloading from JSON, when the | |||
|
56 | // autogrow handler is not called. | |||
|
57 | var dom = element.get(0); | |||
|
58 | var lines_count = 0; | |||
|
59 | // modified split rule from | |||
|
60 | // http://stackoverflow.com/questions/2035910/how-to-get-the-number-of-lines-in-a-textarea/2036424#2036424 | |||
|
61 | var lines = dom.value.split(/\r|\r\n|\n/); | |||
|
62 | lines_count = lines.length; | |||
|
63 | if (lines_count >= 1) { | |||
|
64 | dom.rows = lines_count; | |||
|
65 | } else { | |||
|
66 | dom.rows = 1; | |||
|
67 | } | |||
|
68 | }; | |||
|
69 | ||||
54 |
|
70 | |||
55 | // Subclasses must implement create_element. |
|
71 | // Subclasses must implement create_element. | |
56 | Cell.prototype.create_element = function () {}; |
|
72 | Cell.prototype.create_element = function () {}; |
General Comments 0
You need to be logged in to leave comments.
Login now