2
votes

I am using TinyMCE in an application and having trouble with what seems like something simple. I need to add an image that links to a website. I already have the link, image, and imagetools plugins working. On the toolbar I have a link and image button. However, neither of these options seem to have what I am looking for. The link button forces text and the image button does not allow me to create a link out of it.

I have read thru the plugin section for both Images and Links so maybe I am missing something or this is just not possible. I can add my own button on the toolbar and insert the content myself, but wanted to use the plugin tools if possible.

Here is a subset of my options section:

plugins: "link image imagetools",
imagetools_toolbar: "rotateleft rotateright | flipv fliph | editimage imageoptions",
content_css: "content/mce.css",
toolbar1: 'addlink | undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | image',
2
If I insert an image, click once on the image and then click the insert link toolbar button I can place a hyperlink on the image. Can you create a TinyMCE Fiddle that shows your configuration that is not allowing this behavior? - Michael Fromin
well...... that was easy. I had never thought that the two could be used together on the image.... If you want to create an answer I will accept it for anybody else that misses this simple piece of information - DigitalMystery
Done. Glad this was a simple resolution! - Michael Fromin

2 Answers

2
votes

If I insert an image, click once on the image and then click the insert link toolbar button I can place a hyperlink on the image.

Can you create a TinyMCE Fiddle that shows your configuration that is not allowing this behavior?

0
votes

Hamza is correct, I have managed to bypass this error and allow links from images to work by commenting out the following lines from tinymce.js:

if (node && node.tagName == 'IMG') {
    self.getSel().setBaseAndExtent(node, 0, node, 1);
}