Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita598153

Browse files
author
minjk-bl
committed
CHROME: added codemirror ipython mode and some missing codes
1 parentc154b51 commita598153

File tree

2 files changed

+47
-5
lines changed

2 files changed

+47
-5
lines changed

‎js/com/component/PopupComponent.js‎

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,41 @@
1212
//============================================================================
1313
// [CLASS] PopupComponent
1414
//============================================================================
15+
// CHROME: notebook/js/codemirror-ipython
16+
(function(mod){
17+
if(typeofexports=="object"&&typeofmodule=="object"){// CommonJS
18+
mod(requirejs("codemirror/lib/codemirror"),
19+
requirejs("codemirror/mode/python/python")
20+
);
21+
}elseif(typeofdefine=="function"&&define.amd){// AMD
22+
define('notebook/js/codemirror-ipython',["codemirror/lib/codemirror",
23+
"codemirror/mode/python/python"],mod);
24+
}else{// Plain browser env
25+
mod(CodeMirror);
26+
}
27+
})(function(CodeMirror){
28+
"use strict";
29+
30+
CodeMirror.defineMode("ipython",function(conf,parserConf){
31+
varpythonConf={};
32+
for(varpropinparserConf){
33+
if(parserConf.hasOwnProperty(prop)){
34+
pythonConf[prop]=parserConf[prop];
35+
}
36+
}
37+
pythonConf.name='python';
38+
pythonConf.singleOperators=newRegExp("^[\\+\\-\\*/%&|@\\^~<>!\\?]");
39+
if(pythonConf.version===3){
40+
pythonConf.identifiers=newRegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*");
41+
}elseif(pythonConf.version===2){
42+
pythonConf.identifiers=newRegExp("^[_A-Za-z][_A-Za-z0-9]*");
43+
}
44+
returnCodeMirror.getMode(conf,pythonConf);
45+
},'python');
46+
47+
CodeMirror.defineMIME("text/x-ipython","ipython");
48+
});
49+
1550
define([
1651
'text!vp_base/html/component/popupComponent.html!strip',
1752
'css!vp_base/css/component/popupComponent',
@@ -25,9 +60,9 @@ define([
2560
/** codemirror */
2661
'codemirror/lib/codemirror',
2762
'codemirror/mode/python/python',
28-
'notebook/js/codemirror-ipython',
2963
'codemirror/addon/display/placeholder',
30-
'codemirror/addon/display/autorefresh'
64+
'codemirror/addon/display/autorefresh',
65+
'notebook/js/codemirror-ipython'
3166
],function(popupComponentHtml,popupComponentCss
3267
,com_util,com_Const,com_String,com_interface,Component,DataSelector,codemirror
3368
){

‎js/loadVisualpython.js‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//============================================================================
1313
// Load Visual Python
1414
//============================================================================
15+
// CHROME: removed code
16+
define([
1517
// CHROME: removed .css extension type
1618
'css!vp_base/css/root',
1719
'vp_base/js/com/com_Const',
@@ -27,7 +29,7 @@
2729
//========================================================================
2830
// Define variable
2931
//========================================================================
30-
varJupyter;
32+
varJupyter=null;
3133
varevents;
3234
varliveNotebook=false;
3335

@@ -149,7 +151,9 @@
149151
/**
150152
* visualpython config util
151153
*/
152-
window.vpConfig=newcom_Config();
154+
// CHROME: added extType as 'chrome'
155+
// window.vpConfig = new com_Config();
156+
window.vpConfig=newcom_Config('chrome');
153157
window.VP_MODE_TYPE=com_Config.MODE_TYPE;
154158
/**
155159
* visualpython kernel
@@ -236,7 +240,10 @@
236240
letcfg=readConfig();
237241

238242
vpConfig.readKernelFunction();
239-
_addToolBarVpButton();
243+
// CHROME: edited
244+
if(Jupyter){
245+
_addToolBarVpButton();
246+
}
240247
_loadVpResource(cfg);
241248
_checkVersion();
242249

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp