linktonode can't link images - it removes them
klavs - August 28, 2008 - 11:30
| Project: | Link to content |
| Version: | 5.x-1.7 |
| Component: | Code: Javascript |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
When you select an image and choose linktonode (and some node) it replaces the image with the title of the node.
When you select some random text - and do the same - the text simply is enclosed in the tags.
it should ofcourse just enclose the tag in the tags. I have looked at the JS script - but I've coded JS before - so I couldn't see any obvious explanations.

#1
I'm encountering this as well. I think it's to do with the difference between the way the text editor selects text (highlighted), and the way it selects an image by itself (with the resizing handles). The substitution works fine if you select the image along with some text.
I would suggest taking a look at the standard "Add/Edit Link" plugin and seeing how that handles the same situation ... unfortunately I don't have time to do it myself :(
(In case it isn't clear - klavs is talking about <IMG> and <A> tags, which the issue filters removed and treated as HTML, respectively.)
#2
As a workaround, you can use TinyMCE's own hyperlink insertion, which requires typing the address manually. It works fine hyperlinking images. This would also be a good place to look for differences in the code.