aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/ScriptBox.tsx
diff options
context:
space:
mode:
authorStanley Yip <stanley_yip@brown.edu>2020-01-08 13:47:29 -0500
committerStanley Yip <stanley_yip@brown.edu>2020-01-08 13:47:29 -0500
commitabfa42b6f2cf863deee19aac19328a23687464cb (patch)
treeb481f23ffa7bccbde7a31de34f50d765b6b73162 /src/client/views/ScriptBox.tsx
parentd8fc218f3481728f221ceacc60ac4bc553f8e295 (diff)
parent19a71cb2788b9c1c8d8ced4af285bf91033ba626 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into pen
Diffstat (limited to 'src/client/views/ScriptBox.tsx')
-rw-r--r--src/client/views/ScriptBox.tsx18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/client/views/ScriptBox.tsx b/src/client/views/ScriptBox.tsx
index 8ef9f3be6..ded2329b4 100644
--- a/src/client/views/ScriptBox.tsx
+++ b/src/client/views/ScriptBox.tsx
@@ -59,7 +59,7 @@ export class ScriptBox extends React.Component<ScriptBoxProps> {
onFocus = this.onFocus;
onBlur = this.onBlur;
}
- let params = <EditableView
+ const params = <EditableView
contents={""}
display={"block"}
maxHeight={72}
@@ -96,9 +96,9 @@ export class ScriptBox extends React.Component<ScriptBoxProps> {
}
}
// tslint:disable-next-line: no-unnecessary-callback-wrapper
- let params: string[] = [];
- let setParams = (p: string[]) => params.splice(0, params.length, ...p);
- let scriptingBox = <ScriptBox initialText={originalText} setParams={setParams} onCancel={overlayDisposer} onSave={(text, onError) => {
+ const params: string[] = [];
+ const setParams = (p: string[]) => params.splice(0, params.length, ...p);
+ const scriptingBox = <ScriptBox initialText={originalText} setParams={setParams} onCancel={overlayDisposer} onSave={(text, onError) => {
if (prewrapper) {
text = prewrapper + text + (postwrapper ? postwrapper : "");
}
@@ -113,7 +113,15 @@ export class ScriptBox extends React.Component<ScriptBoxProps> {
return;
}
- params.length && DragManager.StartButtonDrag([], text, "a script", {}, params, (button: Doc) => { }, clientX, clientY);
+ const div = document.createElement("div");
+ div.style.width = "90";
+ div.style.height = "20";
+ div.style.background = "gray";
+ div.style.position = "absolute";
+ div.style.display = "inline-block";
+ div.style.transform = `translate(${clientX}px, ${clientY}px)`;
+ div.innerHTML = "button";
+ params.length && DragManager.StartButtonDrag([div], text, doc.title + "-instance", {}, params, (button: Doc) => { }, clientX, clientY);
doc[fieldKey] = new ScriptField(script);
overlayDisposer();