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

FIX - Improve Link Entry #2779

Closed
wants to merge 13 commits into from
Closed

FIX - Improve Link Entry #2779

wants to merge 13 commits into from

Conversation

tg-ephox
Copy link
Contributor

@tg-ephox tg-ephox commented Sep 25, 2017

Description

Link entry for Paragraph, Cover Image and Button blocks have all been made similar to the Image block (with the addition of animations on entry/exit)

Formatting toolbars for Cover Image and Image have been modified so that they appear in the single toolbar above the block, so that this is consistent between all blocks, previously these were the only toolbars that were centred.

fixes #2715

How Has This Been Tested?

Unit tests, manual browser testing.

Screenshots (jpeg or gifs if applicable):

Types of changes

New feature

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows has proper inline documentation.

@codecov
Copy link

codecov bot commented Sep 25, 2017

Codecov Report

Merging #2779 into master will increase coverage by 3.68%.
The diff coverage is 75.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2779      +/-   ##
==========================================
+ Coverage   34.07%   37.76%   +3.68%     
==========================================
  Files         192      199       +7     
  Lines        5675     6379     +704     
  Branches      996     1190     +194     
==========================================
+ Hits         1934     2409     +475     
- Misses       3165     3330     +165     
- Partials      576      640      +64
Impacted Files Coverage Δ
blocks/library/cover-image/index.js 33.33% <ø> (ø) ⬆️
blocks/library/embed/index.js 45.55% <ø> (ø) ⬆️
blocks/library/video/index.js 21.05% <ø> (ø) ⬆️
blocks/library/button/index.js 21.05% <0%> (+1.05%) ⬆️
blocks/editable/format-toolbar/index.js 12% <0%> (+5.61%) ⬆️
blocks/library/image/block.js 0% <0%> (ø) ⬆️
blocks/url-input/index.js 18.03% <100%> (+16.39%) ⬆️
components/higher-order/with-focus-return/index.js 92.3% <100%> (+0.64%) ⬆️
blocks/url-input/button.js 75% <62.5%> (+75%) ⬆️
blocks/url-input/ancestor-size.js 75% <75%> (ø)
... and 33 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27cd1f5...218de2f. Read the comment docs.

@@ -40,22 +38,9 @@ const DEFAULT_CONTROLS = [ 'bold', 'italic', 'strikethrough', 'link' ];
class FormatToolbar extends Component {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could refactor this component to be just a functional component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can as it needs the lifecycle methods?

@youknowriad
Copy link
Contributor

youknowriad commented Sep 25, 2017

screen shot 2017-09-25 at 15 13 05

I'm seeing a light "white" layer on the border of the link popover submit button

@youknowriad youknowriad added the Needs Design Feedback Needs general design feedback. label Sep 25, 2017
@youknowriad
Copy link
Contributor

I like the fact that we have a unique way of adding links to the components, though, I'm finding that this requries a lot of steps to add the link.

  • Add a link
  • Tweak the options
  • Validate

Maybe the options could be triggered by a gear button or something. anyway, a more "designy" feedback would be great. @jasmussen @karmatosed

@youknowriad
Copy link
Contributor

The button link is not being saved as expected (check the text mode), Not sure if it's related to this PR.

@youknowriad
Copy link
Contributor

the appearing animation is a bit slow IMO, could we increase its speed?

@youknowriad
Copy link
Contributor

I noticed that the link popover is not showing up as expected for the inline toolbar (image captions for example)
screen shot 2017-09-25 at 15 20 15

@tg-ephox
Copy link
Contributor Author

This isn't the correct text for a Button block?

<!-- wp:core/button {"align":"center"} -->
<div class="wp-block-button aligncenter"><a href="https://github.com/WordPress/gutenberg"><span>Help build Gutenberg</span></a></div>
<!-- /wp:core/button -->

@youknowriad
Copy link
Contributor

@tg-ephox for some reason, the a tag was empty (no href) for me. I'll dig more later.

@tg-ephox
Copy link
Contributor Author

@youknowriad the dialog that pops in allows you to 'un-link', which will result in a anchor tag with no href, maybe this option shouldn't be available for the Button block?

@tg-ephox tg-ephox self-assigned this Sep 27, 2017
@youknowriad
Copy link
Contributor

Maybe i'm doing something wrong but here's the screencast
kapture 2017-09-27 at 8 49 11

@tg-ephox
Copy link
Contributor Author

tg-ephox commented Sep 29, 2017

@youknowriad I found the URL problem for Button, I'd renamed a variable...

@tg-ephox
Copy link
Contributor Author

tg-ephox commented Oct 5, 2017

hey @annaephox @karmatosed can I pls get some design feedback on this?

@anna-harrison
Copy link

anna-harrison commented Oct 6, 2017

Hey @tg-ephox : looks really good to me!
@karmatosed : our tests from this feature in TinyMCE mobile showed that people find the serialised link dialog intuitive to use. We have tested the Gutenberg version informally at this stage, and results confirm the same
@youknowriad : are we good to merge?

@youknowriad
Copy link
Contributor

Great job so far! I'm really liking the consistency.

  • Confirmed the button block is working now
  • The inline toolbar is placed at the same level of the block toolbar, I'm not sure this was part of the initial plan of this PR, We'll need a design validation for this @mtias @jasmussen @karmatosed
  • Minor: Could we make sure to submit this when we hit "Enter"?

screen shot 2017-10-06 at 09 49 10

@@ -75,19 +75,9 @@ registerBlockType( 'core/button', {
onChange={ ( value ) => setAttributes( { text: value } ) }
formattingControls={ [ 'bold', 'italic', 'strikethrough' ] }
keepPlaceholderOnFocus
extraToolbarButtons={ <UrlInputButton showSettings={ false } url={ url } onChange={ updateUrl } /> }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this prop? Can't we just put this putting in the BlockControls component?

const EditStep = 'EDIT';
const SettingsStep = 'SETTINGS';

const AllSteps = [ EditStep, SettingsStep, DisplayStep ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this unofficial style guideline for uppercasing module constants? Could we uppercase those?

const DISPLAY_STEP...

if ( steps[ currentStep ] === EditStep ) {
return [
<UrlInput key="urlinput" value={ url || '' } onChange={ this.changeLink } required={ ! isDeleted } />,
<IconButton key="iconbutton" className="blocks-url-input__unlink" icon="dismiss" label={ __( 'Un-link' ) } disabled={ ! url } onClick={ this.deleteLink } />,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we break this line and the above maybe to improve readability?

renderStep( steps ) {
const { currentStep, url, isDeleted, opensInNewWindow } = this.state;

if ( steps[ currentStep ] === EditStep ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not a switch?

@karmatosed
Copy link
Member

@annaephox I am not happy merging it in it's current state. The design discussion is here: #2715

@jasmussen
Copy link
Contributor

Thanks for working on this, sorry for coming in with feedback so late. I'm also coming in fresh, so please let me know if some of the following are known issues, or separate from this PR.

  1. The external link toggle can't be set and immediately unset:

extlink

Just click twice on the switch.

  1. The link dialog will sometimes move if I click to edit a link, then click around in the dialog a bit:

movingdialog

  1. The caret is moved to the start of the input field when I click around. Pretty sure this is the same bug as 2 mentioned above, but perhaps it can help narrow down what happens:

movingcaret

  1. The block level link (i.e. for images) looks a bit off. This is what Riad refers to in this comment:

The inline toolbar is placed at the same level of the block toolbar, I'm not sure this was part of the initial plan of this PR

toolbarposition

Two solutions I can see. The easiest one is probably to let the link dialog box sit stacked below the quick toolbar.

The other solution is to keep it where it is — i.e cover the quick toolbar. But then we can't have stacked shadows, i.e. the quick toolbar should probably be invisible when the link toolbar is there, and reappear when done. Also, we should make sure they have the same height — right now the link toolbar is slightly taller:

toolbarposition

Given the discussion ongoing in #2983, perhaps it's best to do as little as possible around this area right now.

@mikekosulin
Copy link

How to setup option:
Open a new window by default?

@karmatosed
Copy link
Member

I am closing this as we can always iterate but we reached a point here where we weren't progressing. Let's get feedback in testing and take from there.

@karmatosed karmatosed closed this Dec 14, 2017
@youknowriad youknowriad deleted the try/2715-improve-link-entry branch December 15, 2017 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Design Feedback Needs general design feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Link Entry
6 participants