-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Try: Restore block mover for floats. #12758
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,8 +1,8 @@ | ||||||
.editor-block-list__layout .components-draggable__clone { | ||||||
// Hide the Block UI when dragging the block | ||||||
// This ensures the page scroll properly (no sticky elements) | ||||||
// Hide the Block UI when dragging the block. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a few comment cleanups while I'm in here. |
||||||
// This ensures the page scroll properly (no sticky elements). | ||||||
.editor-block-contextual-toolbar { | ||||||
// I think important is fine here to avoid over complexing the selector | ||||||
// It's probably okay to use !important here to avoid over-complicating the selector. | ||||||
display: none !important; | ||||||
} | ||||||
} | ||||||
|
@@ -127,7 +127,7 @@ | |||||
} | ||||||
} | ||||||
|
||||||
// Selected style | ||||||
// Selected style. | ||||||
&.is-selected > .editor-block-list__block-edit::before { | ||||||
// Use opacity to work in various editor styles. | ||||||
outline: $border-width solid $dark-opacity-light-500; | ||||||
|
@@ -137,12 +137,12 @@ | |||||
} | ||||||
} | ||||||
|
||||||
// Hover style | ||||||
// Hover style. | ||||||
&.is-hovered > .editor-block-list__block-edit::before { | ||||||
outline: $border-width solid theme(outlines); | ||||||
} | ||||||
|
||||||
// Spotlight mode | ||||||
// Spotlight mode. | ||||||
&.is-focus-mode:not(.is-multi-selected) { | ||||||
opacity: 0.5; | ||||||
transition: opacity 0.1s linear; | ||||||
|
@@ -168,7 +168,7 @@ | |||||
background-color: $blue-medium-highlight; | ||||||
} | ||||||
|
||||||
// selection style for multiple blocks | ||||||
// Selection style for multiple blocks. | ||||||
&.is-multi-selected *::selection { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think that asterisk is redundant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good thought, but I'd prefer not actually making this change in this PR. It is already sort of big surgery and I'd like to minimize the changes as much as possible. Given that code did not change in this PR, only the comment, I'd prefer to look at this separately. |
||||||
background-color: transparent; | ||||||
} | ||||||
|
@@ -179,7 +179,7 @@ | |||||
// Use opacity to work in various editor styles. | ||||||
mix-blend-mode: multiply; | ||||||
|
||||||
// Collapse extra vertical padding on selection | ||||||
// Collapse extra vertical padding on selection. | ||||||
top: -$block-padding; | ||||||
bottom: -$block-padding; | ||||||
|
||||||
|
@@ -293,12 +293,6 @@ | |||||
margin-bottom: $border-width; | ||||||
} | ||||||
|
||||||
// Hide all additional UI on floats. | ||||||
.editor-block-mover, | ||||||
.editor-block-list__block-mobile-toolbar { | ||||||
display: none; | ||||||
} | ||||||
|
||||||
// Position toolbar better on mobile. | ||||||
.editor-block-contextual-toolbar { | ||||||
width: auto; | ||||||
|
@@ -506,7 +500,8 @@ | |||||
.editor-block-list__block { | ||||||
|
||||||
// Left and right block settings and mover. | ||||||
> .editor-block-mover { | ||||||
&.is-multi-selected > .editor-block-mover, | ||||||
> .editor-block-list__block-edit > .editor-block-mover { | ||||||
position: absolute; | ||||||
width: $block-side-ui-width + $block-side-ui-clearance; | ||||||
|
||||||
|
@@ -516,7 +511,8 @@ | |||||
} | ||||||
|
||||||
// Position depending on whether selected or not. | ||||||
> .editor-block-mover { | ||||||
&.is-multi-selected > .editor-block-mover, | ||||||
> .editor-block-list__block-edit > .editor-block-mover { | ||||||
top: -$block-padding - $border-width; | ||||||
} | ||||||
|
||||||
|
@@ -526,24 +522,60 @@ | |||||
&.is-selected, | ||||||
&.is-hovered { | ||||||
.editor-block-mover { | ||||||
z-index: z-index(".editor-block-list__block.is-{selected,hovered} .editor-block-{settings-menu,mover}"); | ||||||
z-index: z-index(".editor-block-list__block.is-{selected,hovered} .editor-block-mover"); | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
// Left side UI. | ||||||
> .editor-block-mover { | ||||||
&.is-multi-selected > .editor-block-mover, | ||||||
> .editor-block-list__block-edit > .editor-block-mover { | ||||||
padding-right: $block-side-ui-clearance; | ||||||
|
||||||
// Position for top level blocks | ||||||
left: -$block-side-ui-width - $block-side-ui-clearance; | ||||||
// Position for top level blocks. | ||||||
left: -$block-side-ui-width - $block-side-ui-clearance - $block-padding - $border-width; | ||||||
|
||||||
// Mobile | ||||||
// Hide on mobile, as mobile has a separate solution. | ||||||
display: none; | ||||||
@include break-small() { | ||||||
display: block; | ||||||
} | ||||||
} | ||||||
|
||||||
&.is-multi-selected > .editor-block-mover { | ||||||
left: -$block-side-ui-width - $block-side-ui-clearance; | ||||||
} | ||||||
|
||||||
// For floats, show block mover when block is selected, and never on hover. | ||||||
&[data-align="left"], | ||||||
&[data-align="right"] { | ||||||
// Show always when the block is selected. | ||||||
&.is-selected > .editor-block-list__block-edit > .editor-block-mover { | ||||||
// Don't show on mobile, allow the special mobile toolbar to work there. | ||||||
display: none; | ||||||
@include break-small() { | ||||||
display: block; | ||||||
opacity: 1; | ||||||
animation: none; | ||||||
|
||||||
// Make wider and taller to make "safe" hover area bigger. | ||||||
// The intent is to make it less likely that you hover float-adjacent | ||||||
// blocks that visually appear below the block. | ||||||
width: $block-side-ui-width + $block-side-ui-clearance + $block-padding + $border-width; | ||||||
height: auto; | ||||||
padding-bottom: $block-padding; | ||||||
|
||||||
// Unset the negative top margin, or it might overlap the block toolbar. | ||||||
margin-top: 0; | ||||||
} | ||||||
} | ||||||
|
||||||
// Don't show on hover, or on the "ghost" when dragging. | ||||||
&.is-hovered > .editor-block-list__block-edit > .editor-block-mover, | ||||||
&.is-dragging > .editor-block-list__block-edit > .editor-block-mover { | ||||||
display: none; | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the block mover to be able to work for a right-floated block, it has to be inside
.editor-block-list__block-edit
, or the control will show up way on the left of the main column. Same case as when we refactored the floats, essentially.