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

Reveal block boundaries on hover in the Site Editor #27271

Merged
merged 16 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
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
15 changes: 0 additions & 15 deletions packages/block-editor/src/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,6 @@
}
}

// Active entity spotlight.
&.has-active-entity:not(.is-focus-mode) {
opacity: 0.5;
Copy link
Member

Choose a reason for hiding this comment

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

If we are removing the template part spotlight mode thingy, we can probably remove this class entry altogether

transition: opacity 0.1s linear;
@include reduce-motion("transition");

&.is-active-entity,
&.has-child-selected,
&:not(.has-child-selected) .block-editor-block-list__block,
&.is-active-entity .block-editor-block-list__block,
.is-active-entity .block-editor-block-list__block {
opacity: 1;
}
}

/**
* Block styles and alignments
*/
Expand Down
34 changes: 0 additions & 34 deletions packages/block-library/src/template-part/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,37 +89,3 @@
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
}
}

.block-editor-block-list__block[data-type="core/template-part"] {
&.is-selected,
&.has-child-selected {
&::after {
top: $border-width;
bottom: $border-width;
left: $border-width;
right: $border-width;
border-radius: $radius-block-ui - $border-width; // Border is outset, so so subtract the width to achieve correct radius.
}
}

&.is-selected {
&::after {
// 2px outside.
box-shadow: 0 0 0 $border-width-focus var(--wp-admin-theme-color);
// Show a light color for dark themes.
.is-dark-theme & {
box-shadow: 0 0 0 $border-width-focus $dark-theme-focus;
}
}
}

&.has-child-selected {
&::after {
box-shadow: 0 0 0 $border-width $gray-300;

.is-dark-theme & {
box-shadow: 0 0 0 $border-width-focus $gray-700;
}
}
}
}
47 changes: 47 additions & 0 deletions packages/edit-site/src/components/block-editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,50 @@
padding: 6px;
}
}

.block-editor-block-list__layout {
&.edit-site-block-editor__block-list {
.block-editor-block-list__block {
&::after {
outline: 2px solid transparent;
}

&.is-selected {
&::after {
box-shadow: 0 0 0 $border-width $gray-900; // Selected not focussed
top: $border-width;
left: $border-width;
right: $border-width;
bottom: $border-width;
}

&:focus {
&::after {
box-shadow: 0 0 0 $border-width-focus var(--wp-admin-theme-color);
}
}
}

&.is-hovered:not(.is-selected) {
cursor: default;

&::after {
top: $border-width;
left: $border-width;
right: $border-width;
bottom: $border-width;
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
}
}
}

// Do not display a border on rich text blocks when hovered and selected
.block-editor-rich-text__editable {
&.is-selected.is-hovered.is-typing {
&::after {
box-shadow: none;
}
}
}
}
}