Overwrite selected tokens by typing support.

If tokens are selected in `CPTokenField` and new text is entered, the selected tokens are overwritten by the newly entered text.
This commit is contained in:
Alexander Ljungberg
2012-06-16 12:31:50 +01:00
parent 19b53746cf
commit d5918157ff
+8
View File
@@ -699,6 +699,14 @@ var CPScrollDestinationNone = 0,
}
else
{
// If you type something while tokens are selected, overwrite them.
if (_selectedRange.length)
{
[self _removeSelectedTokens:self];
// Make sure the editor is placed so it can capture the characters we're overwriting with.
[self layoutSubviews];
}
// If we didn't handle it, allow _propagateCurrentDOMEvent the input field to receive
// the new character.