My stakeholders encountering a situation where they have to do finagling in the CKEditor window when they copy and paste from Google Docs, which they do often.

Ideally, what would happen is that inline styling information is stripped out from pasted tags, while preserving other styling information. For instance, here's the tag for some large-sized text, copied from Google Doc's resume template, and pasted in to CKEditor in Drupal 8.6.13:

<span style="font-size:36pt;font-family:Merriweather;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Your Name</span></p>

Is there a way to strip out the font-style and font-size attributes on page? I've googled for information on the Drupal side, and also on the CKEditor site, but I haven't found positive confirmation that this is possible.

I see that there are modules for CKEditor that provide a "Paste from Google Docs" button, but my team doesn't want another button they have to remember to use when they are pasting from Google Docs -- they want this to work with the default paste functionality. We will never be using the source font-size and font-family, because we have a style guide for our entire site which is standardized.

I am aware that typeface can be handled differently (e.g. styling tags as bold instead of using font-weight:bold, etc), but we can deal with that. What I am looking for is how to get rid of the font family and font size.

As regarding custom text filters, I looked at this tutorial and downloaded and installed the sample celebrate custom text filter module. Upon testing, I confirmed that it only changed text when I saved the node, not when I pasted into the CKEditor textarea widget. So a custom text filter module does not do what I want.

1 Answer 1


I found the CKEditor custom config module. This allows one to specify arguments to ckeditor's config object. This module provides me as much configuration as CKEditor allows.

I am still testing if I can filter specific inline styles, but if I can't do that, then that's an inability of CKEditor, not Drupal's ability to interact with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.