Skip to content

Commit

Permalink
Lodash: Refactor embed block away from _.kebabCase() (WordPress#51916)
Browse files Browse the repository at this point in the history
* Lodash: Refactor embed block away from _.kebabCase()

* Expose kebabCase for RN
  • Loading branch information
tyxla authored and sethrubenstein committed Jul 13, 2023
1 parent 5952c1f commit faede20
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions packages/block-editor/src/private-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as globalStyles from './components/global-styles';
import { ExperimentalBlockEditorProvider } from './components/provider';
import { lock } from './lock-unlock';
import { getRichTextValues } from './components/rich-text/content';
import { kebabCase } from './utils/object';
import ResizableBoxPopover from './components/resizable-box-popover';
import { ComposedPrivateInserter as PrivateInserter } from './components/inserter';
import { PrivateListView } from './components/list-view';
Expand All @@ -27,6 +28,7 @@ lock( privateApis, {
...globalStyles,
ExperimentalBlockEditorProvider,
getRichTextValues,
kebabCase,
PrivateInserter,
PrivateListView,
ResizableBoxPopover,
Expand Down
2 changes: 2 additions & 0 deletions packages/block-editor/src/private-apis.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import * as globalStyles from './components/global-styles';
import { ExperimentalBlockEditorProvider } from './components/provider';
import { kebabCase } from './utils/object';
import { lock } from './lock-unlock';

/**
Expand All @@ -11,5 +12,6 @@ import { lock } from './lock-unlock';
export const privateApis = {};
lock( privateApis, {
...globalStyles,
kebabCase,
ExperimentalBlockEditorProvider,
} );
10 changes: 4 additions & 6 deletions packages/block-library/src/embed/util.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
/**
* Internal dependencies
*/
import { ASPECT_RATIOS, WP_EMBED_TYPE } from './constants';

/**
* External dependencies
*/
import { kebabCase } from 'lodash';
import classnames from 'classnames/dedupe';
import memoize from 'memize';

/**
* WordPress dependencies
*/
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
import { renderToString } from '@wordpress/element';
import {
createBlock,
Expand All @@ -24,8 +19,11 @@ import {
* Internal dependencies
*/
import metadata from './block.json';
import { ASPECT_RATIOS, WP_EMBED_TYPE } from './constants';
import { unlock } from '../lock-unlock';

const { name: DEFAULT_EMBED_BLOCK } = metadata;
const { kebabCase } = unlock( blockEditorPrivateApis );

/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */

Expand Down

0 comments on commit faede20

Please sign in to comment.