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>");
精彩评论