-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add support for xpost suggestions on mobile #26211
Conversation
Size Change: 0 B Total Size: 1.28 MB ℹ️ View Unchanged
|
1e6d21d
to
0ae4415
Compare
4957240
to
524311b
Compare
Update it to the new callback function
This is limited to Android at this time
524311b
to
cf73fbd
Compare
Long-pressing the @-mentions toolbar button will now let the user add an Xpost or an @-mention
The addition of the xposts modal in e730f2e broke these snapshot tests.
Because using Toolbar with a label prop is deprecated: https://github.com/WordPress/gutenberg/blob/af768dc98c625e33de8023084c6a5c198c52f8ef/packages/components/src/toolbar/index.js#L30-L34
packages/react-native-editor/android/app/src/main/java/com/gutenberg/MainApplication.java
Show resolved
Hide resolved
packages/react-native-editor/ios/GutenbergDemo/GutenbergViewController.swift
Show resolved
Hide resolved
👋 @jhnstn! If you have a chance, I would appreciate it if you could take a look at the js code in this PR. |
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.
Demo app looks great, as well as the rest of the changes here.
👋 @mchowning and @guarani , please add some testing steps (here or in the gutenberg-mobile PR), thanks! |
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.
Working great from my perspective! Tested demo apps on both platforms, I think this is ready to merge.
Thanks @mchowning!
icon: plus, | ||
}, | ||
]; | ||
return allOptions.filter( ( op ) => op.supported ); |
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 personally prefer using functional flows like using filter
here but I think it might be more familiar to build allOptions
with conditionals (i.e.) :
const allOptions = [];
if ( areMentionsSupported ) {
allOptions.push({<option object>})
}
if ( areXPostsSupported ) {
allOptions.push({<option object>})
}
return allOptions;
const { keyCode } = event; | ||
const triggeredOption = this.suggestionOptions().find( ( option ) => { |
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.
Can the return from this.suggestionOptions
be memorized to a class property so doesn't have to be called on every key code event?
@mchowning looks good! I left a few comments but nothing blocking. Edit: apologies for the late review, I hadn't updated my notifications on Github when I got the ping. |
Description
Adding xpost handling for mobile
Related:
How has this been tested?
In the demo app:
@
toolbar button and choose Crosspost to insert a dummy Xpost.@
toolbar button and choose Mention to check that a mention is still inserted@
button to make sure that a mention is still insertedScreenshots
Types of changes
Checklist: