From 9fab1b3ac096138fba3a99a2515ec44b526a3956 Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Sun, 23 Jun 2024 02:54:24 -0400 Subject: text highlight works with 'this.' format --- src/client/views/collections/collectionSchema/SchemaCellField.tsx | 7 +++++-- src/client/views/collections/collectionSchema/SchemaRowBox.tsx | 2 ++ src/client/views/collections/collectionSchema/SchemaTableCell.tsx | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionSchema/SchemaCellField.tsx b/src/client/views/collections/collectionSchema/SchemaCellField.tsx index fc191014c..aa6c382ef 100644 --- a/src/client/views/collections/collectionSchema/SchemaCellField.tsx +++ b/src/client/views/collections/collectionSchema/SchemaCellField.tsx @@ -53,7 +53,7 @@ export class SchemaCellField extends ObservableReactComponent { - // const refToUse = docRef === 'this' ? `${this.docIndex}` : docRef; + const adjMatch = match.replace('this.', `d${this.docIndex}`) chunkedText = chunkedText.replace(match, `${match}`); ++matchNum; }) diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx index f4320dc09..45f178815 100644 --- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx +++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx @@ -22,6 +22,7 @@ import { ContextMenu } from '../../ContextMenu'; import { CollectionFreeFormView } from '../collectionFreeForm'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { IconProp } from '@fortawesome/fontawesome-svg-core'; +import { infoState } from '../collectionFreeForm/CollectionFreeFormInfoState'; interface SchemaRowBoxProps extends FieldViewProps { rowIndex: number; @@ -129,6 +130,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent() { const info = this.schemaView.findCellRefs(text); const cells: HTMLDivElement[] = []; info.forEach(info => {cells.push(this.schemaView.getCellElement(info[0], info[1]))}) + console.log('info: ' + info + ' cells: ' + cells); return cells; }; render() { diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx index ab384a487..6ccada48c 100644 --- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx +++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx @@ -144,10 +144,10 @@ export class SchemaTableCell extends ObservableReactComponent { + adjustSelfReference = (field: string) => { const pattern = /\bthis.\b/g; const modField = field.replace(pattern, `d${this.docIndex}.`); - this._props.highlightCells(modField); + return modField; } // parses a field from the "idToDoc(####)" format to DocumentId (d#) format for readability @@ -183,8 +183,8 @@ export class SchemaTableCell extends ObservableReactComponent this._props.highlightCells(this.adjustSelfReference(text))} + getCells={(text: string) => this._props.func(this.adjustSelfReference(text))} ref={r => selectedCell(this._props) && this._props.autoFocus && r?.setIsFocused(true)} oneLine={this._props.oneLine} contents={undefined} -- cgit v1.2.3-70-g09d2