wysiwyg_cleaner.jpg

Allows users to clean up content in wysiwyg editors.

It is meant to be a generic solution to clean up content in Wysiwyg editors. It can be used to clean up content from third party softwares as word processors or any situation where content needs to be cleaned up.

Using rules based on jQuery selectors or regular expression, you can provide buttons for wysiwyg editors to clean up content. Optionally, cleaning can be automatically fired on paste.

By default an "Open Office" preset is provided. It cleans up content copied from Open Office.

Requires the Wysiwyg module and the last 6.x-2.x-dev version of jQuery Update module (this is required for complex jQuery selectors like "div[attr*=value]" to work).

Presets

Navigate to admin/settings/wysiwyg/cleaner.
You will see the provided default presets, for now, the only profile is "Open Office".

If you create a preset that you think could be added to the provided defaults, please create an issue and submit the preset !

Activate a button

To activate a button, navigate to admin/settings/wysiwyg and edit a profile.
In "Buttons and plugins", check the wanted Wysiwyg cleaner buttons.
To enable auto cleanup on paste, check "Force cleanup on standard paste" in "Cleanup and output"

Preset creation

Navigate to admin/settings/wysiwyg/cleaner/preset/add.
Each rule can be either a regular expression or a jQuery selector.
See the "Rules" section for a description of rules.
Add as many rules as you want.
You can see a preview using the "Preview" button.
Be sure to have set a preview markup using the "Change preview markup" link for preview to work.

Known issues

Currently, multiple jQuery selectors like "table, div, p" are not supported. Instead, create several rules.

Rules

  • jQuery :
    • The syntax is : li > p
    • Replace values :
      • Remove tag : The tag is stripped but its content remains.
      • Delete : The tag and its content are removed.
      • Remove all attributes : Removes all tag attributes.
      • Change tag : Changes the tag.
  • Regular expressions :
    • The syntax is : /[a-z]+[0-9]*/g
    • The replace value will be used as the second argument in a replace() function. Leave empty to remove.

Likwid
Based in Paris, Likwid is a web agency specialized in Drupal development.

Project Information

Downloads