I have a built-in tinyMCE editor where HTML text can contain hyperlinks. If the user clicks the hyperlink, I want them to go to the URL. If they click elsewhere, I want to enter edit mode.
HTML:
<div id="tinymce">
<p>User should be able to <a id="mylink" href="http://google.com">navigate to a link</a> and also edit the text by clicking outside the link.</p>
</div>
script:
tinymce.init({
selector: '#tinymce',
inline: true
});
$('#mylink').on('click', function(e) {
console.log('Link clicked...');
});
jsfiddle: http://jsfiddle.net/rdog33/uLhdq447/
As you can see, I had the idea to connect to the click event of the hyperlink and manually send the user using window.location.href, but this event does not fire. If I uncomment the initialization of tinymce, it fires, so it is obvious that tinymce is somehow interfering.
Any ideas?
Roger source
share