Add CPAltEnterTextAreaFeature checking. FF doesn't add a cariage return on textarea when doing alt+enter

This commit is contained in:
Antoine Mercadal
2014-11-13 00:17:29 -08:00
parent de3f6d3e82
commit e2020fa7f2
2 changed files with 5 additions and 4 deletions
+1 -4
View File
@@ -1079,9 +1079,6 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
[self _didEdit];
}
console.error("newValue : >" + newValue + "<")
console.error("_stringValue : >" + _stringValue + "<")
if ([self _valueIsValid:_stringValue])
{
// If _isEditing == YES then the target action can also be called via
@@ -1129,7 +1126,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
// we don't need to do this in case of textarea
// or we will end up with 2 carriage returns
if (aCharacter != CPNewlineCharacter || element.nodeName.toUpperCase() != "TEXTAREA")
if (aCharacter != CPNewlineCharacter || element.nodeName.toUpperCase() != "TEXTAREA" || !CPFeatureIsCompatible(CPAltEnterTextAreaFeature))
element.value = [element.value stringByReplacingCharactersInRange:[self selectedRange] withString:aCharacter];
[self _setStringValue:element.value];