Created
September 12, 2024 11:08
-
-
Save Zmetser/9e9d182124586063b921b9cb4a4c7d4d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
diff --git a/Maze/Shared/Views/Editor/EditorView.swift b/Maze/Shared/Views/Editor/EditorView.swift | |
index 6f7ef845..c49d0822 100644 | |
--- a/Maze/Shared/Views/Editor/EditorView.swift | |
+++ b/Maze/Shared/Views/Editor/EditorView.swift | |
@@ -55,11 +55,11 @@ struct EditorView: View { | |
.onDisappear { | |
// Only run when the view is visible to the user. | |
// Disables running when navigating away from the screen. This prevents self.focusEditor to throw a runtime error | |
- if isPresented { | |
- if !disableBlurHandler && isFocused { | |
- let cleanedUpText = self.previousContent.trimmingCharacters(in: .whitespacesAndNewlines) | |
+ if isPresented, !disableBlurHandler && isFocused { | |
+ // TODO: damn, why do we need to use previousContent exactly? | |
+ let cleanedUpText = self.previousContent.trimmingCharacters(in: .whitespacesAndNewlines) | |
+ if !cleanedUpText.isEmpty { | |
// Save with previous value, see: .onChange(of: self.content | |
- // TODO: damn, why do we need to use previousContent exactly? | |
self.onEditorBlur(content: .text(value: cleanedUpText), submitType: .Blur) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment