Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

设置focus=false还会主动聚焦,官网demo可复现 #3670

Closed
Chanran opened this issue Oct 17, 2021 · 3 comments
Closed

设置focus=false还会主动聚焦,官网demo可复现 #3670

Chanran opened this issue Oct 17, 2021 · 3 comments
Labels

Comments

@Chanran
Copy link

Chanran commented Oct 17, 2021

bug 描述

设置editor.config.focus=false但是在企业微信webview上还是会主动聚焦到编辑器并且弹出虚拟键盘

你预期的样子是?

设置editor.config.focus=false不会聚焦到编辑器且不会弹出虚拟键盘

浏览器及版本号

iOS企业微信3.1.18(75051),user agent:Mozilla/5.0 (iPhone; CPU iPhone OS 15_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 wxwork/3.1.18 MicroMessenger/7.0.1 Language/zh ColorScheme/Light

wangEditor 版本

4.7.9

官网能否复现该 bug ?

最小成本的复现步骤

(请告诉我们,如何最快的复现该 bug)

  • 步骤一:给examples/index.html文件加上以下代码
<a href="./auto-focus.html">to auto-focus false</a>
  • 步骤二:运行examples例子,在企业微信打开examples/index.html
  • 步骤三:点击"to auto focus false"的链接跳转到examples/auto-focus.html,结果还是自动focus并且弹出虚拟键盘

根因

init-selection.ts editor.selection.createRangeByElem函数执行里还存在一次restoreSelection调用,相当于restoreSelection没有拦住

createRangeByElem -> moveCursor -> restoreSelection -> if(editor.config.focus){restoreSelection}
@a835100635
Copy link
Contributor

v5版本中已修复此问题,可以使用wangEditor v5版本
WechatIMG72

@Chanran
Copy link
Author

Chanran commented Oct 18, 2021

@a835100635 V5版本现在可以应用在移动端了?
image

@rsl140
Copy link
Contributor

rsl140 commented Oct 25, 2021

v5目前暂不兼容移动端,后期会做兼容

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants