Skip to content

Conversation

@kagol
Copy link
Member

@kagol kagol commented Jan 23, 2026

PR

close #441 #402

before:

TinyEditor粘贴图片-before

after:

TinyEditor粘贴图片-after

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Bug Fixes
    • Improved cursor positioning after pasting content; the cursor now correctly moves to the end of pasted material
    • Enhanced handling of non-text content pastes (images, mentions) with accurate cursor placement calculations

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added the bug Something isn't working label Jan 23, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

The custom clipboard module now calculates cursor position after paste operations using the original line index plus pasted content length, and extends delta operation length calculation to include non-string inserts such as images and embedded objects with a unit contribution.

Changes

Cohort / File(s) Summary
Custom Clipboard Cursor Logic
packages/fluent-editor/src/modules/custom-clipboard.ts
Modified cursor positioning after paste to use original line index plus pasted content length; updated delta length calculation to count object inserts (images, mentions) as contributing 1 unit each

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A paste, a hop, a cursor flies,
Through lines of text with delta ties,
Objects count, from one to more,
The clipboard keeper opens doors! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kagol/fix-image-paste

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kagol kagol merged commit d3c6df9 into dev Jan 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [Bug]: 复制粘贴图片位置不准确,并且会多粘贴一个 "image" 的字样

2 participants