From bb890c23b367374d9da7eb10d879ebbf48dc4e77 Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Sat, 6 Jul 2024 02:31:27 -0400 Subject: wheel spinning --- .../collectionSchema/SchemaCellField.tsx | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionSchema/SchemaCellField.tsx b/src/client/views/collections/collectionSchema/SchemaCellField.tsx index 5048bf899..3be9167fe 100644 --- a/src/client/views/collections/collectionSchema/SchemaCellField.tsx +++ b/src/client/views/collections/collectionSchema/SchemaCellField.tsx @@ -111,7 +111,6 @@ export class SchemaCellField extends ObservableReactComponent) { - this.addReactComponents(); super.componentDidUpdate(prevProps); if (this._editing && this._props.editing === false) { this.finalizeEdit(false, true, false); @@ -127,24 +126,25 @@ export class SchemaCellField extends ObservableReactComponent { - if (!this._inputref) return; + // addReactComponents = () => { + // if (!this._inputref) return; - const dateRefs = Array.from(this._inputref.querySelectorAll('.date-placeholder')); + // const dateRefs = Array.from(this._inputref.querySelectorAll('.date-placeholder')); - dateRefs.forEach(ref => { - const root = createRoot(ref); - root.render(); - }) - } + // dateRefs.forEach(ref => { + // const root = createRoot(ref); + // root.render(); + // }) + // } generateSpan = (text: string, cell: HTMLDivElement | undefined): JSX.Element => { const selfRef = text === this.selfRefPattern; + const color: string | undefined = cell?.style.borderTop.replace('2px solid', ''); return ( + color: selfRef ? 'gray' : color}}> {text} ); @@ -176,7 +176,6 @@ export class SchemaCellField extends ObservableReactComponentplaceholder text`); - console.log(chunkedText) return chunkedText; } @@ -206,10 +205,10 @@ export class SchemaCellField extends ObservableReactComponent); - } else if (!text.replace('{{boolean}}', '')) { - eles.push(
boolean thing
); + } else if (text && !text.replace('{{boolean}}', '')) { + eles.push(boolean thing); } else { eles.push({text}); } @@ -218,8 +217,8 @@ export class SchemaCellField extends ObservableReactComponent { - let string: string = this._unrenderedContent; + parseElements = (content: string) => { + let string: string = content; if (string.startsWith(':')) string = string.slice(1); if (string.startsWith('=')) string = string.slice(1); @@ -229,7 +228,7 @@ export class SchemaCellField extends ObservableReactComponent { const pos = this.cursorPosition; - this._displayedContent = this.makeSpans(content); + this._displayedContent = content; + this._displayedElements = this.parseElements(content); restoreCursorPos && setTimeout(() => this.setCursorPosition(pos)); } @@ -339,9 +339,9 @@ export class SchemaCellField extends ObservableReactComponent this.parseElements(this._displayedContent).length) this.setContent(targVal, true); this.setupRefSelect(this.refSelectConditionMet); - console.log(this.parseElements()); + console.log(this.parseElements(targVal)); }; setupRefSelect = (enabled: boolean) => { @@ -461,8 +461,8 @@ export class SchemaCellField extends ObservableReactComponent - {this.parseElements().map((ele, index) => { - return
{ele}
+ {this._displayedElements.map((ele, index) => { + return {ele}; })} ); -- cgit v1.2.3-70-g09d2