Kaynağa Gözat

fix(polls): Keep the original height for options when moving it up and down

master
Vlad Piersec 3 yıl önce
ebeveyn
işleme
c37678f3bb

+ 8
- 0
react/features/polls/components/web/PollCreate.js Dosyayı Görüntüle

116
 
116
 
117
     const [ grabbing, setGrabbing ] = useState(null);
117
     const [ grabbing, setGrabbing ] = useState(null);
118
 
118
 
119
+    const interchangeHeights = (i, j) => {
120
+        const h = answerInputs.current[i].scrollHeight;
121
+
122
+        answerInputs.current[i].style.height = `${answerInputs.current[j].scrollHeight}px`;
123
+        answerInputs.current[j].style.height = `${h}px`;
124
+    };
125
+
119
     const onGrab = useCallback((i, ev) => {
126
     const onGrab = useCallback((i, ev) => {
120
         if (ev.button !== 0) {
127
         if (ev.button !== 0) {
121
             return;
128
             return;
131
     });
138
     });
132
     const onMouseOver = useCallback(i => {
139
     const onMouseOver = useCallback(i => {
133
         if (grabbing !== null && grabbing !== i) {
140
         if (grabbing !== null && grabbing !== i) {
141
+            interchangeHeights(i, grabbing);
134
             moveAnswer(grabbing, i);
142
             moveAnswer(grabbing, i);
135
             setGrabbing(i);
143
             setGrabbing(i);
136
         }
144
         }

Loading…
İptal
Kaydet