mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
Autoindentation fixed and enabled by default.
This commit is contained in:
parent
0db7ab16a3
commit
3db421fb73
@ -10,9 +10,10 @@ var IPython = (function (IPython) {
|
||||
var Cell = function (notebook) {
|
||||
this.notebook = notebook;
|
||||
this.selected = false;
|
||||
this.element;
|
||||
this.element = null;
|
||||
this.create_element();
|
||||
if (this.element !== undefined) {
|
||||
if (this.element !== null) {
|
||||
this.set_autoindent(true);
|
||||
this.element.data("cell", this);
|
||||
this.bind_events();
|
||||
}
|
||||
|
@ -27,8 +27,6 @@ var IPython = (function (IPython) {
|
||||
var input_area = $('<div/>').addClass('input_area box-flex1');
|
||||
this.code_mirror = CodeMirror(input_area.get(0), {
|
||||
indentUnit : 4,
|
||||
enterMode : 'flat',
|
||||
tabMode: 'shift',
|
||||
mode: 'python',
|
||||
theme: 'ipython',
|
||||
onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this)
|
||||
@ -64,7 +62,8 @@ var IPython = (function (IPython) {
|
||||
IPython.notebook.complete_cell(this, line, cur.ch);
|
||||
return true;
|
||||
}
|
||||
} else if (event.keyCode === 8) {
|
||||
} else if (event.keyCode === 8 && event.type == 'keydown') {
|
||||
console.log(event);
|
||||
// If backspace and the line ends with 4 spaces, remove them.
|
||||
var cur = editor.getCursor();
|
||||
var line = editor.getLine(cur.line);
|
||||
|
@ -24,8 +24,6 @@ var IPython = (function (IPython) {
|
||||
var input_area = $('<div/>').addClass('text_cell_input');
|
||||
this.code_mirror = CodeMirror(input_area.get(0), {
|
||||
indentUnit : 4,
|
||||
enterMode : 'flat',
|
||||
tabMode: 'shift',
|
||||
mode: this.code_mirror_mode,
|
||||
theme: 'default',
|
||||
value: this.placeholder
|
||||
|
@ -121,7 +121,7 @@
|
||||
</div>
|
||||
<div class="section_row">
|
||||
<span id="autoindent_span">
|
||||
<input type="checkbox" id="autoindent"></input>
|
||||
<input type="checkbox" id="autoindent" checked="true"></input>
|
||||
</span>
|
||||
<span class="checkbox_label">Autoindent:</span>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user