From c3cc4bebe92ccdee2f95f5b6dee9d4e2f136a206 Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Tue, 2 Jun 2020 00:20:56 -0500 Subject: fixed starting, got rid of space when selected --- src/client/views/nodes/ScriptingBox.tsx | 44 +++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index 245081c47..10f414821 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -38,6 +38,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent 0 ? "70%" : "100%" }}> this._overlayDisposer?.()} @@ -483,10 +484,49 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent, output: (item: any, trigger) => trigger + item.trim(), + }, + ".": { + dataProvider: (token: any) => this.handleToken(token), + component: ({ entity: value }) => +
+
this.setHovered(true)} + onMouseLeave={() => this.setHovered(false)}> + {value} +
+ {!this._hovered ? (null) : + <> +
{this.getDescription(value)}
+
{this.getParams(value)}
+ + } +
, + output: (item: any, trigger) => { + this._spaced = true; + return trigger + item.trim(); + }, } }} - onCaretPositionChange={(number: any) => this.caretPos = number} + onCaretPositionChange={(number: any) => { + this.caretPos = number; + if (this.caretPos === 0) { + this.rawScript = " " + this.rawScript; + } else if (this._spaced) { + this._spaced = false; + if (this.rawScript[this.rawScript.length - 1] === " ") { + this.rawScript = this.rawScript.slice(0, this.rawScript.length - 1); + } + } + }} + + // onClick={() => this.rawScript = this.rawScript[this.rawScript.length - 1]} + + // onKeyPress={e => { + // if (e.key === "Enter" || e.key === "Tab") { + // this.rawScript = this.rawScript[this.rawScript.length - 1]; + // } + // }} /> ; } -- cgit v1.2.3-70-g09d2