diff options
author | bobzel <zzzman@gmail.com> | 2024-03-24 19:22:41 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-03-24 19:22:41 -0400 |
commit | ab76273acd2126d92455ff12c4ba80d8bb9473c5 (patch) | |
tree | c51216759edd958bb5bc118017e3c80cd7002010 | |
parent | 2e0cb3e0a470994eecbb7f6b2ec87296baf517b9 (diff) |
fixed crash on richtextfield to string when there's no data. fixed schema cells not to edit unless selected.
-rw-r--r-- | src/client/views/collections/collectionSchema/SchemaTableCell.tsx | 2 | ||||
-rw-r--r-- | src/fields/RichTextField.ts | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx index ce73ff8a4..67dc508d5 100644 --- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx +++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx @@ -141,7 +141,7 @@ export class SchemaTableCell extends ObservableReactComponent<SchemaTableCellPro this._props.finishEdit?.(); return true; } - const ret = KeyValueBox.SetField(this._props.Document, this._props.fieldKey.replace(/^_/, ''), value, Doc.IsDataProto(this._props.Document) ? true : undefined); + const ret = this.selected && KeyValueBox.SetField(this._props.Document, this._props.fieldKey.replace(/^_/, ''), value, Doc.IsDataProto(this._props.Document) ? true : undefined); this._props.finishEdit?.(); return ret; }, 'edit schema cell')} diff --git a/src/fields/RichTextField.ts b/src/fields/RichTextField.ts index 50cfab988..855b63d4b 100644 --- a/src/fields/RichTextField.ts +++ b/src/fields/RichTextField.ts @@ -31,7 +31,7 @@ export class RichTextField extends ObjectField { return '`' + this.Text + '`'; } [ToScriptString]() { - return `new RichTextField("${this.Data.replace(/"/g, '\\"')}", "${this.Text}")`; + return `new RichTextField("${this.Data?.replace(/"/g, '\\"')}", "${this.Text}")`; } [ToString]() { return this.Text; |