Pranav Kumar
Pranav Kumar

Reputation: 87

TinyMCE4 - valid_elements property not working for 'em'

Want to allow certain tags & properties while pasting from Word/WebPage to TinyMCE4 Editor. I tried to set the configuration as below :

oEvent.getParameters().configuration.valid_elements="em,a[href|target=_blank],strong/b,div[align],br,p[align]";

Now I am able to paste only paragraph,bold & link not text with em tag.

Any idea why its not working ?

I want to allow only certains tags like Paragraph,Stong,StrikeThrough,Bullets.

Any help will be highly appreciated. Thank you.

Upvotes: 1

Views: 450

Answers (2)

Michael Fromin
Michael Fromin

Reputation: 13744

I don't see any issue with using that valid_elements setting. Please see this TinyMCE fiddle:

http://fiddle.tinymce.com/Dmgaab

One editor allows EM and the other does not ... and TinyMCE works as I would expect.

Upvotes: 2

arbuthnott
arbuthnott

Reputation: 3819

Pasting content from word is quite a complicated problem - you'll likely be able to make some functions carry over nicely on your own / with the free version, but tinymce has an extensive paid plugin to handle pastes if that's what you want.

For now, I would try adding span to your list of valid_elements. It would depend on your text source, but I know that tinymce handles italics internally through <span> elements.

valid_elements: "span,em,a[href|target=_blank],strong/b,div[align],br,p[align]"

Upvotes: 2

Related Questions