in Web & Tech

Drupal: Apply text format filters live on Paste

Here’s a brief recap of what I did to make it work to apply filters right upon pasting rich text into Ckeditor. This will only work in combination with Ckeditor (I’m using Ckeditor module, but it should also work wia WYSIWYG module)

What Pasteformat basically does is filtering text that gets pasted into Ckeditor live upon pasting.

This is a great improvement in terms of usability for content editors, as it reduces al lot of confusion. Normally when pasting richt text you see all the original formatting right inside Ckeditor and it doens’t disappear until you view your saved content (because Drupal stores everything in the database and the filter system fires upon viewing). Though there are good reasons for this behaviour it’s really everything but intuitive to see something different inside you WYSIWYG(!!) editor than what will appear on you published pages.

  1. Install Pasteformat module
  2. Set proper permissions for pasteformat
  3. Choose the text format that will define the rules to do the live filtering under admin/config/content/pasteformat (Filtered HTML for me)
  4. Enable the Pasteformat Ckeditor plugin for the profiles you want it pasteformat to run admin/config/content/ckeditor
  5. Make sure your chosen text format is set up to clean up properly, i.g. you’ll most definitely want to limit the allowed HTML tags

Write a Comment

Comment