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

Pullquote block #1920

Closed
wants to merge 14 commits into from
Closed

Pullquote block #1920

wants to merge 14 commits into from

Conversation

ceyhun
Copy link
Contributor

@ceyhun ceyhun commented Feb 17, 2020

Add support for Pullquote block behind dev flag. Issues blocking the release of this block are here: #1854

Gutenberg PR: WordPress/gutenberg#20952

To test: See Gutenberg PR

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@SergioEstevao SergioEstevao self-requested a review February 17, 2020 11:03
@ceyhun ceyhun force-pushed the add/pullquote-block branch from 2a5c168 to bc9a2c5 Compare February 24, 2020 14:41
@marecar3
Copy link
Contributor

marecar3 commented Feb 25, 2020

Hey @mchowning 👋

As I have mentioned on Slack, @ceyhun experienced a problem with text alignment in pullquote block and I tried to find some nice/good fix, but couldn't find an easy one.

Let me try to explain where is the problem and what I have tried in order to fix it.

Problem:

Probably alignment isn't working because <p> is wrapped with <div> and here is the picture of all spans in example text.

Screen Shot 2020-02-25 at 2 33 49 PM

Even if we have ParagraphSpan it seems that the problem is caused by HiddenHtmlBlock.

Solution:

The easiest solution is to call method: view.toggleFormatting(AztecTextFormat.FORMAT_ALIGN_CENTER);
but there is a problem how to determinate when to call the method as:

  • we don't have a specific block type / tag
  • method call can only happen after the text is set
  • we need to know the type of alignment (to store it, but it will be ugly?)

Maybe I am missing something so if you have some ideas which can work, please be free to share, thanks!

@mchowning
Copy link
Contributor

mchowning commented Feb 25, 2020

Even if we have ParagraphSpan it seems that the problem is caused by HiddenHtmlBlock.

I bet you're right. Since HiddenHtmlSpan implements IAztecAlignmentSpan it's going to always ignore the View's gravity. I wonder if it would be possible to make it so that there is a HiddenHtmlSpan class that does not extend IAztecAlignmentSpan, which we could then use to allow the gravity to take effect. Similar to what I did with ParagraphSpan? My suspicion is that will not be an easy change though since it looks like there were specific needs that led to adding alignment to the HiddenHtmlSpan. 😞

The easiest solution is to call method: view.toggleFormatting(AztecTextFormat.FORMAT_ALIGN_CENTER);
but there is a problem how to determinate when to call the method...

Am I understanding correctly that if we were able to use view.toggleFormatting(...) for setting alignment on all blocks, then we wouldn't need to change anything to get alignment working for the pullquote block? I know I ran into a lot of issues trying to use that for paragraphs (I outlined some of those issues in my PR description), but we can always reassess that decision if we need to.

@mchowning
Copy link
Contributor

I have opened an AztecEditor-Android PR that I believe will address the alignment issue. That does not solve the problem of the placeholder not showing though, so that still needs some investigation. As you noted, the quote block also has the same problem with the placeholder, so I don't think that issue should block this PR.

@ceyhun ceyhun marked this pull request as ready for review March 17, 2020 11:06
Copy link
Contributor

@SergioEstevao SergioEstevao left a comment

Choose a reason for hiding this comment

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

:shipit:

@SergioEstevao
Copy link
Contributor

You need to update this PR with the latest changes in develop, after the merge if the CI tests pass feel free to merge.

@ceyhun
Copy link
Contributor Author

ceyhun commented Apr 9, 2020

Closing as gutenberg PR is merged and gutenberg ref already updated by another merged PR.

@ceyhun ceyhun closed this Apr 9, 2020
@ceyhun ceyhun deleted the add/pullquote-block branch April 9, 2020 11:54
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