mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-11 19:17:07 +00:00
fix native cut
This commit is contained in:
1 parent
13ea8eae77
commit
0d7e945623
1 file changed
+24
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user