From e580ea62141ac8f0c4707f8d1bde6d79c19a2404 Mon Sep 17 00:00:00 2001 From: Prozilla Date: Sat, 29 Jul 2023 18:07:12 +0200 Subject: [PATCH] Added ability for app to close its window --- src/components/applications/text-editor/TextEditor.jsx | 3 ++- src/components/windows/Window.jsx | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/applications/text-editor/TextEditor.jsx b/src/components/applications/text-editor/TextEditor.jsx index da29fb9..ec4fc69 100644 --- a/src/components/applications/text-editor/TextEditor.jsx +++ b/src/components/applications/text-editor/TextEditor.jsx @@ -8,7 +8,7 @@ import { HeaderMenu } from "../.common/HeaderMenu.jsx"; * @param {Object} props * @param {VirtualFile} props.file */ -export function TextEditor({ file, setTitle }) { +export function TextEditor({ file, setTitle, close }) { const [currentFile, setCurrentFile] = useState(file); const [content, setContent] = useState(file?.content); const [unsavedChanges, setUnsavedChanges] = useState(false); @@ -62,6 +62,7 @@ export function TextEditor({ file, setTitle }) { onNew={newText} onSave={saveText} onSaveAs={saveTextAs} + onExit={() => { close(); }} />