fix native cut

This commit is contained in:
daboe01 committed 2015-06-22 20:30:44 +02:00
1 parent 13ea8eae77
commit 0d7e945623
1 file changed
+24
+24
View File
@@ -2282,6 +2282,30 @@ var _CPCopyPlaceholder = '-';
e.preventDefault();
e.stopPropagation();
return false;
}
_CPNativeInputField.oncut = function(e)
{
_CPNativeInputFieldWasCopyPaste = YES;
var pasteboard = [CPPasteboard generalPasteboard],
string,
currentFirstResponder = [[CPApp mainWindow] firstResponder];
setTimeout(function(){ // prevent dom-flickering
[currentFirstResponder cut:self];
}, 20);
[currentFirstResponder copy:self]; // this is necessary because cut will only execute in the future
// dataForPasting = [pasteboard dataForType:CPRichStringPboardType],
stringForPasting = [pasteboard stringForType:CPStringPboardType];
e.clipboardData.setData('text/plain', stringForPasting);
// e.clipboardData.setData('application/rtf', stringForPasting); // does not seem to work
e.preventDefault();
e.stopPropagation();
return false;
}
}