Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
098b54b
Initial commit
ramonjd Sep 1, 2021
6fb45f3
Tweaking text and hover colours
ramonjd Sep 14, 2021
04e7ac1
Adding container ref to try to position the popover
ramonjd Sep 14, 2021
e334afa
Experimenting with removing the default style picker select dropdown …
ramonjd Sep 16, 2021
caf01b9
Abstract renderedStyles, which adds a default to the array for user s…
ramonjd Sep 17, 2021
05952b2
Reduce the switcher to a Make default button where the preferred defa…
ramonjd Sep 17, 2021
9aa6248
Aligning preview with preview block popover styles
ramonjd Sep 20, 2021
a651c01
Fixed typo in expected label in the getRenderedStyles test
ramonjd Sep 20, 2021
35ea380
Cleaning up styles and classnames
ramonjd Sep 20, 2021
3a1cf50
Removing unused preview block code in the block styles menu switcher
ramonjd Sep 21, 2021
e16a4eb
This commit reverts the default style picker, and creates a condition…
ramonjd Sep 29, 2021
ebc57c5
This commit:
ramonjd Oct 1, 2021
51cf2f3
Removing `useCallback` function memo
ramonjd Oct 1, 2021
8373343
Using the Text component to control character overflow.
ramonjd Oct 5, 2021
7e1c8f5
This commit splits BlockStyles component into two components: one for…
ramonjd Oct 12, 2021
aa7bc1d
This commit fixes the position of the block preview container and rem…
ramonjd Oct 26, 2021
e1c8294
This is an attempt to ensure that we should the preview panel outside…
ramonjd Oct 29, 2021
71fcad7
This commit adds a slot in the editor content area for the block styl…
ramonjd Nov 4, 2021
bf66057
Fixing z-index to have the same z-index as the sidebar.
ramonjd Nov 4, 2021
51319b0
Using lodash debounce so we can cancel the debounce when needed.
ramonjd Nov 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
This is an attempt to ensure that we should the preview panel outside…
… the confines of the sidebar container.

Removing overflow: auto allows us to position elements beyond the container.
We have to detect fullscreen vs non-fullscreen mode to allow for varying top positions.
Also updated selected active states of the button.
  • Loading branch information
ramonjd committed Nov 10, 2021
commit e1c82942fd89fb46bbf2b36819d5ee0760fa5c28
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function BlockStyles( {
activeStyle,
genericPreviewBlock,
className: previewClassName,
isFullscreenActive,
} = useStylesForBlocks( {
clientId,
onSwitch,
Expand All @@ -57,7 +58,11 @@ export default function BlockStyles( {
};

return (
<div className={ classnames( 'block-editor-block-styles', className ) }>
<div
className={ classnames( 'block-editor-block-styles', className, {
'is-fullscreen-active': isFullscreenActive,
} ) }
>
<div className="block-editor-block-styles__variants">
{ stylesToRender.map( ( style ) => {
const buttonText = style.label || style.name;
Expand Down Expand Up @@ -95,6 +100,7 @@ export default function BlockStyles( {
as="span"
limit={ 12 }
ellipsizeMode="tail"
className="block-editor-block-styles__item-text"
truncate
>
{ buttonText }
Expand Down
23 changes: 18 additions & 5 deletions packages/block-editor/src/components/block-styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
// Fixing the position is specific to the block inspector context.
&.block-inspector__block-styles .block-editor-inserter__preview-container {
position: fixed;
right: calc(#{$sidebar-width} + #{$grid-unit-40});
top: calc(#{$header-height} + #{$panel-header-height});
right: $sidebar-width + $grid-unit-40;
top: $header-height + $grid-unit-40 + $admin-bar-height; // $admin-bar-height;
left: auto;
}

&.is-fullscreen-active.block-inspector__block-styles .block-editor-inserter__preview-container {
top: $header-height + $grid-unit-40;
}

.block-editor-block-card__title.block-editor-block-card__title {
margin: 0;
}
Expand All @@ -32,13 +36,22 @@
&:focus,
&:hover {
color: var(--wp-admin-theme-color);
box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color);
box-shadow: inset 0 0 0 2px var(--wp-admin-theme-color);
}

&.is-active,
&.is-active:hover {
color: $gray-900;
box-shadow: inset 0 0 0 2px $gray-900;
background-color: $gray-800;
box-shadow: none;
}

&.is-active .block-editor-block-styles__item-text,
&.is-active:hover .block-editor-block-styles__item-text {
color: $white;
}

&.is-active:focus {
box-shadow: inset 0 0 0 1px $white, 0 0 0 2px var(--wp-admin-theme-color);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,18 @@ export default function useStylesForBlocks( { clientId, onSwitch } ) {
blockType,
styles: getBlockStyles( block.name ),
className: block.attributes.className || '',
isFullscreenActive: select( 'core/edit-post' ).isFeatureActive(
'fullscreenMode'
),
};
};
const { styles, block, blockType, className } = useSelect( selector, [
clientId,
] );
const {
styles,
block,
blockType,
className,
isFullscreenActive,
} = useSelect( selector, [ clientId ] );
const { updateBlockAttributes } = useDispatch( blockEditorStore );
const stylesToRender = getRenderedStyles( styles );
const activeStyle = getActiveStyle( stylesToRender, className );
Expand All @@ -95,5 +102,6 @@ export default function useStylesForBlocks( { clientId, onSwitch } ) {
activeStyle,
genericPreviewBlock,
className,
isFullscreenActive,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ html.interface-interface-skeleton__html-container {
}

.interface-interface-skeleton__sidebar {
overflow: auto;

@include break-medium() {
border-left: $border-width solid $gray-200;
}
Expand Down