-
Notifications
You must be signed in to change notification settings - Fork 210
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
feat: Add contentInsertionConfiguration to editor and text input service #691
feat: Add contentInsertionConfiguration to editor and text input service #691
Conversation
1158589
to
a0a8ebf
Compare
allowedMimeTypes: widget.contentInsertionConfiguration == null | ||
? const <String>[] | ||
: widget.contentInsertionConfiguration!.allowedMimeTypes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allowedMimeTypes: widget.contentInsertionConfiguration == null | |
? const <String>[] | |
: widget.contentInsertionConfiguration!.allowedMimeTypes, | |
allowedMimeTypes: | |
widget.contentInsertionConfiguration?.allowedMimeTypes ?? [], |
example/pubspec.yaml
Outdated
@@ -43,6 +43,7 @@ dependencies: | |||
highlight: ^0.7.0 | |||
http: ^1.1.0 | |||
show_fps: ^1.0.6 | |||
path: ^1.8.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it because of the "depend_on_referenced_packages" lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
Hi, @stevenosse. Thanks for contributing. Have you tried using the |
Here is how it looks like: screen-20240128-212248.1.online-video-cutter.com.mp4On some Xiaomi devices, when a user takes a screenshot, it's added to their clipboard (on WhatsApp, they can select that image from their clipboard and it's sent as an image). |
@stevenosse Nice inspiration. Could you also share your code sample for implementing the 'insert image from clipboard' feature here, so that other developers can refer to it? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #691 +/- ##
==========================================
+ Coverage 76.46% 76.48% +0.02%
==========================================
Files 295 295
Lines 13094 13315 +221
==========================================
+ Hits 10012 10184 +172
- Misses 3082 3131 +49 ☔ View full report in Codecov by Sentry. |
Sure ! AppFlowyEditor(
editorStyle: editorStyle,
editorState: editorState,
editorScrollController: editorScrollController,
blockComponentBuilders: blockComponentBuilders,
showMagnifier: true,
// showcase 3: customize the header and footer.
header: Padding(
padding: const EdgeInsets.only(bottom: 10.0),
child: Image.asset(
'assets/images/header.png',
),
),
footer: const SizedBox(
height: 100,
),
/// Usage of content insertion configuration
contentInsertionConfiguration: ContentInsertionConfiguration(
allowedMimeTypes: ['image/gif', 'image/png'],
onContentInserted: (content) async {
if (content.data != null) {
final tmpDir = await getTemporaryDirectory();
final filename = path.basename(content.uri);
final file = File('${tmpDir.path}/$filename');
await file.writeAsBytes(content.data!);
editorState.insertImageNode(file.path);
}
},
),
), |
* main: chore: bump version 2.3.1 (AppFlowy-IO#697) feat: add contentInsertionConfiguration to editor and text input service (AppFlowy-IO#691) fix: add support for breakline and divider (AppFlowy-IO#690) chore: translate commands (AppFlowy-IO#687)
Description
This PR Adds support for
contentInsertionConfiguration
attribute that allows the usage of Android's image keyboard to Flutter.See: https://api.flutter.dev/flutter/material/TextField/contentInsertionConfiguration.html
Impact
This will allow the handling of more complex clipboard contents pastes (like images), or insertion of gifs and stickers
Linked issue: #646