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

Button: Add "Start on a new line" option (#1473) #1512

Merged
merged 1 commit into from
Oct 6, 2017
Merged

Button: Add "Start on a new line" option (#1473) #1512

merged 1 commit into from
Oct 6, 2017

Conversation

truongwp
Copy link
Contributor

@truongwp truongwp commented Jun 27, 2017

There is no way to clear the float when using an align left or right button, the next text button always behinds the button. You can read more here: #1473

@truongwp truongwp closed this Jun 27, 2017
@truongwp
Copy link
Contributor Author

I will pull and rebase to avoid marge commit.

@truongwp truongwp reopened this Jun 27, 2017
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

It looks like it addresses #1473. Can you rebase with master and provide testing instructions? I'm happy to help to land it into master.

@codecov
Copy link

codecov bot commented Sep 23, 2017

Codecov Report

Merging #1512 into master will decrease coverage by 0.09%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #1512     +/-   ##
=========================================
- Coverage   33.77%   33.67%   -0.1%     
=========================================
  Files         191      190      -1     
  Lines        5691     5686      -5     
  Branches      996      993      -3     
=========================================
- Hits         1922     1915      -7     
- Misses       3189     3191      +2     
  Partials      580      580
Impacted Files Coverage Δ
blocks/library/button/index.js 19.04% <0%> (-7.62%) ⬇️
editor/selectors.js 94.73% <0%> (-2.02%) ⬇️
blocks/editable/index.js 10.31% <0%> (-0.19%) ⬇️
blocks/library/table/index.js 41.66% <0%> (ø) ⬆️
editor/modes/visual-editor/block-list.js 0% <0%> (ø) ⬆️
editor/store-persist.js 100% <0%> (ø) ⬆️
blocks/library/code/index.js 57.14% <0%> (ø) ⬆️
...ditor/modes/visual-editor/invalid-block-warning.js 0% <0%> (ø) ⬆️
blocks/library/shortcode/index.js 50% <0%> (ø) ⬆️
blocks/library/pullquote/index.js 33.33% <0%> (ø) ⬆️
... and 13 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 ff1ef2b...07e5a06. Read the comment docs.

@truongwp
Copy link
Contributor Author

truongwp commented Sep 23, 2017

@gziolo I rebased with master. Below is the problem and the test case:

I want to align my button to the right, then next line is a paragraph, like this:

selection_001

But if I align my button right, it floats and the second paragraph goes beside the button:

selection_002

With the "Start on a new line" option, the button is always on a line, even when floats left, right. We can discuss about "Start on a new line" phrase. I can't find a better phrase.

@youknowriad
Copy link
Contributor

related #1473

@gziolo
Copy link
Member

gziolo commented Sep 25, 2017

With the "Start on a new line" option, the button is always on a line, even when floats left, right. We can discuss about "Start on a new line" phrase. I can't find a better phrase.

@karmatosed or @jasmussen any suggestions on the name this option?

@truongwp
Copy link
Contributor Author

What about this phrase: "Stand on a line"

@jasmussen
Copy link
Contributor

What about this phrase: "Stand on a line"

I like that.

@youknowriad
Copy link
Contributor

Just a note that this is probably something we can handle as an "extension" to blocks, the same way we're thinking of refactoring the custom className and anchor properties. See here for more details #2474 (comment)

@gziolo
Copy link
Member

gziolo commented Sep 25, 2017

Code looks good, it works as advertised. It only needs an option name to be updated as discussed above and it should be good to merge. Thank you very much for working on that one.

@truongwp
Copy link
Contributor Author

@gziolo Thank you. Do I need to update the commit to change option name?

@gziolo
Copy link
Member

gziolo commented Sep 25, 2017

That would be the best. You can also add another commit and we can squash before merge.

@truongwp
Copy link
Contributor Author

I updated the commit with option text is "Stand on a line"


return [
focus && (
<BlockControls key="controls">
<BlockAlignmentToolbar value={ align } onChange={ updateAlignment } />
</BlockControls>
),
focus && (
<InspectorControls key="inspector">
{clearControl}
Copy link
Member

Choose a reason for hiding this comment

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

@truongwp one more little thing before we merge. Can you add spaces around clearControl to satisfy WordPress coding guidelines? I missed that yesterday, thanks!

@truongwp
Copy link
Contributor Author

@gziolo I added spaces around clearControl. Just wait CI to check code :D

@gziolo
Copy link
Member

gziolo commented Sep 26, 2017

Travis CI seems to be unhappy with this change which is surprising and completely unexpected. I'm trying to find out what has happened on Slack's #core-editor channel.

@truongwp
Copy link
Contributor Author

Sometimes I meet this error. I think it isn't coding error.

@truongwp
Copy link
Contributor Author

I moved "Stand on a line" options to below of block description.

@gziolo
Copy link
Member

gziolo commented Oct 2, 2017

This is how it looks like at the moment:

screen shot 2017-10-02 at 11 38 07

I moved "Stand on a line" options to below of block description.

@jasmussen I'm not familiar with the patterns here, can you confirm it fits well?

Another question is if we should remove max-width: 370px when Stand on a line is enabled? It seems like it should take all space in such case, similar to when it's center aligned.

@jasmussen
Copy link
Contributor

Another question is if we should remove max-width: 370px when Stand on a line is enabled? It seems like it should take all space in such case, similar to when it's center aligned.

I think we had the 370px value back when we didn't have image resizing, and perhaps the button just inherited it. It seems like if the button width can expand the block border itself, then that would be superior to having a fixed width. What do you think, @mtias?

By the way we should reconsider that link thing on the button. I know why we did it initially, but two toolbars is too much for that block. We should have a link button in the toolbar that just applies at the block level to the block.

@gziolo
Copy link
Member

gziolo commented Oct 6, 2017

Okey, it looks like this width issue is unrelated to this change. So let's fix it in another PR if we agree that it makes sense. Merging this one as it is. @truongwp thanks for your contribution 👍

@gziolo gziolo merged commit 1400611 into WordPress:master Oct 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants