RichEditor icon indicating copy to clipboard operation
RichEditor copied to clipboard

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

Open leeManong opened this issue 5 years ago • 6 comments

leeManong avatar Sep 27 '19 07:09 leeManong

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

RexSuper avatar Oct 09 '19 08:10 RexSuper

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

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

FF3et5 avatar Oct 16 '19 08:10 FF3et5

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

RexSuper avatar Oct 31 '19 06:10 RexSuper

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

RexSuper avatar Oct 31 '19 10:10 RexSuper

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) } 添加单张图片的点击事件.

zhangshuqi avatar Apr 28 '20 05:04 zhangshuqi

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 avatar Jul 08 '20 06:07 liqiangCoding