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
This commit is contained in:
parent
b4fea8c647
commit
6bb383a4a5
1 changed files with 5 additions and 0 deletions
|
|
@ -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" };
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue