How disable color from paste

181 views Asked by At

I would like so if it's possible in the Tinymce editor to disable the color with the copy past from Word for example.

Thanks for the help.

1

There are 1 answers

1
Usama On

If you console.log value in onEditorChange event of editor after pasting the text, you can see style="color: red;" is added in the pasted text.

In onEditorChange you can use regex to remove color property from style, and then set the edited value.

onEditorChange={(value) => {value.replace(/color(.*?);/i, "")}}

Check this example

Note: The code is according to tinymce react component. You may need to change some code if you are not using tinymce for react