Skip to content

Commit

Permalink
#1943 Feature request: Allow categories[0].node_types[0].app_data.ui_… (
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlyn authored May 15, 2024
1 parent b9e323c commit 4195fa5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2294,6 +2294,14 @@ export default class CanvasController {
data.editType === "deconstructSuperNode" ||
data.editType === "convertSuperNodeExternalToLocal") {
data = this.preProcessForExternalPipelines(data);

} else if (data.editType === "paste") {
const pasteObjects = this.objectModel.getObjectsToPaste();
if (pasteObjects) {
data.objects = pasteObjects;
} else {
return false;
}
}

// Check with host application if it wants to proceed with the command
Expand Down Expand Up @@ -2618,13 +2626,9 @@ export default class CanvasController {
break;
}
case "paste": {
const pasteObjects = this.objectModel.getObjectsToPaste();
if (pasteObjects) {
data.objects = pasteObjects;
command = new PasteAction(data, this);
this.commandStack.do(command);
data = command.getData();
}
command = new PasteAction(data, this);
this.commandStack.do(command);
data = command.getData();
break;
}
case "undo": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default class JsxIconsCanvas extends React.Component {
this.canvasController.setPipelineFlow(this.getConvertedFlow(JsxIconsCanvasFlow));

this.getConfig = this.getConfig.bind(this);
this.beforeEditActionHandler = this.beforeEditActionHandler.bind(this);
}

getConvertedPalette(palette) {
Expand Down Expand Up @@ -95,12 +96,24 @@ export default class JsxIconsCanvas extends React.Component {
}
}

// If nodes are pasted into the canvas ensure their image fields
// are set appropriately.
beforeEditActionHandler(data, command) {
if (data.editType === "paste") {
data.objects?.nodes?.forEach((n) => {
n.image = this.convertOpToImage(n.op);
});
}
return data;
}

render() {
const config = this.getConfig();

return (
<CommonCanvas
canvasController={this.canvasController}
beforeEditActionHandler={this.beforeEditActionHandler}
config={config}
/>
);
Expand Down

0 comments on commit 4195fa5

Please sign in to comment.