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

Try additional borders and padding for nested blocks #14961

Merged
merged 38 commits into from
Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d3f8857
Add extra padding and borders to child blocks
kjellr Apr 12, 2019
8165e5a
Small tweaks margin/padding of selected Media+Text/Group blocks.
kjellr Apr 12, 2019
e5d35b1
Add has-child-selected class to parent blocks.
kjellr Apr 16, 2019
67a7180
Adjust border/padding to also apply when child blocks are selected.
kjellr Apr 16, 2019
09bc3a4
Try an animation when nested blocks are selected.
kjellr Apr 16, 2019
879f025
Hide the "Column" block.
kjellr Apr 17, 2019
66e535d
Try using a scale animation for child blocks.
kjellr Apr 18, 2019
77dedc1
Reduce scale animation to be really tiny.
kjellr Apr 18, 2019
a50aa46
Re-add has-child-selected class.
kjellr May 9, 2019
66ca27b
Selecting parents: Try clickthrough.
May 9, 2019
cd153fc
Add some visual debugging for nested overlays
gziolo May 14, 2019
762ab1d
Add hasChildSelected prop
gziolo May 16, 2019
869acc7
Add borders/padding to direct children + parents only.
kjellr May 16, 2019
60c849f
Revert "Merge branch 'try/clickthrough' into try/additional-borders-p…
kjellr May 17, 2019
324d293
Revert "Add borders/padding to direct children + parents only."
kjellr May 21, 2019
4f54fd7
Revert "Add hasChildSelected prop"
kjellr May 21, 2019
e717cfc
Remove animation, adjust specificity.
kjellr May 21, 2019
e4612ea
Columns block adjustments.
kjellr May 21, 2019
8d27002
Clean up media-text block CSS.
kjellr May 21, 2019
84824a0
Correct block breadcrumb position for the column block.
kjellr May 22, 2019
0a4903e
Move all block movers up above contextual toolbars.
kjellr May 22, 2019
272fe4a
Clean up block list appender margins.
kjellr May 22, 2019
a3e32ce
Clean up block list appender margins for the columns block.
kjellr May 22, 2019
c6462d9
Reduce specificity for the group block appender overrides.
kjellr May 22, 2019
9228859
Resolve merge inconsitencies after rebasing this branch
gziolo Jun 6, 2019
8e6705d
Merge branch 'master' into try/additional-borders-padding-for-child-b…
kjellr Jun 17, 2019
ce2759a
Improve compaibiilty with custom inner containers.
kjellr Jun 17, 2019
b0e5c99
Merge branch 'master' into try/additional-borders-padding-for-child-b…
kjellr Jun 18, 2019
f46d338
Move extra padding to just the columns and group blocks.
kjellr Jun 18, 2019
77c5321
Merge branch 'master' into try/additional-borders-padding-for-child-b…
kjellr Jun 24, 2019
47f6f44
Try fixing e2e test
ellatrix Jun 25, 2019
ac69599
Merge branch 'master' into try/additional-borders-padding-for-child-b…
kjellr Jul 1, 2019
2ff9a80
Clean up columns block placeholder padding.
kjellr Jul 1, 2019
82dfc34
Modify writing-flow test to pass.
kjellr Jul 9, 2019
45b7bbb
Followup to 82dfc34
kjellr Jul 9, 2019
f67dccf
Update snapshots for writing-flow test.
kjellr Jul 9, 2019
1b9d6bb
Add inline comments about the test adjustment.
kjellr Jul 22, 2019
7a0a201
Remove previous attempt to fix failing tests.
kjellr Jul 22, 2019
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
2 changes: 1 addition & 1 deletion assets/stylesheets/_z-index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $z-layers: (
".block-editor-block-list__block {core/image aligned wide or fullwide}": 20,
".block-library-classic__toolbar": 10,
".block-editor-block-list__layout .reusable-block-indicator": 1,
".block-editor-block-list__breadcrumb": 2,
".block-editor-block-list__breadcrumb": 22,
".components-form-toggle__input": 1,
".components-panel__header.edit-post-sidebar__panel-tabs": -1,
".edit-post-sidebar .components-panel": -2,
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ function BlockListBlock( {
'is-typing': isTypingWithinBlock,
'is-focused': isFocusMode && ( isSelected || isParentOfSelectedBlock ),
'is-focus-mode': isFocusMode,
'has-child-selected': isParentOfSelectedBlock,
},
className
);
Expand Down
27 changes: 21 additions & 6 deletions packages/block-editor/src/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,28 @@
opacity: 1;
}
}
}

// Add extra border to parent blocks when their children are selected.
&.has-child-selected {

> .block-editor-block-list__block-edit::before {
border: $border-width dashed $dark-opacity-light-800;
}

> .block-editor-block-list__block-edit > [data-block] > div > .block-editor-inner-blocks > .block-editor-block-list__layout > .block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__block-edit::before,
> .block-editor-block-list__block-edit > [data-block] > div > .wp-block-cover__inner-container > .block-editor-inner-blocks > .block-editor-block-list__layout > .block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__block-edit::before,
> .block-editor-block-list__block-edit > [data-block] > div > .wp-block-group__inner-container > .block-editor-inner-blocks > .block-editor-block-list__layout > .block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__block-edit::before {
border: $border-width dashed $dark-opacity-light-800;
}
}

// Add extra border to child blocks when they are selected.
&.is-selected > .block-editor-block-list__block-edit > [data-block] > div > .block-editor-inner-blocks > .block-editor-block-list__layout > .block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__block-edit::before,
&.is-selected > .block-editor-block-list__block-edit > [data-block] > div > .wp-block-cover__inner-container > .block-editor-inner-blocks > .block-editor-block-list__layout > .block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__block-edit::before,
&.is-selected > .block-editor-block-list__block-edit > [data-block] > div > .wp-block-group__inner-container > .block-editor-inner-blocks > .block-editor-block-list__layout > .block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__block-edit::before {
tellthemachines marked this conversation as resolved.
Show resolved Hide resolved
border: $border-width dashed $dark-opacity-light-800;
}
}

/**
* Cross-block selection
Expand Down Expand Up @@ -1019,11 +1039,6 @@
}
}

// Position this above the toolbar of parent blocks.
.editor-inner-blocks & {
z-index: z-index(".editor-inner-blocks .block-editor-block-list__breadcrumb");
}

// Remove negative left breadcrumb position for left aligned blocks.
[data-align="left"] & {
left: 0;
Expand Down
31 changes: 24 additions & 7 deletions packages/block-library/src/columns/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,18 @@
* vertical to ensure there is equal visual spacing around the inserter. Note there
* is no formal API for a "passthrough" Block so this is an edge case overide
*/
[data-type="core/columns"] .block-list-appender {
margin-top: $block-padding*2;
margin-bottom: $block-padding*2;
[data-type="core/columns"] {

.block-list-appender {
margin-top: $block-padding*2;
margin-bottom: $block-padding*2;
}

// When the individual column block is selected, the nested padding overrules
// some of this margin. We need to adjust the appender spacing again as a result.
[data-type="core/column"].is-selected .block-list-appender {
margin: $block-padding 0;
}
}

/**
Expand All @@ -158,13 +167,11 @@ div.block-core-columns.is-vertically-aligned-bottom {
justify-content: flex-end;
}


/**
* Fixes single Column breadcrumb to RHS of Block boundary
* Fixes single Column breadcrumb position.
*/
[data-type="core/column"] > .editor-block-list__block-edit > .editor-block-list__breadcrumb {
right: 0;
left: auto;
left: -$block-left-border-width;
}

/**
Expand All @@ -174,3 +181,13 @@ div.block-core-columns.is-vertically-aligned-bottom {
left: 0;
right: 0;
}

/**
* Add extra padding when the parent block is selected, for easier interaction.
*/
.block-editor-block-list__layout .block-editor-block-list__block[data-type="core/columns"].is-selected > .block-editor-block-list__block-edit > [data-block] > div > .block-editor-inner-blocks,
.block-editor-block-list__layout .block-editor-block-list__block[data-type="core/columns"].has-child-selected > .block-editor-block-list__block-edit > [data-block] > div > .block-editor-inner-blocks,
.block-editor-block-list__layout .block-editor-block-list__block[data-type="core/column"].is-selected > .block-editor-block-list__block-edit > [data-block] > div > .block-editor-inner-blocks,
.block-editor-block-list__layout .block-editor-block-list__block[data-type="core/column"].has-child-selected > .block-editor-block-list__block-edit > [data-block] > div > .block-editor-inner-blocks {
padding: $block-padding;
}
28 changes: 28 additions & 0 deletions packages/block-library/src/group/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,31 @@
width: calc(100% + 60px);
}
}

// Add padding when the block is selected, for easier interaction.
.block-editor-block-list__layout .block-editor-block-list__block[data-type="core/group"].has-child-selected > .block-editor-block-list__block-edit > [data-block] > .wp-block-group,
.block-editor-block-list__layout .block-editor-block-list__block[data-type="core/group"].is-selected > .block-editor-block-list__block-edit > [data-block] > .wp-block-group {

> .wp-block-group__inner-container > .block-editor-inner-blocks {
padding: $block-padding;
}

&:not(.has-background) > .wp-block-group__inner-container > .block-editor-inner-blocks > .block-editor-block-list__layout {
margin-top: -$block-padding * 2;
margin-bottom: -$block-padding * 2;
}
}

// Place block list appender in the same place content will appear.
[data-type="core/group"].is-selected {

.block-list-appender {
margin-left: 0;
margin-right: 0;
}

.has-background .block-list-appender {
margin-top: $block-padding + $grid-size-small;
margin-bottom: $block-padding + $grid-size-small;
}
}