Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile: Drawing: Fix clicking "cancel" after starting a new drawing in editing mode creates an empty resource #10986

Conversation

personalizedrefrigerator
Copy link
Collaborator

Summary

This pull request fixes an issue related to this forum post. Previously,

  1. opening a note in edit mode,
  2. clicking "Attach drawing", and
  3. clicking "Close"

would attach an empty drawing to the current note, which may cause sync to fail for some sync targets.

Testing plan

  1. Create a new note.
  2. Verify that the note editor (and not the viewer) is open.
  3. Open the note action menu.
  4. Click "Draw picture".
  5. Click "Close".
  6. Verify that no drawing has been added.
  7. Open the note action menu.
  8. Click "Draw picture".
  9. Draw something.
  10. Click "Close".
  11. Click "Save changes".
  12. Verify that an image has been inserted.
  13. Move the cursor to the beginning of the editor.
  14. Open the note action menu.
  15. Click "Draw picture".
  16. Draw something.
  17. Click "save".
  18. Verify that "save" is greyed out/disabled.
  19. Click "Close".
  20. Verify that a new drawing has been added to the beginning of the note.
  21. Switch to the note viewer.
  22. Open the note action menu.
  23. Click "Draw picture".
  24. Draw something.
  25. Click "close".
  26. Click "Discard changes".
  27. Verify that no new drawing has been attached.
  28. Open the note action menu.
  29. Click "Draw picture".
  30. Draw something.
  31. Click "save", then "close".
  32. Verify that a new drawing has been added to the end of the note.

This has been tested successfully on:

  • An iOS 17 simulator.
  • Web (Safari on MacOS).
  • Android 13

Comment on lines +328 to +330
} else if (json.action === 'save-and-close') {
await props.onSave(json.data);
onRequestCloseEditor(json.promptIfUnsaved);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new save-and-close action was added to fix an issue on iOS where clicking "Close" then "Save changes" would attach duplicates of a drawing. This saves before the editor starts loading (rather than during). See #10431.

@laurent22 laurent22 merged commit 04f5433 into laurent22:dev Sep 7, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants