aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/EditableView.tsx
diff options
context:
space:
mode:
authorJoanne <zehan_ding@brown.edu>2025-06-24 10:15:04 -0400
committerJoanne <zehan_ding@brown.edu>2025-06-24 10:15:04 -0400
commitad1f2ffb01fef49449c2dd5875659e1c904558fd (patch)
tree3c586cc104b18b9bc183ebf875c970292aae06ca /src/client/views/EditableView.tsx
parent17ec2a19b2d2dc5ba3f99c43d86c27946de2ac71 (diff)
parent1396850b90ed2dcca3776057ec4a7f2fc7ff297a (diff)
Merge branch 'master' of https://github.com/brown-dash/Dash-Web into joanne-tutorialagent
Diffstat (limited to 'src/client/views/EditableView.tsx')
-rw-r--r--src/client/views/EditableView.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx
index d9447b7ec..deeabaa28 100644
--- a/src/client/views/EditableView.tsx
+++ b/src/client/views/EditableView.tsx
@@ -236,6 +236,7 @@ export class EditableView extends ObservableReactComponent<EditableProps> {
return this._editing;
};
+ setInputRef = (r: HTMLInputElement | HTMLTextAreaElement | null) => (this._inputref = r);
renderEditor() {
return this._props.autosuggestProps ? (
<Autosuggest
@@ -255,7 +256,7 @@ export class EditableView extends ObservableReactComponent<EditableProps> {
) : this._props.oneLine !== false && this._props.GetValue()?.toString().indexOf('\n') === -1 ? (
<input
className="editableView-input"
- ref={r => { this._inputref = r; }} // prettier-ignore
+ ref={this.setInputRef}
style={{ display: this._props.display, overflow: 'auto', fontSize: this._props.fontSize, minWidth: 20, background: this._props.background }}
placeholder={this._props.placeholder}
onBlur={e => this.finalizeEdit(e.currentTarget.value, false, true, false)}
@@ -270,7 +271,7 @@ export class EditableView extends ObservableReactComponent<EditableProps> {
) : (
<textarea
className="editableView-input"
- ref={r => { this._inputref = r; }} // prettier-ignore
+ ref={this.setInputRef}
style={{ display: this._props.display, overflow: 'auto', fontSize: this._props.fontSize, minHeight: `min(100%, ${(this._props.GetValue()?.split('\n').length || 1) * 15})`, minWidth: 20, background: this._props.background }}
placeholder={this._props.placeholder}
onBlur={e => this.finalizeEdit(e.currentTarget.value, false, true, false)}