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

<p class="child-node-is-img" contenteditable="false">无效 #9

Open
chenyucai opened this issue Oct 23, 2018 · 2 comments
Open

<p class="child-node-is-img" contenteditable="false">无效 #9

chenyucai opened this issue Oct 23, 2018 · 2 comments

Comments

@chenyucai
Copy link

image
点击图片,还是弹出键盘了。有一个体验比较不好的地方,就是点击删除图片的叉叉时,弹出键盘了。是不是可以在点击删除事件那里stop和prevent一下,看样子时点击穿透了。

@yaofang123
Copy link

也遇到同样的问题,但是下载代码本地运行,微信浏览器,qq浏览器、google浏览器都没有这个问题。自己的代码在微信浏览器、google浏览器都会唤起键盘,只有在qq浏览器不会唤起,不知道是啥原因

@yaofang123
Copy link

之前也以为是冒泡事件的锅,看来源代码,其实是有阻止事件冒泡的。发现是contenteditable的锅。看了源码,在点击图片或是删除按钮的时候是传出了一个click事件的,可以在此时使元素失去焦点(blur)。我的代码如下,测试是可用的。(我的事件里又判断判断了一次,应该也可以不用判断)
zxEditor.on('click', function(dom, e) {
if (e.target.nodeName.toLowerCase() === 'i' || e.target.nodeName.toLowerCase() === 'img') {
document.querySelector('.zxeditor-content-wrapper').blur();
}
});

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

No branches or pull requests

2 participants