From ed13010b78f197cc32c3faa19b568b4d9f001b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Ventura?= Date: Wed, 28 Jun 2017 13:53:47 +0200 Subject: [PATCH 1/4] Move "continue writing" next to inserter and show on hover. --- editor/modes/visual-editor/block-list.js | 36 +++++++++++++++++------- editor/modes/visual-editor/index.js | 2 -- editor/modes/visual-editor/style.scss | 14 +++++++++ 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/editor/modes/visual-editor/block-list.js b/editor/modes/visual-editor/block-list.js index f5a0b1eb558657..b0b9a11d441965 100644 --- a/editor/modes/visual-editor/block-list.js +++ b/editor/modes/visual-editor/block-list.js @@ -16,6 +16,7 @@ import { ENTER } from 'utils/keycodes'; * Internal dependencies */ import VisualEditorBlock from './block'; +import Inserter from '../../inserter'; import { getBlockUids, getBlockInsertionPoint, @@ -224,16 +225,31 @@ class VisualEditorBlockList extends Component { /> ); } ) } - - + { ! blocks.length && + + } +
+ + { !! blocks.length && + + } +
); } diff --git a/editor/modes/visual-editor/index.js b/editor/modes/visual-editor/index.js index 3ec6b502b45d75..a5c951056796ad 100644 --- a/editor/modes/visual-editor/index.js +++ b/editor/modes/visual-editor/index.js @@ -15,7 +15,6 @@ import { CHAR_A } from 'utils/keycodes'; * Internal dependencies */ import './style.scss'; -import Inserter from '../../inserter'; import VisualEditorBlockList from './block-list'; import PostTitle from '../../post-title'; import { getBlockUids } from '../../selectors'; @@ -80,7 +79,6 @@ class VisualEditor extends Component { > - ); /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */ diff --git a/editor/modes/visual-editor/style.scss b/editor/modes/visual-editor/style.scss index d81146c08cca9a..14d65e4a8c328f 100644 --- a/editor/modes/visual-editor/style.scss +++ b/editor/modes/visual-editor/style.scss @@ -322,3 +322,17 @@ $sticky-bottom-offset: 20px; outline: 1px solid $light-gray-500; } } + +.editor-visual-editor__continue-writing { + display: flex; + .editor-visual-editor__placeholder[type=text] { + opacity: 0; + transition: opacity 200; + margin: 2px 0; + outline: none; + } + &:hover .editor-visual-editor__placeholder[type=text], + &:focus .editor-visual-editor__placeholder[type=text] { + opacity: 1; + } +} From 7d15a805ad6d6160331c26293a3aa6742ad36cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Ventura?= Date: Wed, 28 Jun 2017 16:59:19 +0200 Subject: [PATCH 2/4] Add row of common blocks next to in-page inserter. --- editor/modes/visual-editor/block-list.js | 46 +++++++++++++++++------- editor/modes/visual-editor/style.scss | 14 ++++---- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/editor/modes/visual-editor/block-list.js b/editor/modes/visual-editor/block-list.js index b0b9a11d441965..1c720719ebd548 100644 --- a/editor/modes/visual-editor/block-list.js +++ b/editor/modes/visual-editor/block-list.js @@ -10,6 +10,7 @@ import { throttle, reduce, noop } from 'lodash'; import { __ } from 'i18n'; import { Component } from 'element'; import { serialize, getDefaultBlock, createBlock } from 'blocks'; +import { Dashicon } from 'components'; import { ENTER } from 'utils/keycodes'; /** @@ -192,8 +193,19 @@ class VisualEditorBlockList extends Component { this.props.onInsertBlock( newBlock ); } + insertBlock( name ) { + const newBlock = createBlock( name ); + this.props.onInsertBlock( newBlock ); + } + render() { - const { blocks, showInsertionPoint, insertionPoint, multiSelectedBlockUids } = this.props; + const { + blocks, + showInsertionPoint, + insertionPoint, + multiSelectedBlockUids, + } = this.props; + const insertionPointIndex = blocks.indexOf( insertionPoint ); const blocksWithInsertionPoint = showInsertionPoint ? [ @@ -238,17 +250,27 @@ class VisualEditorBlockList extends Component { }
- { !! blocks.length && - - } + + +
); diff --git a/editor/modes/visual-editor/style.scss b/editor/modes/visual-editor/style.scss index 14d65e4a8c328f..cc6f1341f4512f 100644 --- a/editor/modes/visual-editor/style.scss +++ b/editor/modes/visual-editor/style.scss @@ -325,14 +325,16 @@ $sticky-bottom-offset: 20px; .editor-visual-editor__continue-writing { display: flex; - .editor-visual-editor__placeholder[type=text] { + align-items: baseline; + + .editor-inserter__block { opacity: 0; - transition: opacity 200; - margin: 2px 0; - outline: none; + transition: opacity 150ms; + margin: 0 10px; + width: auto; } - &:hover .editor-visual-editor__placeholder[type=text], - &:focus .editor-visual-editor__placeholder[type=text] { + &:hover .editor-inserter__block, + &:focus .editor-inserter__block { opacity: 1; } } From 321d695d87a10f607d16c0617f64de58a6ceb0a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Ventura?= Date: Wed, 28 Jun 2017 17:12:13 +0200 Subject: [PATCH 3/4] Remove heading. --- editor/modes/visual-editor/block-list.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/editor/modes/visual-editor/block-list.js b/editor/modes/visual-editor/block-list.js index 1c720719ebd548..adf50a72f92d45 100644 --- a/editor/modes/visual-editor/block-list.js +++ b/editor/modes/visual-editor/block-list.js @@ -264,13 +264,6 @@ class VisualEditorBlockList extends Component { { __( 'Image' ) } - ); From 8a184c24d19e65f1a21784f524e2e86082047b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Ventura?= Date: Wed, 28 Jun 2017 17:14:55 +0200 Subject: [PATCH 4/4] Adjust font-size. --- editor/modes/visual-editor/style.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editor/modes/visual-editor/style.scss b/editor/modes/visual-editor/style.scss index cc6f1341f4512f..e6767d4da4d41b 100644 --- a/editor/modes/visual-editor/style.scss +++ b/editor/modes/visual-editor/style.scss @@ -332,6 +332,8 @@ $sticky-bottom-offset: 20px; transition: opacity 150ms; margin: 0 10px; width: auto; + font-family: $default-font; + font-size: $default-font-size; } &:hover .editor-inserter__block, &:focus .editor-inserter__block {