Reputation: 5729
I'm running into this weird issue with TinyMCE where selecting a text and adding a link to it without "http://" will cause the new link to append to the current URL.
Example (assume my website is www.example.com):
Now under my settings "click" will link to "www.example.com/linkexample.com". I need it to link to "http://linkexample.com" instead, without manually adding "http://" in the "Url" field in the popup.
I've been trying different solutions online but nothing seemed to work for me.
Here is the list of solutions I've tried so far, none worked for me:
P.S. I'm running the latest TinyMCE 4.1.7
Upvotes: 2
Views: 2489
Reputation: 1
I actually replaced this code:
/^\s*www./i.test(e)
with
!(/^\s*(http://|https://)/i.test(e))
Upvotes: -1
Reputation: 8621
In version 4.x this functionality is built in. But unfortunately it's not mentioned in the documentation, it's only documented in the changelog so I would imagine this is widely unknown.
$('textarea').tinymce({
...
link_assume_external_targets: true
...
});
Upvotes: 1
Reputation: 72
I'm done to try this one. it's worked for me (tell me if this thing worked for you)
www
using Ctrl+F in your editor like Notepad++ or Sublime Text/^\s*www\./i
delete www\.
/^\s*i
Done. I hope help you out.
Upvotes: 3