diff options
| author | Sam Wilkins <abdullah_ahmed@brown.edu> | 2019-05-08 23:16:24 -0400 |
|---|---|---|
| committer | Sam Wilkins <abdullah_ahmed@brown.edu> | 2019-05-08 23:16:24 -0400 |
| commit | 508410d810f61b8f8602dedbbba3e0736c1f5ba3 (patch) | |
| tree | b6de0f335ed187f7e795025ba9a304b3146fc6a2 /src/client/views/collections/CollectionSchemaView.tsx | |
| parent | 086391b7e45ed4b3cb29602a776f5812f142fff2 (diff) | |
| parent | 890d43c23c5aaafc8ebc2978cd1ad2e19bfcd830 (diff) | |
Working implementation of remote cursors
Diffstat (limited to 'src/client/views/collections/CollectionSchemaView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionSchemaView.tsx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx index 67784fa81..16818affd 100644 --- a/src/client/views/collections/CollectionSchemaView.tsx +++ b/src/client/views/collections/CollectionSchemaView.tsx @@ -19,7 +19,7 @@ import { DocumentView } from "../nodes/DocumentView"; import { FieldView, FieldViewProps } from "../nodes/FieldView"; import "./CollectionSchemaView.scss"; import { CollectionSubView } from "./CollectionSubView"; -import { Opt, Field, Doc } from "../../../new_fields/Doc"; +import { Opt, Field, Doc, DocListCast } from "../../../new_fields/Doc"; import { Cast, FieldValue, NumCast } from "../../../new_fields/Types"; import { listSpec } from "../../../new_fields/Schema"; import { List } from "../../../new_fields/List"; @@ -111,17 +111,15 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) { } return applyToDoc(props.Document, script.run); }} - OnFillDown={(value: string) => { + OnFillDown={async (value: string) => { let script = CompileScript(value, { addReturn: true, params: { this: Document.name } }); if (!script.compiled) { return; } const run = script.run; //TODO This should be able to be refactored to compile the script once - const val = Cast(this.props.Document[this.props.fieldKey], listSpec(Doc)); - if (val) { - val.forEach(doc => applyToDoc(doc, run)); - } + const val = await DocListCast(this.props.Document[this.props.fieldKey]) + val && val.forEach(doc => applyToDoc(doc, run)); }}> </EditableView> </div > @@ -268,6 +266,7 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) { focus={emptyFunction} parentActive={this.props.active} whenActiveChanged={this.props.whenActiveChanged} + bringToFront={emptyFunction} /> </div> <input className="collectionSchemaView-input" value={this.previewScript} onChange={this.onPreviewScriptChange} |
