mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-11 11:07:07 +00:00
focusForClipboard fixes
This commit is contained in:
1 parent
dd5521a07c
commit
6d877754da
1 file changed
+8
-9
@@ -2315,7 +2315,6 @@ var _CPCopyPlaceholder = '-';
|
||||
|
||||
+ (void)focus
|
||||
{
|
||||
|
||||
var currentFirstResponder = [[CPApp mainWindow] firstResponder];
|
||||
|
||||
if (![currentFirstResponder respondsToSelector:@selector(_activateNativeInputElement:)])
|
||||
@@ -2341,6 +2340,14 @@ var _CPCopyPlaceholder = '-';
|
||||
|
||||
currentFirstResponder._DOMElement.appendChild(_CPNativeInputField);
|
||||
_CPNativeInputField.focus();
|
||||
}
|
||||
|
||||
+ (void)focusForClipboard
|
||||
{
|
||||
if (!_CPNativeInputFieldActive && _CPNativeInputField.innerHTML.length == 0)
|
||||
_CPNativeInputField.innerHTML = _CPCopyPlaceholder; // make sure we have a selection to allow the native pasteboard work in safari
|
||||
|
||||
[self focus];
|
||||
|
||||
// select all in the contenteditable div (http://stackoverflow.com/questions/12243898/how-to-select-all-text-in-contenteditable-div)
|
||||
if (document.body.createTextRange)
|
||||
@@ -2358,14 +2365,6 @@ var _CPCopyPlaceholder = '-';
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)focusForClipboard
|
||||
{
|
||||
if (_CPNativeInputField.innerHTML.length == 0)
|
||||
_CPNativeInputField.innerHTML = _CPCopyPlaceholder; // make sure we have a selection to allow the native pasteboard work in safari
|
||||
|
||||
[self focus];
|
||||
}
|
||||
|
||||
+ (void)hideInputElement
|
||||
{
|
||||
_CPNativeInputField.style.top="-10000px";
|
||||
|
||||
Reference in new issue
Block a user