Andra Zeberga
Andra Zeberga

Reputation: 227

TinyMCE links plugin doesn't render anchor links in the content

I use links plugin for TinyMCE text editor. When I insert link it saves as an anchor link. When the page is refreshed the link is showed as plain text in paragraph tag. I want the link to be showed as tag so it can be clickable.

I have used link plugin commands like:

tinymce.init({
 selector: "textarea",
  plugins: "link autolink",
  menubar: "insert",
  "valid_elements": "*",
});

The actual output is is plain text link in paragraph tag.

I expect the output be anchor tag link in paragraph tag

Upvotes: 1

Views: 3420

Answers (1)

Michael Fromin
Michael Fromin

Reputation: 13744

The way you have the valid_elements setting configured it is not doing what you think it is doing. Your current configuration is causing TinyMCE to not allow any attributes on any HTML tags so the HTML you are creating is like this:

<p><a>http://www.google.com</a></p>

If you just remove your valid_elements configuration option you will get appropriate links like this:

<p><a href="http://www.google.com">http://www.google.com</a></p>

I have created a TinyMCE Fiddle so you can see the impact of your current valid_elements setting:

http://fiddle.tinymce.com/xSgaab/3

Fundamentally you should be able to just remove that valid_elements setting.

Upvotes: 1

Related Questions