Skip to content

Commit a0564d7

Browse files
authored
fix: file upload (#203)
1 parent edb5932 commit a0564d7

File tree

1 file changed

+7
-17
lines changed
  • src/unfold/static/unfold/js

1 file changed

+7
-17
lines changed

src/unfold/static/unfold/js/app.js

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,13 @@ const dateTimeShortcutsOverlay = () => {
5959
* File upload path
6060
*************************************************************/
6161
const fileInputUpdatePath = () => {
62-
const updateFilePath = () => {
63-
Array.from(document.querySelectorAll("input[type=file]")).forEach(
64-
(input) => {
65-
input.addEventListener("change", (e) => {
66-
const parts = e.target.value.split("\\");
67-
const placeholder =
68-
input.parentNode.parentNode.querySelector("input[type=text]");
69-
placeholder.setAttribute("value", parts[parts.length - 1]);
70-
});
71-
}
72-
);
73-
};
74-
75-
updateFilePath();
76-
77-
document.addEventListener("DOMNodeInserted", (e) => {
78-
updateFilePath();
62+
Array.from(document.querySelectorAll("input[type=file]")).forEach((input) => {
63+
input.addEventListener("change", (e) => {
64+
const parts = e.target.value.split("\\");
65+
const placeholder =
66+
input.parentNode.parentNode.querySelector("input[type=text]");
67+
placeholder.setAttribute("value", parts[parts.length - 1]);
68+
});
7969
});
8070
};
8171

0 commit comments

Comments
 (0)