Skip to content

Commit

Permalink
Refact block hover and select css
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Jun 26, 2018
1 parent 1a78cd2 commit 627beea
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
8 changes: 0 additions & 8 deletions components/draggable/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@

The component accepts the following props:

### draggable

If the component is in a draggable state or not. If false, the component is rendered but it is not possible to drag it. Defaults to true.

- Type: `boolean`
- Required: No
- Default: `true`

### elementId

The HTML id of the element to clone on drag
Expand Down
4 changes: 2 additions & 2 deletions components/draggable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ class Draggable extends Component {
}

render() {
const { children, draggable = true, className } = this.props;
const { children, className } = this.props;
return (
<div
className={ classnames( 'components-draggable', className ) }
onDragStart={ this.onDragStart }
onDragEnd={ this.onDragEnd }
draggable={ draggable }
draggable
>
{ children }
</div>
Expand Down
3 changes: 1 addition & 2 deletions editor/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ export class BlockListBlock extends Component {
] }
{ ...wrapperProps }
>
{ ! isMultiSelected && (
{ ! isMultiSelected && isMovable && (
<BlockDraggable
rootUID={ rootUID }
index={ order }
Expand All @@ -481,7 +481,6 @@ export class BlockListBlock extends Component {
onDragEnd={ this.onDragEnd }
isDragging={ dragging }
elementId={ blockElementId }
draggable={ isMovable } // only in locking all moving blocks is totally impossible
/>
) }
{ shouldShowInsertionPoint && (
Expand Down
32 changes: 28 additions & 4 deletions editor/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@
}
}

&[draggable=true]{
cursor: move; // Fallback for IE/Edge < 14
cursor: grab;
}

cursor: move; // Fallback for IE/Edge < 14
cursor: grab;
}


Expand Down Expand Up @@ -935,3 +934,28 @@
content: '';
}
}

.editor-block-list__block {
@include break-small {
// Increases the hover and selection area around blocks.
// This makes the blue hover line, and the settings button appear even if the mouse,
// is still some pixels outside the block.
// It is also possible to click some pixels outside the block and select it.
&:before {
content: '';
position: absolute;
right: -$parent-block-padding - $block-padding;
left: -$parent-block-padding - $block-padding;

bottom: 0;
top: 0;
}

// Removes the effect of the previous rule on nested blocks,
// so it only applies to top-level blocks.
& &:before {
left: 0;
right: 0;
}
}
}

0 comments on commit 627beea

Please sign in to comment.