From b0d3aa2fff87cdaeb4308c278b248f2d11cc043e Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Thu, 18 Jun 2020 15:27:01 -0500 Subject: doc opening button --- src/client/views/collections/CollectionSchemaCells.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/client/views/collections/CollectionSchemaCells.tsx') diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx index df2a90366..2aed880ec 100644 --- a/src/client/views/collections/CollectionSchemaCells.tsx +++ b/src/client/views/collections/CollectionSchemaCells.tsx @@ -364,7 +364,9 @@ export class CollectionSchemaDocCell extends CollectionSchemaCell { if (results && results.success) { console.log(results.result); - // this._docTitle = results.result; + this._doc = results.result; + this.prop.Document[this.prop.fieldKey] = results.result; + this._docTitle = this._doc?.title; return true; } @@ -378,18 +380,26 @@ export class CollectionSchemaDocCell extends CollectionSchemaCell { this._overlayDisposer = OverlayView.Instance.addElement(, { x: 0, y: 0 }); } + onOpenClick = () => { + if (this._doc) { + this.prop.addDocTab(this._doc, "onRight"); + return true; + } + return false; + } + render() { const dragRef: React.RefObject = React.createRef(); const reference = React.createRef(); - if (typeof this._field === "object" && this._docTitle) { + if (typeof this._field === "object" && this._doc && this._docTitle) { return (
-
this._overlayDisposer?.()} ref={this.dropRef}> @@ -409,6 +419,8 @@ export class CollectionSchemaDocCell extends CollectionSchemaCell { })} />
+
); } else { -- cgit v1.2.3-70-g09d2