CEP-Resources
CEP-Resources copied to clipboard
CEP10: Clipboard Paste window.execCommand('paste') broken on Windows
Hey guys,
It seems like using clipboard Paste via window.execCommand('paste')
is not working on Windows (but ok on macOS) with Illustrator 25 while window.execCommand('copy')
is OK.
Any idea?
@ghenania Do you have a sample? That will help in investigating this quicker.
@sujaisivanandan I guess you can try in CEP10 Mac and Windows something like:
<!DOCTYPE html>
<html>
<body>
<p>Copy something in your clipboard and then click on the button to paste the text in the text field.</p>
<input type="text" id="myInput">
<button onclick="myFunction()">Paste text</button>
<script>
function myFunction() {
var pasteText = document.getElementById("myInput");
pasteText.focus();
var success = document.execCommand("paste");
if (success) {
alert("Pasted the text: " + pasteText.value);
} else {
alert("Failed to Paste");
}
}
</script>
</body>
</html>
@ghenania I tried your code in chrome browser and I noticed that the paste is failing. I noticed the same behaviour in CEP(Mac) also. Can you re-check the above script?
@rushilmahajan-adobe Yes it's normal. It fails on recent versions of Chrome (as a new API is recommended). But on CEP10, it fails on Windows but not on Mac. And it works fine on both platforms with CEP9. So 2 questions here: 1/ Why does it works on Mac but not on Windows? 2/ The new Clipboard API may be an alternative but doesn't work on CEP10. As a result today, there is no native way to do a Paste on WIndows with CEP 10.