Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jonathan Wilkes
purr-data
Commits
cfd09b29
Commit
cfd09b29
authored
Jul 21, 2021
by
Jonathan Wilkes
Browse files
Merge branch 'prakhar/purr-data-open_files' into emscripten
parents
c43d3b38
a87c8361
Pipeline
#3684
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
emscripten/project/purr-data/components/menu/menu.html
View file @
cfd09b29
...
...
@@ -8,7 +8,7 @@
<label>
<li
id=
"file-open"
>
</li>
<input
id=
"uploadPatch"
type=
"file"
onchange=
"pdbundle.pdgui.upload_patch(this.files)"
multiple
>
<input
id=
"uploadPatch"
type=
"file"
accept=
".pd"
onchange=
"pdbundle.pdgui.upload_patch(this.files)"
multiple
>
</label>
<!-- Recent Files submenu -->
...
...
pd/nw/pdgui.js
View file @
cfd09b29
...
...
@@ -2035,6 +2035,25 @@ function upload_patch(files) {
return
;
}
var
fileInput
=
document
.
getElementById
(
"
uploadPatch
"
);
var
allowedExtension
=
"
.pd
"
;
// Check that the file extension is supported.
// If not, clear the input.
var
hasInvalidFiles
=
false
;
for
(
var
i
=
0
;
i
<
files
.
length
;
i
++
)
{
var
file
=
files
[
i
];
if
(
!
file
.
name
.
endsWith
(
allowedExtension
))
{
hasInvalidFiles
=
true
;
}
}
if
(
hasInvalidFiles
)
{
fileInput
.
value
=
""
;
alert
(
"
Unsupported file selected.
"
);
}
for
(
const
file
of
files
){
var
reader
=
new
FileReader
();
reader
.
onload
=
function
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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