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