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

Outline editable blocks when in a pattern that has locked children #57991

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Changes from all commits
Commits
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
43 changes: 25 additions & 18 deletions packages/block-editor/src/components/block-list/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -303,27 +303,34 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
}
}

// Indicate which blocks are editable within a page editor or a content-locked
// pattern. Only show when user hovers over the page editor or pattern.
// Indicate which blocks are editable within a locked context.
// 1. User must be hovering an editor with renderingMode = 'template-lock'; or...
.is-template-locked:hover,
// ...a container block.
.block-editor-block-list__block:hover {
.block-editor-block-list__block.is-editing-disabled > .block-editor-block-list__block:not(.is-editing-disabled):not(.is-selected):not(.has-child-selected) {
&::after {
content: "";
border-style: dotted;
position: absolute;
pointer-events: none;
top: $border-width;
left: $border-width;
right: $border-width;
bottom: $border-width;
border: 1px dotted var(--wp-admin-theme-color);
border-radius: $radius-block-ui - $border-width;
}
// 2. Look for locked blocks; or...
.block-editor-block-list__block.is-editing-disabled,
// ...container blocks that have locked children.
&:has(> .block-editor-block-list__block.is-editing-disabled) {
// 3. Highlight any unlocked children of that locked block.
& > .block-editor-block-list__block:not(.is-editing-disabled):not(.is-selected):not(.has-child-selected) {
&::after {
content: "";
border-style: dotted;
position: absolute;
pointer-events: none;
top: $border-width;
left: $border-width;
right: $border-width;
bottom: $border-width;
border: 1px dotted var(--wp-admin-theme-color);
border-radius: $radius-block-ui - $border-width;
}

&.is-hovered::after {
background: rgba(var(--wp-admin-theme-color--rgb), 0.1);
border: none;
&.is-hovered::after {
background: rgba(var(--wp-admin-theme-color--rgb), 0.1);
border: none;
}
}
}
}
Expand Down
Loading