Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block editor: remove CSS appender hiding #61142

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -9,12 +9,3 @@
.block-list-appender > .block-editor-inserter {
display: block;
}

// Hide the nested appender unless parent or child is selected.
// This selector targets unselected blocks that have only a single nesting level.
.block-editor-block-list__block:not(.is-selected):not(.has-child-selected):not(.block-editor-block-list__layout) {
.block-editor-block-list__layout > .block-list-appender .block-list-appender__toggle {
opacity: 0;
transform: scale(0);
}
}
14 changes: 0 additions & 14 deletions packages/block-editor/src/components/block-list/content.scss
Expand Up @@ -259,11 +259,6 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
}
}

// Reusable blocks parent border.
&.is-reusable.has-child-selected::after {
box-shadow: 0 0 0 1px var(--wp-admin-theme-color);
}

// Clear floats.
&[data-clear="true"] {
float: none;
Expand Down Expand Up @@ -444,15 +439,6 @@ body.is-zoomed-out {
@include reduce-motion("animation");
}

.block-editor-block-list__block:not(.is-selected):not(.has-child-selected) .block-editor-default-block-appender {
display: none;

.block-editor-inserter__toggle {
opacity: 0;
transform: scale(0);
}
}

.block-editor-block-list__block .block-editor-block-list__block-html-textarea {
display: block;
margin: 0;
Expand Down
10 changes: 6 additions & 4 deletions packages/block-editor/src/components/block-list/index.js
Expand Up @@ -198,20 +198,22 @@ function Items( {
}

const selectedBlockClientId = getSelectedBlockClientId();
const isParentSelected = rootClientId === selectedBlockClientId;
const isEmpty = ! _order.length;
const shouldShowAppender = isParentSelected || isEmpty;

return {
order: _order,
selectedBlocks: getSelectedBlockClientIds(),
visibleBlocks: __unstableGetVisibleBlocks(),
shouldRenderAppender:
hasAppender &&
shouldShowAppender &&
__unstableGetEditorMode() !== 'zoom-out' &&
( hasCustomAppender
? ! getTemplateLock( rootClientId ) &&
getBlockEditingMode( rootClientId ) !== 'disabled'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This special condition for the custom appender is also very strange. If a template is locked or editing is disabled, default appenders should also be removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses rootClientId so I wonder if we wanted to avoid a situation where blocks could be added if the parent was locked. Maybe @draganescu knows more.

: rootClientId === selectedBlockClientId ||
( ! rootClientId &&
! selectedBlockClientId &&
! _order.length ) ),
: true ),
};
},
[ rootClientId, hasAppender, hasCustomAppender ]
Expand Down