Feature hasn't been suggested before.
Describe the enhancement you want to request
Currently, the Copy button does not work in http environments because the navigator.clipboard API requires a secure context (https or localhost).
Many opencode users likely run the application in self-hosted http contexts, so this limits usability.
Although document.execCommand("copy") is deprecated, it is still supported by many browsers and works in http enviroments.
I propose implementing execCommand as a fallback when navigator.clipboard is unavalible.
Sample Code
const content = "copy content";
// Check if clipboard API is available
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(content);
} else {
// Fallback for HTTP / older browsers
const textarea = document.createElement("textarea");
textarea.value = content;
document.body.appendChild(textarea);
textarea.select();
document.execCommand("copy");
document.body.removeChild(textarea);
}
Feature hasn't been suggested before.
Describe the enhancement you want to request
Currently, the Copy button does not work in
httpenvironments because thenavigator.clipboardAPI requires a secure context (httpsorlocalhost).Many opencode users likely run the application in self-hosted
httpcontexts, so this limits usability.Although
document.execCommand("copy")is deprecated, it is still supported by many browsers and works inhttpenviroments.I propose implementing
execCommandas a fallback whennavigator.clipboardis unavalible.Sample Code