Skip to content

Instantly share code, notes, and snippets.

@BlairDuncan
Created August 25, 2010 05:01
Show Gist options
  • Select an option

  • Save BlairDuncan/548887 to your computer and use it in GitHub Desktop.

Select an option

Save BlairDuncan/548887 to your computer and use it in GitHub Desktop.
@implementation LPMultiLineTextField(fix)
- (void)layoutSubviews
{
[super layoutSubviews];
var contentView = [self layoutEphemeralSubviewNamed:@"content-view"
positioned:CPWindowAbove
relativeToEphemeralSubviewNamed:@"bezel-view"];
[contentView setHidden:YES];
var DOMElement = [self _DOMTextareaElement],
contentInset = [self currentValueForThemeAttribute:@"content-inset"],
bounds = [self bounds];
DOMElement.style.top = contentInset.top + @"px";
DOMElement.style.bottom = contentInset.bottom + @"px";
DOMElement.style.left = contentInset.left + @"px";
DOMElement.style.right = contentInset.right + @"px";
DOMElement.style.width = (CGRectGetWidth(bounds) - contentInset.left - contentInset.right) + @"px";
DOMElement.style.height = (CGRectGetHeight(bounds) - contentInset.top - contentInset.bottom) + @"px";
DOMElement.style.color = [[self currentValueForThemeAttribute:@"text-color"] cssString];
DOMElement.style.font = [[self currentValueForThemeAttribute:@"font"] cssString];
DOMElement.value = _stringValue || @"";
// this switch case adds support for text alignment
switch ([self currentValueForThemeAttribute:@"alignment"])
{
case CPCenterTextAlignment:
DOMElement.style.textAlign = "center";
break;
case CPRightTextAlignment:
DOMElement.style.textAlign = "right";
break;
default:
DOMElement.style.textAlign = "left";
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment