diff options
-rw-r--r-- | src/client/util/ScriptManager.ts | 3 | ||||
-rw-r--r-- | src/client/util/Scripting.ts | 4 | ||||
-rw-r--r-- | src/client/views/nodes/ScriptingBox.scss | 9 | ||||
-rw-r--r-- | src/client/views/nodes/ScriptingBox.tsx | 15 |
4 files changed, 22 insertions, 9 deletions
diff --git a/src/client/util/ScriptManager.ts b/src/client/util/ScriptManager.ts index 2b82786b3..e8bbe180a 100644 --- a/src/client/util/ScriptManager.ts +++ b/src/client/util/ScriptManager.ts @@ -1,7 +1,7 @@ import { Doc, DocListCast } from "../../fields/Doc"; import { List } from "../../fields/List"; import { Docs } from "../documents/Documents"; -import { Scripting, ScriptParam } from "./Scripting"; +import { Scripting } from "./Scripting"; import { StrCast, Cast } from "../../fields/Types"; import { listSpec } from "../../fields/Schema"; import { ScriptingBox } from "../views/nodes/ScriptingBox"; @@ -14,6 +14,7 @@ export class ScriptManager { return this._instance || (this._instance = new this()); } private constructor() { + console.log("CONSTRUCTED"); ScriptingBox.DeleteScript = this.deleteScript; ScriptingBox.AddScript = this.addScript; } diff --git a/src/client/util/Scripting.ts b/src/client/util/Scripting.ts index 5847623cc..f618a9e6e 100644 --- a/src/client/util/Scripting.ts +++ b/src/client/util/Scripting.ts @@ -10,6 +10,8 @@ export { ts }; // @ts-ignore import * as typescriptlib from '!!raw-loader!./type_decls.d'; import { Doc, Field } from '../../fields/Doc'; +import { Cast } from "../../fields/Types"; +import { listSpec } from "../../fields/Schema"; export interface ScriptSucccess { success: true; @@ -69,6 +71,7 @@ export namespace Scripting { if (third !== undefined) { obj.push(third); } + n = first.name; } } else if (first && typeof first.name === "string") { n = first.name; @@ -162,6 +165,7 @@ function Run(script: string | undefined, customParams: string[], diagnostics: an } return { success: true, result }; } catch (error) { + if (batch) { batch.end(); } diff --git a/src/client/views/nodes/ScriptingBox.scss b/src/client/views/nodes/ScriptingBox.scss index 1e4dc4868..a2e1ad267 100644 --- a/src/client/views/nodes/ScriptingBox.scss +++ b/src/client/views/nodes/ScriptingBox.scss @@ -35,15 +35,20 @@ flex-direction: row; justify-content: center; - + .descriptor { + overflow: hidden; + } .scriptingBox-textArea { flex: 70; height: 100%; + max-width: 95%; + min-width: none; box-sizing: border-box; resize: none; padding: 7px; overflow-y: scroll; + overflow-x: hidden; body { font-family: Arial, Helvetica, sans-serif; @@ -188,8 +193,10 @@ .scriptingBox-toolbar { width: 100%; height: 30px; + overflow: hidden; .scriptingBox-button { + font-size: xx-small; width: 50%; resize: auto; } diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index 61f58cb0f..cf941fb7a 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -22,7 +22,6 @@ const _global = (window /* browser */ || global /* node */) as any; import ReactTextareaAutocomplete from "@webscopeio/react-textarea-autocomplete"; import "@webscopeio/react-textarea-autocomplete/style.css"; -//import { ScriptManager } from "../../util/ScriptManager"; const ScriptingSchema = createSchema({}); @@ -240,6 +239,8 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc @action onCreate = () => { + this._errorMessage = ""; + if (this.functionName.length === 0) { this._errorMessage = "Must enter a function name"; return false; @@ -321,12 +322,12 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc />; return <div className="scriptingBox-inputDiv" onPointerDown={e => this.props.isSelected() && e.stopPropagation()} > - <div className="scriptingBox-wrapper"> - <div className="container"> - <div style={{ textAlign: "center", display: "inline-block" }}> Enter a name for this function: </div> - <div> {nameInput}</div> - <div style={{ textAlign: "center", display: "inline-block" }}> Enter a description of this function: </div> - <div>{descriptionInput}</div> + <div className="scriptingBox-wrapper" style={{ maxWidth: "100%" }}> + <div className="container" style={{ maxWidth: "100%" }}> + <div className="descriptor" style={{ textAlign: "center", display: "inline-block", maxWidth: "100%" }}> Enter a function name: </div> + <div style={{ maxWidth: "100%" }}> {nameInput}</div> + <div className="descriptor" style={{ textAlign: "center", display: "inline-block", maxWidth: "100%" }}> Enter a function description: </div> + <div style={{ maxWidth: "100%" }}>{descriptionInput}</div> </div> </div> {this.renderErrorMessage()} |