From ba6491650ce2415ec027d7f125cd47eced613df7 Mon Sep 17 00:00:00 2001 From: shaoyongjun Date: Thu, 31 Oct 2024 21:41:59 +0800 Subject: [PATCH] to:sync --- static/js/lib/common/MyUtils.js | 77 +++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 32 deletions(-) diff --git a/static/js/lib/common/MyUtils.js b/static/js/lib/common/MyUtils.js index fe7cc0f..74e32f9 100644 --- a/static/js/lib/common/MyUtils.js +++ b/static/js/lib/common/MyUtils.js @@ -340,50 +340,63 @@ export class MyUtils { console.log("body-frontSize: ", myEditFrontSize.style.fontSize); - let testDiv = document.getElementById("testDevice"); - var resizeHeight = document.documentElement.clientHeight || document.body.clientHeight; - if (window.myEdit.ctx.originHeight < resizeHeight) { - console.log('Android 键盘收起啦!'); - testDiv.innerText = "\nmobile: " + 'Android 键盘收起啦!' + - "\noriginHeight " + window.myEdit.ctx.originHeight + - "\nresizeHeight:" + resizeHeight + - "\ninnerHeight:" + window.innerHeight + - "\nvisualViewport.height: " + window.visualViewport.height - // Android 键盘收起后操作 - let styleUtils = document.getElementById("_style_utils"); - styleUtils.style.display = "none"; - } else { - console.log('Android 键盘弹起啦!'); - testDiv.innerText = "\nmobile: " + 'Android 键盘弹起啦!' + - "\noriginHeight " + window.myEdit.ctx.originHeight + - "\nresizeHeight " + resizeHeight + - "\ninnerHeight:" + window.innerHeight + - "\nvisualViewport.height: " + window.visualViewport.height + if (window.myEdit.ctx.isMobile) { + let testDiv = document.getElementById("testDevice"); + var resizeHeight = document.documentElement.clientHeight || document.body.clientHeight; + if (window.myEdit.ctx.originHeight < resizeHeight) { + console.log('Android 键盘收起啦!'); + testDiv.innerText = "\nmobile: " + 'Android 键盘收起啦!' + + "\noriginHeight " + window.myEdit.ctx.originHeight + + "\nresizeHeight:" + resizeHeight + + "\ninnerHeight:" + window.innerHeight + + "\nvisualViewport.height: " + window.visualViewport.height + // Android 键盘收起后操作 + let styleUtils = document.getElementById("_style_utils"); + styleUtils.style.display = "none"; + setTimeout(() => { + this.keyBoardHeight = window.innerHeight - window.visualViewport.height; + // console.log("mobile: ", this.keyBoardHeight); + testDiv.innerText = "\n键盘收起啦mobile: " + this.keyBoardHeight + + "\noriginHeight " + window.myEdit.ctx.originHeight + + "\nresizeHeight " + resizeHeight + + "\ninnerHeight:" + window.innerHeight + + "\nvisualViewport.height: " + window.visualViewport.height - // Android 键盘弹起后操作 - setTimeout(() => { - this.keyBoardHeight = window.innerHeight - window.visualViewport.height; - // console.log("mobile: ", this.keyBoardHeight); + let styleUtils = document.getElementById("_style_utils"); + styleUtils.style.display = "none"; + }, 800); + } else { + console.log('Android 键盘弹起啦!'); - testDiv.innerText = "\nmobile: " + this.keyBoardHeight + + testDiv.innerText = "\nmobile: " + 'Android 键盘弹起啦!' + "\noriginHeight " + window.myEdit.ctx.originHeight + "\nresizeHeight " + resizeHeight + "\ninnerHeight:" + window.innerHeight + "\nvisualViewport.height: " + window.visualViewport.height - let styleUtils = document.getElementById("_style_utils"); - styleUtils.style.display = "block"; - // styleUtils.style.left = 0; - styleUtils.style.bottom = "600px"; - }, 800); + // Android 键盘弹起后操作 + setTimeout(() => { + this.keyBoardHeight = window.innerHeight - window.visualViewport.height; + // console.log("mobile: ", this.keyBoardHeight); + testDiv.innerText = "\n键盘弹起啦mobile: " + this.keyBoardHeight + + "\noriginHeight " + window.myEdit.ctx.originHeight + + "\nresizeHeight " + resizeHeight + + "\ninnerHeight:" + window.innerHeight + + "\nvisualViewport.height: " + window.visualViewport.height + // styleUtils.style.left = 0; + let styleUtils = document.getElementById("_style_utils"); + styleUtils.style.display = "block"; + styleUtils.style.bottom = "500px"; + }, 800); + + + } + window.myEdit.ctx.originHeight = resizeHeight; } - window.myEdit.ctx.originHeight = resizeHeight; - - } /**