aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/CollectionSchemaCells.tsx16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx
index 18ae260e8..3d472b791 100644
--- a/src/client/views/collections/CollectionSchemaCells.tsx
+++ b/src/client/views/collections/CollectionSchemaCells.tsx
@@ -71,6 +71,7 @@ export class CollectionSchemaCell extends React.Component<CellProps> {
@observable protected _isEditing: boolean = false;
protected _focusRef = React.createRef<HTMLDivElement>();
protected _rowDoc = this.props.rowProps.original;
+ protected _rowDataDoc = Doc.GetProto(this.props.rowProps.original);
protected _dropDisposer?: DragManager.DragDropDisposer;
@observable contents: string = "";
@@ -126,11 +127,11 @@ export class CollectionSchemaCell extends React.Component<CellProps> {
private drop = (e: Event, de: DragManager.DropEvent) => {
if (de.complete.docDragData) {
if (de.complete.docDragData.draggedDocuments.length === 1) {
- this._rowDoc[this.renderFieldKey] = de.complete.docDragData.draggedDocuments[0];
+ this._rowDataDoc[this.renderFieldKey] = de.complete.docDragData.draggedDocuments[0];
}
else {
const coll = Docs.Create.SchemaDocument([new SchemaHeaderField("title", "#f1efeb")], de.complete.docDragData.draggedDocuments, {});
- this._rowDoc[this.renderFieldKey] = coll;
+ this._rowDataDoc[this.renderFieldKey] = coll;
}
e.stopPropagation();
}
@@ -164,8 +165,7 @@ export class CollectionSchemaCell extends React.Component<CellProps> {
@computed get renderFieldKey() { return CollectionSchemaCell.resolvedFieldKey(this.props.rowProps.column.id!, this.props.rowProps.original); }
onItemDown = async (e: React.PointerEvent) => {
if (this.props.Document._searchDoc) {
- const doc = Doc.GetProto(this._rowDoc);
- const aliasdoc = await SearchUtil.GetAliasesOfDocument(doc);
+ const aliasdoc = await SearchUtil.GetAliasesOfDocument(this._rowDataDoc);
const targetContext = aliasdoc.length <= 0 ? undefined : Cast(aliasdoc[0].context, Doc, null);
DocumentManager.Instance.jumpToDocument(this._rowDoc, false, () => undefined, targetContext);
}
@@ -238,10 +238,10 @@ export class CollectionSchemaCell extends React.Component<CellProps> {
let retVal = false;
if (value.startsWith(":=") || value.startsWith("=:=")) {
const script = value.substring(value.startsWith("=:=") ? 3 : 2);
- retVal = this.props.setComputed(script, value.startsWith(":=") ? Doc.GetProto(this.props.Document) : this.props.Document, this.renderFieldKey, this.props.row, this.props.col);
+ retVal = this.props.setComputed(script, value.startsWith(":=") ? this._rowDataDoc : this._rowDoc, this.renderFieldKey, this.props.row, this.props.col);
} else {
const script = CompileScript(value, { requiredType: type, typecheck: false, editable: true, addReturn: true, params: { this: Doc.name, $r: "number", $c: "number", $: "any" } });
- script.compiled && (retVal = this.applyToDoc(this._rowDoc, this.props.row, this.props.col, script.run));
+ script.compiled && (retVal = this.applyToDoc(this._rowDataDoc, this.props.row, this.props.col, script.run));
}
if (retVal) {
this._isEditing = false; // need to set this here. otherwise, the assignment of the field will invalidate & cause render() to be called with the wrong value for 'editing'
@@ -253,8 +253,8 @@ export class CollectionSchemaCell extends React.Component<CellProps> {
const script = CompileScript(value, { requiredType: type, typecheck: false, editable: true, addReturn: true, params: { this: Doc.name, $r: "number", $c: "number", $: "any" } });
script.compiled && DocListCast(field).
forEach((doc, i) => value.startsWith(":=") ?
- this.props.setComputed(value.substring(2), doc, this.renderFieldKey, i, this.props.col) :
- this.applyToDoc(doc, i, this.props.col, script.run));
+ this.props.setComputed(value.substring(2), Doc.GetProto(doc), this.renderFieldKey, i, this.props.col) :
+ this.applyToDoc(Doc.GetProto(doc), i, this.props.col, script.run));
}}
/>
: