A
A
Anton2015-10-16 05:42:35
CKEditor
Anton, 2015-10-16 05:42:35

Ckeditor how to remove styles when pasting from websites or Word?

Hello, how can I remove styles, etc., when I copy text from the site and paste it, as well as when I copy it from Word and other applications and paste it, it is inserted with Word styles, etc.
I would like to paste text without different styles, etc. .
There is a button to remove text formatting, but each time you press it and select the text is not very convenient, I would like to copy the text from the Word or from sites, etc., paste it and have it without styles.
Here is what the Word inserts:
f43d0c36e43b4b898cccd38b2c7afa6d.jpg
Why in the text, instead of the empty space between the lines, there is also this ( )
4b1c105528a34e799275caa5ff576657.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fedornabilkin, 2017-09-19
Websaytovsky @ws17

Add to config:
pasteFromWordRemoveFontStyles = true // removes styles related to changing the font font-size line-height font-family etc.
pasteFromWordRemoveStyles = true // generally cuts all styles
In recent versions, pasteFromWordRemoveFontStyles is marked as deprecated, and pasteFromWordRemoveStyles is completely removed. It looks like it only works on earlier versions.
Read more on offsite
UPD
Found an option. In the config, specify in allowedContent a list of tags, separated by a space, that must be left when pasting. You can also specify which attributes to leave. Depending on the specified tags, some buttons in the toolbar may not be displayed. a semicolon can be used to separate tag blocks in which to remove / leave the specified attributes.

allowedContent = 'h1 h2 h3 div p table tr td th[!dir,id,name]; a[!href,id,name]; img(left,right)[!src,alt,width,height];';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question