I've been trying out the excellent Medium Editor. The problem that I've been having is that I can't seem to get links to "work".
At the simplest, here's some HTML/JS to use to demonstrate the problem:
HTML:
<html>
<head>
<script src="//cdn.jsdelivr.net/medium-editor/latest/js/medium-editor.min.js"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/medium-editor/latest/css/medium-editor.min.css" type="text/css" media="screen" charset="utf-8">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/medium-editor/latest/css/themes/beagle.min.css" type="text/css">
</head>
<body>
<div class='editable'>
Hello world. <a href="http://www.google.com">link</a>
</div>
</body>
</html>
Javascript:
var editor = new MediumEditor('.editable');
This fiddle demonstrates the problem (using the code above).
It seems to me that clicking the link should take me wherever the link's href
is targeting. The only way to use the link is to right click and either open in a new tab or new window -- which I don't want to ask my users to do.
I feel like I must be missing something simple in the configuration (either the Anchor Preview Options or the Anchor Form Options). Unfortunately, I'm not seeing it.
In my actual application, I'm not using jQuery
, but I am using angularjs
. If a strictly Medium Editor answer doesn't exist, I can fall back to using basic JS or anything that angularjs provides.
External linksAffiliate links are allowed on Medium, however, according to Medium's rules any affiliate links or outside payment received for writing a story MUST be disclosed somewhere in the story.
Ads, Promotions, and MarketingImages functioning as third-party ads are not allowed. Inline images or embeds that link out and function as banner ads for third-party brands are not allowed. You must disclose affiliate links.
You can share a Friend Link with anyone. As long as they have that link, they'll have free access. And people can share it with other people too — it doesn't just have to come from you. They will need to receive the link from you, however — only the author can see the Friend Link when viewing their stories.
I've found how to bind event.
Here is full event list https://github.com/yabwe/medium-editor/blob/master/CUSTOM-EVENTS.md
Try to change your code to
var editor = new MediumEditor('.editable')
.subscribe("editableClick", function(e){if (e.target.href) {window.open(e.target.href)}})
https://jsfiddle.net/fhr18gm1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With