From 77f89d24587aabd45746b1ebfebaba73c7d71541 Mon Sep 17 00:00:00 2001 From: Derek Blank Date: Thu, 30 Nov 2023 10:18:48 +1000 Subject: [PATCH] Move InserterButton from components package to block-editor package (#56494) * Move mobile InserterButton from components package to block-editor package * Add @wordpress/primitives to block-editor package dependencies * Update react-native-editor CHANGELOG * Move SVG and Path imports from @wordpress/primitives to @wordpress/components * Update components package CHANGELOG * Update InserterButton import paths --- .../src/components/block-types-list/index.native.js | 3 ++- .../src/components/block-variation-picker/index.native.js | 2 +- packages/block-editor/src/components/index.native.js | 1 + .../src/components}/inserter-button/README.md | 0 .../src/components}/inserter-button/index.native.js | 2 +- .../src/components}/inserter-button/sparkles.js | 2 +- .../src/components}/inserter-button/style.native.scss | 0 packages/components/CHANGELOG.md | 1 + packages/components/src/index.native.js | 1 - packages/react-native-editor/CHANGELOG.md | 1 + 10 files changed, 8 insertions(+), 5 deletions(-) rename packages/{components/src/mobile => block-editor/src/components}/inserter-button/README.md (100%) rename packages/{components/src/mobile => block-editor/src/components}/inserter-button/index.native.js (98%) rename packages/{components/src/mobile => block-editor/src/components}/inserter-button/sparkles.js (95%) rename packages/{components/src/mobile => block-editor/src/components}/inserter-button/style.native.scss (100%) diff --git a/packages/block-editor/src/components/block-types-list/index.native.js b/packages/block-editor/src/components/block-types-list/index.native.js index 450e45220436e9..1d32103773fb39 100644 --- a/packages/block-editor/src/components/block-types-list/index.native.js +++ b/packages/block-editor/src/components/block-types-list/index.native.js @@ -15,7 +15,7 @@ import { * WordPress dependencies */ import { useState, useEffect } from '@wordpress/element'; -import { BottomSheet, Gradient, InserterButton } from '@wordpress/components'; +import { BottomSheet, Gradient } from '@wordpress/components'; import { usePreferredColorScheme, usePreferredColorSchemeStyle, @@ -25,6 +25,7 @@ import { * Internal dependencies */ import styles from './style.scss'; +import InserterButton from '../inserter-button'; const MIN_COL_NUM = 3; diff --git a/packages/block-editor/src/components/block-variation-picker/index.native.js b/packages/block-editor/src/components/block-variation-picker/index.native.js index b60c7a414d22d4..e117bda7c93df5 100644 --- a/packages/block-editor/src/components/block-variation-picker/index.native.js +++ b/packages/block-editor/src/components/block-variation-picker/index.native.js @@ -20,7 +20,6 @@ import { PanelBody, BottomSheet, FooterMessageControl, - InserterButton, } from '@wordpress/components'; import { Icon, close } from '@wordpress/icons'; @@ -29,6 +28,7 @@ import { Icon, close } from '@wordpress/icons'; */ import styles from './style.scss'; import { store as blockEditorStore } from '../../store'; +import InserterButton from '../inserter-button'; const hitSlop = { top: 22, bottom: 22, left: 22, right: 22 }; diff --git a/packages/block-editor/src/components/index.native.js b/packages/block-editor/src/components/index.native.js index de134f1b5e3bc4..45451908a34472 100644 --- a/packages/block-editor/src/components/index.native.js +++ b/packages/block-editor/src/components/index.native.js @@ -90,6 +90,7 @@ export { default as BlockStyles } from './block-styles'; export { default as DefaultBlockAppender } from './default-block-appender'; export { default as __unstableEditorStyles } from './editor-styles'; export { default as Inserter } from './inserter'; +export { default as InserterButton } from './inserter-button'; export { useBlockProps } from './block-list/use-block-props'; export { default as FloatingToolbar } from './floating-toolbar'; diff --git a/packages/components/src/mobile/inserter-button/README.md b/packages/block-editor/src/components/inserter-button/README.md similarity index 100% rename from packages/components/src/mobile/inserter-button/README.md rename to packages/block-editor/src/components/inserter-button/README.md diff --git a/packages/components/src/mobile/inserter-button/index.native.js b/packages/block-editor/src/components/inserter-button/index.native.js similarity index 98% rename from packages/components/src/mobile/inserter-button/index.native.js rename to packages/block-editor/src/components/inserter-button/index.native.js index 91d8a3b449f18c..7df5d450d1e629 100644 --- a/packages/components/src/mobile/inserter-button/index.native.js +++ b/packages/block-editor/src/components/inserter-button/index.native.js @@ -10,11 +10,11 @@ import { Component } from '@wordpress/element'; import { Icon } from '@wordpress/components'; import { withPreferredColorScheme } from '@wordpress/compose'; import { __, sprintf } from '@wordpress/i18n'; -import { BlockIcon } from '@wordpress/block-editor'; /** * Internal dependencies */ +import { BlockIcon } from '../block-icon'; import styles from './style.scss'; import sparkles from './sparkles'; class MenuItem extends Component { diff --git a/packages/components/src/mobile/inserter-button/sparkles.js b/packages/block-editor/src/components/inserter-button/sparkles.js similarity index 95% rename from packages/components/src/mobile/inserter-button/sparkles.js rename to packages/block-editor/src/components/inserter-button/sparkles.js index 663824e11a1d61..1b893f30bbfd52 100644 --- a/packages/components/src/mobile/inserter-button/sparkles.js +++ b/packages/block-editor/src/components/inserter-button/sparkles.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { SVG, Path } from '@wordpress/primitives'; +import { SVG, Path } from '@wordpress/components'; const sparkles = ( diff --git a/packages/components/src/mobile/inserter-button/style.native.scss b/packages/block-editor/src/components/inserter-button/style.native.scss similarity index 100% rename from packages/components/src/mobile/inserter-button/style.native.scss rename to packages/block-editor/src/components/inserter-button/style.native.scss diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 8ad7fb695eb3f6..0f4c8ebb8a08cf 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -8,6 +8,7 @@ - `FormToggle`: refine animation and improve high contrast styles ([#56515](https://github.com/WordPress/gutenberg/pull/56515)). - `Button`: Add focus rings to focusable disabled buttons ([#56383](https://github.com/WordPress/gutenberg/pull/56383)). +- `InserterButton`: Move mobile InserterButton from components package to block-editor package ([#56494](https://github.com/WordPress/gutenberg/pull/56494)) ### Bug Fix diff --git a/packages/components/src/index.native.js b/packages/components/src/index.native.js index f88399fbee2878..6c793499102e1c 100644 --- a/packages/components/src/index.native.js +++ b/packages/components/src/index.native.js @@ -110,7 +110,6 @@ export { default as ImageLinkDestinationsScreen } from './mobile/link-settings/i export { default as SegmentedControl } from './mobile/segmented-control'; export { default as Image, IMAGE_DEFAULT_FOCAL_POINT } from './mobile/image'; export { default as ImageEditingButton } from './mobile/image/image-editing-button'; -export { default as InserterButton } from './mobile/inserter-button'; export { setClipboard, getClipboard } from './mobile/clipboard'; export { default as AudioPlayer } from './mobile/audio-player'; export { default as Badge } from './mobile/badge'; diff --git a/packages/react-native-editor/CHANGELOG.md b/packages/react-native-editor/CHANGELOG.md index f0844dbed0861b..981e15afcb4c3e 100644 --- a/packages/react-native-editor/CHANGELOG.md +++ b/packages/react-native-editor/CHANGELOG.md @@ -10,6 +10,7 @@ For each user feature we should also add a importance categorization label to i --> ## Unreleased +- [*] [internal] Move InserterButton from components package to block-editor package [#56494] - [***] Fix issue when backspacing in an empty Paragraph block [#56496] - [**] Editor displays user of network connection status when offline [#56627]