From 13f1952137b27480a12fa4a20a4cfc49f823ebf8 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Tue, 28 Apr 2020 00:08:57 -0400 Subject: final dashFieldView cleanup --- src/client/util/DashFieldView.scss | 4 ++++ src/client/util/DashFieldView.tsx | 18 +++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/client/util/DashFieldView.scss b/src/client/util/DashFieldView.scss index e396788b5..35ff9c1e6 100644 --- a/src/client/util/DashFieldView.scss +++ b/src/client/util/DashFieldView.scss @@ -27,6 +27,10 @@ position: relative; display: inline-block; background-color: rgba(155, 155, 155, 0.24); + span { + min-width: 100%; + display: inline-block; + } } } \ No newline at end of file diff --git a/src/client/util/DashFieldView.tsx b/src/client/util/DashFieldView.tsx index a135db003..d76e9d1ec 100644 --- a/src/client/util/DashFieldView.tsx +++ b/src/client/util/DashFieldView.tsx @@ -58,11 +58,9 @@ interface IDashFieldViewInternal { @observer export class DashFieldViewInternal extends React.Component { - _reactionDisposer: IReactionDisposer | undefined; _textBoxDoc: Doc; _fieldKey: string; - _options: Doc[] = []; _fieldStringRef = React.createRef(); @observable _showEnumerables: boolean = false; @observable _dashDoc: Doc | undefined; @@ -74,9 +72,9 @@ export class DashFieldViewInternal extends React.Component dashDoc instanceof Doc && runInAction(() => this.setDashDoc(dashDoc))); + then(action(async dashDoc => dashDoc instanceof Doc && (this._dashDoc = dashDoc))); } else { - this.setDashDoc(this.props.tbox.props.DataDoc || this.props.tbox.dataDoc); + this._dashDoc = this.props.tbox.props.DataDoc || this.props.tbox.dataDoc; } } componentWillUnmount() { @@ -115,15 +113,6 @@ export class DashFieldViewInternal extends React.Component { - this._dashDoc = doc; - if (this._options?.length && !this._dashDoc[this._fieldKey]) { - this._dashDoc[this._fieldKey] = StrCast(this._options[0].title); - } - // NOTE: if the field key starts with "@", then the actual field key is stored in the field 'fieldKey' (removing the @). - //this._fieldKey = this._fieldKey?.startsWith("@") ? StrCast(this._textBoxDoc[StrCast(this._fieldKey as string).substring(1)]) : this._fieldKey as string; - } - // we need to handle all key events on the input span or else they will propagate to prosemirror. @action fieldSpanKeyDown = (e: KeyboardEvent, span: HTMLSpanElement) => { @@ -172,6 +161,7 @@ export class DashFieldViewInternal extends React.Component { e.stopPropagation(); const collview = await Doc.addFieldEnumerations(this._textBoxDoc, this._fieldKey, [{ title: this._fieldKey }]); @@ -179,6 +169,8 @@ export class DashFieldViewInternal extends React.Component { e.stopPropagation(); let container = this.props.tbox.props.ContainingCollectionView; -- cgit v1.2.3-70-g09d2