aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ScriptingBox.tsx
diff options
context:
space:
mode:
authoranika-ahluwalia <anika.ahluwalia@gmail.com>2020-04-29 23:43:31 -0500
committeranika-ahluwalia <anika.ahluwalia@gmail.com>2020-04-29 23:43:31 -0500
commit20a4159484c75396857290779814b948abf49734 (patch)
treeab30f8ca44a71685ccf83ee4ae9e209818992d90 /src/client/views/nodes/ScriptingBox.tsx
parenta3d0d5cb8d00eb6c360c95e0c5c03e37b218e49a (diff)
fixed parts of drag and drop and finalized deleting params
Diffstat (limited to 'src/client/views/nodes/ScriptingBox.tsx')
-rw-r--r--src/client/views/nodes/ScriptingBox.tsx13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx
index f810d178c..8e8340042 100644
--- a/src/client/views/nodes/ScriptingBox.tsx
+++ b/src/client/views/nodes/ScriptingBox.tsx
@@ -122,14 +122,17 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc
this._overlayDisposer = OverlayView.Instance.addElement(<DocumentIconContainer />, { x: 0, y: 0 });
}
+ @action
onDrop = (e: Event, de: DragManager.DropEvent, index: any) => {
this._dropped = true;
+ console.log("drop");
const firstParam = this.compileParams[index].split("=");
- this.compileParams[index] = firstParam[0] + " = " + de.complete.docDragData?.droppedDocuments[0];
+ this.compileParams[index] = firstParam[0] + " = " + de.complete.docDragData?.droppedDocuments[0].id;
}
- onDelete = (parameter: any) => {
- this.compileParams.filter(s => s !== parameter);
+ @action
+ onDelete = (num: number) => {
+ this.compileParams.splice(num, 1);
}
render() {
@@ -154,7 +157,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc
/>;
const listParams = this.compileParams.map((parameter, i) =>
- <div className="scriptingBox-pborder" style={{ background: this._dropped ? "blue" : "" }}>
+ <div className="scriptingBox-pborder" style={{ background: this._dropped ? "yellow" : "" }}>
<EditableView
contents={parameter}
display={"block"}
@@ -169,7 +172,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc
parameter = value;
return true;
} else {
- this.onDelete(parameter);
+ this.onDelete(i);
return true;
}
}}