From 1dc732d1306080c6e78525928c5c5b8ef2420c02 Mon Sep 17 00:00:00 2001 From: Marin Atanasov Date: Mon, 26 Jun 2023 16:35:15 +0300 Subject: [PATCH 1/2] Lodash: Refactor embed block away from _.kebabCase() --- packages/block-editor/src/private-apis.js | 2 ++ packages/block-library/src/embed/util.js | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/block-editor/src/private-apis.js b/packages/block-editor/src/private-apis.js index dd8d2d8ff411f7..1200dee367d243 100644 --- a/packages/block-editor/src/private-apis.js +++ b/packages/block-editor/src/private-apis.js @@ -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'; @@ -27,6 +28,7 @@ lock( privateApis, { ...globalStyles, ExperimentalBlockEditorProvider, getRichTextValues, + kebabCase, PrivateInserter, PrivateListView, ResizableBoxPopover, diff --git a/packages/block-library/src/embed/util.js b/packages/block-library/src/embed/util.js index 609a46293666e8..a7a6ea219f2772 100644 --- a/packages/block-library/src/embed/util.js +++ b/packages/block-library/src/embed/util.js @@ -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, @@ -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 */ From 76c5a51f5ce4c12e8a6398f5018079e67236be79 Mon Sep 17 00:00:00 2001 From: Marin Atanasov Date: Mon, 26 Jun 2023 17:22:37 +0300 Subject: [PATCH 2/2] Expose kebabCase for RN --- packages/block-editor/src/private-apis.native.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/block-editor/src/private-apis.native.js b/packages/block-editor/src/private-apis.native.js index 5555e00477e7b5..17676f634b1cae 100644 --- a/packages/block-editor/src/private-apis.native.js +++ b/packages/block-editor/src/private-apis.native.js @@ -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'; /** @@ -11,5 +12,6 @@ import { lock } from './lock-unlock'; export const privateApis = {}; lock( privateApis, { ...globalStyles, + kebabCase, ExperimentalBlockEditorProvider, } );