-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[RNMobile][Embed block] Block settings #33654
Changes from all commits
f81e528
7dc7923
abc6857
6ecadb1
c78c547
bef5578
9ecad94
3bb454c
5359651
3e77c78
036c0e7
c77768e
a037f0c
596ef52
14076e2
e9a9886
d602e75
3d1117a
d90ce3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -16,6 +16,7 @@ import { useSelect } from '@wordpress/data'; | |||||||||||||||||||||
import { store as editorStore } from '@wordpress/editor'; | ||||||||||||||||||||||
import { BottomSheet, Icon, TextControl } from '@wordpress/components'; | ||||||||||||||||||||||
import { help } from '@wordpress/icons'; | ||||||||||||||||||||||
import { BlockIcon } from '@wordpress/block-editor'; | ||||||||||||||||||||||
|
||||||||||||||||||||||
/** | ||||||||||||||||||||||
* Internal dependencies | ||||||||||||||||||||||
|
@@ -38,10 +39,6 @@ const EmbedNoPreview = ( { label, icon, isSelected, onPress } ) => { | |||||||||||||||||||||
styles.embed__label, | ||||||||||||||||||||||
styles[ 'embed__label--dark' ] | ||||||||||||||||||||||
); | ||||||||||||||||||||||
const embedIconStyle = usePreferredColorSchemeStyle( | ||||||||||||||||||||||
styles.embed__icon, | ||||||||||||||||||||||
styles[ 'embed__icon--dark' ] | ||||||||||||||||||||||
); | ||||||||||||||||||||||
const descriptionStyle = usePreferredColorSchemeStyle( | ||||||||||||||||||||||
styles.embed__description, | ||||||||||||||||||||||
styles[ 'embed__description--dark' ] | ||||||||||||||||||||||
|
@@ -118,7 +115,7 @@ const EmbedNoPreview = ( { label, icon, isSelected, onPress } ) => { | |||||||||||||||||||||
onPress={ onPressContainer } | ||||||||||||||||||||||
> | ||||||||||||||||||||||
<View style={ containerStyle }> | ||||||||||||||||||||||
<Icon icon={ icon } fill={ embedIconStyle.fill } /> | ||||||||||||||||||||||
<BlockIcon icon={ icon } /> | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that we've enabled all the variations, icons can also be objects: gutenberg/packages/block-library/src/embed/icons.js Lines 26 to 35 in 3e77c78
BlockIcon component was used in the web version and it handles this case as well.
|
||||||||||||||||||||||
<Text style={ labelStyle }>{ label }</Text> | ||||||||||||||||||||||
<Text style={ descriptionStyle }> | ||||||||||||||||||||||
{ __( 'Embed previews not yet available' ) } | ||||||||||||||||||||||
|
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,3 +1,8 @@ | ||||||||||||
/** | ||||||||||||
* External dependencies | ||||||||||||
*/ | ||||||||||||
import { isFunction } from 'lodash'; | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* WordPress dependencies | ||||||||||||
*/ | ||||||||||||
|
@@ -11,15 +16,16 @@ const ToggleControl = memo( | |||||||||||
( { label, checked, help, instanceId, className, onChange, ...props } ) => { | ||||||||||||
const id = `inspector-toggle-control-${ instanceId }`; | ||||||||||||
|
||||||||||||
const helpLabel = help && isFunction( help ) ? help( checked ) : help; | ||||||||||||
|
||||||||||||
return ( | ||||||||||||
<SwitchCell | ||||||||||||
label={ label } | ||||||||||||
id={ id } | ||||||||||||
help={ help } | ||||||||||||
help={ helpLabel } | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed that on Android when tapping over the "Resize for smaller devices" element the ripple animation covers also the help message, not sure if this is expected 🤔 . Screen_Recording_20210813-153056_WordPress.Pre-Alpha.mp4There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I didn't make changes around that in this PR. I've checked with Audio Block settings and it seems to be the same there. Pressing directly on the toggle doesn't create that effect, so I guess it could be the bottom sheet row being a touchable that's making that happen. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, looks like this is related to the fact that the help message is rendered within the gutenberg/packages/components/src/mobile/bottom-sheet/cell.native.js Lines 397 to 401 in b77066b
If we're using it in other places I guess it's expected, thanks for checking it 🙇 . |
||||||||||||
className={ className } | ||||||||||||
value={ checked } | ||||||||||||
onValueChange={ onChange } | ||||||||||||
aria-describedby={ !! help ? id + '__help' : undefined } | ||||||||||||
{ ...props } | ||||||||||||
/> | ||||||||||||
); | ||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -6,7 +6,7 @@ import apiFetch from '@wordpress/api-fetch'; | |||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
// Please add only wp.org API paths here! | ||||||||||||||||||||||||||||||||||||||||||||||
const SUPPORTED_ENDPOINTS = [ | ||||||||||||||||||||||||||||||||||||||||||||||
/wp\/v2\/(media|categories|blocks)\/?\d*?.*/i, | ||||||||||||||||||||||||||||||||||||||||||||||
/wp\/v2\/(media|categories|blocks|themes)\/?\d*?.*/i, | ||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering if we should fetch theme data via the bridge instead of directly making the API request, for other values like colors or gradients, we're getting them from the editor settings: gutenberg/packages/react-native-bridge/ios/Gutenberg.swift Lines 193 to 214 in 59530f3
From my POV it's totally ok to fetch from the editor but we might have issues for supporting offline mode, wdyt? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried fetching it from the bridge on WPiOS via WordPressKit-iOS, but it seems like the /wp-block-editor/v1/settings endpoint is used instead of /wp/v2/themes if the blog supports it here and the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Right, I checked the schema of NOTE: I noticed that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the response from /sites/%@/themes/mine also doesn't return the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, I'm afraid that this could turn more complex than what we would expect for this task. At this point, I'd lean towards stick with using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, opened an issue for this: wordpress-mobile/gutenberg-mobile#3825 |
||||||||||||||||||||||||||||||||||||||||||||||
/wp\/v2\/search\?.*/i, | ||||||||||||||||||||||||||||||||||||||||||||||
/oembed\/1\.0\/proxy\?.*/i, | ||||||||||||||||||||||||||||||||||||||||||||||
]; | ||||||||||||||||||||||||||||||||||||||||||||||
|
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.
Normally the embed variations were hidden from the inserter as we had an empty
embed/variations.native.js
file (which I deleted in this PR). We needed to re-enable those as the information if an embed supports this setting is kept in theattributes
there with theresponsive
flag:gutenberg/packages/block-library/src/embed/variations.js
Line 44 in 3e77c78
This should also help us when we add a few more variations for wordpress-mobile/gutenberg-mobile#3278