You are not logged in.

#1 2008-02-27 18:17:40

kevin
Member
Registered: 2008-02-27
Posts: 66

New SimplePaste plugin available!

Hello everyone,

Since the new official paste plugin has been released in TinyMCE 3.2.3, consider SimplePaste to be obsolete. Download TinyMCE 3.2.3 for the new official paste plugin!

I've created a new paste plugin (called SimplePaste) that works just as good in Firefox and Safari as in IE. That means Word content cleaning IS supported in all these browsers WITHOUT the use of a popup window. It supports the same configuration as the original paste plugin, except the paste_auto_cleanup_on_paste option is gone: Word content is always cleaned (why wouldn't you want to..?)

How does it work?
Firefox is unable to read the contents of the clipboard, so you can't just clean the clipboard and then insert the cleaned content. Instead I create an extra tinymce instance (hidden and with minimal setup), and just before the paste action I give the focus to this editor. So what happens is that the clipboard is actually pasted into ANOTHER editor. I can then get the content out of it, clean it and finally insert it into my original editor. It works very well and is tested in Firefox, IE and Safari.

The only thing that's left to do is to hack the contextmenu plugin so the paste action doesn't just give an error about pasting in Firefox, but instead will paste using my SimplePaste plugin.

Install instructions:
1. Download at http://www.bolhoed.net/simplepaste-1.15.zip Unzip and insert into your plugins folder.
2. Load the plugin. If you already use the normal paste plugin you can simply change 'paste' to 'simplepaste':
      plugins : 'inlinepopups,contextmenu,spellchecker,simplepaste',
3. Have a look at http://wiki.moxiecode.com/index.php/Tin … gins/paste for the available options. Remember, paste_auto_cleanup_on_paste is gone as it is always executed.

Also included in the zip file is a hacked version of the contextmenu plugin, removing the cut/copy/paste actions since they don't work crossbrowser anyway. So for now people will have to use plain old ctrl-c and ctrl-v.

I'll keep you posted on updates (subscribe to this topic to keep informed!).

Right now version 1.15 is online

Cheers,
Kevin
kevin@ingoedebanen.nl

Last edited by kevin (2009-04-24 10:03:45)

Offline

 

#2 2008-02-29 12:29:39

kevin
Member
Registered: 2008-02-27
Posts: 66

Re: New SimplePaste plugin available!

Version 1.7 is now online, removing the need to add css by hand.

Last edited by kevin (2008-02-29 13:25:45)

Offline

 

#3 2008-02-29 12:42:19

gregsmith
Member
Registered: 2007-07-13
Posts: 53

Re: New SimplePaste plugin available!

Awesome!  Thanks for listening.  Will be getting and using your plugin as of now.

Last edited by gregsmith (2008-02-29 12:42:34)

Offline

 

#4 2008-02-29 16:15:38

flipper01
Member
Registered: 2006-11-15
Posts: 8

Re: New SimplePaste plugin available!

I can't get it to work..
I pasted the files into plugins/simplepaste/ and used this code:
<script language="javascript" type="text/javascript" src="../tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
    language : "nl",
    mode : "textareas",
    plugins : "simplepaste",
    theme_advanced_buttons3_add : "simplepaste",
    theme : "advanced",
    theme_advanced_buttons1 : "bold,italic,underline,formatselect,separator,bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,separator",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    content_css : "editor_styles.css",
    theme_advanced_blockformats : "h1,h2,h3,h4",
    relative_urls : false,
    remove_script_host : false,
    paste_create_paragraphs : true,
    paste_create_linebreaks : true,
    paste_remove_spans : true
});

</script>

I hope you can help me solve this.

Offline

 

#5 2008-02-29 16:23:00

kevin
Member
Registered: 2008-02-27
Posts: 66

Re: New SimplePaste plugin available!

theme_advanced_buttons3_add : "simplepaste", should not be there to start with, as this plugin doesn't have any buttons.
Do you get errors of any kind?

Offline

 

#6 2008-02-29 16:33:30

flipper01
Member
Registered: 2006-11-15
Posts: 8

Re: New SimplePaste plugin available!

I guess I found the source of my problem, I tried to paste from an e-mail message.. When I pasted the text in Word and then copied and pasted it in tinymce it got cleaned! So I guess it has something to do with pasting from e-mail...

Offline

 

#7 2008-02-29 17:06:18

kevin
Member
Registered: 2008-02-27
Posts: 66

Re: New SimplePaste plugin available!

Weird, that should not happen. Do you have a link where I can reproduce it?

Offline

 

#8 2008-03-03 14:53:00

kevin
Member
Registered: 2008-02-27
Posts: 66

Re: New SimplePaste plugin available!

For your information: version 1.8 is now online, working perfectly in IE 6.0 and eliminating the need for an extra css file. I've also included a hacked version of the contextmenu plugin, see startpost for details.

Last edited by kevin (2008-03-03 15:21:24)

Offline

 

#9 2008-03-04 17:17:28

kevin
Member
Registered: 2008-02-27
Posts: 66

Re: New SimplePaste plugin available!

Version 1.11 had just been uploaded, fixing the bug originally present in the paste plugin from 3.0.2: pasting text containing middots gave an error in IE.

Last edited by kevin (2008-03-04 17:18:02)

Offline

 

#10 2008-03-06 13:01:13

gregsmith
Member
Registered: 2007-07-13
Posts: 53

Re: New SimplePaste plugin available!

Hi Kevin,

I've just realised that with your paste plugin there's no 'pastetext' button available anymore.  This would be a useful option as sometimes they're pasting from somewhere other than Word with harmful stuff that isn't being cleaned.

Offline

 

#11 2008-03-06 13:26:18

evicske
Member
Registered: 2008-03-06
Posts: 1

Re: New SimplePaste plugin available!

Hi Kevin

I am new here and try to find the answers but this one is I think strictly related to simplepaste plugin
the plugin works great, it cleans up a lot of mess from pastes smile

the only little problem I have is when I use the browser button to go back one page "history.go(-1)" it shows me the empty form. I hope I understand it right:  it is because the content gets pasted into the "in_content" to perform the cleanup?

is there a way to fix it "simple" way?
if not I will make if from some php code but was wondering if you know something easier

Offline

 

#12 2008-03-06 16:14:53

kevin
Member
Registered: 2008-02-27
Posts: 66

Re: New SimplePaste plugin available!

gregsmith: the auto_clean option should clean "normal" harmful stuff because the buildin insertcontent function is used. At least I think so...

evicske: I'll have to look into that, but normally when you go back, the content that was inserted by javascript should NOT still be visible.

Offline

 

#13 2008-03-06 16:32:38

gregsmith
Member
Registered: 2007-07-13
Posts: 53

Re: New SimplePaste plugin available!

Ah, that's cool.  I don't really know the inner workings of the cleanup script.

There are instances where users will have say black styled text which is not bad code or anything but won't be visible on a black background.  In this instance the 'pastetext' button would still be useful as an option.  I don't want this stuff to always be removed, only when the user wants to paste as plain text specifically.

Offline

 

#14 2008-03-06 16:38:18

kevin
Member
Registered: 2008-02-27
Posts: 66

Re: New SimplePaste plugin available!

So you want the paste as text button back? That'll take some time, which sadly I don't have this week. So, hopefully by the end of next week.

Offline

 

#15 2008-03-06 16:47:00

gregsmith
Member
Registered: 2007-07-13
Posts: 53

Re: New SimplePaste plugin available!

kevin wrote:

So you want the paste as text button back? That'll take some time, which sadly I don't have this week. So, hopefully by the end of next week.

Sorry if I came across as demanding.  Was only meant as a suggestion.  Don't worry if it's not part of your plans for the plugin.

I assume running the original paste and simplepaste plugins together will cause problems/conflicts?  Perhaps the original could be stripped down to just be the 'paste as plain text' button and functionality?

Offline

 

#16 2008-03-06 17:01:56

kevin
Member
Registered: 2008-02-27
Posts: 66

Re: New SimplePaste plugin available!

Not a problem, it's a good suggestion. I just don't have the time right now smile
And yes, using both plugins wont' work and stripping down the original plugin makes upgrades more difficult. So I'll copy the necessary code into mine.

Offline

 

#17 2008-03-14 15:02:27

MIvanIsten
Member
Registered: 2008-03-14
Posts: 1

Re: New SimplePaste plugin available!

Any news about paste as text button?
I miss it a lot. smile

Offline

 

#18 2008-03-17 21:45:18

dabilock
Member
Registered: 2008-03-06
Posts: 9

Re: New SimplePaste plugin available!

Kevin,

With your understanding of how the paste-related code works, do you have any idea what the solution to this issue might be?

http://tinymce.moxiecode.com/punbb/view … ?pid=34246

Damon

Offline

 

#19 2008-04-02 21:33:25

flipper01
Member
Registered: 2006-11-15
Posts: 8

Re: New SimplePaste plugin available!

The simplepaste plugin seems to work fine in FireFox, but in IE it doesn't work... Is this a common problem or could it be that I did something wrong?

Offline

 

#20 2008-04-04 09:01:15

devon05
Member
Registered: 2008-04-04
Posts: 6

Re: New SimplePaste plugin available!

For me simplepaste seems to work on IE. For example, it cleans up anything pasted from Word.

Thanks to Kevin for this plugin!

Offline

 

#21 2008-04-11 12:44:42

devon05
Member
Registered: 2008-04-04
Posts: 6

Re: New SimplePaste plugin available!

Hmm. Can't seem to get simplepaste to work with Safari 3.1 (current version) on Windows. Problem is that it does not clean text pasted from Word 2007.

Works fine on Windows with IE, Firefox and Opera, though. I haven't tried on Mac OSX yet.

Offline

 

#22 2008-04-17 23:18:29

adrianbj
Member
Registered: 2006-03-29
Posts: 15

Re: New SimplePaste plugin available!

I am using TinyMCE 3.0.7 and Simplepaste 1.11 but when I paste from Word 2007 using FF 3b4 I get the following:

<!--[if gte mso 9]><xml> Normal   0               false   false   false      EN-US   X-NONE   X-NONE                                                     MicrosoftInternetExplorer4 </xml><![endif]--><!--[if gte mso 9]><xml> </xml><![endif]--> <!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin-top:0in;
    mso-para-margin-right:0in;
    mso-para-margin-bottom:10.0pt;
    mso-para-margin-left:0in;
    line-height:115%;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:"Times New Roman";
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;}
</style>
<![endif]--> The quick brown fox jumps over the lazy dog<br /><br />



It seems to work fine in IE7, except for the addition of the <br /><br /> at the end.

My setup is:

<script language="javascript" type="text/javascript">
    tinyMCE.init({
        theme : "advanced",
        mode : "textareas",
        plugins : "inlinepopups,contextmenu,spellchecker,simplepaste",
        convert_urls : false,
        extended_valid_elements : "-p[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]",
        theme_advanced_toolbar_location : "top",
        theme_advanced_disable : "image,anchor,strikethrough,styleselect,fontselect,formatselect,hr,visualaid,underline",
        theme_advanced_buttons1 : "bold,italic,undo,redo,link,unlink,sub,sup,code",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        forced_root_block : '',
        force_p_newlines : false,
        force_br_newlines : false,       
        paste_create_paragraphs : false,
        paste_create_linebreaks : false,
        paste_use_dialog : true,
        paste_auto_cleanup_on_paste : true,
        paste_convert_middot_lists : false,
        paste_unindented_list_class : "unindentedList",
        paste_convert_headers_to_strong : true
});


</script>


Anyone know how to fix the FF problem?

Thanks,
Adrian

Offline

 

#23 2008-04-17 23:35:14

kevin
Member
Registered: 2008-02-27
Posts: 66

Re: New SimplePaste plugin available!

Sorry guys, for my lack of response, I didn't get the notification emails about new posts...

MIvanIsten: paste as text is still something I have to look into to
dabilock: I have no idea, I think that other thread has a better change of getting you an answer
devon05: haven't tried the very latest Safari version yet, I'll look into it
adrianbj: Firefox 3 has not been tested yet either, I'l look into this too

I think some bugs will be fixed by using the very lastest paste plugin as the base for the SimplePaste plugin. Haven't upgraded in a while so I am somewhat behind smile This probably means that the next version of SimplePaste will depend on TinyMCE 3.0.7. Hopefully I'll have enough time for all this tomorrow...

In the meantime, here is my setup:

<script type="text/javascript">
    tinyMCE.init({
    language : 'nl',
    mode : 'textareas',
    theme : 'advanced',
    theme_advanced_resizing : false,
    plugins : 'inlinepopups,contextmenu,advimage,spellchecker,simplepaste',
    theme_advanced_buttons1 : "bold,italic,underline,forecolor,fontsizeselect,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator,undo,redo,separator,spellchecker,separator,link",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_toolbar_location : 'top',
    theme_advanced_toolbar_align : 'left',
    extended_valid_elements : 'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]',
    paste_convert_middot_lists: true,
    paste_convert_headers_to_strong: true,
    remove_linebreaks: true,
    apply_source_formatting: false,
    button_tile_map : true,
    spellchecker_languages : '+Nederlands=nl,Engels=en'
    });
</script>

Last edited by kevin (2008-04-17 23:56:33)

Offline

 

#24 2008-04-17 23:40:33

kevin
Member
Registered: 2008-02-27
Posts: 66

Re: New SimplePaste plugin available!

Just tested Firefox 3 beta 5 and pasting from Word 2007 seems to work just fine. At least with my test document and my TinyMCE setup (and still using TinyMCE 3.0.5 atm) smile

Also did a very quick test in Safari and indeed the content doesn't seem to be cleaned properly.

Last edited by kevin (2008-04-18 00:01:24)

Offline

 

#25 2008-04-18 00:40:35

adrianbj
Member
Registered: 2006-03-29
Posts: 15

Re: New SimplePaste plugin available!

Hey Kevin, thanks for looking into my FF3 problems. I just just copied your setup exactly except for the language setting and I still get the same problems. I wonder if it's a 3.05 vs 3.07 issue. Very confusing!

Also, I added 'code' to the list of buttons so I could easily see exactly what was pasted.

Last edited by adrianbj (2008-04-18 01:09:17)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB