Trying to add Simplepaste plugin to TinyMCE in Drupal....

emdalton - September 3, 2008 - 19:59
Project:TinyMCE
Version:5.x-1.9
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I've been trying to get SimplePaste (http://tinymce.moxiecode.com/punbb/viewtopic.php?id=10409&p=1) working on Drupal, but haven't been able to get it working. I'm using Drupal 5.10 and TinyMCE 3.x. Here's what I've done so far:

- I downloaded the plugin and unzipped it in /sites/all/modules/tinymce/tinymce/jscripts/tiny_mce/plugins/

- I added this line to plugin_reg.php:
$plugins['simplepaste'] = array();

Simplepaste doesn't have any buttons, so I didn't have a line for those equivalent to the one for the Paste plugin.

- I commented out the following lines:

//$plugins['paste'] = array();
//$plugins['paste']['theme_advanced_buttons3'] = array('pastetext', 'pasteword', 'selectall');

I added the following to tinymce.module:

  $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.')
  );

  $form['output']['paste_remove_styles'] = array(
     '#type' => 'select',
     '#title' => t('Remove Styles 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 style attributes, they will be removed by default.')
  );

  $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. ')
  );

- I copied editor_plugin.js to editor_plugin_src.js

At this point I did see the "Clean html and Word content on paste" checkbox under TinyMCE "Buttons and plugins" and the "Remove... on paste" options under "Cleanup and Output" but even after I checked them all for the profile I'm testing in, paste was not cleaned.

Did I miss a step? Thanks!

#1

klavs - February 3, 2009 - 13:26

Did you get this working? I would very much like to have the simplepaste plugin with tinymce in Drupal 5.x as well. Having to paste via notepad and then in the tinymce field is tiresome :(

#2

emdalton - February 6, 2009 - 19:20

I did get it working, but I don't remember now all the contortions I had to go through. I'll have to look on the server and see what the code looks like now.

#3

klavs - February 6, 2009 - 20:55

If you could tar up the modified modules I could easily diff them against the original source so I could reimplement it for current version.

#4

emdalton - February 11, 2009 - 17:51

I tried to upload the tarball, but it's too big to attach here. Do you have a suggestion for how to send the file? I can arrange an ftp server if necessary, but if you already have one available, I could just use that.

#5

klavs - February 13, 2009 - 07:12

I have an ftp server - but I need your IP to let you in. you can email me at kl at vsen dot dk

#6

rockaholiciam - May 15, 2009 - 13:23
Version:5.x-1.9-1» 5.x-1.9

facing the same issue...not working for me either...can you kindly elaborate what steps or measures you took to get it working?

 
 

Drupal is a registered trademark of Dries Buytaert.