Skip to content

Conversation

@spaghetti-coder
Copy link
Contributor

@spaghetti-coder spaghetti-coder commented Dec 9, 2025

Fixes #5330

Additional changes:

  1. Added a few commands. Criteria for adding a command:
    1. Present in other similar editors, basically same as 1.2
    2. Often needed (one can argue that details is not one of them, but IMO point 1.3 is the exact reason)
    3. Hard to recall / too long to type
  2. Fixed an issue from this comment

 
Demo:

demo-shortkeys-1.mp4

@spaghetti-coder spaghetti-coder changed the title Fix/cmd cursor offset Commands fixes and updates Dec 9, 2025
@boojack boojack requested a review from Copilot December 10, 2025 01:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes command functionality in the memo editor by updating the cursor positioning system and adding new commands. It addresses issue #5330 and fixes a click interaction bug in the suggestions popup. The main changes include:

  • Migrating from cursorOffset to cursorRange to support text selection after command insertion
  • Adding three new commands: details, image, and youtube
  • Fixing a focus-loss issue when clicking suggestion items by adding preventDefault()
  • Updating existing commands to use the new cursor positioning system with text selection

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
web/src/components/MemoEditor/Editor/commands.ts Replaces cursorOffset with cursorRange array format, adds details, image, and youtube commands, updates existing commands to select relevant placeholders
web/src/components/MemoEditor/Editor/CommandSuggestions.tsx Implements cursor positioning logic to handle the new cursorRange format with text selection support
web/src/components/MemoEditor/Editor/SuggestionsPopup.tsx Adds preventDefault() to mouse down handler to prevent focus loss when selecting suggestions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@spaghetti-coder spaghetti-coder force-pushed the fix/cmd-cursor-offset branch 3 times, most recently from c08c7c5 to a2c8873 Compare December 10, 2025 11:13
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.

Wrong commands cursor offset

1 participant