-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mobile] Add support for full-width/wide alignment options (#24598)
* Mobile - Full / Wide alignment support * Mobile - Full / Width alignment support: wide setting improvements * Mobile - Full / Wide alignment support - Custom align native hook to filter unsupported blocks * Mobile - Full / Wide alignment support - margin improvements and fixes * Mobile - BlockListItem - Remove unused selector * Mobile - Full / Wide alignments - props order * Mobile - Full / wide alignment - use declared const * Mobile - Full / Wide alignment - Remove right / left support * Mobile - Full width / wide alignment - Add Imade block support and Group appender fix * Mobile - Full width / wide alignment - Cover and group improvements * Mobile - Full width / wide alignments - Improve margins * Mobile - Full width / wide alignment options - Fix appender and selected border for full width blocks * Mobile - Full width / wide alignment - Update margins * Mobile - Wide / full width alignments - Margin fixes and improvements * Mobile - Full width / wide alignment fix margins and max width * Mobile - Remove unused style * Mobile - Full-width / wide alignment options - Restore cover paddings for inner blocks * Mobile - Full width / wide alignments update breakpoints * Mobile - Full-width / Wide alignments - Improve max width and margins for smaller screens * Mobile - Full-width / Wide alignments - Remove unused variable * Mobile - Full-width / Wide alignments - New utils with alignments and breakpoints * Mobile - Full-width fix for Android devices window width * React Native Editor - Update changelog
- Loading branch information
Gerardo Pacheco
authored
Sep 4, 2020
1 parent
b1c8026
commit 8ba0a42
Showing
21 changed files
with
383 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/block-editor/src/components/block-list/block-list-item.native.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.stretch { | ||
flex: 1; | ||
} | ||
|
||
.fullAlignment { | ||
margin-left: 0; | ||
width: 100%; | ||
} | ||
|
||
.fullAlignmentPadding { | ||
padding: $block-edge-to-content; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { without } from 'lodash'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { addFilter } from '@wordpress/hooks'; | ||
import { hasBlockSupport } from '@wordpress/blocks'; | ||
import { WIDE_ALIGNMENTS } from '@wordpress/components'; | ||
|
||
const ALIGNMENTS = [ 'left', 'center', 'right' ]; | ||
|
||
export { AlignmentHookSettingsProvider } from './align.js'; | ||
|
||
// Used to filter out blocks that don't support wide/full alignment on mobile | ||
addFilter( | ||
'blocks.registerBlockType', | ||
'core/react-native-editor/align', | ||
( settings, name ) => { | ||
if ( | ||
! WIDE_ALIGNMENTS.supportedBlocks.includes( name ) && | ||
hasBlockSupport( settings, 'align' ) | ||
) { | ||
const blockAlign = settings.supports.align; | ||
|
||
settings.supports = { | ||
...settings.supports, | ||
align: Array.isArray( blockAlign ) | ||
? without( | ||
blockAlign, | ||
...Object.values( WIDE_ALIGNMENTS.alignments ) | ||
) | ||
: blockAlign, | ||
alignWide: false, | ||
}; | ||
settings.attributes = { | ||
...settings.attributes, | ||
align: { | ||
type: 'string', | ||
// Allow for '' since it is used by updateAlignment function | ||
// in withToolbarControls for special cases with defined default values. | ||
enum: [ ...ALIGNMENTS, '' ], | ||
}, | ||
}; | ||
} | ||
|
||
return settings; | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
export { AlignmentHookSettingsProvider } from './align'; | ||
import { AlignmentHookSettingsProvider } from './align'; | ||
import './anchor'; | ||
import './custom-class-name'; | ||
import './generated-class-name'; | ||
import './style'; | ||
import './color'; | ||
import './font-size'; | ||
|
||
export { AlignmentHookSettingsProvider }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { | ||
PREFERENCES_DEFAULTS, | ||
SETTINGS_DEFAULTS as SETTINGS, | ||
} from './defaults.js'; | ||
|
||
const SETTINGS_DEFAULTS = { | ||
...SETTINGS, | ||
alignWide: true, | ||
}; | ||
|
||
export { PREFERENCES_DEFAULTS, SETTINGS_DEFAULTS }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,10 @@ | |
z-index: 4; | ||
} | ||
|
||
.image { | ||
width: 100%; | ||
} | ||
|
||
.colorPaletteWrapper { | ||
min-height: 50px; | ||
} | ||
|
Oops, something went wrong.