开发者

Tinymce setcontent a link an selected img

In Tinymce I select an image. I would like to create a link with this:

var code开发者_如何转开发 = window.opener.tinyMCE.activeEditor.selection.getContent();
window.opener.tinyMCE.activeEditor.selection.setContent(code);

but it doesn't work.

If i select a text then work correctly!

Please help me i dont understand that why?


What you are doing here wont't work because you just get the selection context and set it to this context - so nothing changes!

A solution approach:

var code = window.opener.tinyMCE.activeEditor.selection.getContent();
window.opener.tinyMCE.activeEditor.selection.setContent(code + "<a href='http://mydomain/xxx.png'>Link</a>");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜