Commit 6bb383a4 authored by Steven's avatar Steven

fix: prevent CTRL+Enter save while editor is loading content (#5581)

- Add validation check for loading state before allowing save
- Prevents false "Content, attachment, or file required" error
- Occurs when user presses CTRL+Enter immediately after opening edit mode
- Editor state may still be loading when keyboard shortcut fires

Closes #5581
parent b4fea8c6
...@@ -7,6 +7,11 @@ export interface ValidationResult { ...@@ -7,6 +7,11 @@ export interface ValidationResult {
export const validationService = { export const validationService = {
canSave(state: EditorState): ValidationResult { canSave(state: EditorState): ValidationResult {
// Cannot save while loading initial content
if (state.ui.isLoading.loading) {
return { valid: false, reason: "Loading memo content" };
}
// Must have content, attachment, or local file // Must have content, attachment, or local file
if (!state.content.trim() && state.metadata.attachments.length === 0 && state.localFiles.length === 0) { if (!state.content.trim() && state.metadata.attachments.length === 0 && state.localFiles.length === 0) {
return { valid: false, reason: "Content, attachment, or file required" }; return { valid: false, reason: "Content, attachment, or file required" };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment