focusForClipboard fixes

This commit is contained in:
daboe01 committed 2015-06-27 13:10:53 +02:00
1 parent dd5521a07c
commit 6d877754da
1 file changed
+8 -9
+8 -9
View File
@@ -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";