-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding appendChild fix for GWT game input, to see if it works in Safari.
- Loading branch information
1 parent
5eea774
commit 950b015
Showing
1 changed file
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,8 +280,12 @@ private final native void showHtmlOpenFileDialog(String type, GwtOpenFileResults | |
console.log('Finished creating input element of type file'); | ||
document.body.appendChild(fileInputElem); | ||
// The change event occurs after a file is chosen. | ||
fileInputElem.addEventListener("change", function(event) { | ||
document.body.removeChild(fileInputElem); | ||
if (this.files.length === 0) { | ||
console.log('No files selected for import'); | ||
|
@@ -319,6 +323,15 @@ private final native void showHtmlOpenFileDialog(String type, GwtOpenFileResults | |
} | ||
}); | ||
fileInputElem.addEventListener("cancel", function(event) { | ||
document.body.removeChild(fileInputElem); | ||
console.log('Open file dialog was cancelled.'); | ||
// No file was selected, so nothing more to do. | ||
[email protected]::onFileResultsReady([Lcom/agifans/agile/gwt/GwtOpenFileResult;)([]); | ||
}); | ||
// Trigger the display of the open file dialog. | ||
fileInputElem.click(); | ||
|