Skip to content

Conversation

@draphy
Copy link
Contributor

@draphy draphy commented Jan 27, 2026

Issues

Fixes #2616

Description

replaceGenericContentEditable used el.textContent = value, which destroys DOM structure and loses cursor position. This affects editors like Notion that fall through to the generic handler.

Now tries surgical replacement via selectSpanInEditor + replaceTextInRange first, falling back to the original behavior if that fails.

Also extracts testBasicSuggestionRichText and testCanIgnoreRichTextSuggestion shared test utilities (matching the existing testMultipleSuggestionsAndUndo pattern) and adds cursor position verification to the basic suggestion test.

How Has This Been Tested?

The basic suggestion test now verifies cursor position by using ArrowRight×3 + Backspace from the expected cursor position.

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes

@draphy draphy force-pushed the fix/generic-contenteditable-cursor-position branch from dff390b to 986822a Compare January 27, 2026 20:44
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.

Cursor jumps to start of text block after applying suggestion in Notion

1 participant