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

编辑的时候怎么给图片加点击事件? #2

Open
leeManong opened this issue Sep 27, 2019 · 6 comments
Open

编辑的时候怎么给图片加点击事件? #2

leeManong opened this issue Sep 27, 2019 · 6 comments

Comments

@leeManong
Copy link

No description provided.

@RexSuper
Copy link
Owner

RexSuper commented Oct 9, 2019

一样的原理,可以看看 CommonJs.IMG_CLICK_JS 的使用

@FF3et5
Copy link

FF3et5 commented Oct 16, 2019

一样的原理,可以看看 CommonJs.IMG_CLICK_JS 的使用

你好,我没有太理解这个意思,我看CommonJs.IMG_CLICK_JS的使用是在预览模式下,拼接在整个html的后面在用webview load,那编辑模式下怎么做?每次onTextChange后面拼接吗?不是吧?

@RexSuper
Copy link
Owner

嗯,我明白了你的需求了,本身的是可以的 但是为避免编辑的时候又去看,才不要了,我等会给你写个方案

@RexSuper
Copy link
Owner

RexSuper commented Oct 31, 2019

方法是开始就添加这个
<script type="text/javascript">document.body.onclick = function(e) { var target = e.target if (target.tagName.toUpperCase() === 'IMG') { window.imageOnclick.openImage(src); }; };</script>
但我发现和其他一些事件冲突了,我明天看看怎么兼容

@zhangshuqi
Copy link

zhangshuqi commented Apr 28, 2020

RE.insertImage = function(url, alt,style) {
var html = <img src=${url} alt=${alt} style=${style} onClick="window.imageOnclick.openImage('${url}')" /><br></br>;
RE.insertHTML(html);
RE.editor.scrollIntoView(false)
}
添加单张图片的点击事件.

@liqiangCoding
Copy link

RE.insertImage = function(url, alt,style) {
var html = <img src=${url} alt=${alt} style=${style} onClick="window.imageOnclick.openImage('${url}')" /><br></br>;
RE.insertHTML(html);
RE.editor.scrollIntoView(false)
}
添加单张图片的点击事件.

试了你给的这个方法没效果

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

5 participants