From 33327b3e6bbc1fdad9ae4ed134a5c23d6b102c15 Mon Sep 17 00:00:00 2001 From: Derek Blank Date: Fri, 24 Nov 2023 13:36:29 +1000 Subject: [PATCH 1/6] Move mobile InserterButton from components package to block-editor package --- .../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 | 1 + .../src/components}/inserter-button/style.native.scss | 0 packages/components/src/index.native.js | 1 - 8 files changed, 6 insertions(+), 4 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..fb8a0a0b5b1f47 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,8 @@ import { * WordPress dependencies */ import { useState, useEffect } from '@wordpress/element'; -import { BottomSheet, Gradient, InserterButton } from '@wordpress/components'; +import { BottomSheet, Gradient } from '@wordpress/components'; +import { InserterButton } from '@wordpress/block-editor'; import { usePreferredColorScheme, usePreferredColorSchemeStyle, 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..a94b69798d8c01 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,8 +20,8 @@ import { PanelBody, BottomSheet, FooterMessageControl, - InserterButton, } from '@wordpress/components'; +import { InserterButton } from '@wordpress/block-editor'; import { Icon, close } from '@wordpress/icons'; /** 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..3717535803a3ad 100644 --- a/packages/components/src/mobile/inserter-button/sparkles.js +++ b/packages/block-editor/src/components/inserter-button/sparkles.js @@ -1,6 +1,7 @@ /** * WordPress dependencies */ +// eslint-disable-next-line import/no-extraneous-dependencies import { SVG, Path } from '@wordpress/primitives'; 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/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'; From b57e077368a8d205edbb4d7140e1ef28cb23b44f Mon Sep 17 00:00:00 2001 From: Derek Blank Date: Mon, 27 Nov 2023 10:51:31 +1000 Subject: [PATCH 2/6] Add @wordpress/primitives to block-editor package dependencies --- packages/block-editor/package.json | 1 + packages/block-editor/src/components/inserter-button/sparkles.js | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index a80fd2f9bca969..804b0f05cda5bc 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -57,6 +57,7 @@ "@wordpress/keycodes": "file:../keycodes", "@wordpress/notices": "file:../notices", "@wordpress/preferences": "file:../preferences", + "@wordpress/primitives": "file:../primitives", "@wordpress/private-apis": "file:../private-apis", "@wordpress/rich-text": "file:../rich-text", "@wordpress/style-engine": "file:../style-engine", diff --git a/packages/block-editor/src/components/inserter-button/sparkles.js b/packages/block-editor/src/components/inserter-button/sparkles.js index 3717535803a3ad..663824e11a1d61 100644 --- a/packages/block-editor/src/components/inserter-button/sparkles.js +++ b/packages/block-editor/src/components/inserter-button/sparkles.js @@ -1,7 +1,6 @@ /** * WordPress dependencies */ -// eslint-disable-next-line import/no-extraneous-dependencies import { SVG, Path } from '@wordpress/primitives'; const sparkles = ( From 489808dea8f6c19193fecdc8848790135706eab9 Mon Sep 17 00:00:00 2001 From: Derek Blank Date: Mon, 27 Nov 2023 10:55:26 +1000 Subject: [PATCH 3/6] Update react-native-editor CHANGELOG --- packages/react-native-editor/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native-editor/CHANGELOG.md b/packages/react-native-editor/CHANGELOG.md index 2fef3d50be3389..3c2598e2ac99f5 100644 --- a/packages/react-native-editor/CHANGELOG.md +++ b/packages/react-native-editor/CHANGELOG.md @@ -11,6 +11,7 @@ For each user feature we should also add a importance categorization label to i ## Unreleased - [*] Audio block: Improve legibility of audio file details on various background colors [#55627] +- [*] [internal] Move InserterButton from components package to block-editor package [#56494] ## 1.108.0 - [*] Fix error when pasting deeply nested structure content [#55613] From 83895588a0309797da7b7ca079a5fcdab1348d50 Mon Sep 17 00:00:00 2001 From: Derek Blank Date: Mon, 27 Nov 2023 11:39:39 +1000 Subject: [PATCH 4/6] Move SVG and Path imports from @wordpress/primitives to @wordpress/components --- packages/block-editor/package.json | 1 - .../block-editor/src/components/inserter-button/sparkles.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index 804b0f05cda5bc..a80fd2f9bca969 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -57,7 +57,6 @@ "@wordpress/keycodes": "file:../keycodes", "@wordpress/notices": "file:../notices", "@wordpress/preferences": "file:../preferences", - "@wordpress/primitives": "file:../primitives", "@wordpress/private-apis": "file:../private-apis", "@wordpress/rich-text": "file:../rich-text", "@wordpress/style-engine": "file:../style-engine", diff --git a/packages/block-editor/src/components/inserter-button/sparkles.js b/packages/block-editor/src/components/inserter-button/sparkles.js index 663824e11a1d61..1b893f30bbfd52 100644 --- a/packages/block-editor/src/components/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 = ( From 75924d4fdb7be414916ccbfeee8020b00392a483 Mon Sep 17 00:00:00 2001 From: Derek Blank Date: Mon, 27 Nov 2023 11:54:05 +1000 Subject: [PATCH 5/6] Update components package CHANGELOG --- packages/components/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 0f60b1aaee51ab..5f20c098880bde 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -5,6 +5,7 @@ ### Enhancements - `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)) ### Experimental From f649c78e8b3a0a94914bf7395353667d64ee03f2 Mon Sep 17 00:00:00 2001 From: Derek Blank Date: Tue, 28 Nov 2023 12:15:03 +1000 Subject: [PATCH 6/6] Update InserterButton import paths --- .../src/components/block-types-list/index.native.js | 2 +- .../src/components/block-variation-picker/index.native.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 fb8a0a0b5b1f47..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 @@ -16,7 +16,6 @@ import { */ import { useState, useEffect } from '@wordpress/element'; import { BottomSheet, Gradient } from '@wordpress/components'; -import { InserterButton } from '@wordpress/block-editor'; import { usePreferredColorScheme, usePreferredColorSchemeStyle, @@ -26,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 a94b69798d8c01..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 @@ -21,7 +21,6 @@ import { BottomSheet, FooterMessageControl, } from '@wordpress/components'; -import { InserterButton } from '@wordpress/block-editor'; 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 };