Merge pull request #6221 from Carreau/cm4

Switch to CodeMirror 4.6.0
Jonathan Frederic 11 years ago
commit 98cef15a7c

@ -4,7 +4,8 @@
define([
'base/js/namespace',
'jquery',
], function(IPython, $) {
'codemirror/lib/codemirror',
], function(IPython, $, CodeMirror) {
"use strict";
var modal = function (options) {

@ -1,5 +1,12 @@
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
/**
*
*
* @module keyboard
* @namespace keyboard
* @class ShortcutManager
*/
define([
'base/js/namespace',
@ -126,6 +133,12 @@ define([
// Shortcut manager class
var ShortcutManager = function (delay, events) {
/**
* A class to deal with keyboard event and shortcut
*
* @class ShortcutManager
* @constructor
*/
this._shortcuts = {};
this._counts = {};
this._timers = {};
@ -201,6 +214,16 @@ define([
};
ShortcutManager.prototype.count_handler = function (shortcut, event, data) {
/**
* Seem to allow to call an handler only after several key press.
* like, I suppose `dd` that delete the current cell only after
* `d` has been pressed twice..
* @method count_handler
* @return {Boolean} `true|false`, whether or not the event has been handled.
* @param shortcut {shortcut}
* @param event {event}
* @param data {data}
*/
var that = this;
var c = this._counts;
var t = this._timers;
@ -221,6 +244,12 @@ define([
};
ShortcutManager.prototype.call_handler = function (event) {
/**
* Call the corresponding shortcut handler for a keyboard event
* @method call_handler
* @return {Boolean} `true|false`, `false` if no handler was found, otherwise the value return by the handler.
* @param event {event}
*/
var shortcut = event_to_shortcut(event);
var data = this._shortcuts[shortcut];
if (data) {
@ -252,7 +281,7 @@ define([
event_to_shortcut : event_to_shortcut
};
// For backwards compatability.
// For backwards compatibility.
IPython.keyboard = keyboard;
return keyboard;

@ -4,7 +4,8 @@
define([
'base/js/namespace',
'jquery',
], function(IPython, $){
'codemirror/lib/codemirror',
], function(IPython, $, CodeMirror){
"use strict";
IPython.load_extensions = function () {
@ -538,6 +539,20 @@ define([
msg += ajax_error_msg(jqXHR);
console.log(msg);
};
var requireCodeMirrorMode = function (mode, callback, errback) {
// load a mode with requirejs
if (typeof mode != "string") mode = mode.name;
if (CodeMirror.modes.hasOwnProperty(mode)) {
callback(CodeMirror.modes.mode);
return;
}
require([
// might want to use CodeMirror.modeURL here
['codemirror/mode', mode, mode].join('/'),
], callback, errback
);
};
var utils = {
regex_split : regex_split,
@ -563,6 +578,7 @@ define([
mergeopt: mergeopt,
ajax_error_msg : ajax_error_msg,
log_ajax_error : log_ajax_error,
requireCodeMirrorMode : requireCodeMirrorMode,
};
// Backwards compatability.

@ -1,44 +1,39 @@
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
/**
*
*
* @module cell
* @namespace cell
* @class Cell
*/
define([
'base/js/namespace',
'jquery',
'base/js/utils',
], function(IPython, $, utils) {
'codemirror/lib/codemirror',
'codemirror/addon/edit/matchbrackets',
'codemirror/addon/edit/closebrackets',
'codemirror/addon/comment/comment'
], function(IPython, $, utils, CodeMirror, cm_match, cm_closeb, cm_comment) {
// TODO: remove IPython dependency here
"use strict";
// monkey patch CM to be able to syntax highlight cell magics
// bug reported upstream,
// see https://github.com/codemirror/CodeMirror/issues/670
if(CodeMirror.getMode(1,'text/plain').indent === undefined ){
CodeMirror.modes.null = function() {
return {token: function(stream) {stream.skipToEnd();},indent : function(){return 0;}};
};
}
CodeMirror.patchedGetMode = function(config, mode){
var cmmode = CodeMirror.getMode(config, mode);
if(cmmode.indent === null) {
console.log('patch mode "' , mode, '" on the fly');
cmmode.indent = function(){return 0;};
}
return cmmode;
};
// end monkey patching CodeMirror
var Cell = function (options) {
// Constructor
//
// The Base `Cell` class from which to inherit.
//
// Parameters:
// options: dictionary
// Dictionary of keyword arguments.
// events: $(Events) instance
// config: dictionary
// keyboard_manager: KeyboardManager instance
/* Constructor
*
* The Base `Cell` class from which to inherit.
* @constructor
* @param:
* options: dictionary
* Dictionary of keyword arguments.
* events: $(Events) instance
* config: dictionary
* keyboard_manager: KeyboardManager instance
*/
options = options || {};
this.keyboard_manager = options.keyboard_manager;
this.events = options.events;
@ -184,9 +179,22 @@ define([
Cell.prototype.handle_codemirror_keyevent = function (editor, event) {
var shortcuts = this.keyboard_manager.edit_shortcuts;
var cur = editor.getCursor();
if((cur.line !== 0 || cur.ch !==0) && event.keyCode === 38){
event._ipkmIgnore = true;
}
var nLastLine = editor.lastLine()
if( ( event.keyCode === 40)
&& (( cur.line !== nLastLine)
|| ( cur.ch !== editor.getLineHandle(nLastLine).text.length))
){
event._ipkmIgnore = true;
}
// if this is an edit_shortcuts shortcut, the global keyboard/shortcut
// manager will handle it
if (shortcuts.handles(event)) { return true; }
if (shortcuts.handles(event)) {
return true;
}
return false;
};
@ -277,9 +285,6 @@ define([
* @return {Boolean} `true` if CodeMirror should ignore the event, `false` Otherwise
*/
Cell.prototype.handle_keyevent = function (editor, event) {
// console.log('CM', this.mode, event.which, event.type)
if (this.mode === 'command') {
return true;
} else if (this.mode === 'edit') {
@ -509,6 +514,7 @@ define([
**/
Cell.prototype._auto_highlight = function (modes) {
//Here we handle manually selected modes
var that = this;
var mode;
if( this.user_highlight !== undefined && this.user_highlight != 'auto' )
{
@ -530,33 +536,34 @@ define([
return;
}
if (mode.search('magic_') !== 0) {
this.code_mirror.setOption('mode', mode);
CodeMirror.autoLoadMode(this.code_mirror, mode);
utils.requireCodeMirrorMode(mode, function () {
that.code_mirror.setOption('mode', mode);
});
return;
}
var open = modes[mode].open || "%%";
var close = modes[mode].close || "%%end";
var mmode = mode;
mode = mmode.substr(6);
if(current_mode == mode){
var magic_mode = mode;
mode = magic_mode.substr(6);
if(current_mode == magic_mode){
return;
}
CodeMirror.autoLoadMode(this.code_mirror, mode);
// create on the fly a mode that swhitch between
// plain/text and smth else otherwise `%%` is
// source of some highlight issues.
// we use patchedGetMode to circumvent a bug in CM
CodeMirror.defineMode(mmode , function(config) {
return CodeMirror.multiplexingMode(
CodeMirror.patchedGetMode(config, 'text/plain'),
// always set someting on close
{open: open, close: close,
mode: CodeMirror.patchedGetMode(config, mode),
delimStyle: "delimit"
}
);
utils.requireCodeMirrorMode(mode, function () {
// create on the fly a mode that switch between
// plain/text and something else, otherwise `%%` is
// source of some highlight issues.
CodeMirror.defineMode(magic_mode, function(config) {
return CodeMirror.multiplexingMode(
CodeMirror.getMode(config, 'text/plain'),
// always set something on close
{open: open, close: close,
mode: CodeMirror.getMode(config, mode),
delimStyle: "delimit"
}
);
});
that.code_mirror.setOption('mode', magic_mode);
});
this.code_mirror.setOption('mode', mmode);
return;
}
}

@ -114,7 +114,7 @@ define([
* @param name {String} name to use to refer to the callback. It is advised to use a prefix with the name
* for easier sorting and avoid collision
* @param callback {function(div, cell)} callback that will be called to generate the ui element
* @param [cell_types] {List of String|undefined} optional list of cell types. If present the UI element
* @param [cell_types] {List_of_String|undefined} optional list of cell types. If present the UI element
* will be added only to cells of types in the list.
*
*
@ -163,7 +163,7 @@ define([
* @method register_preset
* @param name {String} name to use to refer to the preset. It is advised to use a prefix with the name
* for easier sorting and avoid collision
* @param preset_list {List of String} reverse order of the button in the toolbar. Each String of the list
* @param preset_list {List_of_String} reverse order of the button in the toolbar. Each String of the list
* should correspond to a name of a registerd callback.
*
* @private
@ -288,8 +288,6 @@ define([
};
/**
*/
CellToolbar.utils = {};
@ -385,7 +383,7 @@ define([
* @method utils.select_ui_generator
* @static
*
* @param list_list {list of sublist} List of sublist of metadata value and name in the dropdown list.
* @param list_list {list_of_sublist} List of sublist of metadata value and name in the dropdown list.
* subslit shoud contain 2 element each, first a string that woul be displayed in the dropdown list,
* and second the corresponding value to be passed to setter/return by getter. the corresponding value
* should not be "undefined" or behavior can be unexpected.

@ -1,5 +1,13 @@
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
/**
*
*
* @module codecell
* @namespace codecell
* @class CodeCell
*/
define([
'base/js/namespace',
@ -10,7 +18,10 @@ define([
'notebook/js/outputarea',
'notebook/js/completer',
'notebook/js/celltoolbar',
], function(IPython, $, utils, keyboard, cell, outputarea, completer, celltoolbar) {
'codemirror/lib/codemirror',
'codemirror/mode/python/python',
'notebook/js/codemirror-ipython'
], function(IPython, $, utils, keyboard, cell, outputarea, completer, celltoolbar, CodeMirror, cmpython, cmip) {
"use strict";
var Cell = cell.Cell;
@ -72,11 +83,7 @@ define([
this.completer = null;
var cm_overwrite_options = {
onKeyEvent: $.proxy(this.handle_keyevent,this)
};
var config = utils.mergeopt(CodeCell, this.config, {cm_config: cm_overwrite_options});
var config = utils.mergeopt(CodeCell, this.config);
Cell.apply(this,[{
config: config,
keyboard_manager: options.keyboard_manager,
@ -102,9 +109,7 @@ define([
},
mode: 'ipython',
theme: 'ipython',
matchBrackets: true,
// don't auto-close strings because of CodeMirror #2385
autoCloseBrackets: "()[]{}"
matchBrackets: true
}
};
@ -135,6 +140,7 @@ define([
inner_cell.append(this.celltoolbar.element);
var input_area = $('<div/>').addClass('input_area');
this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config);
this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this))
$(this.code_mirror.getInputField()).attr("spellcheck", "false");
inner_cell.append(input_area);
input.append(prompt).append(inner_cell);
@ -220,10 +226,11 @@ define([
}
// If we closed the tooltip, don't let CM or the global handlers
// handle this event.
event.stop();
event.codemirrorIgnore = true;
event.preventDefault();
return true;
} else if (event.keyCode === keycodes.tab && event.type === 'keydown' && event.shiftKey) {
if (editor.somethingSelected()){
if (editor.somethingSelected() || editor.getSelections().length !== 1){
var anchor = editor.getCursor("anchor");
var head = editor.getCursor("head");
if( anchor.line != head.line){
@ -231,12 +238,15 @@ define([
}
}
this.tooltip.request(that);
event.stop();
event.codemirrorIgnore = true;
event.preventDefault();
return true;
} else if (event.keyCode === keycodes.tab && event.type == 'keydown') {
// Tab completion.
this.tooltip.remove_and_cancel_tooltip();
if (editor.somethingSelected()) {
// completion does not work on multicursor, it might be possible though in some cases
if (editor.somethingSelected() || editor.getSelections().length > 1) {
return false;
}
var pre_cursor = editor.getRange({line:cur.line,ch:0},cur);
@ -245,7 +255,8 @@ define([
// is empty. In this case, let CodeMirror handle indentation.
return false;
} else {
event.stop();
event.codemirrorIgnore = true;
event.preventDefault();
this.completer.startCompletion();
return true;
}

@ -3,7 +3,18 @@
// callback to auto-load python mode, which is more likely not the best things
// to do, but at least the simple one for now.
CodeMirror.requireMode('python',function(){
(function(mod) {
if (typeof exports == "object" && typeof module == "object"){ // CommonJS
mod(require("codemirror/lib/codemirror"),
require("codemirror/mode/python/python")
);
} else if (typeof define == "function" && define.amd){ // AMD
define(["codemirror/lib/codemirror",
"codemirror/mode/python/python"], mod);
} else {// Plain browser env
mod(CodeMirror);
}
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("ipython", function(conf, parserConf) {

@ -1,44 +1,62 @@
// IPython GFM (GitHub Flavored Markdown) mode is just a slightly altered GFM
// Mode with support for latex.
// IPython GFM (GitHub Flavored Markdown) mode is just a slightly altered GFM
// Mode with support for latex.
//
// Latex support was supported by Codemirror GFM as of
// Latex support was supported by Codemirror GFM as of
// https://github.com/codemirror/CodeMirror/pull/567
// But was later removed in
// https://github.com/codemirror/CodeMirror/commit/d9c9f1b1ffe984aee41307f3e927f80d1f23590c
CodeMirror.requireMode('gfm', function(){
CodeMirror.requireMode('stex', function(){
CodeMirror.defineMode("ipythongfm", function(config, parserConfig) {
var gfm_mode = CodeMirror.getMode(config, "gfm");
var tex_mode = CodeMirror.getMode(config, "stex");
return CodeMirror.multiplexingMode(
gfm_mode,
{
open: "$", close: "$",
mode: tex_mode,
delimStyle: "delimit"
},
{
open: "$$", close: "$$",
mode: tex_mode,
delimStyle: "delimit"
},
{
open: "\\(", close: "\\)",
mode: tex_mode,
delimStyle: "delimit"
},
{
open: "\\[", close: "\\]",
mode: tex_mode,
delimStyle: "delimit"
}
// .. more multiplexed styles can follow here
);
}, 'gfm');
CodeMirror.defineMIME("text/x-ipythongfm", "ipythongfm");
});
});
(function(mod) {
if (typeof exports == "object" && typeof module == "object"){ // CommonJS
mod(require("codemirror/lib/codemirror")
,require("codemirror/addon/mode/multiplex")
,require("codemirror/mode/gfm/gfm")
,require("codemirror/mode/stex/stex")
);
} else if (typeof define == "function" && define.amd){ // AMD
define(["codemirror/lib/codemirror"
,"codemirror/addon/mode/multiplex"
,"codemirror/mode/python/python"
,"codemirror/mode/stex/stex"
], mod);
} else {// Plain browser env
mod(CodeMirror);
}
})( function(CodeMirror){
"use strict";
CodeMirror.defineMode("ipythongfm", function(config, parserConfig) {
var gfm_mode = CodeMirror.getMode(config, "gfm");
var tex_mode = CodeMirror.getMode(config, "stex");
return CodeMirror.multiplexingMode(
gfm_mode,
{
open: "$", close: "$",
mode: tex_mode,
delimStyle: "delimit"
},
{
// not sure this works as $$ is interpreted at (opening $, closing $, as defined just above)
open: "$$", close: "$$",
mode: tex_mode,
delimStyle: "delimit"
},
{
open: "\\(", close: "\\)",
mode: tex_mode,
delimStyle: "delimit"
},
{
open: "\\[", close: "\\]",
mode: tex_mode,
delimStyle: "delimit"
}
// .. more multiplexed styles can follow here
);
}, 'gfm');
CodeMirror.defineMIME("text/x-ipythongfm", "ipythongfm");
})

@ -7,7 +7,8 @@ define([
'base/js/utils',
'base/js/keyboard',
'notebook/js/contexthint',
], function(IPython, $, utils, keyboard) {
'codemirror/lib/codemirror',
], function(IPython, $, utils, keyboard, CodeMirror) {
"use strict";
// easier key mapping
@ -93,7 +94,7 @@ define([
Completer.prototype.startCompletion = function () {
// call for a 'first' completion, that will set the editor and do some
// special behavior like autopicking if only one completion available.
if (this.editor.somethingSelected()) return;
if (this.editor.somethingSelected()|| this.editor.getSelections().length > 1) return;
this.done = false;
// use to get focus back on opera
this.carry_on_completion(true);
@ -142,7 +143,7 @@ define([
}
// We want a single cursor position.
if (this.editor.somethingSelected()) {
if (this.editor.somethingSelected()|| this.editor.getSelections().length > 1) {
return;
}
@ -316,11 +317,15 @@ define([
// Enter
if (code == keycodes.enter) {
CodeMirror.e_stop(event);
event.codemirrorIgnore = true;
event._ipkmIgnore = true;
event.preventDefault();
this.pick();
// Escape or backspace
} else if (code == keycodes.esc || code == keycodes.backspace) {
CodeMirror.e_stop(event);
event.codemirrorIgnore = true;
event._ipkmIgnore = true;
event.preventDefault();
this.close();
} else if (code == keycodes.tab) {
//all the fastforwarding operation,
@ -339,7 +344,9 @@ define([
} else if (code == keycodes.up || code == keycodes.down) {
// need to do that to be able to move the arrow
// when on the first or last line ofo a code cell
CodeMirror.e_stop(event);
event.codemirrorIgnore = true;
event._ipkmIgnore = true;
event.preventDefault();
var options = this.sel.find('option');
var index = this.sel[0].selectedIndex;
@ -352,7 +359,7 @@ define([
index = Math.min(Math.max(index, 0), options.length-1);
this.sel[0].selectedIndex = index;
} else if (code == keycodes.pageup || code == keycodes.pagedown) {
CodeMirror.e_stop(event);
event._ipkmIgnore = true;
var options = this.sel.find('option');
var index = this.sel[0].selectedIndex;

@ -2,7 +2,7 @@
// Distributed under the terms of the Modified BSD License.
// highly adapted for codemiror jshint
define([], function() {
define(['codemirror/lib/codemirror'], function(CodeMirror) {
"use strict";
var forEach = function(arr, f) {

@ -1,5 +1,12 @@
// Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
/**
*
*
* @module keyboardmanager
* @namespace keyboardmanager
* @class KeyboardManager
*/
define([
'base/js/namespace',
@ -16,13 +23,15 @@ define([
var keycodes = keyboard.keycodes;
var KeyboardManager = function (options) {
// Constructor
//
// Parameters:
// options: dictionary
// Dictionary of keyword arguments.
// events: $(Events) instance
// pager: Pager instance
/**
* A class to deal with keyboard event and shortcut
*
* @class KeyboardManager
* @constructor
* @param options {dict} Dictionary of keyword arguments :
* @param options.events {$(Events)} instance
* @param options.pager: {Pager} pager instance
*/
this.mode = 'command';
this.enabled = true;
this.pager = options.pager;
@ -37,6 +46,22 @@ define([
this.edit_shortcuts.add_shortcuts(this.get_default_edit_shortcuts());
};
/**
* Return a dict of common shortcut
* @method get_default_common_shortcuts
*
* @example Example of returned shortcut
* ```
* 'shortcut-key': // a string representing the shortcut as dash separated value.
* // e.g. 'shift' , 'shift-enter', 'cmd-t'
* {
* help: String // user facing help string
* help_index: String // string used internally to order the shortcut on the quickhelp
* handler: function(event){return true|false} // function that takes an even as first and only parameter
* // and return a boolean indicating whether or not the event should been handled further.
* }
*```
*/
KeyboardManager.prototype.get_default_common_shortcuts = function() {
var that = this;
var shortcuts = {
@ -125,19 +150,17 @@ define([
handler : function (event) {
var index = that.notebook.get_selected_index();
var cell = that.notebook.get_cell(index);
if (cell && cell.at_top() && index !== 0) {
var cm = that.notebook.get_selected_cell().code_mirror;
var cur = cm.getCursor()
if (cell && cell.at_top() && index !== 0 && cur.ch === 0) {
event.preventDefault();
that.notebook.command_mode();
that.notebook.select_prev();
that.notebook.edit_mode();
var cm = that.notebook.get_selected_cell().code_mirror;
cm.setCursor(cm.lastLine(), 0);
return false;
} else if (cell) {
var cm = cell.code_mirror;
cm.execCommand('goLineUp');
return false;
}
return false;
}
},
'down' : {
@ -154,11 +177,8 @@ define([
var cm = that.notebook.get_selected_cell().code_mirror;
cm.setCursor(0, 0);
return false;
} else {
var cm = cell.code_mirror;
cm.execCommand('goLineDown');
return false;
}
return false;
}
},
'ctrl-shift--' : {
@ -488,6 +508,10 @@ define([
KeyboardManager.prototype.bind_events = function () {
var that = this;
$(document).keydown(function (event) {
if(event._ipkmIgnore==true||(event.originalEvent||{})._ipkmIgnore==true){
return false;
}
return that.handle_keydown(event);
});
};

@ -19,8 +19,9 @@ require([
'notebook/js/keyboardmanager',
'notebook/js/config',
'notebook/js/kernelselector',
// only loaded, not used:
'custom/custom',
'codemirror/lib/codemirror',
// only loaded, not used, please keep sure this is loaded last
'custom/custom'
], function(
IPython,
$,
@ -38,13 +39,19 @@ require([
savewidget,
keyboardmanager,
config,
kernelselector
kernelselector,
CodeMirror,
// please keep sure that even if not used, this is loaded last
custom
) {
"use strict";
// compat with old IPython, remove for IPython > 3.0
window.CodeMirror = CodeMirror;
var common_options = {
ws_url : utils.get_body_data("wsUrl"),
base_url : utils.get_body_data("baseUrl"),
ws_url : IPython.utils.get_body_data("wsUrl"),
notebook_path : utils.get_body_data("notebookPath"),
notebook_name : utils.get_body_data('notebookName')
};

@ -893,7 +893,7 @@ define([
* Insert an element at given cell index.
*
* @method _insert_element_at_index
* @param element {dom element} a cell element
* @param element {dom_element} a cell element
* @param [index] {int} a valid index where to inser cell
* @private
*
@ -1532,7 +1532,7 @@ define([
modename = newmode.name || newmode
that = this;
CodeMirror.requireMode(modename, function(){
utils.requireCodeMirrorMode(modename, function () {
$.map(that.get_cells(), function(cell, i) {
if (cell.cell_type === 'code'){
cell.code_mirror.setOption('mode', newmode);

@ -10,7 +10,10 @@ define([
'notebook/js/mathjaxutils',
'notebook/js/celltoolbar',
'components/marked/lib/marked',
], function(IPython, utils, $, cell, security, mathjaxutils, celltoolbar, marked) {
'codemirror/lib/codemirror',
'codemirror/mode/gfm/gfm',
'notebook/js/codemirror-ipythongfm'
], function(IPython,utils , $, cell, security, mathjaxutils, celltoolbar, marked, CodeMirror, gfm, ipgfm) {
"use strict";
var Cell = cell.Cell;

@ -11,7 +11,7 @@ define([
* A generic toolbar on which one can add button
* @class ToolBar
* @constructor
* @param {Dom object} selector
* @param {Dom_object} selector
*/
var ToolBar = function (selector, layout_manager) {
this.selector = selector;

@ -117,8 +117,7 @@ define([
Tooltip.prototype.showInPager = function (cell) {
// reexecute last call in pager by appending ? to show back in pager
var that = this;
this.events.trigger('open_with_text.Pager', that._reply.content);
this.events.trigger('open_with_text.Pager', this._reply.content);
this.remove_and_cancel_tooltip();
};
@ -208,7 +207,7 @@ define([
var msg_id = cell.kernel.inspect(text, cursor_pos, callbacks);
};
// make an imediate completion request
// make an immediate completion request
Tooltip.prototype.request = function (cell, hide_if_no_docstring) {
// request(codecell)
// Deal with extracting the text from the cell and counting
@ -222,10 +221,11 @@ define([
this._hide_if_no_docstring = hide_if_no_docstring;
if(editor.somethingSelected()){
// get only the most recent selection.
text = editor.getSelection();
}
// need a permanent handel to code_mirror for future auto recall
// need a permanent handle to code_mirror for future auto recall
this.code_mirror = editor;
// now we treat the different number of keypress
@ -325,7 +325,7 @@ define([
this.text.scrollTop(0);
};
// Backwards compatability.
// Backwards compatibility.
IPython.Tooltip = Tooltip;
return {'Tooltip': Tooltip};

@ -311,25 +311,6 @@ class="notebook_app"
{% block script %}
{{super()}}
<script src="{{ static_url("components/codemirror/lib/codemirror.js") }}" charset="utf-8"></script>
<script type="text/javascript">
CodeMirror.modeURL = "{{ static_url("components/codemirror/mode/%N/%N.js", include_version=False) }}";
</script>
<script src="{{ static_url("components/codemirror/addon/mode/loadmode.js") }}" charset="utf-8"></script>
<script src="{{ static_url("components/codemirror/addon/mode/multiplex.js") }}" charset="utf-8"></script>
<script src="{{ static_url("components/codemirror/addon/mode/overlay.js") }}" charset="utf-8"></script>
<script src="{{ static_url("components/codemirror/addon/edit/matchbrackets.js") }}" charset="utf-8"></script>
<script src="{{ static_url("components/codemirror/addon/edit/closebrackets.js") }}" charset="utf-8"></script>
<script src="{{ static_url("components/codemirror/addon/comment/comment.js") }}" charset="utf-8"></script>
<script src="{{ static_url("components/codemirror/mode/htmlmixed/htmlmixed.js") }}" charset="utf-8"></script>
<script src="{{ static_url("components/codemirror/mode/xml/xml.js") }}" charset="utf-8"></script>
<script src="{{ static_url("components/codemirror/mode/javascript/javascript.js") }}" charset="utf-8"></script>
<script src="{{ static_url("components/codemirror/mode/css/css.js") }}" charset="utf-8"></script>
<script src="{{ static_url("components/codemirror/mode/rst/rst.js") }}" charset="utf-8"></script>
<script src="{{ static_url("components/codemirror/mode/markdown/markdown.js") }}" charset="utf-8"></script>
<script src="{{ static_url("components/codemirror/mode/python/python.js") }}" charset="utf-8"></script>
<script src="{{ static_url("notebook/js/codemirror-ipython.js") }}" charset="utf-8"></script>
<script src="{{ static_url("notebook/js/codemirror-ipythongfm.js") }}" charset="utf-8"></script>
<script src="{{ static_url("notebook/js/main.js") }}" charset="utf-8"></script>

@ -28,6 +28,7 @@
jqueryui: 'components/jquery-ui/ui/minified/jquery-ui.min',
highlight: 'components/highlight.js/build/highlight.pack',
moment: "components/moment/moment",
codemirror: 'components/codemirror',
},
shim: {
underscore: {

Loading…
Cancel
Save