From 65ff6d515cd8102c3a4284244f8a84d356ba0c05 Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Wed, 3 Jun 2020 15:58:12 -0500 Subject: fixed wrapped params except onResize --- src/client/util/CurrentUserUtils.ts | 6 ++-- src/client/util/DropConverter.ts | 3 +- src/client/util/LinkManager.ts | 3 +- src/client/views/nodes/ScriptingBox.scss | 7 ++-- src/client/views/nodes/ScriptingBox.tsx | 56 ++++++++++++++++++++++---------- 5 files changed, 50 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index 4c30b4c03..3dcb484be 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -736,7 +736,9 @@ export class CurrentUserUtils { } } -Scripting.addGlobal("setupMobileInkingDoc", function setupMobileInkingDoc(userDoc: Doc) { return CurrentUserUtils.setupMobileInkingDoc(userDoc); }); +Scripting.addGlobal(function setupMobileInkingDoc(userDoc: Doc) { return CurrentUserUtils.setupMobileInkingDoc(userDoc); }, + "initializes the Mobile inking document", "{ userDoc: Doc }"); Scripting.addGlobal(function setupMobileUploadDoc(userDoc: Doc) { return CurrentUserUtils.setupMobileUploadDoc(userDoc); }, "initializes the Mobile upload document", "{ userDoc: Doc }"); -Scripting.addGlobal(function createNewWorkspace() { return MainView.Instance.createNewWorkspace(); }); \ No newline at end of file +Scripting.addGlobal(function createNewWorkspace() { return MainView.Instance.createNewWorkspace(); }, + "creates a new workspace when called"); \ No newline at end of file diff --git a/src/client/util/DropConverter.ts b/src/client/util/DropConverter.ts index 752c1cfc5..785e087f9 100644 --- a/src/client/util/DropConverter.ts +++ b/src/client/util/DropConverter.ts @@ -76,4 +76,5 @@ export function convertDropDataToButtons(data: DragManager.DocumentDragData) { data.droppedDocuments[i] = dbox; }); } -Scripting.addGlobal(function convertToButtons(dragData: any) { convertDropDataToButtons(dragData as DragManager.DocumentDragData); }); \ No newline at end of file +Scripting.addGlobal(function convertToButtons(dragData: any) { convertDropDataToButtons(dragData as DragManager.DocumentDragData); }, + "converts the dropped data to buttons", "{ dragData: any }"); \ No newline at end of file diff --git a/src/client/util/LinkManager.ts b/src/client/util/LinkManager.ts index 8e6ccf098..9b20af4cb 100644 --- a/src/client/util/LinkManager.ts +++ b/src/client/util/LinkManager.ts @@ -211,4 +211,5 @@ export class LinkManager { } } -Scripting.addGlobal(function links(doc: any) { return new List(LinkManager.Instance.getAllRelatedLinks(doc)); }); \ No newline at end of file +Scripting.addGlobal(function links(doc: any) { return new List(LinkManager.Instance.getAllRelatedLinks(doc)); }, + "creates a link to inputted document", "{ doc: any }"); \ No newline at end of file diff --git a/src/client/views/nodes/ScriptingBox.scss b/src/client/views/nodes/ScriptingBox.scss index ae2569704..32021e637 100644 --- a/src/client/views/nodes/ScriptingBox.scss +++ b/src/client/views/nodes/ScriptingBox.scss @@ -15,6 +15,8 @@ position: absolute; z-index: 100; padding: 5px; + white-space: nowrap; + overflow: hidden; } .scriptingBox-inputDiv { @@ -51,12 +53,11 @@ .rta { position: relative; - font-size: 12px; width: 100%; height: 100%; margin-bottom: 60px !important; overflow-y: scroll; - font-size: 9px; + overflow-x: hidden; } .rta__textarea { @@ -75,7 +76,6 @@ margin-top: 0; margin-bottom: 1em; max-height: 100px; - overflow-y: auto; } .rta__list { @@ -87,6 +87,7 @@ box-shadow: 0 0 5px rgba(27, 31, 35, 0.1); list-style: none; overflow-y: scroll; + overflow-x: hidden; } .rta__entity { diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index f6e7e375b..3c268b5cd 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -44,11 +44,14 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent p.split(":")[0].trim()); } @computed({ keepAlive: true }) get paramsTypes() { return this.compileParams.map(p => p.split(":")[1].trim()); } @@ -469,27 +472,42 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent (x + scriptWidth)) { + const diff = (left + suggestionWidth) - (x + scriptWidth); + left = left - diff; + } + + runInAction(() => { + This._suggestionBoxX = left; + This._suggestionBoxY = top; + }); + }); + } + @action keyHandler(e: any, pos: number) { console.log(e.key); if (e.key === "(") { console.log("hello"); - const getCaretCoordinates = require('textarea-caret'); - - const This = this; - document.querySelector('textarea')?.addEventListener('input', function () { - const caret = getCaretCoordinates(this, this.selectionEnd); - console.log('(top, left, height) = (%s, %s, %s)', caret.top, caret.left, caret.height); - let top = caret.top; - let left = caret.left; - runInAction(() => { - This._suggestionBoxX = left; - This._suggestionBoxY = top; - }); - }); + this.suggestionPos(); this._scriptSuggestedParams = this.getSuggestedParams(pos); + //this._scriptSuggestedParams =
; + if (this._scriptSuggestedParams !== undefined && this._scriptSuggestedParams.length > 0) { if (this.rawScript[pos - 2] !== "(") { console.log("suggestion params"); @@ -536,7 +554,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent 0 ? "70%" : "100%" }}> + return
0 ? "70%" : "100%" }} ref={this._scriptTextRef}> -
this.props.isSelected(true) && e.stopPropagation()}> - {this._paramSuggestion ?
{this._scriptSuggestedParams}
: null} +
+
this.props.isSelected(true) && e.stopPropagation()}> + {this._paramSuggestion ?
{this._scriptSuggestedParams}
: null} {!this._applied ? this.renderScriptingInputs : this.renderParamsInputs()} {!this._applied ? this.renderScriptingTools() : this.renderParamsTools()}
-- cgit v1.2.3-70-g09d2