Skip to content

Commit

Permalink
Fix subsequent loading of the same file on web
Browse files Browse the repository at this point in the history
The input element remembers its last selection and
doesn't trigger events if you select the same file.
  • Loading branch information
YuriSizov committed Dec 26, 2024
1 parent 8d21de1 commit a1a403b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions utils/FileDialogNativeWeb.gd
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func _file_selected(_event: JavaScriptObject) -> void:
var file_reader: JavaScriptObject = JavaScriptBridge.create_object("FileReader")
_add_event_handler(file_reader, "load", _file_loaded.bind(file_name))
file_reader.readAsArrayBuffer(_element.files[0])
_element.value = "" # Clear the input so the same file can be loaded in the future.


func _file_loaded(event: JavaScriptObject, filename: String) -> void:
Expand Down

0 comments on commit a1a403b

Please sign in to comment.