-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[TIMOB-24080] : iOS - Paragraph style support in attributed string #10032
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor issues.
iphone/Classes/UIModule.m
Outdated
@@ -594,6 +594,26 @@ - (NSNumber *)ATTRIBUTE_LINE_BREAK_BY_TRUNCATING_MIDDLE | |||
{ | |||
return NUMINTEGER(NSLineBreakByTruncatingMiddle); | |||
} | |||
- (NSNumber *)ATTRIBUTE_TEXT_ALIGNMENT_LEFT | |||
{ | |||
return NUMINTEGER(NSTextAlignmentLeft); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already support these on the UIModule class via Ti.UI.TEXT_ALIGNMENT_*
@@ -504,7 +504,7 @@ - (NSNumber *)convertUnits:(id)args | |||
MAKE_SYSTEM_PROP(ATTRIBUTE_STRIKETHROUGH_COLOR, AttributeNameStrikethroughColor); | |||
MAKE_SYSTEM_PROP(ATTRIBUTE_OBLIQUENESS, AttributeNameObliqueness); | |||
MAKE_SYSTEM_PROP(ATTRIBUTE_EXPANSION, AttributeNameExpansion); | |||
MAKE_SYSTEM_PROP(ATTRIBUTE_LINE_BREAK, AttributeNameLineBreak); | |||
MAKE_SYSTEM_PROP(ATTRIBUTE_LINE_BREAK, AttributeNameLineBreak); // deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we only warn the user via code so far, not via docs. Please add.
description: | | ||
This property contains the line break mode to be used laying out the text of paragraph. | ||
type: Number | ||
constants: [ Titanium.UI.ATTRIBUTE_LINE_BREAK_* ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this is deprecated?
apidoc/Titanium/UI/Attribute.yml
Outdated
If positive, this value is the distance from the leading margin | ||
(for example, the left margin in left-to-right text). If 0 or negative, | ||
it is the distance from the trailing margin. This is a float value. | ||
type: Number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to document what units tailIndex
uses, such as points.
apidoc/Titanium/UI/Attribute.yml
Outdated
description: | | ||
This value is always nonnegative. This value is included in the line fragment heights | ||
in the layout manager. | ||
type: Number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to document the lineSpacing
units, such as points.
apidoc/Titanium/UI/Attribute.yml
Outdated
would not otherwise fit in the available space. The maximum amount of tightening performed | ||
by the system is dependent on the font, line width, and other factors. The default value of | ||
this property is NO. | ||
type: Number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The allowsDefaultTighteningForTruncation
type should be boolean, not number.
And the description should use true
and false
instead of the Objective-C YES
and NO
.
apidoc/Titanium/UI/Attribute.yml
Outdated
to separate it from the following paragraph. This value must be nonnegative. The space | ||
between paragraphs is determined by adding the paragraphSpacing of previous paragraph and | ||
the paragraphSpacingBefore of current paragraph. | ||
type: Number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should rename property paragraphSpacing
to paragraphSpacingAfter
. This makes it clear that it's only applied after the paragraph (assuming this is actually how it works). And it clearly separates it from the paragraphSpacingBefore
property.
@vijaysingh-axway, @hansemannn, it's kind of a bummer that we're hard-coding properties such as To be fair, I've noticed that our existing |
apidoc/Titanium/UI/Attribute.yml
Outdated
The natural line height of the receiver is multiplied by this factor (if positive) | ||
before being constrained by minimum and maximum line height. The default value of | ||
this property is 0.0. | ||
type: Number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs here don't do a good job describing what lineHeightMultiple
, maximumLineHeight
, and minimumLineHeight
do. Nor why you would want to use them.
(Not trying to be rude. Just looking at this from a Titanium dev's perspective.) 😄
I assume you would want to use minimumLineHeight
in case you use mixed font sizes and you want all lines to have the same height as the largest font size. That's the only use-case I can think of.
But why would you want to use maximumLineHeight
? Would it clip text that exceed this height? If there is answer to this, then we should document it.
Also, I have no clue what lineHeightMultiple
is supposed to do from reading the description... nor why I would want to use it. If there is a valid use-case, then let's document it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I assume a value of zero for maximumLineHeight
means do not apply a max, right? Otherwise text would always be clipped. We should document that.
I assume the same is true for lineHeightMultiple
? A value of zero means don't multiply?
I agree! There is a helper for convertig values to dimensions. Vijay, can you address that? |
@vijaysingh-axway Can you check the review comments? Moving to 7.3.0 for now, due to lower priority. |
Note that I'm not trying to picky. These details matter when we implement this on Android for parity. Documenting these details not only benefits Titanium devs, but it also serves as a specification when implementing this feature on other platforms. Thanks! |
@@ -178,11 +213,12 @@ - (void)addAttribute:(id)args | |||
break; | |||
|
|||
case AttributeNameLineBreak: | |||
DEPRECATED_REPLACED(@"UI.ATTRIBUTE_LINE_BREAK", @"UI.ATTRIBUTE_PARAGRAPH_STYLE.lineBreakMode", @"7.3.0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7.4.0
@hansemannn Fixed the dimension conversion. Now you can review. Thanks! |
@vijaysingh-axway You still should update the docs to reflect that developers can also use non-Number types. |
Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR passed!
@jquick-axway Can you re-review / approve this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR: Pass
FR passed. Attributed string Works fine on IOS. PR merged |
https://jira.appcelerator.org/browse/TIMOB-24080