Skip to content

Provide default native implementation of ClipboardService without external dependencies #2229

Closed
@EchoEllet

Description

@EchoEllet

Is there an existing issue for this?

Use case

The functionality of Flutter Clipboard is limited and only supports retrieving the content as plain text since the implementation can be different on each platform, there is no standard.

This leads us to use plugins for accessing the platform APIs we need for some features, such as rich text pasting, which allows the user to copy content from websites and apps and paste them into the editor, with the links, styles, etc...

Why replace pasteboard with super_clipboard?

Previously, we were using pasteboard for accessing the clipboard, I had to replace it with super_clipboard since it lacks support for Android (for all methods), and not all functions support all platforms, the static getter html only supports Windows and Web and it doesn't seem to work on Web either since web require registering the paste event. It also was a bit outdated (2y since the last update on pub.dev), it has been updated recently (8 days ago) to support Flutter/WASM.

Why moved super_clipboardto flutter_quill_extensions?

super_clipboard uses Rust to access platform APIs and a bridge, which seems to be experimental and caused a lot of build failure issues for a lot of users, some of the issues are in runtime and are unexpected, I have tried it out on Linux and macOS without any issues other than it takes long to build the app for the first time. So we had to exclude it from flutter_quill and move it to flutter_quill_extensions, which also requires calling a function manually to use the plugin implementation.

It also requires minSdkVersion to be at least 23 which seems to be an issue since some apps still use 19 or 21.

See #1914 for more details.

Why move super_clipboard into its own package/module?

I initially wanted to move super_clipboard into its own package (quill_super_clipboard) to allow flutter_quill users to use it without flutter_quill_extensions and users of flutter_quill_extensions to use the extensions package without super_clipbaord. We were interested in having fewer dependencies on the user's project.

Since those issues still persist, we will introduce a breaking change and move the super_clipboard outside of flutter_quill_extensions.

What about rich_clipboard?

It has been discontinued.

What would be the replacement?

As a replacement, we will provide a default native implementation for the functionalities we need instead of relying on third-party plugins. We have introduced quill_native_bridge in #2194 and removed device_info_plus to have more control over the implementation, only the functionalities we need which result in a more lightweight package, and fewer issues and conflicts with the user dependencies if a major breaking release introduced in a dependency, you can update directly without having to update the Flutter Quill project first, when a new feature comes out in Flutter, like a major breaking release such as support for Flutter/WASM or breaking changes in Dart or updating Android Gradle Plugin, we can update the project directly from this repo.

If we manage to get this feature working on all platforms, you probably won't need pasteboard or super_clipboard for this feature anymore.

We only need a way to access the HTML and Markdown from the system clipboard (regardless if it was a file or a text copied from an app or website).

Web

we have already introduced support for this feature in #2009 using paste_event,. There seems to be an issue, see #2220.

Clipboard API has restrictions on Firefox and Safari.

Mobile (Android and iOS)

Desktop

Proposal

QuillNativeBridgeAndroidDemo.mov
QuillNativeBridgeIosDemo.mov
Screenshot

image

Web support of rich text pasting is missing (need to solve #2220).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestin progressThis issue or feature is currently being worked on by someone.minorMinimal impact or cosmetic issue. Can be resolved at a later time without affecting overall function

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions