mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-22 22:45:52 +00:00
Fixed: show placeholder string while editing empty CPTextField
Previously, selecting an empty text field hid the contentView, causing the placeholder string to dissapear. This fix leaves the contentView of the text field visible when the internal _stringValue is nil or empty. Fixes #2049
This commit is contained in:
1 parent
23f04b3d09
commit
5b4e7df856
1 file changed
+3
-3
@@ -586,7 +586,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
lineHeight = [font defaultLineHeightForFont];
|
||||
|
||||
element.value = _stringValue;
|
||||
element.style.color = [[self currentValueForThemeAttribute:@"text-color"] cssString];
|
||||
element.style.color = [[self valueForThemeAttribute:@"text-color" inState:CPThemeStateEditing] cssString];
|
||||
|
||||
if (CPFeatureIsCompatible(CPInputSetFontOutsideOfDOM))
|
||||
element.style.font = [font cssString];
|
||||
@@ -1158,7 +1158,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
- (void)_updatePlaceholderState
|
||||
{
|
||||
if ((!_stringValue || _stringValue.length === 0) && ![self hasThemeState:CPThemeStateEditing])
|
||||
if (!_stringValue || _stringValue.length === 0)
|
||||
[self setThemeState:CPTextFieldStatePlaceholder];
|
||||
else
|
||||
[self unsetThemeState:CPTextFieldStatePlaceholder];
|
||||
@@ -1705,7 +1705,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
if (contentView)
|
||||
{
|
||||
[contentView setHidden:[self hasThemeState:CPThemeStateEditing]];
|
||||
[contentView setHidden:(_stringValue && _stringValue.length > 0) && [self hasThemeState:CPThemeStateEditing]];
|
||||
|
||||
var string = "";
|
||||
|
||||
|
||||
Reference in new issue
Block a user