Reorder the logic for the copy / past in HTML5

Added a focus() fix for copy/paste operations in Chrome.
This commit is contained in:
Andrew Sevenson
2019-12-03 11:28:05 +11:00
committed by Joshua Granick
parent 70493d21c2
commit db8279e928

View File

@@ -904,23 +904,23 @@ class HTML5Window
public function setClipboard(value:String):Void
{
if (textArea == null)
{
textArea = cast Browser.document.createElement("textarea");
textArea.style.height = "0px";
textArea.style.left = "-100px";
textArea.style.opacity = "0";
textArea.style.position = "fixed";
textArea.style.top = "-100px";
textArea.style.width = "0px";
Browser.document.body.appendChild(textArea);
}
textArea.value = value;
textArea.focus();
textArea.select();
if (Browser.document.queryCommandEnabled("copy"))
{
if (textArea == null)
{
textArea = cast Browser.document.createElement("textarea");
textArea.style.height = "0px";
textArea.style.left = "-100px";
textArea.style.opacity = "0";
textArea.style.position = "fixed";
textArea.style.top = "-100px";
textArea.style.width = "0px";
Browser.document.body.appendChild(textArea);
}
textArea.value = value;
textArea.select();
Browser.document.execCommand("copy");
}
}