开发者

Tinymce setcontent a link an selected img

开发者 https://www.devze.com 2023-01-15 14:23 出处:网络
In Tinymce I select an image. I would like to create a link with this: var code开发者_如何转开发 = window.opener.tinyMCE.activeEditor.selection.getContent();

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

精彩评论

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