Skip to content

Commit

Permalink
Block Appender: Use a button instead of input
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 23, 2017
1 parent 9b619a7 commit 441cfc4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
12 changes: 3 additions & 9 deletions editor/components/default-block-appender/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import { connect } from 'react-redux';
import { noop } from 'lodash';
import classnames from 'classnames';
import 'element-closest';

Expand Down Expand Up @@ -41,14 +40,9 @@ class DefaultBlockAppender extends Component {
return (
<div className={ className }>
<BlockDropZone />
<input
type="text"
readOnly
onFocus={ this.appendDefaultBlock }
onClick={ noop }
onKeyDown={ noop }
value={ count === 0 ? __( 'Write your story' ) : '' }
/>
<button onClick={ this.appendDefaultBlock }>
{ count === 0 && __( 'Write your story' ) }
</button>
</div>
);
}
Expand Down
11 changes: 8 additions & 3 deletions editor/components/default-block-appender/style.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.editor-default-block-appender {
input[type=text] {
button {
border: none;
background: none;
box-shadow: none;
Expand All @@ -10,15 +10,20 @@
line-height: $editor-line-height;
cursor: text;
max-width: none; // fixes a bleed issue from the admin
text-align: left;

&:focus {
outline: 1px solid $light-gray-500;
}
}

&.is-visible-placeholder input[type=text] {
&.is-visible-placeholder button {
height: $text-editor-font-size * 4; // the height of an empty paragraph
color: $dark-gray-300;
outline: 1px solid transparent;
transition: 0.2s outline;

&:hover {
&:hover, &:focus {
outline: 1px solid $light-gray-500;
}
}
Expand Down
2 changes: 1 addition & 1 deletion editor/edit-post/modes/visual-editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
@include break-small() {
padding: 0 $block-mover-padding-visible;

input[type=text] {
button {
padding: 0 $block-padding;
}
}
Expand Down

0 comments on commit 441cfc4

Please sign in to comment.