diff options
author | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-06-18 15:27:01 -0500 |
---|---|---|
committer | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-06-18 15:27:01 -0500 |
commit | b0d3aa2fff87cdaeb4308c278b248f2d11cc043e (patch) | |
tree | 6265c57836cab477c2b8bb782f6cd9317ee1c521 | |
parent | ff53019e6a801954b3798c09f01e893a1528c82f (diff) |
doc opening button
-rw-r--r-- | src/client/views/collections/CollectionSchemaCells.tsx | 18 | ||||
-rw-r--r-- | src/client/views/collections/CollectionSchemaView.scss | 11 |
2 files changed, 26 insertions, 3 deletions
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(<DocumentIconContainer />, { x: 0, y: 0 }); } + onOpenClick = () => { + if (this._doc) { + this.prop.addDocTab(this._doc, "onRight"); + return true; + } + return false; + } + render() { const dragRef: React.RefObject<HTMLDivElement> = React.createRef(); const reference = React.createRef<HTMLDivElement>(); - if (typeof this._field === "object" && this._docTitle) { + if (typeof this._field === "object" && this._doc && this._docTitle) { return ( <div className="collectionSchemaView-cellWrapper" ref={this._focusRef} tabIndex={-1} onPointerDown={this.onPointerDown}> - <div className="collectionSchemaView-cellContents" + <div className="collectionSchemaView-cellContents-document" style={{ padding: "5.9px" }} onFocus={this.onFocus} onBlur={() => this._overlayDisposer?.()} ref={this.dropRef}> @@ -409,6 +419,8 @@ export class CollectionSchemaDocCell extends CollectionSchemaCell { })} /> </div > + <button onClick={this.onOpenClick} className="collectionSchemaView-cellContents-docButton"> + <FontAwesomeIcon icon="external-link-alt" size="1x" ></FontAwesomeIcon> </button> </div> ); } else { diff --git a/src/client/views/collections/CollectionSchemaView.scss b/src/client/views/collections/CollectionSchemaView.scss index 5a4e1aa58..50971420d 100644 --- a/src/client/views/collections/CollectionSchemaView.scss +++ b/src/client/views/collections/CollectionSchemaView.scss @@ -413,6 +413,17 @@ button.add-column { display: block; } + + .collectionSchemaView-cellContents-document { + display: inline-block; + } + + .collectionSchemaView-cellContents-docButton { + float: right; + width: "15px"; + height: "15px"; + } + .collectionSchemaView-dropdownWrapper { border: grey; |