Skip to content

Commit

Permalink
Copy to clipboard when creating share link (#147)
Browse files Browse the repository at this point in the history
* copy to clipboard when generating share link

* note that it's in your keyboard already

* Copy MakeCode Project Link -> Create MakeCode Share Link
  • Loading branch information
jwunderl authored Mar 17, 2023
1 parent b41233d commit be3cef3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Some other files you might see in your project include:

Some of the important fields include:

* **name** - The name of the project. When you create a share link, this name is what people will see. Try to make it descriptive!
* **name** - The name of the project. When you create a MakeCode share link, this name is what people will see. Try to make it descriptive!
* **description** - A description of your project.
* **dependencies** - This field contains all of the extensions used by your project. To add/remove an extension, see the sections below. By default, all arcade projects depend on the `device` extension; make sure not to remove it if you want your project to work with MakeCode Arcade!
* **files** - This is a list of the files in your project. All `.ts`, `.jres`, `.g.ts`, `.g.jres`, and `.md` files should be listed here.
Expand Down Expand Up @@ -183,7 +183,7 @@ If your hardware is failing to show up as a USB drive when you plug it in, try t

## Sharing your project

To create a share link for your project, click the "Create a share link" command in the MakeCode Asset Explorer. This will cause the output pane to open with a link that you can copy/paste.
To create a MakeCode share link for your project, click the "Create MakeCode Share Link" command in the MakeCode Asset Explorer. This will cause the output pane to open with a link that you can copy/paste.

To change the name of your shared project, see the `pxt.json` section above.

Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"makecode.install.title": "Install project dependencies",
"makecode.clean.title": "Clean built folders",
"makecode.importUrl.title": "Import project from URL",
"makecode.shareProject.title": "Create a share link",
"makecode.shareProject.title": "Create MakeCode Share Link",
"makecode.addDependency.title": "Add extension to project",
"makecode.removeDependency.title": "Remove extension from project",
"makecode.createImage.title": "Create a new image asset",
Expand Down
4 changes: 2 additions & 2 deletions src/web/actionsTreeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ const actions: ActionTreeNode[] = [
}
},
{
label: vscode.l10n.t("Create a share link"),
label: vscode.l10n.t("Create MakeCode Share Link"),
icon: new vscode.ThemeIcon("export"),
command: {
title: vscode.l10n.t("Create a share link"),
title: vscode.l10n.t("Create MakeCode Share Link"),
command: "makecode.shareProject"
}
},
Expand Down
7 changes: 6 additions & 1 deletion src/web/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,14 @@ async function shareCommandAsync() {
const link = await shareProjectAsync(workspace);

if (link) {
try {
await vscode.env.clipboard.writeText(link);
} catch (e) {
tickEvent("clipboard.failed");
}
const output = vscode.window.createOutputChannel("MakeCode");
output.show();
output.append(vscode.l10n.t("Congratulations! Your project is shared at ") + link)
output.append(vscode.l10n.t("Congratulations! Your project is shared at {0} and has been copied into your clipboard.", link));
}
}

Expand Down

0 comments on commit be3cef3

Please sign in to comment.