Hi,

I read the description in README file : "Optionally, cleaning can be automatically fired on paste."
I cannot figure out how can this be done. I can add the button for a profile in wysiwyg ,but I don't see how I can filter the content automatically on paste

Comments

markwittens’s picture

To enable auto cleanup on paste, check "Force cleanup on standard paste" in "Cleanup and output" (in the WYSIWYG profile settings)

jstoller’s picture

I want everything pasted into my TinyMCE editor to be stripped of all tags, so I created a "deep clean" preset and I checked the "Force cleanup on standard paste" box in the WYSIWYG profile settings, but it didn't work. Then I tried enabling the "Wysiwyg cleaner : Deep clean" button in my profile and suddenly clean on paste started working. But now I have a button on my TinyMCE toolbar that I don't want. How can I enable cleaning on paste, using my chosen preset, without also enabling the button?

markwittens’s picture

This is something I would like to know as well...

Also, could you share the export of your deep clean preset here?

jide’s picture

For now, the button must be enabled for the "cleanup on paste" functionality to work. You could hide the button through CSS or JS.

Sharing your presets would be great !

jide’s picture

Status: Active » Closed (works as designed)

Marking as "by design".

jstoller’s picture

I've posted a feature request for this. Please consider it for future development.

#878370: Allow cleaning on paste without displaying button

my-family’s picture

@jstoller: please could you share your preset? It would be very helpful, thank you...

jstoller’s picture

This has not been thuroughly tested yet, but it seems to work pretty well so far.

(array(
   'name' => 'Deep clean',
   'icon' => '',
   'rules' => 
  array (
    33 => 
    (array(
       'rule' => '*',
       'value' => '$(this).WysiwygCleanerRemoveAllAttributes();',
       'arguments' => '',
    )),
    34 => 
    (array(
       'rule' => 'span',
       'value' => '$(this).WysiwygCleanerStripTag();',
       'arguments' => '',
    )),
    35 => 
    (array(
       'rule' => 'div',
       'value' => '$(this).WysiwygCleanerStripTag();',
       'arguments' => '',
    )),
    36 => 
    (array(
       'rule' => 'h1',
       'value' => '$(this).WysiwygCleanerChangeTag("%s");',
       'arguments' => 'p',
    )),
    37 => 
    (array(
       'rule' => 'h2',
       'value' => '$(this).WysiwygCleanerChangeTag("%s");',
       'arguments' => 'p',
    )),
    38 => 
    (array(
       'rule' => 'h3',
       'value' => '$(this).WysiwygCleanerChangeTag("%s");',
       'arguments' => 'p',
    )),
    39 => 
    (array(
       'rule' => 'h4',
       'value' => '$(this).WysiwygCleanerChangeTag("%s");',
       'arguments' => 'p',
    )),
    40 => 
    (array(
       'rule' => 'h5',
       'value' => '$(this).WysiwygCleanerChangeTag("%s");',
       'arguments' => 'p',
    )),
    41 => 
    (array(
       'rule' => 'h6',
       'value' => '$(this).WysiwygCleanerChangeTag("%s");',
       'arguments' => 'p',
    )),
    42 => 
    (array(
       'rule' => 'blockquote',
       'value' => '$(this).WysiwygCleanerChangeTag("%s");',
       'arguments' => 'p',
    )),
    43 => 
    (array(
       'rule' => 'pre',
       'value' => '$(this).WysiwygCleanerChangeTag("%s");',
       'arguments' => 'p',
    )),
    45 => 
    (array(
       'rule' => 'a',
       'value' => '$(this).WysiwygCleanerStripTag();',
       'arguments' => '',
    )),
    46 => 
    (array(
       'rule' => 'form',
       'value' => '$(this).remove();',
       'arguments' => '',
    )),
    47 => 
    (array(
       'rule' => 'fieldset',
       'value' => '$(this).remove();',
       'arguments' => '',
    )),
    48 => 
    (array(
       'rule' => 'iframe',
       'value' => '$(this).remove();',
       'arguments' => '',
    )),
    49 => 
    (array(
       'rule' => 'img',
       'value' => '$(this).remove();',
       'arguments' => '',
    )),
    50 => 
    (array(
       'rule' => 'embed',
       'value' => '$(this).remove();',
       'arguments' => '',
    )),
    51 => 
    (array(
       'rule' => 'code',
       'value' => '$(this).WysiwygCleanerChangeTag("%s");',
       'arguments' => 'p',
    )),
    52 => 
    (array(
       'rule' => 'dl',
       'value' => '$(this).WysiwygCleanerStripTag();',
       'arguments' => '',
    )),
    53 => 
    (array(
       'rule' => 'dt',
       'value' => '$(this).WysiwygCleanerChangeTag("%s");',
       'arguments' => 'p',
    )),
    54 => 
    (array(
       'rule' => 'dd',
       'value' => '$(this).WysiwygCleanerChangeTag("%s");',
       'arguments' => 'p',
    )),
    55 => 
    (array(
       'rule' => 'li > p',
       'value' => '$(this).WysiwygCleanerStripTag();',
       'arguments' => '',
    )),
    56 => 
    (array(
       'rule' => 'p > p',
       'value' => '$(this).WysiwygCleanerStripTag();',
       'arguments' => '',
    )),
  ),
))
luco’s picture

@jstoller, I tried Deep clean on content copied from word for mac: nothing happened.

I'm pretty sure I have all the right modules: Wysiwyg cleaner 6.x-1.2, Wysiwyg 6.x-2.1 and jQuery Update 6.x-2.x-dev but still no joy.

I also turned on the Deep clean button, checked force cleanup on standard paste, the works.

any thoughts?

thanks in advance :)