Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: artifacts - add button to download/save the generated html (or other code) #4645

Open
1 task done
quacrobat opened this issue Nov 6, 2024 · 0 comments
Open
1 task done
Labels
enhancement New feature or request

Comments

@quacrobat
Copy link

quacrobat commented Nov 6, 2024

What features would you like to see added?

Right now there's a copy-code-to-clipboard button at the bottom right of the artifacts window.
I suggest an additional button to download/save to local disk. Ideally it would try to chose a filename by default (eg. the <title> of the html).
image

More details

// something like this should work

        const content = //get the artifact content
        const filename = prompt("Enter a filename to save as:", `${defaultTitle}.html`);

        if (filename) {
            const blob = new Blob([content], { type: "text/html" });
            const url = URL.createObjectURL(blob);
            const link = document.createElement("a");
            link.href = url;
            link.download = filename;
            link.click();
            URL.revokeObjectURL(url);

Which components are impacted by your request?

UI

Pictures

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@quacrobat quacrobat added the enhancement New feature or request label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant