浏览代码

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

master
Vlad Piersec 3 年前
父节点
当前提交
c37678f3bb
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8
    0
      react/features/polls/components/web/PollCreate.js

+ 8
- 0
react/features/polls/components/web/PollCreate.js 查看文件

@@ -116,6 +116,13 @@ const PollCreate = (props: AbstractProps) => {
116 116
 
117 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 126
     const onGrab = useCallback((i, ev) => {
120 127
         if (ev.button !== 0) {
121 128
             return;
@@ -131,6 +138,7 @@ const PollCreate = (props: AbstractProps) => {
131 138
     });
132 139
     const onMouseOver = useCallback(i => {
133 140
         if (grabbing !== null && grabbing !== i) {
141
+            interchangeHeights(i, grabbing);
134 142
             moveAnswer(grabbing, i);
135 143
             setGrabbing(i);
136 144
         }

正在加载...
取消
保存