From db747fcb82c44a63cc3905c031ab2ae34403f5ae Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Wed, 3 Jun 2020 13:04:47 -0500 Subject: fixed uneven parantheses showing params suggestion --- src/client/util/CurrentUserUtils.ts | 2 +- src/client/views/nodes/ScriptingBox.scss | 1 + src/client/views/nodes/ScriptingBox.tsx | 43 +++++++++++++++++++++----------- 3 files changed, 31 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index 632187b49..4c30b4c03 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -738,5 +738,5 @@ export class CurrentUserUtils { Scripting.addGlobal("setupMobileInkingDoc", function setupMobileInkingDoc(userDoc: Doc) { return CurrentUserUtils.setupMobileInkingDoc(userDoc); }); Scripting.addGlobal(function setupMobileUploadDoc(userDoc: Doc) { return CurrentUserUtils.setupMobileUploadDoc(userDoc); }, - "initializes the Mobile upload document", "{ userDoc: the document to initialize }"); + "initializes the Mobile upload document", "{ userDoc: Doc }"); Scripting.addGlobal(function createNewWorkspace() { return MainView.Instance.createNewWorkspace(); }); \ No newline at end of file diff --git a/src/client/views/nodes/ScriptingBox.scss b/src/client/views/nodes/ScriptingBox.scss index edf79b38e..ae2569704 100644 --- a/src/client/views/nodes/ScriptingBox.scss +++ b/src/client/views/nodes/ScriptingBox.scss @@ -94,6 +94,7 @@ width: 100%; text-align: left; outline: none; + overflow-y: scroll; } .rta__entity:hover { diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index f1105e614..f6e7e375b 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -491,10 +491,25 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent 0) { - this._paramSuggestion = true; + if (this.rawScript[pos - 2] !== "(") { + console.log("suggestion params"); + this._paramSuggestion = true; + } } } else if (e.key === ")") { this._paramSuggestion = false; + } else { + console.log(this.rawScript.split("(").length - 1); + console.log(this.rawScript.split(")").length - 1); + if (this.rawScript.split("(").length - 1 <= this.rawScript.split(")").length - 1) { + console.log("removed params"); + this._paramSuggestion = false; + } else { + if (e.key === "Backspace") { + console.log("removed params"); + this._paramSuggestion = false; + } + } } } @@ -542,12 +557,12 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent this.setHovered(false)}> {value} - {!this._hovered ? (null) : - <> -
{this.getDescription(value)}
-
{this.getParams(value)}
- - } + {/* {!this._hovered ? (null) : + <> */} +
{this.getDescription(value)}
+
{this.getParams(value)}
+ {/* + } */} , output: (item: any, trigger) => { this._spaced = true; @@ -563,12 +578,12 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent this.setHovered(false)}> {value} - {!this._hovered ? (null) : - <> -
{this.getDescription(value)}
-
{this.getParams(value)}
- - } + {/* {!this._hovered ? (null) : + <> */} +
{this.getDescription(value)}
+
{this.getParams(value)}
+ {/* + } */} , output: (item: any, trigger) => { this._spaced = true; @@ -577,7 +592,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent this.keyHandler(e, this.caretPos)} + onKeyDown={(e) => this.keyHandler(e, this.caretPos)} onCaretPositionChange={(number: any) => this.handlePosChange(number)} /> -- cgit v1.2.3-70-g09d2