mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-06 11:35:24 +08:00
Merge pull request #7926 from Carreau/config-3.1
Fix configurability of codecell
This commit is contained in:
commit
3a21271d7e
@ -572,8 +572,17 @@ define([
|
|||||||
var regs = modes[mode].reg;
|
var regs = modes[mode].reg;
|
||||||
// only one key every time but regexp can't be keys...
|
// only one key every time but regexp can't be keys...
|
||||||
for(var i=0; i<regs.length; i++) {
|
for(var i=0; i<regs.length; i++) {
|
||||||
// here we handle non magic_modes
|
// here we handle non magic_modes.
|
||||||
if(first_line.match(regs[i]) !== null) {
|
// TODO :
|
||||||
|
// On 3.0 and below, these things were regex.
|
||||||
|
// But now should be string for json-able config.
|
||||||
|
// We should get rid of assuming they might be already
|
||||||
|
// in a later version of IPython.
|
||||||
|
var re = regs[i];
|
||||||
|
if(typeof(re) === 'string'){
|
||||||
|
re = new RegExp(re)
|
||||||
|
}
|
||||||
|
if(first_line.match(re) !== null) {
|
||||||
if(current_mode == mode){
|
if(current_mode == mode){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -127,22 +127,22 @@ define([
|
|||||||
},
|
},
|
||||||
mode: 'ipython',
|
mode: 'ipython',
|
||||||
theme: 'ipython',
|
theme: 'ipython',
|
||||||
matchBrackets: true
|
matchBrackets: true,
|
||||||
}
|
autoCloseBrackets: true
|
||||||
};
|
},
|
||||||
|
|
||||||
CodeCell.config_defaults = {
|
|
||||||
highlight_modes : {
|
highlight_modes : {
|
||||||
'magic_javascript' :{'reg':[/^%%javascript/]},
|
'magic_javascript' :{'reg':['^%%javascript']},
|
||||||
'magic_perl' :{'reg':[/^%%perl/]},
|
'magic_perl' :{'reg':['^%%perl']},
|
||||||
'magic_ruby' :{'reg':[/^%%ruby/]},
|
'magic_ruby' :{'reg':['^%%ruby']},
|
||||||
'magic_python' :{'reg':[/^%%python3?/]},
|
'magic_python' :{'reg':['^%%python3?']},
|
||||||
'magic_shell' :{'reg':[/^%%bash/]},
|
'magic_shell' :{'reg':['^%%bash']},
|
||||||
'magic_r' :{'reg':[/^%%R/]},
|
'magic_r' :{'reg':['^%%R']},
|
||||||
'magic_text/x-cython' :{'reg':[/^%%cython/]},
|
'magic_text/x-cython' :{'reg':['^%%cython']},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CodeCell.config_defaults = CodeCell.options_default;
|
||||||
|
|
||||||
CodeCell.msg_cells = {};
|
CodeCell.msg_cells = {};
|
||||||
|
|
||||||
CodeCell.prototype = Object.create(Cell.prototype);
|
CodeCell.prototype = Object.create(Cell.prototype);
|
||||||
@ -163,7 +163,7 @@ define([
|
|||||||
notebook: this.notebook});
|
notebook: this.notebook});
|
||||||
inner_cell.append(this.celltoolbar.element);
|
inner_cell.append(this.celltoolbar.element);
|
||||||
var input_area = $('<div/>').addClass('input_area');
|
var input_area = $('<div/>').addClass('input_area');
|
||||||
this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config);
|
this.code_mirror = new CodeMirror(input_area.get(0), this.class_config.get_sync('cm_config'));
|
||||||
// In case of bugs that put the keyboard manager into an inconsistent state,
|
// In case of bugs that put the keyboard manager into an inconsistent state,
|
||||||
// ensure KM is enabled when CodeMirror is focused:
|
// ensure KM is enabled when CodeMirror is focused:
|
||||||
this.code_mirror.on('focus', function () {
|
this.code_mirror.on('focus', function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user