Hi,

According to the TinyMCE documentation on the Paste plugin at http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste there are a number of available options that would help our users considerably. They include:

paste_auto_cleanup_on_paste
paste_remove_spans
paste_remove_styles
paste_strip_class_attributes
and possibly
paste_insert_word_content_callback

I don't see a way to enable these options using the TinyMCE module interface. The code examples at the TinyMCE website seem relatively straightforward, but when I look in tinymce.module, the tinyMCE.init function just uses $tinymce_settings, which seems to get its value from the database. Can this be configured elsewhere in the code? Should I edit the database entry for the role directly? Is the format of the database value documented somewhere? Or will I need to edit the tinymce_profile_form_build function?

Comments

emdalton’s picture

Ok, I've tried editing the tinymce_profile_form_build function in tinymce.module. I added the following options. Some work, some don't seem to work. In particular, 'paste_auto_cleanup_on_paste' doesn't seem
to work in IE6 or IE7. (I don't expect it to work in non-IE browsers, based on the TinyMCE documentation.) Any suggestions from someone who has successfully implemented TinyMCE options in the past would be greatly appreciated.

/* EMD Additions */

/* does not work */
  $form['output']['paste_auto_cleanup_on_paste'] = array(
     '#type' => 'select',
     '#title' => t('Auto-Cleanup on Paste'),
     '#default_value' => $edit->settings['paste_auto_cleanup_on_paste'],
     '#options' => array('false' => t('false'), 'true' => t('true')),
     '#description' => t('MSIE specific option. If you enable this feature, a word paste will be executed when the user copy/paste content to the editor. This feature is disabled by default.')
  );

/* works but only when "Paste from Word" button is used */
  $form['output']['paste_remove_spans'] = array(
     '#type' => 'select',
     '#title' => t('Remove Span tags on Paste'),
     '#default_value' => $edit->settings['paste_remove_spans'],
     '#options' => array('false' => t('false'), 'true' => t('true')),
     '#description' => t('This enables you to control if the word parse operation should remove or keep span elements, they will be removed by default.')
  );

/* works but only when "Paste from Word" button is used */
  $form['output']['paste_remove_styles'] = array(
     '#type' => 'select',
     '#title' => t('Remove Spans on Paste'),
     '#default_value' => $edit->settings['paste_remove_styles'],
     '#options' => array('false' => t('false'), 'true' => t('true')),
     '#description' => t('This enables you to control if the word parse operation should remove or keep span elements, they will be removed by default.')
  );

 /* works but only when "Paste from Word" button is used */
 $form['output']['paste_strip_class_attributes'] = array(
     '#type' => 'select',
     '#title' => t('Strip Class Attributres on Paste'),
     '#default_value' => $edit->settings['paste_strip_class_attributes'],
     '#options' => array('none' => t('none'), 'all' => t('all'), 'mso' => t('mso')),
     '#description' => t('This feature allows you to control whether or not class attributes are stripped when using pasteword. Valid values are: all - will strip all class attributes from the pasted content. This is the default value; none - will not strip any class attributes from the pasted content; mso - will strip out all of the class attribute values that start with "Mso", but retain all others. ')
  );

/* not sure if it's working or not */
  $form['output']['paste_replace_list'] = array(
    '#type' => 'textfield',
    '#title' => t('Paste replace list'),
    '#default_value' => $edit->settings['paste_replace_list'] ? $edit->settings['paste_replace_list'] : 'a,b',
    '#size' => 40,
    '#maxlength' => 250,
    '#description' => t('Comma separated list of search/replace chunks. Where even items is the regexp that is to be used for the search and odd values are the contents that are to be replaced.  this list replaces some custom MS 1250 characters. The \uXXXX values is the hex values of the Unicode characters.')
  );

/* does not work */
  $form['output']['forced_root_block'] = array(
    '#type' => 'textfield',
    '#title' => t('Force Root Block'),
    '#default_value' => $edit->settings['forced_root_block'] ? $edit->settings['forced_root_block'] : 'p',
    '#size' => 40,
    '#maxlength' => 250,
    '#description' => t('This option enables you to make sure that any non block elements or text nodes are wrapped in block elements.')
  );

/* does not seem to work */
  $form['output']['invalid_elements'] = array(
    '#type' => 'textfield',
    '#title' => t('Invalid Elements'),
    '#default_value' => $edit->settings['invalid_elements'] ? $edit->settings['invalid_elements'] : 'font[face]',
    '#size' => 40,
    '#maxlength' => 250,
    '#description' => t('This option should contain a comma separated list of element names to exclude from the content. Elements in this list will removed when TinyMCE executes a cleanup.')
  );

/* end EMD additions */
pomliane’s picture

Status: Active » Closed (won't fix)

This version of TinyMCE is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.

This issue has been automagically closed by a script.