diff --git a/packages/block-editor/src/components/block-list/block.native.js b/packages/block-editor/src/components/block-list/block.native.js
index 018cf4760a07eb..c81a2d5469ecc1 100644
--- a/packages/block-editor/src/components/block-list/block.native.js
+++ b/packages/block-editor/src/components/block-list/block.native.js
@@ -48,11 +48,13 @@ function BlockForType( {
parentWidth,
wrapperProps,
blockWidth,
+ baseGlobalStyles,
} ) {
const defaultColors = useSetting( 'color.palette' ) || emptyArray;
const globalStyle = useGlobalStyles();
const mergedStyle = useMemo( () => {
return getMergedGlobalStyles(
+ baseGlobalStyles,
globalStyle,
wrapperProps.style,
attributes,
@@ -300,6 +302,7 @@ export default compose( [
withSelect( ( select, { clientId, rootClientId } ) => {
const {
getBlockIndex,
+ getSettings,
isBlockSelected,
__unstableGetBlockWithoutInnerBlocks,
getSelectedBlockClientId,
@@ -347,6 +350,9 @@ export default compose( [
isDescendantOfParentSelected ||
isParentSelected ||
parentId === '';
+ const baseGlobalStyles = getSettings()
+ ?.__experimentalGlobalStylesBaseStyles;
+
return {
icon,
name: name || 'core/missing',
@@ -360,6 +366,7 @@ export default compose( [
isParentSelected,
firstToSelectId,
isTouchable,
+ baseGlobalStyles,
wrapperProps: getWrapperProps(
attributes,
blockType.getEditWrapperProps
diff --git a/packages/block-editor/src/components/provider/index.native.js b/packages/block-editor/src/components/provider/index.native.js
index 157cd72d1f237b..8851a2b9b47a15 100644
--- a/packages/block-editor/src/components/provider/index.native.js
+++ b/packages/block-editor/src/components/provider/index.native.js
@@ -10,6 +10,7 @@ import { useEffect } from '@wordpress/element';
import withRegistryProvider from './with-registry-provider';
import useBlockSync from './use-block-sync';
import { store as blockEditorStore } from '../../store';
+import { BlockRefsProvider } from './block-refs-provider';
/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */
@@ -24,7 +25,7 @@ function BlockEditorProvider( props ) {
// Syncs the entity provider with changes in the block-editor store.
useBlockSync( props );
- return children;
+ return { children };
}
export default withRegistryProvider( BlockEditorProvider );
diff --git a/packages/block-editor/src/hooks/color.js b/packages/block-editor/src/hooks/color.js
index 554781d057b5fd..2da9875c07584f 100644
--- a/packages/block-editor/src/hooks/color.js
+++ b/packages/block-editor/src/hooks/color.js
@@ -234,7 +234,7 @@ export function ColorEdit( props ) {
localAttributes.current = attributes;
}, [ attributes ] );
- if ( ! hasColorSupport( blockName ) || Platform.OS !== 'web' ) {
+ if ( ! hasColorSupport( blockName ) ) {
return null;
}
diff --git a/packages/block-library/src/paragraph/edit.native.js b/packages/block-library/src/paragraph/edit.native.js
index a51a708a222767..1cd75758543006 100644
--- a/packages/block-library/src/paragraph/edit.native.js
+++ b/packages/block-library/src/paragraph/edit.native.js
@@ -30,6 +30,11 @@ function ParagraphBlock( {
const { align, content, placeholder } = attributes;
const styles = {
+ ...( mergedStyle?.baseColors && {
+ color: mergedStyle.baseColors?.color?.text,
+ placeholderColor: mergedStyle.baseColors?.color?.text,
+ linkColor: mergedStyle.baseColors?.elements?.link?.color?.text,
+ } ),
...mergedStyle,
...style,
};
diff --git a/packages/components/src/mobile/global-styles-context/index.native.js b/packages/components/src/mobile/global-styles-context/index.native.js
index 81a60ccc8eb56e..1d4d0d45be6761 100644
--- a/packages/components/src/mobile/global-styles-context/index.native.js
+++ b/packages/components/src/mobile/global-styles-context/index.native.js
@@ -22,16 +22,21 @@ const GlobalStylesContext = createContext( { style: {} } );
GlobalStylesContext.BLOCK_STYLE_ATTRIBUTES = BLOCK_STYLE_ATTRIBUTES;
export const getMergedGlobalStyles = (
+ baseGlobalStyles,
globalStyle,
wrapperPropsStyle,
blockAttributes,
defaultColors
) => {
+ const baseGlobalColors = {
+ baseColors: baseGlobalStyles || {},
+ };
const blockStyleAttributes = pick(
blockAttributes,
BLOCK_STYLE_ATTRIBUTES
);
const mergedStyle = {
+ ...baseGlobalColors,
...globalStyle,
...wrapperPropsStyle,
};
diff --git a/packages/edit-post/src/components/layout/index.native.js b/packages/edit-post/src/components/layout/index.native.js
index f0abe54cfc9e97..d98bae6739ef59 100644
--- a/packages/edit-post/src/components/layout/index.native.js
+++ b/packages/edit-post/src/components/layout/index.native.js
@@ -9,7 +9,11 @@ import SafeArea from 'react-native-safe-area';
*/
import { Component } from '@wordpress/element';
import { withSelect } from '@wordpress/data';
-import { BottomSheetSettings, FloatingToolbar } from '@wordpress/block-editor';
+import {
+ BottomSheetSettings,
+ FloatingToolbar,
+ store as blockEditorStore,
+} from '@wordpress/block-editor';
import { compose, withPreferredColorScheme } from '@wordpress/compose';
import {
HTMLTextInput,
@@ -101,7 +105,7 @@ class Layout extends Component {
}
render() {
- const { getStylesFromColorScheme, mode } = this.props;
+ const { getStylesFromColorScheme, mode, globalStyles } = this.props;
const isHtmlView = mode === 'text';
@@ -118,6 +122,16 @@ class Layout extends Component {
bottom: this.state.safeAreaInsets.bottom,
};
+ const editorStyles = [
+ getStylesFromColorScheme(
+ styles.background,
+ styles.backgroundDark
+ ),
+ globalStyles?.background && {
+ backgroundColor: globalStyles.background,
+ },
+ ];
+
return (
-
+
{ isHtmlView ? this.renderHTML() : this.renderVisual() }
{ ! isHtmlView && Platform.OS === 'android' && (
@@ -176,9 +185,14 @@ export default compose( [
editorStore
);
const { getEditorMode } = select( editPostStore );
+ const { getSettings } = select( blockEditorStore );
+ const globalStyles = getSettings()?.__experimentalGlobalStylesBaseStyles
+ ?.color;
+
return {
isReady: isEditorReady(),
mode: getEditorMode(),
+ globalStyles,
};
} ),
withPreferredColorScheme,
diff --git a/packages/editor/src/components/post-title/index.native.js b/packages/editor/src/components/post-title/index.native.js
index 0587f26227ec83..4e117f73fb315b 100644
--- a/packages/editor/src/components/post-title/index.native.js
+++ b/packages/editor/src/components/post-title/index.native.js
@@ -19,6 +19,8 @@ import { withFocusOutside } from '@wordpress/components';
import { withInstanceId, compose } from '@wordpress/compose';
import { __, sprintf } from '@wordpress/i18n';
import { pasteHandler } from '@wordpress/blocks';
+import { store as blockEditorStore } from '@wordpress/block-editor';
+import { store as editorStore } from '@wordpress/editor';
/**
* Internal dependencies
@@ -107,12 +109,20 @@ class PostTitle extends Component {
borderStyle,
isDimmed,
postType,
+ globalStyles,
} = this.props;
const decodedPlaceholder = decodeEntities( placeholder );
const borderColor = this.props.isSelected
? focusedBorderColor
: 'transparent';
+ const titleStyles = {
+ ...style,
+ ...( globalStyles?.text && {
+ color: globalStyles.text,
+ placeholderColor: globalStyles.text,
+ } ),
+ };
return (
{
const { isPostTitleSelected, getEditedPostAttribute } = select(
- 'core/editor'
- );
-
- const { getSelectedBlockClientId, getBlockRootClientId } = select(
- 'core/block-editor'
+ editorStore
);
+ const {
+ getSelectedBlockClientId,
+ getBlockRootClientId,
+ getSettings,
+ } = select( blockEditorStore );
const selectedId = getSelectedBlockClientId();
const selectionIsNested = !! getBlockRootClientId( selectedId );
+ const globalStyles = getSettings()?.__experimentalGlobalStylesBaseStyles
+ ?.color;
return {
postType: getEditedPostAttribute( 'type' ),
isAnyBlockSelected: !! selectedId,
isSelected: isPostTitleSelected(),
isDimmed: selectionIsNested,
+ globalStyles,
};
} ),
withDispatch( ( dispatch ) => {
const { undo, redo, togglePostTitleSelection } = dispatch(
- 'core/editor'
+ editorStore
);
const { clearSelectedBlock, insertDefaultBlock } = dispatch(
- 'core/block-editor'
+ blockEditorStore
);
return {
diff --git a/packages/rich-text/src/component/index.native.js b/packages/rich-text/src/component/index.native.js
index 195de53e802fed..8f5afcc4857168 100644
--- a/packages/rich-text/src/component/index.native.js
+++ b/packages/rich-text/src/component/index.native.js
@@ -3,21 +3,18 @@
/**
* External dependencies
*/
+import { View, Platform } from 'react-native';
+import { get, pickBy, debounce, isString } from 'lodash';
+import memize from 'memize';
+
/**
* WordPress dependencies
*/
import RCTAztecView from '@wordpress/react-native-aztec';
-import { View, Platform } from 'react-native';
import {
showUserSuggestions,
showXpostSuggestions,
} from '@wordpress/react-native-bridge';
-import { get, pickBy, debounce, isString } from 'lodash';
-import memize from 'memize';
-
-/**
- * WordPress dependencies
- */
import { BlockFormatControls } from '@wordpress/block-editor';
import { Component } from '@wordpress/element';
import { compose, withPreferredColorScheme } from '@wordpress/compose';
@@ -982,10 +979,12 @@ export class RichText extends Component {
text: html,
eventCount: this.lastEventCount,
selection,
- linkTextColor: defaultTextDecorationColor,
+ linkTextColor:
+ style?.linkColor || defaultTextDecorationColor,
} }
placeholder={ this.props.placeholder }
placeholderTextColor={
+ style?.placeholderColor ||
this.props.placeholderTextColor ||
defaultPlaceholderTextColor
}