aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/DashFieldView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-09-13 04:29:37 -0400
committerbobzel <zzzman@gmail.com>2020-09-13 04:29:37 -0400
commitbf8a62fbb1b70bc013ec2f342930f35d6108065b (patch)
tree162ef710b7156070301a2f78cbf2698e78ea2544 /src/client/views/nodes/formattedText/DashFieldView.tsx
parente99637ef4c03a438db7d0372aaf650ac9920641a (diff)
fixed making delegates of custom headerViews. fixed non-responsive carriage returns in textBoxes occasionally at the end of the text stream. fixed upating titles on templated text boxes. fixed setting layoutfield values in DashFieldViews to update the template and layout doc.
Diffstat (limited to 'src/client/views/nodes/formattedText/DashFieldView.tsx')
-rw-r--r--src/client/views/nodes/formattedText/DashFieldView.tsx22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/client/views/nodes/formattedText/DashFieldView.tsx b/src/client/views/nodes/formattedText/DashFieldView.tsx
index f14a57e31..0332bb4fd 100644
--- a/src/client/views/nodes/formattedText/DashFieldView.tsx
+++ b/src/client/views/nodes/formattedText/DashFieldView.tsx
@@ -1,5 +1,5 @@
import { IReactionDisposer, observable, runInAction, computed, action } from "mobx";
-import { Doc, DocListCast, Field } from "../../../../fields/Doc";
+import { Doc, DocListCast, Field, LayoutSym } from "../../../../fields/Doc";
import { List } from "../../../../fields/List";
import { listSpec } from "../../../../fields/Schema";
import { SchemaHeaderField } from "../../../../fields/SchemaHeaderField";
@@ -70,7 +70,7 @@ export class DashFieldViewInternal extends React.Component<IDashFieldViewInterna
DocServer.GetRefField(this.props.docid).
then(action(async dashDoc => dashDoc instanceof Doc && (this._dashDoc = dashDoc)));
} else {
- this._dashDoc = this.props.tbox.props.DataDoc || this.props.tbox.dataDoc;
+ this._dashDoc = this.props.tbox.rootDoc;
}
}
componentWillUnmount() {
@@ -92,7 +92,10 @@ export class DashFieldViewInternal extends React.Component<IDashFieldViewInterna
return <input
className="dashFieldView-fieldCheck"
type="checkbox" checked={boolVal}
- onChange={e => this._dashDoc![this._fieldKey] = e.target.checked}
+ onChange={e => {
+ if (this._fieldKey.startsWith("_")) Doc.Layout(this._textBoxDoc)[this._fieldKey] = e.target.checked;
+ this._dashDoc![this._fieldKey] = e.target.checked;
+ }}
/>;
}
else // field value is a string, so display it as an editable span
@@ -159,9 +162,16 @@ export class DashFieldViewInternal extends React.Component<IDashFieldViewInterna
} else if (nodeText.startsWith("=:=")) {
Doc.Layout(this._textBoxDoc)[this._fieldKey] = ComputedField.MakeFunction(nodeText.substring(3));
} else {
- const splits = newText.split(this.multiValueDelimeter);
- if (this._fieldKey !== "PARAMS" || !this._textBoxDoc[this._fieldKey] || this._dashDoc?.PARAMS) {
- this._dashDoc![this._fieldKey] = splits.length > 1 ? new List<string>(splits) : newText;
+ if (Number(newText).toString() === newText) {
+ if (this._fieldKey.startsWith("_")) Doc.Layout(this._textBoxDoc)[this._fieldKey] = Number(newText);
+ this._dashDoc![this._fieldKey] = Number(newText);
+ } else {
+ const splits = newText.split(this.multiValueDelimeter);
+ if (this._fieldKey !== "PARAMS" || !this._textBoxDoc[this._fieldKey] || this._dashDoc?.PARAMS) {
+ const strVal = splits.length > 1 ? new List<string>(splits) : newText;
+ if (this._fieldKey.startsWith("_")) Doc.Layout(this._textBoxDoc)[this._fieldKey] = strVal;
+ this._dashDoc![this._fieldKey] = strVal;
+ }
}
}
});