Monday, 15 August 2011

javascript - How to remove other html tags except p tag on Paste? -



javascript - How to remove other html tags except p tag on Paste? -

i having little problem inline text editor. simple user has permission re-create paste on textarea div. no problem that. dont want allow them paste html images, , div elements.

i have used

valid_elements: "p,br,b,i,strong,em",

it removes style of p tags content.

to not solution according requirements.

and tried paste_postprocess didn't latest version of tinymce.

and have tried many solutions posted in community. none of them work me because using latest version tinymce 4.0.26.

i know can prevent re-create paste disabling right click. not idea.

is there way filter p tag style html content?

so if has worked on re-create paste latest versions of tinymce.

please help.

you need explicitly tell tinymce attributes maintain when using valid_elements option. example, using previous valid_elements list, might this:

valid_elements: "p[style],br,b,i,strong,em"

this tells tinymce maintain tags listed , maintain style attributes defined p tags. alternatively, can include attributes specific element doing this:

valid_elements: "p[*],br,b,i,strong,em"

again, tells tinymce maintain of tags listed, p tag, maintain every attribute defined.

for more info on syntax of valid_elements selector, check out this page.

javascript jquery html copy-paste tinymce-4

No comments:

Post a Comment