aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/trails/PresBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/trails/PresBox.tsx')
-rw-r--r--src/client/views/nodes/trails/PresBox.tsx51
1 files changed, 23 insertions, 28 deletions
diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx
index cb2a1f13f..04b312ca5 100644
--- a/src/client/views/nodes/trails/PresBox.tsx
+++ b/src/client/views/nodes/trails/PresBox.tsx
@@ -1743,6 +1743,15 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
return <div />;
}
+ setAiEffectsRef = (r: HTMLTextAreaElement | null) =>
+ setTimeout(() => {
+ if (r && !r.textContent) {
+ r.style.height = '';
+ r.style.height = r.scrollHeight + 'px';
+ }
+ });
+
+ setAnimDictationRef = (r: DictationButton | null) => (this._animationDictation = r);
/**
* This chatbox is for getting slide effect transition suggestions from gpt and visualizing them
*/
@@ -1755,14 +1764,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
<ReactTextareaAutosize
placeholder="Use AI to suggest effects. Leave blank for random results."
className="pres-chatbox"
- ref={r => {
- setTimeout(() => {
- if (r && !r.textContent) {
- r.style.height = '';
- r.style.height = r.scrollHeight + 'px';
- }
- });
- }}
+ ref={this.setAiEffectsRef}
value={this._animationChat}
onChange={e => {
e.currentTarget.style.height = '';
@@ -1784,12 +1786,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
color={SnappingManager.userVariantColor}
onClick={this.customizeAnimations}
/>
- <DictationButton
- ref={r => {
- this._animationDictation = r;
- }}
- setInput={this.setAnimationChat}
- />
+ <DictationButton ref={this.setAnimDictationRef} setInput={this.setAnimationChat} />
</div>
<div style={{ alignItems: 'center' }}>
Click a box to use the effect.
@@ -1821,6 +1818,16 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
);
}
+ setPropertiesRef = (r: HTMLTextAreaElement | null) =>
+ setTimeout(() => {
+ if (r && !r.textContent) {
+ r.style.height = '';
+ r.style.height = r.scrollHeight + 'px';
+ }
+ });
+
+ setSlideDictationRef = (r: DictationButton | null) => (this._slideDictation = r);
+
@computed get transitionDropdown() {
const { activeItem } = this;
// Retrieving spring timing properties
@@ -1855,14 +1862,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
<ReactTextareaAutosize
placeholder="Describe how to modify the slide properties."
className="pres-chatbox"
- ref={r => {
- setTimeout(() => {
- if (r && !r.textContent) {
- r.style.height = '';
- r.style.height = r.scrollHeight + 'px';
- }
- });
- }}
+ ref={this.setPropertiesRef}
value={this._chatInput}
onChange={e => {
e.currentTarget.style.height = '';
@@ -1874,12 +1874,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
e.stopPropagation();
}}
/>
- <DictationButton
- ref={r => {
- this._slideDictation = r;
- }}
- setInput={this.setChatInput}
- />
+ <DictationButton ref={this.setSlideDictationRef} setInput={this.setChatInput} />
</div>
<Button
style={{ alignSelf: 'flex-end' }}