feat(web): rich text paste from Clipboard using HTML #2009
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Support Rich Text Pasting with HTML on the Web.
Importing any file from
web
directly will cause a compile issue on non-web platforms even if we're usingkIsWeb
to check the platform, so I used conditional import by importing a file that mocks the implementation for non-web platforms, for web will import the real implementation that is intended for web and use theweb
package.This process is error-prone and can cause issues when moving the files and refactoring the imports since the IDE doesn't update the conditional import path and the compiler only causes issues when compiling to the web, which is why the GitHub workflow build the example app for both Web and Linux (a non-web platform).
Also the
_pasteMarkdown
and_pasteHTML
are no longer accessible toquill_controller_web_stub.dart
as it's in a separate file, I didn't make them public since they are intended for internal use only, so I moved them into a separate file that's not exported, I have noticed we're making some APIs public because we need them somewhere else internally, making more breaking changes when there is a need.The deprecated APIs should be in their own separate file since we can move them somewhere else and export the file and still be backward compatible, maybe we need a new directory such as
deprecated
at some pointRelated Issues
Previously, some assertions were failing, some of them were not caused by this feature but related to it.
Suggestions
Remove the
meta
package fromflutter_quill
since it's already available in Flutter and exposed as a public API, it's required indart_quill_delta
We should probably deprecate the experimental function
QuillController.setContents
, it's misleading and doesn't work the same as Quill JS. It's not being used internally.disableClipboard
is not quite a descriptive name or I might have not understood it correctly, it says:I'm not sure if it disables all Clipboard features including the
Clipboard
from Flutter or only the Rich text pasting feature. See related PR #1719.Checklist
Breaking Change
Does your PR require developers to manually update their apps to accommodate your change?
!
in the title as explained in Conventional Commits).