Skip to content
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

Move transform styles function to blockEditor package. #15572

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/block-editor/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ import './store';
import './hooks';

export * from './components';
export * from './utils';

export { SETTINGS_DEFAULTS } from './store/defaults';
4 changes: 4 additions & 0 deletions packages/block-editor/src/utils/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Internal dependencies
*/
export { default as __experimentalTransformStyles } from './transform-styles';
9 changes: 6 additions & 3 deletions packages/block-library/src/html/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
*/
import { __ } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { BlockControls, PlainText } from '@wordpress/block-editor';
import { transformStyles } from '@wordpress/editor';
import {
BlockControls,
PlainText,
__experimentalTransformStyles,
} from '@wordpress/block-editor';
import { Disabled, SandBox } from '@wordpress/components';
import { withSelect } from '@wordpress/data';

Expand Down Expand Up @@ -35,7 +38,7 @@ class HTMLEdit extends Component {

this.setState( { styles: [
defaultStyles,
...transformStyles( styles ),
...__experimentalTransformStyles( styles ),
] } );
}

Expand Down
5 changes: 2 additions & 3 deletions packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ import { compose } from '@wordpress/compose';
import { Component } from '@wordpress/element';
import { withDispatch, withSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { BlockEditorProvider } from '@wordpress/block-editor';
import { BlockEditorProvider, __experimentalTransformStyles } from '@wordpress/block-editor';
import apiFetch from '@wordpress/api-fetch';
import { addQueryArgs } from '@wordpress/url';
import { decodeEntities } from '@wordpress/html-entities';

/**
* Internal dependencies
*/
import transformStyles from '../../editor-styles';
import { mediaUpload } from '../../utils';
import ReusableBlocksButtons from '../reusable-blocks-buttons';

Expand Down Expand Up @@ -111,7 +110,7 @@ class EditorProvider extends Component {
return;
}

const updatedStyles = transformStyles( this.props.settings.styles, '.editor-styles-wrapper' );
const updatedStyles = __experimentalTransformStyles( this.props.settings.styles, '.editor-styles-wrapper' );

map( updatedStyles, ( updatedCSS ) => {
if ( updatedCSS ) {
Expand Down
6 changes: 5 additions & 1 deletion packages/editor/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ import './hooks';

export * from './components';
export * from './utils';
export { default as transformStyles } from './editor-styles';

/*
* Backward compatibility
*/
export { __experimentalTransformStyles as transformStyles } from '@wordpress/block-editor';