diff options
author | Andy Rickert <andrew_rickert@brown.edu> | 2020-07-08 23:23:51 -0400 |
---|---|---|
committer | Andy Rickert <andrew_rickert@brown.edu> | 2020-07-08 23:23:51 -0400 |
commit | acf3830b77f8da19330d11d449cbf1712aa30c23 (patch) | |
tree | 276a4839b7a7d91011c3a90aa787b1f863f1b62c /src | |
parent | 20bf67a41b16dd4df42e7dfc93e9acc38e910d29 (diff) |
highlighting search results in schema
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/EditableView.tsx | 4 | ||||
-rw-r--r-- | src/client/views/collections/CollectionSchemaCells.tsx | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx index 628db366f..54b0bbe65 100644 --- a/src/client/views/EditableView.tsx +++ b/src/client/views/EditableView.tsx @@ -194,7 +194,9 @@ export class EditableView extends React.Component<EditableProps> { ref={this._ref} style={{ display: this.props.display, minHeight: "20px", height: `${this.props.height ? this.props.height : "auto"}`, maxHeight: `${this.props.maxHeight}` }} onClick={this.onClick} placeholder={this.props.placeholder}> - <span style={{ fontStyle: this.props.fontStyle, fontSize: this.props.fontSize, color: this.props.contents ? "black" : "grey" }}>{this.props.contents ? this.props.contents?.valueOf() : this.props.placeholder?.valueOf()}</span> + <span style={{ backgroundColor: "#FFFF00", fontStyle: this.props.fontStyle, fontSize: this.props.fontSize, color: this.props.contents ? "black" : "grey" }}>{this.props.contents ? this.props.contents?.valueOf() : this.props.placeholder?.valueOf()}</span> + + </div> ); } diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx index 0008cfad3..5a84408f7 100644 --- a/src/client/views/collections/CollectionSchemaCells.tsx +++ b/src/client/views/collections/CollectionSchemaCells.tsx @@ -32,6 +32,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import DatePicker from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; import { DateField } from "../../../fields/DateField"; +import { indexOf } from "lodash"; const path = require('path'); library.add(faExpand); @@ -244,14 +245,17 @@ export class CollectionSchemaCell extends React.Component<CellProps> { // ); trace(); + if (type === "string") { + let search = StrCast(this.props.Document._searchString) + let start = contents.indexOf(search); + console.log(contents.slice(start, search.length)); + } - + StrCast(this.props.Document._searchString) ? console.log(StrCast(this.props.Document._searchString)) : undefined; return ( <div className="collectionSchemaView-cellContainer" style={{ cursor: fieldIsDoc ? "grab" : "auto" }} ref={dragRef} onPointerDown={this.onPointerDown} onPointerEnter={onPointerEnter} onPointerLeave={onPointerLeave}> <div className={className} ref={this._focusRef} onPointerDown={onItemDown} tabIndex={-1}> <div className="collectionSchemaView-cellContents" ref={type === undefined || type === "document" ? this.dropRef : null} key={props.Document[Id]}> - - <EditableView editing={this._isEditing} isEditingCallback={this.isEditingCallback} |