console.js 415 B

1234567891011121314151617
  1. window.consoleEmulatorScroll = (el) => {
  2. if (el) el.scrollTop = el.scrollHeight;
  3. };
  4. window.consoleHasSelection = () => {
  5. const sel = window.getSelection();
  6. return sel && sel.toString().length > 0;
  7. };
  8. window.scrollToAnchor = (anchor) => {
  9. if (!anchor) return;
  10. const el = document.getElementById(anchor);
  11. if (el) {
  12. el.scrollIntoView({ behavior: "smooth", block: "start" });
  13. }
  14. };