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 sibling inserter tweaks #7220

Merged
merged 5 commits into from
Jun 21, 2018
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
1 change: 1 addition & 0 deletions editor/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ export class BlockListBlock extends Component {
rootUID={ rootUID }
layout={ layout }
canShowInserter={ canShowInBetweenInserter }
onInsert={ this.hideHoverEffects }
/>
) }
<BlockDropZone
Expand Down
3 changes: 3 additions & 0 deletions editor/components/block-list/insertion-point.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class BlockInsertionPoint extends Component {
props.insertDefaultBlock( { layout }, rootUID, index );
props.startTyping();
this.onBlurInserter();
if ( props.onInsert ) {
this.props.onInsert();
}
}

render() {
Expand Down
35 changes: 19 additions & 16 deletions editor/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -682,41 +682,44 @@
height: $block-padding * 2; // Matches the whole empty space between two blocks
justify-content: center;

// Show a clickable plus
// Show a clickable plus.
.editor-block-list__insertion-point-button {
margin-top: -4px;
border-radius: 50%;
color: $dark-gray-100;
color: $blue-medium-focus;
background: $white;
height: $block-padding * 2 + 8px;
width: $block-padding * 2 + 8px;

&:not(:disabled):not([aria-disabled="true"]):hover {
box-shadow: none;
}

}

// Show a line indicator when hovering, but this is unclickable
&:before {
position: absolute;
top: calc( 50% - #{ $border-width } );
height: 2px;
left: 0;
right: 0;
background: $dark-gray-100;
content: '';
}

// Hide both the line and button until hovered
// Hide both the button until hovered.
opacity: 0;
transition: opacity 0.1s linear 0.1s;

&:hover, &.is-visible {
&:hover,
&.is-visible {
opacity: 1;
}
}

// Don't show the sibling inserter before the selected block.
.edit-post-layout:not( .has-fixed-toolbar ) {
// The child selector is necessary for this to work properly in nested contexts.
.is-selected > .editor-block-list__insertion-point > .editor-block-list__insertion-point-inserter {
opacity: 0;
pointer-events: none;

&.is-visible {
opacity: 1;
pointer-events: auto;
}
}
}

.editor-block-list__block {
> .editor-block-list__insertion-point {
position: absolute;
Expand Down