Skip to content

Text alignment support#624

Merged
daniloercoli merged 46 commits intodevelopfrom
issue/465-text-alignment
Feb 1, 2018
Merged

Text alignment support#624
daniloercoli merged 46 commits intodevelopfrom
issue/465-text-alignment

Conversation

@0nko
Copy link
Copy Markdown
Contributor

@0nko 0nko commented Jan 31, 2018

Addresses #465.

All inline and block elements can now by aligned to the left, right and center. If alignment is applied to plain text it is surrounded by <p> tags. Multi-selection is also supported.

The alignment formatting is parsed to HTML as a CSS style.

The toolbar button functionality is overloaded for the [caption] shortcode, where it's used for caption-specific alignment parsing (e.g. align="alignright").

Don't be put off by the large number of changes as a lot of them are just resource files and unit tests.

Note that the cursor position is behaving a little weird around empty hidden spans, because special zero-width characters are used for the spans.

screenshot_1517417175

0nko added 30 commits January 22, 2018 20:13
@daniloercoli
Copy link
Copy Markdown
Contributor

When I start the demo app the caption is right aligned even though there is no align="alignright" specified.
device-2018-02-01-151805

nestable: IAztecSpan, parents: ArrayList<IAztecNestable>?, nestingLevel: Int) {
nestable: IAztecParagraphStyle, parents: ArrayList<IAztecNestable>?, nestingLevel: Int) {

CssStyleFormatter.removeStyleAttribute(nestable.attributes, CssStyleFormatter.CSS_TEXT_ALIGN_ATTRIBUTE)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's not clear to me why we're removing the text-align style attribute, and then re-applying it in case nestable.shouldParseAlignmentToHtml() is true.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I'm trying to think of a case when this could be a problem. It's not an issue for captions because the plugin removes the style attribute. But I suppose we can move it within the if statement.


val spans = editableText.getSpans(start, end + endModifier, spanType)
spans.forEach { span ->
spans.forEach innerForEach@ { span ->
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Niptick - Is innerForEach@ needed here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, it's a leftover from a change that required it but eventually got removed.

@0nko
Copy link
Copy Markdown
Contributor Author

0nko commented Feb 1, 2018

About the caption alignment - it's here :).

@daniloercoli
Copy link
Copy Markdown
Contributor

Impressive. :shipit:

@daniloercoli daniloercoli merged commit 5d00583 into develop Feb 1, 2018
@daniloercoli daniloercoli deleted the issue/465-text-alignment branch February 1, 2018 18:10
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.

3 participants