fix(editor): unify editor exit handling by megayu · Pull Request #13802 · logseq/logseq · GitHub
Skip to content

fix(editor): unify editor exit handling - #13802

Open
megayu wants to merge 2 commits into
masterfrom
fix/unify-editor-exit
Open

megayu wants to merge 2 commits into
masterfrom
fix/unify-editor-exit

Conversation

@megayu

@megayu megayu commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Route outside clicks, block switching, and page-reference navigation through the same save-and-exit flow. Each path now flushes the current input before clearing editing state, while preserving any editor opened during the save.
Separate outside-click and Escape event handling, and remove the unused exit callback and obsolete test.

Validation

  • 124 unit tests and 9 browser E2E tests passed.
  • Covered block switching, outside clicks, navigation, and draft persistence after reload, including cases with an editor popup open.
  • Corrected an existing navigation assertion to wait for the destination title.
  • Compilation, lint, and diff checks passed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Navigation can unmount the source editor before save completion, causing cleanup to skip stale editing state.

1 open issue
What changed in this PR

Unifies editor exits around saving the current input while preserving any newly opened editor.

Changes:

  • Routes outside clicks, block switches, and page-reference navigation through shared exit handling.
  • Separates Escape handling from outside-click handling.
  • Adds draft-persistence coverage and improves a navigation assertion.
File Description
src/​test/​frontend/​handler/​editor_test.cljs Removes an obsolete exit-handler test.
src/​main/​frontend/​handler/​editor.cljs Centralizes save-and-exit behavior with input flushing.
src/​main/​frontend/​components/​editor.cljs Separates outside-click and Escape handling.
src/​main/​frontend/​components/​block.cljs Uses shared exit handling when switching blocks.
clj-e2e/​test/​logseq/​e2e/​editor_basic_test.clj Tests draft persistence and waits for navigation completion.

Review effort: Balanced

Comment thread src/main/frontend/handler/editor.cljs
@megayu
megayu requested a review from tiensonqin October 19, 2026 09:08
@tiensonqin
tiensonqin force-pushed the fix/unify-editor-exit branch from 4846448 to 69459d9 Compare October 19, 2026 10:01

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants