Sfoglia il codice sorgente

improve AutoScrollBottom logic

AutoScrollBottom only when set `AutoScrollBottom` and put msg with no `anchor` parameter
wangweimin 5 anni fa
parent
commit
15e00dc348
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      pywebio/html/js/form.js

+ 2 - 2
pywebio/html/js/form.js

@@ -134,8 +134,8 @@
         } else if (msg.command === 'output_ctl') {
             this.handle_output_ctl(msg);
         }
-        // note:当接收到scroll_to指令时,忽略AutoScrollBottom
-        if (AutoScrollBottom && !(msg.command === 'output_ctl' && msg.spec.scroll_to !== undefined))
+        // 当设置了AutoScrollBottom、并且不指定锚点进行输出时,滚动到底部
+        if (AutoScrollBottom && msg.command !== 'output_ctl' && msg.spec.before === undefined && msg.spec.after === undefined)
             this.scroll_bottom();
     };