-
-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathapi.js
More file actions
33 lines (30 loc) · 1.14 KB
/
api.js
File metadata and controls
33 lines (30 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
define([
'require'
, 'jquery'
, 'nbextensions/visualpython/src/common/vpCommon'
], function (requirejs, $, vpCommon) {
// fileNavigation 등의 hotkey 제어 input text 인 경우 포커스를 가지면 핫키 막고 잃으면 핫키 허용
var controlToggleInput = function() {
$(`#vp_fileNavigation`).on("focus", ".fileNavigationPage-container input[type='text']", function() {
Jupyter.notebook.keyboard_manager.disable();
});
$(`#vp_fileNavigation`).on("blur", ".fileNavigationPage-container input[type='text']", function() {
Jupyter.notebook.keyboard_manager.enable();
});
}
var importVisualPythonData = function(file, callback) {
var rawFile = new XMLHttpRequest();
rawFile.overrideMimeType("application/json");
rawFile.open("GET", file, true);
rawFile.onreadystatechange = function() {
if (rawFile.readyState === 4 && rawFile.status == "200") {
callback(rawFile.responseText);
}
}
rawFile.send(null);
}
return {
controlToggleInput
, importVisualPythonData
}
});