Skip to content

fix: resolve the issue of having an additional image label when copying images directly from the editor to the clipboard#462

Open
wuyiping0628 wants to merge 1 commit intodevfrom
wyp/position-0319
Open

fix: resolve the issue of having an additional image label when copying images directly from the editor to the clipboard#462
wuyiping0628 wants to merge 1 commit intodevfrom
wyp/position-0319

Conversation

@wuyiping0628
Copy link
Collaborator

@wuyiping0628 wuyiping0628 commented Mar 23, 2026

…ing images directly from the editor to the clipboard

PR

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: #402

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Chores

    • Enhanced internal debugging for clipboard operations.
  • Bug Fixes

    • Improved clipboard file upload handling to use a more reliable method for image processing.

…ing images directly from the editor to the clipboard
@github-actions github-actions bot added the bug Something isn't working label Mar 23, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2026

Walkthrough

Modified clipboard handling in the fluent-editor custom clipboard module by adding debug logging to three functions and refactoring the files2urls method to use an asynchronous URL retrieval approach instead of direct file upload operations.

Changes

Cohort / File(s) Summary
Custom Clipboard Module
packages/fluent-editor/src/modules/custom-clipboard.ts
Added synchronous debug logging to prepareMatching, onCaptureCopy, and onCapturePaste functions. Changed files2urls to call this.quill.uploader.getFileUrls() asynchronously instead of this.quill.uploader.upload(), returning the first URL or undefined per image.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A clipboard for files, now smarter and bright,
With logs that shine through the debugging night,
URLs flow async where uploads once grew,
This fluent-eared bunny says: "Carrot-config true!" 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main change: fixing the issue of an additional image label appearing when copying images from the editor to the clipboard, which aligns with the code changes to the clipboard handling logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wyp/position-0319

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/fluent-editor/src/modules/custom-clipboard.ts`:
- Line 26: Remove the temporary debug console.log calls (e.g. console.log(1111,
'prepareMatching'), and the other debug lines with 2222 and 333) from
custom-clipboard code; replace them with appropriate logging (console.warn/error
or the project logger) only if needed to preserve runtime warnings, or simply
delete them to satisfy the no-console ESLint rule and clean up the code; look
for the 'prepareMatching' debug message and other console.log(...) occurrences
and remove or convert them accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1a6ee70b-f8a4-47c5-8771-40ff31765df7

📥 Commits

Reviewing files that changed from the base of the PR and between 270a8cd and d1e74ee.

📒 Files selected for processing (1)
  • packages/fluent-editor/src/modules/custom-clipboard.ts

declare quill: FluentEditor

prepareMatching(container: HTMLElement, nodeMatches) {
console.log(1111, 'prepareMatching');
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove debug console.log statements before merging.

These debug statements with numeric identifiers (1111, 2222, 333) appear to be temporary debugging artifacts that should not be committed. ESLint also flags these as violations of the no-console rule which only permits warn and error methods.

🐛 Proposed fix to remove debug statements

At line 26:

 prepareMatching(container: HTMLElement, nodeMatches) {
-    console.log(1111, 'prepareMatching');
     const elementMatchers = []

At line 60:

 onCaptureCopy(e, isCut = false) {
-    console.log(2222, 'onCaptureCopy');
     if (e.defaultPrevented) {

At lines 96-97:

 onCapturePaste(e: ClipboardEvent) {
-    console.log(333, 'onCapturePaste');
-    
     if (e.defaultPrevented || !this.quill.isEnabled()) {

Also applies to: 60-60, 96-97

🧰 Tools
🪛 ESLint

[error] 26-26: Unexpected console statement. Only these console methods are allowed: warn, error.

(no-console)


[error] 26-26: Extra semicolon.

(style/semi)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/fluent-editor/src/modules/custom-clipboard.ts` at line 26, Remove
the temporary debug console.log calls (e.g. console.log(1111,
'prepareMatching'), and the other debug lines with 2222 and 333) from
custom-clipboard code; replace them with appropriate logging (console.warn/error
or the project logger) only if needed to preserve runtime warnings, or simply
delete them to satisfy the no-console ESLint rule and clean up the code; look
for the 'prepareMatching' debug message and other console.log(...) occurrences
and remove or convert them accordingly.

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.

1 participant