aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/collectionSchema/SchemaCellField.tsx6
-rw-r--r--src/client/views/collections/collectionSchema/SchemaRowBox.tsx2
-rw-r--r--src/client/views/collections/collectionSchema/SchemaTableCell.tsx4
3 files changed, 8 insertions, 4 deletions
diff --git a/src/client/views/collections/collectionSchema/SchemaCellField.tsx b/src/client/views/collections/collectionSchema/SchemaCellField.tsx
index 8e751f4ba..27ca37c2b 100644
--- a/src/client/views/collections/collectionSchema/SchemaCellField.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaCellField.tsx
@@ -33,6 +33,7 @@ export class SchemaCellField extends ObservableReactComponent<SchemaCellFieldPro
@observable _editing: boolean = false;
@observable _displayedContent = '';
@observable _inCellSelectMode: boolean = false;
+ @observable _dependencyMessageShown: boolean = false;
constructor(props: SchemaCellFieldProps) {
super(props);
@@ -300,7 +301,10 @@ export class SchemaCellField extends ObservableReactComponent<SchemaCellFieldPro
@action
finalizeEdit(shiftDown: boolean, lostFocus: boolean, enterKey: boolean) {
if (this._unrenderedContent.replace(this.selfRefPattern, '') !== this._unrenderedContent) {
- console.log('error'); this._editing = false; return;
+ this._dependencyMessageShown ? this._dependencyMessageShown = false :
+ alert("Circular dependency detected. Please update the field.")
+ this._dependencyMessageShown = true;
+ return;
}
if (this._props.SetValue(this._unrenderedContent, shiftDown, enterKey)) {
diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
index 3f5c2a90e..c9feeac6b 100644
--- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
@@ -179,7 +179,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() {
<SchemaTableCell
selectReference={this.selectReference}
refSelectModeInfo={this.refSelectModeInfo}
- func={this.eqHighlightFunc}
+ eqHighlightFunc={this.eqHighlightFunc}
equationHighlightRef={this.schemaView._cellHighlightColors}
highlightCells={this.highlightCells}
isolatedSelection={this.isolatedSelection}
diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
index ef46c44da..016ab5e69 100644
--- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
@@ -63,7 +63,7 @@ export interface SchemaTableCellProps {
isolatedSelection: [boolean, boolean];
highlightCells: (text: string) => void;
equationHighlightRef: ObservableMap<HTMLDivElement, string>;
- func: (text: string) => HTMLDivElement[] | [];
+ eqHighlightFunc: (text: string) => HTMLDivElement[] | [];
refSelectModeInfo: {enabled: boolean, currEditing: SchemaCellField | undefined};
selectReference: (doc: Doc, col: number) => void;
}
@@ -190,7 +190,7 @@ export class SchemaTableCell extends ObservableReactComponent<SchemaTableCellPro
refSelectModeInfo={this._props.refSelectModeInfo}
Document={this._props.Document}
highlightCells={(text: string) => this._props.highlightCells(this.adjustSelfReference(text))}
- getCells={(text: string) => this._props.func(this.adjustSelfReference(text))}
+ getCells={(text: string) => this._props.eqHighlightFunc(this.adjustSelfReference(text))}
ref={r => selectedCell(this._props) && this._props.autoFocus && r?.setIsFocused(true)}
oneLine={this._props.oneLine}
contents={undefined}