+
+ {
+ setAttributes( {
+ className: nextValue !== '' ? nextValue : undefined,
+ } );
+ } }
+ help={ __( 'Separate multiple classes with spaces.' ) }
+ >
+ { hasBlockStyles && (
+
+ ) }
+
+
+
+ );
+}
diff --git a/packages/block-editor/src/components/custom-class-name-control/style.scss b/packages/block-editor/src/components/custom-class-name-control/style.scss
new file mode 100644
index 00000000000000..4ee866bc66cc64
--- /dev/null
+++ b/packages/block-editor/src/components/custom-class-name-control/style.scss
@@ -0,0 +1,28 @@
+.additional-class-name-control__container.has-block-styles {
+ .additional-class-name-control__text-control > .components-base-control__field {
+ position: relative;
+ }
+}
+
+.additional-class-name-control__block-style-dropdown {
+ position: absolute;
+ top: auto;
+ right: 2px;
+ bottom: 2px;
+ background: $white;
+
+ button.components-button.has-icon {
+ min-width: 24px;
+ height: 24px;
+ padding: 0;
+
+ svg {
+ height: 27px;
+ width: 27px;
+ @include break-medium() {
+ height: 18px;
+ width: 18px;
+ }
+ }
+ }
+}
diff --git a/packages/block-editor/src/hooks/custom-class-name.js b/packages/block-editor/src/hooks/custom-class-name.js
index 0ed09f8975c5cb..492560ae13a1c3 100644
--- a/packages/block-editor/src/hooks/custom-class-name.js
+++ b/packages/block-editor/src/hooks/custom-class-name.js
@@ -7,15 +7,13 @@ import classnames from 'classnames';
* WordPress dependencies
*/
import { addFilter } from '@wordpress/hooks';
-import { TextControl } from '@wordpress/components';
-import { __ } from '@wordpress/i18n';
import { hasBlockSupport } from '@wordpress/blocks';
import { createHigherOrderComponent } from '@wordpress/compose';
/**
* Internal dependencies
*/
-import { InspectorControls } from '../components';
+import CustomClassNameControl from '../components/custom-class-name-control';
/**
* Filters registered block settings, extending attributes with anchor using ID
@@ -55,28 +53,12 @@ export const withInspectorControl = createHigherOrderComponent(
'customClassName',
true
);
+
if ( hasCustomClassName && props.isSelected ) {
return (
<>