Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Basthon
Basthon Notebook
Commits
8c5b6520
Commit
8c5b6520
authored
Oct 22, 2020
by
Romain Casati
Browse files
Support for loading external files (to then load from Python).
parent
3288a322
Pipeline
#354648
passed with stages
in 7 minutes and 8 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
notebook/static/notebook/js/notebook.js
View file @
8c5b6520
...
...
@@ -3182,13 +3182,22 @@ pas fonctionner avec certains navigateurs.
input
.
type
=
'
file
'
;
input
.
style
.
display
=
"
none
"
;
input
.
onchange
=
function
(
event
)
{
/* TODO: connect filename to notebook name */
const
file
=
event
.
target
.
files
[
0
];
var
reader
=
new
FileReader
();
reader
.
readAsText
(
file
);
reader
.
onload
=
function
(
event
)
{
that
.
load
(
JSON
.
parse
(
event
.
target
.
result
));
};
for
(
var
file
of
event
.
target
.
files
)
{
const
ext
=
file
.
name
.
split
(
'
.
'
).
pop
();
var
reader
=
new
FileReader
();
if
(
ext
===
'
ipynb
'
)
{
/* TODO: connect filename to notebook name */
reader
.
readAsText
(
file
);
reader
.
onload
=
function
(
event
)
{
that
.
load
(
JSON
.
parse
(
event
.
target
.
result
));
};
}
else
{
reader
.
readAsArrayBuffer
(
file
);
reader
.
onload
=
function
(
event
)
{
Basthon
.
putFile
(
file
.
name
,
event
.
target
.
result
);
};
}
}
};
document
.
body
.
appendChild
(
input
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment