fix url to open sketch in cloud editor (#452)

This commit is contained in:
Alberto Iannaccone 2021-07-23 10:01:21 +02:00 committed by GitHub
parent d790266cc8
commit 5897f379a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -176,7 +176,7 @@ export class CloudSketchbookContribution extends Contribution {
registry.registerCommand(CloudSketchbookCommands.OPEN_IN_CLOUD_EDITOR, {
execute: (arg) => {
this.windowService.openNewWindow(
`https://create.arduino.cc/editor/${arg.node.sketchId}`,
`https://create.arduino.cc/editor/${arg.username}/${arg.node.sketchId}`,
{ external: true }
);
},

View File

@ -94,7 +94,9 @@ export class CloudSketchbookTreeWidget extends SketchbookTreeWidget {
this.currentSketchUri === node.uri.toString())
) {
return Array.from(new Set(node.commands)).map((command) =>
this.renderInlineCommand(command.id, node)
this.renderInlineCommand(command.id, node, {
username: this.authenticationService.session?.account?.label,
})
);
}
return undefined;

View File

@ -125,11 +125,12 @@ export class SketchbookTreeWidget extends FileTreeWidget {
protected renderInlineCommand(
commandId: string,
node: SketchbookTree.SketchDirNode
node: SketchbookTree.SketchDirNode,
options?: any
): React.ReactNode {
const command = this.commandRegistry.getCommand(commandId);
const icon = command?.iconClass;
const args = { model: this.model, node: node };
const args = { model: this.model, node: node, ...options };
if (
command &&
icon &&