Show More
@@ -30,9 +30,9 define([ | |||
|
30 | 30 | * @param: |
|
31 | 31 | * options: dictionary |
|
32 | 32 | * Dictionary of keyword arguments. |
|
33 |
* events: $(Events) instance |
|
|
33 | * events: $(Events) instance | |
|
34 | 34 | * config: dictionary |
|
35 |
* keyboard_manager: KeyboardManager instance |
|
|
35 | * keyboard_manager: KeyboardManager instance | |
|
36 | 36 | */ |
|
37 | 37 | options = options || {}; |
|
38 | 38 | this.keyboard_manager = options.keyboard_manager; |
@@ -183,7 +183,7 define([ | |||
|
183 | 183 | if((cur.line !== 0 || cur.ch !==0) && event.keyCode === 38){ |
|
184 | 184 | event._ipkmIgnore = true; |
|
185 | 185 | } |
|
186 |
var nLastLine = editor.lastLine() |
|
|
186 | var nLastLine = editor.lastLine() | |
|
187 | 187 | if( ( event.keyCode === 40) |
|
188 | 188 | && (( cur.line !== nLastLine) |
|
189 | 189 | || ( cur.ch !== editor.getLineHandle(nLastLine).text.length)) |
@@ -192,8 +192,8 define([ | |||
|
192 | 192 | } |
|
193 | 193 | // if this is an edit_shortcuts shortcut, the global keyboard/shortcut |
|
194 | 194 | // manager will handle it |
|
195 |
if (shortcuts.handles(event)) { |
|
|
196 |
return true; |
|
|
195 | if (shortcuts.handles(event)) { | |
|
196 | return true; | |
|
197 | 197 | } |
|
198 | 198 | |
|
199 | 199 | return false; |
@@ -543,26 +543,26 define([ | |||
|
543 | 543 | } |
|
544 | 544 | var open = modes[mode].open || "%%"; |
|
545 | 545 | var close = modes[mode].close || "%%end"; |
|
546 | var mmode = mode; | |
|
547 | mode = mmode.substr(6); | |
|
548 | if(current_mode == mmode){ | |
|
546 | var magic_mode = mode; | |
|
547 | mode = magic_mode.substr(6); | |
|
548 | if(current_mode == magic_mode){ | |
|
549 | 549 | return; |
|
550 | 550 | } |
|
551 | 551 | utils.requireCodeMirrorMode(mode, function () { |
|
552 | 552 | // create on the fly a mode that switch between |
|
553 | 553 | // plain/text and something else, otherwise `%%` is |
|
554 | 554 | // source of some highlight issues. |
|
555 | CodeMirror.defineMode(mmode, function(config) { | |
|
555 | CodeMirror.defineMode(magic_mode, function(config) { | |
|
556 | 556 | return CodeMirror.multiplexingMode( |
|
557 | 557 | CodeMirror.getMode(config, 'text/plain'), |
|
558 | // always set someting on close | |
|
558 | // always set something on close | |
|
559 | 559 | {open: open, close: close, |
|
560 | 560 | mode: CodeMirror.getMode(config, mode), |
|
561 | 561 | delimStyle: "delimit" |
|
562 | 562 | } |
|
563 | 563 | ); |
|
564 | 564 | }); |
|
565 | that.code_mirror.setOption('mode', mmode); | |
|
565 | that.code_mirror.setOption('mode', magic_mode); | |
|
566 | 566 | }); |
|
567 | 567 | return; |
|
568 | 568 | } |
@@ -5,18 +5,18 | |||
|
5 | 5 | |
|
6 | 6 | (function(mod) { |
|
7 | 7 | if (typeof exports == "object" && typeof module == "object"){ // CommonJS |
|
8 |
mod(require("codemirror/lib/codemirror"), |
|
|
8 | mod(require("codemirror/lib/codemirror"), | |
|
9 | 9 | require("codemirror/mode/python/python") |
|
10 | 10 | ); |
|
11 | 11 | } else if (typeof define == "function" && define.amd){ // AMD |
|
12 |
define(["codemirror/lib/codemirror", |
|
|
12 | define(["codemirror/lib/codemirror", | |
|
13 | 13 | "codemirror/mode/python/python"], mod); |
|
14 | 14 | } else {// Plain browser env |
|
15 | 15 | mod(CodeMirror); |
|
16 | 16 | } |
|
17 | 17 | })(function(CodeMirror) { |
|
18 | 18 | "use strict"; |
|
19 | ||
|
19 | ||
|
20 | 20 | CodeMirror.defineMode("ipython", function(conf, parserConf) { |
|
21 | 21 | var pythonConf = {}; |
|
22 | 22 | for (var prop in parserConf) { |
@@ -36,4 +36,3 | |||
|
36 | 36 | |
|
37 | 37 | CodeMirror.defineMIME("text/x-ipython", "ipython"); |
|
38 | 38 | }) |
|
39 |
@@ -1,7 +1,7 | |||
|
1 |
// IPython GFM (GitHub Flavored Markdown) mode is just a slightly altered GFM |
|
|
2 |
// Mode with support for latex. |
|
|
1 | // IPython GFM (GitHub Flavored Markdown) mode is just a slightly altered GFM | |
|
2 | // Mode with support for latex. | |
|
3 | 3 | // |
|
4 |
// Latex support was supported by Codemirror GFM as of |
|
|
4 | // Latex support was supported by Codemirror GFM as of | |
|
5 | 5 | // https://github.com/codemirror/CodeMirror/pull/567 |
|
6 | 6 | // But was later removed in |
|
7 | 7 | // https://github.com/codemirror/CodeMirror/commit/d9c9f1b1ffe984aee41307f3e927f80d1f23590c |
@@ -15,7 +15,7 | |||
|
15 | 15 | ,require("codemirror/mode/stex/stex") |
|
16 | 16 | ); |
|
17 | 17 | } else if (typeof define == "function" && define.amd){ // AMD |
|
18 |
define(["codemirror/lib/codemirror" |
|
|
18 | define(["codemirror/lib/codemirror" | |
|
19 | 19 | ,"codemirror/addon/mode/multiplex" |
|
20 | 20 | ,"codemirror/mode/python/python" |
|
21 | 21 | ,"codemirror/mode/stex/stex" |
@@ -27,10 +27,10 | |||
|
27 | 27 | "use strict"; |
|
28 | 28 | |
|
29 | 29 | CodeMirror.defineMode("ipythongfm", function(config, parserConfig) { |
|
30 | ||
|
30 | ||
|
31 | 31 | var gfm_mode = CodeMirror.getMode(config, "gfm"); |
|
32 | 32 | var tex_mode = CodeMirror.getMode(config, "stex"); |
|
33 | ||
|
33 | ||
|
34 | 34 | return CodeMirror.multiplexingMode( |
|
35 | 35 | gfm_mode, |
|
36 | 36 | { |
@@ -57,8 +57,6 | |||
|
57 | 57 | // .. more multiplexed styles can follow here |
|
58 | 58 | ); |
|
59 | 59 | }, 'gfm'); |
|
60 | ||
|
61 | CodeMirror.defineMIME("text/x-ipythongfm", "ipythongfm"); | |
|
62 | ||
|
63 | 60 | |
|
61 | CodeMirror.defineMIME("text/x-ipythongfm", "ipythongfm"); | |
|
64 | 62 | }) |
General Comments 0
You need to be logged in to leave comments.
Login now