Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clipboard image pasting #2384

Merged
merged 1 commit into from
Nov 17, 2024
Merged

Conversation

Maksim-Nikolaev
Copy link
Contributor

@Maksim-Nikolaev Maksim-Nikolaev commented Nov 16, 2024

Description

Fix clipboard image pasting by checking if "onImagePaste" and/or "onGifPaste" handlers are provided in the clipboardConfig before handling the plainText (since it is not null if image/gif is present).

Related Issues

Type of Change

  • Feature: New functionality without breaking existing features.
  • 🛠️ Bug fix: Resolves an issue without altering current behavior.
  • 🧹 Refactor: Code reorganization, no behavior change.
  • Breaking: Alters existing functionality and requires updates.
  • 🧪 Tests: New or modified tests
  • 📝 Documentation: Updates or additions to documentation.
  • 🗑️ Chore: Routine tasks, or maintenance.
  • Build configuration change: Build/configuration changes.

Video demonstration:

Behavior before:

broken.mp4

Behavior after:

fixed.mp4

@EchoEllet
Copy link
Collaborator

Thanks for the contribution. I will review it soon, though this PR fix #2323 too.

@Maksim-Nikolaev
Copy link
Contributor Author

Thanks for the contribution. I will review it soon, though this PR fix #2323 too.

Thanks. I edited the message to include Issue #2323

Let me know if you have any questions or need help testing.

Copy link
Collaborator

@EchoEllet EchoEllet left a comment

Choose a reason for hiding this comment

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

The issue is related to the Flutter Clipboard service retrieving plain text (more details in #2323). It does not occur using super_clipboard. The plugin quill_native_bridge doesn't provide getClipboardText though it's possible to.

I previously avoided this change:

  • The image clipboard paste was within the QuillRawEditorState and the plain text was in QuillController (before feat!: release version 11.0.0 with breaking changes #2338).
  • To avoid regressions, since this is not tested and it's possible by only updating quill_native_bridge to provide getClipboardText and then replace Clipboard.getData(Clipboard.kTextPlain).

I will merge as I don't plan on adding more feature to quill_native_bridge for now.

@EchoEllet
Copy link
Collaborator

EchoEllet commented Nov 17, 2024

## [Unreleased]

+ ### Fixed
+
+ - Fixed a bug where clipboard images were pasted as plain text on Android [#2384](https://github.com/singerdmx/flutter-quill/pull/2384).

@EchoEllet EchoEllet merged commit c804c08 into singerdmx:master Nov 17, 2024
2 of 3 checks passed
EchoEllet added a commit that referenced this pull request Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants