mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-08 20:06:32 +00:00
fix: remote sketch creation if tree is not active
Closes #1715 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
parent
81195431b0
commit
c0488d1f64
@ -202,11 +202,12 @@ export class NewCloudSketch extends Contribution {
|
||||
private treeModelFrom(
|
||||
widget: SketchbookWidget
|
||||
): CloudSketchbookTreeModel | undefined {
|
||||
const treeWidget = widget.getTreeWidget();
|
||||
if (treeWidget instanceof CloudSketchbookTreeWidget) {
|
||||
const model = treeWidget.model;
|
||||
if (model instanceof CloudSketchbookTreeModel) {
|
||||
return model;
|
||||
for (const treeWidget of widget.getTreeWidgets()) {
|
||||
if (treeWidget instanceof CloudSketchbookTreeWidget) {
|
||||
const model = treeWidget.model;
|
||||
if (model instanceof CloudSketchbookTreeModel) {
|
||||
return model;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
|
@ -53,10 +53,28 @@ export class SketchbookWidget extends BaseWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The currently selected sketchbook tree widget inside the view.
|
||||
*/
|
||||
getTreeWidget(): SketchbookTreeWidget {
|
||||
return this.sketchbookCompositeWidget.treeWidget;
|
||||
}
|
||||
|
||||
/**
|
||||
* An array of all sketchbook tree widgets managed by the view.
|
||||
*/
|
||||
getTreeWidgets(): SketchbookTreeWidget[] {
|
||||
return toArray(this.sketchbookTreesContainer.widgets()).reduce(
|
||||
(acc, curr) => {
|
||||
if (curr instanceof BaseSketchbookCompositeWidget) {
|
||||
acc.push(curr.treeWidget);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
[] as SketchbookTreeWidget[]
|
||||
);
|
||||
}
|
||||
|
||||
activeTreeWidgetId(): string | undefined {
|
||||
const selectedTreeWidgets = toArray(
|
||||
this.sketchbookTreesContainer.selectedWidgets()
|
||||
|
Loading…
x
Reference in New Issue
Block a user