mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-05 03:08:12 +08:00
Tidy up the full frontend codebase and use optional chaining where possible (#620)
* Tidy up the full frontend codebase and use optional chaining where possible * Code review changes
This commit is contained in:
@@ -21,12 +21,13 @@ export async function upload(acceptedEextensions: string): Promise<{ filename: s
|
||||
element.addEventListener(
|
||||
"change",
|
||||
async () => {
|
||||
if (!element.files || !element.files.length) return;
|
||||
const file = element.files[0];
|
||||
const filename = file.name;
|
||||
const content = await file.text();
|
||||
if (element.files?.length) {
|
||||
const file = element.files[0];
|
||||
const filename = file.name;
|
||||
const content = await file.text();
|
||||
|
||||
resolve({ filename, content });
|
||||
resolve({ filename, content });
|
||||
}
|
||||
},
|
||||
{ capture: false, once: true }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user