UNPKG

@tencentcloud/roomkit-electron-vue3

Version:

<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,

46 lines (45 loc) 1.26 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const universalApi = require("@tencentcloud/universal-api"); const ua = navigator.userAgent; function getScrollTypeByPlatform() { if (universalApi.isIOS) { if (/Safari\//.test(ua) || /IOS 11_[0-3]\D/.test(ua)) { return 0; } return 1; } return 2; } function riseInput(input, target) { const scrollType = getScrollTypeByPlatform(); let scrollTimer; if (!target) { target = input; } const scrollIntoView = () => { if (scrollType === 0) return; if (scrollType === 1) { document.body.scrollTop = document.body.scrollHeight; } else { target == null ? void 0 : target.scrollIntoView(false); } }; input.addEventListener("focus", () => { const timer = setTimeout(() => { scrollIntoView(); clearTimeout(timer); }, 300); scrollTimer = setTimeout(scrollIntoView, 1e3); }); input.addEventListener("blur", () => { clearTimeout(scrollTimer); if (scrollType && universalApi.isIOS) { const timer = setTimeout(() => { document.body.scrollIntoView(); clearTimeout(timer); }); } }); } exports.default = riseInput;