511. File Comparison Report

Produced on Mon May 12 13:06:16 2008 UTC. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

511.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5\plugins\tiny_mce\plugins\paste editor_plugin_src.js Thu Sep 20 08:59:18 2007 UTC
2 Dolphin-v.6.1.0\plugins\tiny_mce\plugins\paste editor_plugin_src.js Thu Mar 27 13:53:26 2008 UTC

511.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 54 508
Changed 51 264
Inserted 2 3
Removed 1 1

511.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

511.4 Active regular expressions

No regular expressions were active.

511.5 Comparison detail

1   /**   1   /**
2     *   $Id:   editor_plu gin_src.js   2 0 1   200 7 -02- 1 2  
1 5 : 56 : 56 Z   spocke   $
  2     *   $Id:   editor_plu gin_src.js   65 0  
200 8 -02-
2 7   1 3 : 41 : 02 Z   spocke   $
3    *   3    *
4    * @author  Moxiecode   4    * @author  Moxiecode
5     *   @copyright   Copyright   ©   2004-200 7 ,   Moxiecode   Systems   AB,   All   rights   reserved.   5     *   @copyright   Copyright   ©   2004-200 8 ,   Moxiecode   Systems   AB,   All   rights   reserved.
6    */   6    */
7     7  
8   /* Import  plugin spe cific lang uage pack  */    8   (function( ) {
9   tinyMCE.im portPlugin LanguagePa ck('paste' );   9       var Ev ent = tiny mce.dom.Ev ent;
10     10  
11   var TinyMC E_PastePlu gin = {   11       tinymc e.create(' tinymce.pl ugins.Past ePlugin',  {
12        getI n fo   :   function(
)   {
  12            i n it   :   function( ed,   url )   {
13           re turn {   13                var t =  this;
14                longname  : 'Paste  text/word' ,    
15                author :  'Moxiecod e Systems  AB',    
16                authorur l : 'http: //tinymce. moxiecode. com',    
17                infourl  : 'http:// wiki.moxie code.com/i ndex.php/T inyMCE:Plu gins/paste ',    
18                version  : tinyMCE. majorVersi on + "." +  tinyMCE.m inorVersio n    
19           };    
20       },    
21     14  
22       initIn stance : f unction(in st) {   15                t.editor  = ed; 
23           if  (tinyMCE. isMSIE &&  tinyMCE.ge tParam("pa ste_auto_c leanup_on_ paste", fa lse))    
24                tinyMCE. addEvent(i nst.getBod y(), "past e", TinyMC E_PastePlu gin._handl ePasteEven t);    
25       },    
26     16  
27        h and l e Ev e n t   :   function( e )   {   17                // Regis ter comman ds
28           //  Force pas te dialog  if non IE  browser   18                 ed.addComm and ('mc e Past e Tex t ',   function( ui,   v )   {
29           if  (!tinyMCE .isRealIE  && tinyMCE .getParam( "paste_aut o_cleanup_ on_paste",  false) &&  e.ctrlKey  && e.keyC ode == 86  && e.type  == "keydow n") {   19                    if ( ui) {
30                window.s etTimeout( 'tinyMCE.s electedIns tance.exec Command("m cePasteTex t",true)',  1);   20                         ed.windowM anager.ope n({
31                return t inyMCE.can celEvent(e );   21                             file :  url + '/p astetext.h tm',
32            }
  22                             width  : 450,
    23                             height  : 400,
    24                             inline  : 1
    25                         }, {
    26                             plugin _url : url
    27                         });
    28                    } el se
    29                         t._insertT ext(v.html , v.linebr eaks);
    30                 } );
33     31  
34           re turn true;   32                ed.addCo mmand('mce PasteWord' , function (ui, v) {
35       } ,   33                    if ( ui) {
    34                         ed.windowM anager.ope n({
    35                             file :  url + '/p asteword.h tm',
    36                             width  : 450,
    37                             height  : 400,
    38                             inline  : 1
    39                         }, {
    40                             plugin _url : url
    41                         });
    42                    } el se
    43                         t._insertW ordContent (v);
    44                } );
36     45  
37        g e t Co
n
t ro l HTML   :   function( cn )   {  
  46                
e d.add Co mma n d('mceSele c t A l l',   function(
)   {
38           sw itch (cn)    47                    ed.e xecCommand ('selectal l'); 
39                case "pa stetext":   48                });
40                    retu rn tinyMCE .getButton HTML(cn, ' lang_paste _text_desc ', '{$plug inurl}/ima ges/pastet ext.gif',  'mcePasteT ext', true );    
41     49  
42                case "pa steword":   50                // Regis ter button s
43                     r e turn   tinyMCE . get Button HTML ( cn,   ' lang_ paste _ word _desc ',   ' { $plug i nur l }/imag e
s / paste
word .gif ',  
'mcePasteW ord',  
true
);
  51                ed.addBu tton('past etext', {t itle : 'pa ste.paste_ text_desc' , cmd : 'm cePasteTex t', ui : t rue});
    52                
e d . add Button
(
'
paste
word
',  
{ t i t l
e   :   'pa s te. paste _ word _desc ',   cmd   :   'mcePasteW ord',   ui   :   true } );
    53                ed.addBu tton('sele ctall', {t itle : 'pa ste.select all_desc',  cmd : 'mc eSelectAll '});
44     54  
45                case "se lectall":   55                if (ed.g etParam("p aste_auto_ cleanup_on _paste", f alse)) {
46                    retu rn tinyMCE .getButton HTML(cn, ' lang_selec tall_desc' , '{$plugi nurl}/imag es/selecta ll.gif', ' mceSelectA ll', true) ;   56                    ed.o nPaste.add (function( ed, e) {
    57                         return t._ handlePast eEvent(e)
    58                    });
47           }    59                }
48     60  
49           re turn '';    61                if (!tin ymce.isIE  && ed.getP aram("past e_auto_cle anup_on_pa ste", fals e)) {
50        },
  62                    // F orce paste  dialog if  non IE br owser
    63                    ed.o nKeyDown.a dd(functio n(ed, e) {
    64                         if (e.ctrl Key && e.k eyCode ==  86) {
    65                             window .setTimeou t(function () {
    66                                 ed .execComma nd("mcePas teText", t rue);
    67                              },   1);
51     68  
52       execCo mmand : fu nction(edi tor_id, el ement, com mand, user _interface , value) {     69                             Event. cancel(e);
53           sw itch (comm and) {     
54                case "mc ePasteText ":     
55                    if ( user_inter face) {    
56                         if ((tinyM CE.isMSIE  && !tinyMC E.isOpera)  && !tinyM CE.getPara m('paste_u se_dialog' , false))    
57                             TinyMC E_PastePlu gin._inser tText(clip boardData. getData("T ext"), tru e);     
58                         else {     
59                             var te mplate = n ew Array()    
60                             templa te['file']     = '../ ../plugins /paste/pas tetext.htm '; // Rela tive to th eme     
61                             templa te['width' ]  = 450;     
62                             templa te['height '] = 400;     
63                             var pl ain_text =  "";     
64                             tinyMC E.openWind ow(templat e, {editor _id : edit or_id, pla in_text: p lain_text,  resizable  : "yes",  scrollbars  : "no", i nline : "y es", mceDo  : 'insert '});     
65                         }   70                         }
66                    }  else   71                    } );
67                         TinyMCE_Pa stePlugin. _insertTex t(value['h tml'], val ue['linebr eaks']);    
68      
69                    retu rn true;    
70      
71                case "mc ePasteWord ":     
72                    if ( user_inter face) {    
73                         if ((tinyM CE.isMSIE  && !tinyMC E.isOpera)  && !tinyM CE.getPara m('paste_u se_dialog' , false))  {    
74                             TinyMC E_PastePlu gin._inser tWordConte nt(TinyMCE _PastePlug in._clipbo ardHTML()) ;    
75                         } else {     
76                             var te mplate = n ew Array()    
77                             templa te['file']     = '../ ../plugins /paste/pas teword.htm '; // Rela tive to th eme     
78                             templa te['width' ]  = 450;     
79                             templa te['height '] = 400;     
80                             var pl ain_text =  "";     
81                             tinyMC E.openWind ow(templat e, {editor _id : edit or_id, pla in_text: p lain_text,  resizable  : "yes",  scrollbars  : "no", i nline : "y es", mceDo  : 'insert '});    
82                         }    
83                    } el se    
84                         TinyMCE_Pa stePlugin. _insertWor dContent(v alue);    
85      
86                    retu rn true;    
87      
88                case "mc eSelectAll ":    
89                    tiny MCE.execIn stanceComm and(editor _id, 'sele ctall');     
90                    retu rn true;     
91      
92           }    72                }
    73           },
93     74  
94           //  Pass to n ext handle r in chain     75           ge tInfo : fu nction() {
95            return   false;     76                 return   {
    77                    long name : 'Pa ste text/w ord',
    78                    auth or : 'Moxi ecode Syst ems AB',
    79                    auth orurl : 'h ttp://tiny mce.moxiec ode.com',
    80                    info url : 'htt p://wiki.m oxiecode.c om/index.p hp/TinyMCE :Plugins/p aste',
    81                    vers ion : tiny mce.majorV ersion + " ." + tinym ce.minorVe rsion
    82                };
96       },   83           },
97     84  
98        //   Private   plugin   internal   methods   85            //   Private  
methods
99     86  
100       _handl ePasteEven t : functi on(e) {   87           _h andlePaste Event : fu nction(e)  {
101           sw itch (e.ty pe) {   88                 var   html   =  
t h i s ._clipboar dHTML() ,   ed   =   this.edito r,   sel   =   ed.selecti on,   r ;
102                case "pa ste":    
103                     var   html   =   TinyMCE_Pa s t ePlug i n ._clipboar dHTML()
;
   
104                    var  r, inst =  tinyMCE.se lectedInst ance;    
105     89  
106                    // R emoves ita lic, stron g etc, the  if was ne eded due t o bug #143 7114   90                // Remov es italic,  strong et c, the if  was needed  due to bu g #1437114
107                     if   ( inst   &&   (r   =   in s t .getRng())   &&   r.text.len gth   >   0)   91                 if   ( ed   &&   (r   =  
s el .getRng())   &&   r.text.len gth   >   0)
108                         tinyMCE .execComma nd('delete ');   92                     ed .execComma nd('delete ');
109     93  
110                    if ( html && ht ml.length  > 0)   94                if (html  && html.l ength > 0)
111                         tinyMCE .execComma nd('mcePas teWord',   false,   html);   95                     ed .execComma nd('mcePas teWord',   false,   html);
112      
113                    tiny MCE.cancel Event(e);    
114                    retu rn false;    
115           }    
116     96  
117            return  
t ru e
;
  97                 return   Even t .canc e l(e) ;
118       },   98           },
119     99  
120       _inser tText : fu nction(con tent, bLin ebreaks) {     100           _i nsertText  : function (content,  bLinebreak s) { 
121           if  (content  && content .length >  0) {   101                if (cont ent && con tent.lengt h > 0) {
122                if (bLin ebreaks) {     102                    if ( bLinebreak s) { 
123                    // S pecial par agraph tre atment    103                         // Special  paragraph  treatment  
124                     if   (t
i nyMCE .getParam( "paste_cre ate_paragr aphs",   true))   {
  104                         if   (t h i s.editor .getParam( "paste_cre ate_paragr aphs",   true))   {
125                         var   rl   =   t
i nyMCE .getParam( "paste_rep lace_list" ,   '\u2122,<s up>TM</sup >,\u2026,. ..,\u201c| \u201d,",\ u2019,\',\ u2013|\u20 14|\u2015| \u2212,-') .split(',' );
  105                              var   rl   =   t h i s.editor .getParam( "paste_rep lace_list" ,   '\u2122,<s up>TM</sup >,\u2026,. ..,\u201c| \u201d,",\ u2019,\',\ u2013|\u20 14|\u2015| \u2212,-') .split(',' );
126                         for (var i =0; i<rl.l ength; i+= 2)   106                             for (v ar i=0; i< rl.length;  i+=2)
127                             conten t = conten t.replace( new RegExp (rl[i], 'g i'), rl[i+ 1]);   107                                 co ntent = co ntent.repl ace(new Re gExp(rl[i] , 'gi'), r l[i+1]);
128     108  
129                         content   =  
t i n yMCE .re gexpRe place( content,   " \r\n\r\n " ,   " </p><p> ",   "gi" );  
  109                              content   =   con t e n t .re
place( / \r\n\r\n /g ,   ' </p><p> ' );
130                         content   =  
t i n yMCE .re gexpRe place( content,   " \r\r " ,   " </p><p> ",   "gi" );  
  110                              content   =   con t e n t .re
place( / \r\r /g ,   ' </p><p> ' );
131                         content   =  
t i n yMCE .re gexpRe place( content,   " \n\n " ,   " </p><p> ",   "gi" );  
  111                              content   =   con t e n t .re
place( / \n\n /g ,   ' </p><p> ' );
132     112  
133                         // Has par agraphs    113                             // Has  paragraph
134                         if ((pos =  content.i ndexOf('</ p><p>')) ! = -1) {    114                             if ((p os = conte nt.indexOf ('</p><p>' )) != -1) 
135                              t
i nyMCE .execComma nd("Delete ");  
  115                                  t h i s.editor .execComma nd("Delete ");  
136     116  
137                              var   node   =   t
i nyMCE .select edInsta n ce .get F o cusElem e nt ();  
  117                                  var   node   =   t h i s.editor .select io n
.get N o d e
();  
138     118  
139                             // Get  list of e lements to  break    119                                 //  Get list  of element s to break  
140                              var   breakElms   =   new   Array() ;     120                                  var   breakElms   =   [] ;
141     121  
142                             do {    122                                 do  { 
143                                 if  (node.nod eType == 1 ) {    123                                      if (node .nodeType  == 1) { 
144                                      // Don't  break tab les and br eak at bod   124                                          // D on't break  tables an d break at  body 
145                                      if (node .nodeName  == "TD" ||  node.node Name == "B ODY")    125                                          if ( node.nodeN ame == "TD " || node. nodeName = = "BODY") 
146                                          brea k;    126                                               break; 
147              127                
148                                      breakElm s[breakElm s.length]  = node;    128                                          brea kElms[brea kElms.leng th] = node
149                                 }    129                                      } 
150                             } whil e(node = n ode.parent Node);    130                                 }  while(node  = node.pa rentNode);  
151     131  
152                             var be fore = "",  after = " </p>";    132                                 va r before =  "", after  = "</p>";  
153                             before  += conten t.substrin g(0, pos);     133                                 be fore += co ntent.subs tring(0, p os); 
154     134  
155                             for (v ar i=0; i< breakElms. length; i+ +) {    135                                 fo r (var i=0 ; i<breakE lms.length ; i++) { 
156                                 be fore += "< /" + break Elms[i].no deName + " >";    136                                      before + = "</" + b reakElms[i ].nodeName  + ">"; 
157                                 af ter += "<"  + breakEl ms[(breakE lms.length -1)-i].nod eName + "> ";    137                                      after +=  "<" + bre akElms[(br eakElms.le ngth-1)-i] .nodeName  + ">"; 
158                             }    138                                 } 
159     139  
160                             before  += "<p>";     140                                 be fore += "< p>"; 
161                             conten t = before  + content .substring (pos+7) +  after;    141                                 co ntent = be fore + con tent.subst ring(pos+7 ) + after;  
162                           142                             } 
163                    }    143                        
164     144  
165                     if   (t
i nyMCE .getParam( "paste_cre ate_linebr eaks",   true))   {
  145                         if   (t h i s.editor .getParam( "paste_cre ate_linebr eaks",   true))   {
166                         content   =  
t i n yMCE .re gexpRe place( content,   " \r\n " ,   " <br   /> ",   "gi" );  
  146                              content   =   con t e n t .re
place( / \r\n /g ,   ' <br   /> ' );
167                         content   =  
t i n yMCE .re gexpRe place( content,   " \r " ,   " <br   /> ",   "gi" );  
  147                              content   =   con t e n t .re
place( / \r /g ,   ' <br   /> ' );
168                         content   =  
t i n yMCE .re gexpRe place( content,   " \n " ,   " <br   /> ",   "gi" );  
  148                              content   =   con t e n t .re
place( / \n /g ,   ' <br   /> ' );
169                    }   149                         }
170                }    150                    } 
171              151                
172                 t
i nyMCE .execComma nd("mceIns ertRawHTML ",   false,   content);  
  152                     t h i s.editor .execComma nd("mceIns ertRawHTML ",   false,   content);  
173           }   153                }
174       },   154           },
175     155  
176       _inser tWordConte nt : funct ion(conten t) {    156           _i nsertWordC ontent : f unction(co ntent) { 
    157                var t =  this, ed =  t.editor;
    158  
177           if  (content  && content .length >  0) {   159                if (cont ent && con tent.lengt h > 0) {
178                // Clean up Word co ntent   160                    // C leanup Wor d content
179                var bull  = String. fromCharCo de(8226);   161                    var  bull = Str ing.fromCh arCode(822 6);
180                var midd ot = Strin g.fromChar Code(183);   162                    var  middot = S tring.from CharCode(1 83);
181                var cb;    
182     163  
183                 if   ( (cb   =   tinyMCE .getParam( " paste_inse rt_word_co ntent_call back ",   "") )   !=   "" )   164                     if   ( ed .getParam( ' paste_inse rt_word_co ntent_call back ' )
)
184                     content   =   e v al
(
c
b   +   "( 'before',   content) ") ;
  165                         content   =   e d.execC al lback ( 'paste_ins ert_word_c ontent_ c all b ack',   'before',   content)
;
185     166  
186                 var   rl   =   tinyMCE .getParam( "paste_rep lace_list" ,   '\u2122,<s up>TM</sup >,\u2026,. ..,\u201c| \u201d,",\ u2019,\',\ u2013|\u20 14|\u2015| \u2212,-') .split(',' );   167                     var   rl   =   ed .getParam( "paste_rep lace_list" ,   '\u2122,<s up>TM</sup >,\u2026,. ..,\u201c| \u201d,",\ u2019,\',\ u2013|\u20 14|\u2015| \u2212,-') .split(',' );
187                for (var  i=0; i<rl .length; i +=2)   168                    for  (var i=0;  i<rl.lengt h; i+=2)
188                    cont ent = cont ent.replac e(new RegE xp(rl[i],  'gi'), rl[ i+1]);   169                         content =  content.re place(new  RegExp(rl[ i], 'gi'),  rl[i+1]);
189     170  
190                 if   (t
i nyMCE .getParam( "paste_con vert_heade rs_to_stro ng",   false))   {
  171                     if   (t h i s.editor .getParam( "paste_con vert_heade rs_to_stro ng",   false))   {
191                    cont ent = cont ent.replac e(new RegE xp('<p cla ss=MsoHead ing.*?>(.* ?)<\/p>',  'gi'), '<p ><b>$1</b> </p>');   172                         content =  content.re place(new  RegExp('<p  class=Mso Heading.*? >(.*?)<\/p >', 'gi'),  '<p><b>$1 </b></p>') ;
192                }   173                    }
193     174  
194                content  = content. replace(ne w RegExp(' tab-stops:  list [0-9 ]+.0pt">',  'gi'), '" >' + "--li st--");   175                    cont ent = cont ent.replac e(new RegE xp('tab-st ops: list  [0-9]+.0pt ">', 'gi') , '">' + " --list--") ;
195                content  = content. replace(ne w RegExp(b ull + "(.* ?)<BR>", " gi"), "<p> " + middot  + "$1</p> ");   176                    cont ent = cont ent.replac e(new RegE xp(bull +  "(.*?)<BR> ", "gi"),  "<p>" + mi ddot + "$1 </p>");
196                content  = content. replace(ne w RegExp(' <SPAN styl e="mso-lis t: Ignore" >', 'gi'),  "<span>"  + bull); / / Covert t o bull lis t   177                    cont ent = cont ent.replac e(new RegE xp('<SPAN  style="mso -list: Ign ore">', 'g i'), "<spa n>" + bull ); // Cove rt to bull  list
197                content  = content. replace(/< o:p><\/o:p >/gi, "");   178                    cont ent = cont ent.replac e(/<o:p><\ /o:p>/gi,  "");
198                content  = content. replace(ne w RegExp(' <br style= "page-brea k-before:  always;.*> ', 'gi'),  '-- page b reak --');  // Replac e pagebrea ks   179                    cont ent = cont ent.replac e(new RegE xp('<br st yle="page- break-befo re: always ;.*>', 'gi '), '-- pa ge break - -'); // Re place page breaks
199                content  = content. replace(ne w RegExp(' <(!--)([^> ]*)(--)>',  'g'), "") ;  // Word  comments   180                    cont ent = cont ent.replac e(new RegE xp('<(!--) ([^>]*)(-- )>', 'g'),  "");  //  Word comme nts
200     181  
201                 if   (t
i nyMCE .getParam( "paste_rem ove_spans" ,   true))
  182                     if   (t h i s.editor .getParam( "paste_rem ove_spans" ,   true))
202                    cont ent = cont ent.replac e(/<\/?spa n[^>]*>/gi , "");   183                         content =  content.re place(/<\/ ?span[^>]* >/gi, "");
203     184  
204                 if   (t
i nyMCE .getParam( "paste_rem ove_styles ",   true))
  185                     if   (t h i s.editor .getParam( "paste_rem ove_styles ",   true))
205                    cont ent = cont ent.replac e(new RegE xp('<(\\w[ ^>]*) styl e="([^"]*) "([^>]*)',  'gi'), "< $1$3");   186                         content =  content.re place(new  RegExp('<( \\w[^>]*)  style="([^ "]*)"([^>] *)', 'gi') , "<$1$3") ;
206     187  
207                content  = content. replace(/< \/?font[^> ]*>/gi, "" );   188                    cont ent = cont ent.replac e(/<\/?fon t[^>]*>/gi , "");
208     189  
209                // Strip s class at tributes.   190                    // S trips clas s attribut es.
210                 switch   (t
i nyMCE .getParam( "paste_str ip_class_a ttributes" ,   "all"))   {
  191                     switch   (t h i s.editor .getParam( "paste_str ip_class_a ttributes" ,   "all"))   {
211                    case  "all":   192                         case "all" :
212                         content =  content.re place(/<(\ w[^>]*) cl ass=([^ |> ]*)([^>]*) /gi, "<$1$ 3");   193                             conten t = conten t.replace( /<(\w[^>]* ) class=([ ^ |>]*)([^ >]*)/gi, " <$1$3");
213                         break;   194                             break;
214     195  
215                    case  "mso":   196                         case "mso" :
216                         content =  content.re place(new  RegExp('<( \\w[^>]*)  class="?ms o([^ |>]*) ([^>]*)',  'gi'), "<$ 1$3");   197                             conten t = conten t.replace( new RegExp ('<(\\w[^> ]*) class= "?mso([^ | >]*)([^>]* )', 'gi'),  "<$1$3");
217                         break;   198                             break;
218                }   199                    }
219     200  
220                 content   =   content.re place(new   RegExp('hr ef="?'   +   TinyMCE_Pa s t ePlug i n ._reEscape (""   +   document.l ocation)   +   '',   'gi'),   'href="'   +   t
i nyMCE. s
e tt i ngs[' document _b ase _url'] );
  201                     content   =   content.re place(new   RegExp('hr ef="?'   +  
t h i s ._reEscape (""   +   document.l ocation)   +   '',   'gi'),   'href="'   +   t h i
s . e d i tor. document B ase URI.getURI () );
221                content  = content. replace(/< (\w[^>]*)  lang=([^ | >]*)([^>]* )/gi, "<$1 $3");   202                    cont ent = cont ent.replac e(/<(\w[^> ]*) lang=( [^ |>]*)([ ^>]*)/gi,  "<$1$3");
222                content  = content. replace(/< \\?\?xml[^ >]*>/gi, " ");   203                    cont ent = cont ent.replac e(/<\\?\?x ml[^>]*>/g i, "");
223                content  = content. replace(/< \/?\w+:[^> ]*>/gi, "" );   204                    cont ent = cont ent.replac e(/<\/?\w+ :[^>]*>/gi , "");
224                content  = content. replace(/- - page bre ak --\s*<p >&nbsp;<\/ p>/gi, "") ; // Remov e pagebrea ks   205                    cont ent = cont ent.replac e(/-- page  break --\ s*<p>&nbsp ;<\/p>/gi,  ""); // R emove page breaks
225                content  = content. replace(/- - page bre ak --/gi,  ""); // Re move pageb reaks   206                    cont ent = cont ent.replac e(/-- page  break --/ gi, ""); / / Remove p agebreaks
226     207  
227       //       content  = content. replace(/\ /?&nbsp;*/ gi, ""); & nbsp;   208           //       cont ent = cont ent.replac e(/\/?&nbs p;*/gi, "" ); &nbsp;
228       //       content  = content. replace(/< p>&nbsp;<\ /p>/gi, '' );   209           //       cont ent = cont ent.replac e(/<p>&nbs p;<\/p>/gi , '');
229     210  
230                 if   (!t
i nyMCE. s
e tt i n g s[ 'force_p_n ewlines' ] )   {
  211                     if   (!t h i
s . e d i tor. g etParam( 'force_p_n ewlines' ) )   {
231                    cont ent = cont ent.replac e('', '' , 'gi');   212                         content =  content.re place('',  '' ,'gi');
232                    cont ent = cont ent.replac e('</p>',  '<br /><br  />' ,'gi' );   213                         content =  content.re place('</p >', '<br / ><br />' , 'gi');
233                }   214                    }
234     215  
235                 if   (!tiny MCE .is MS IE   &&   !t
i nyMCE. s
e tt i n g s[ 'force_p_n ewlines' ] )   {
  216                     if   (!tiny mce .is
IE   &&   !t h i
s . e d i tor. g etParam( 'force_p_n ewlines' ) )   {
236                    cont ent = cont ent.replac e(/<\/?p[^ >]*>/gi, " ");   217                         content =  content.re place(/<\/ ?p[^>]*>/g i, "");
237                }   218                    }
238     219  
239                content  = content. replace(/< \/?div[^>] *>/gi, "") ;   220                    cont ent = cont ent.replac e(/<\/?div [^>]*>/gi,  "");
240     221  
241                // Conve rt all mid dlot lists  to UL lis ts   222                    // C onvert all  middlot l ists to UL  lists
242                 if   (t
i nyMCE .getParam( "paste_con vert_middo t_lists",   true))   {
  223                     if   (t h i s.editor .getParam( "paste_con vert_middo t_lists",   true))   {
243                     var   div   =  
do cu m ent .create Element ("div"
);
  224                         var   div   =   ed. do
m
.create
("div" ,   null,   content );
244                    div. innerHTML  = content;    
245     225  
246                    // C onvert all  middot pa ragraphs t o li eleme nts   226                         // Convert  all middo t paragrap hs to li e lements
247                     var   className   =   t
i nyMCE .getParam( "paste_uni ndented_li st_class",   "unIndente dList");
  227                         var   className   =   t h i s.editor .getParam( "paste_uni ndented_li st_class",   "unIndente dList");
248     228  
249                     while   ( TinyMCE_Pa s t ePlug i n ._convertM iddots(div ,   "--list--" ))   ;   //   bull   229                         while   (
t h i s ._convertM iddots(div ,   "--list--" ))   ;   //   bull
250                     while   ( TinyMCE_Pa s t ePlug i n ._convertM iddots(div ,   middot,   className) )   ;   //   Middot   230                         while   (
t h i s ._convertM iddots(div ,   middot,   className) )   ;   //   Middot
251                     while   ( TinyMCE_Pa s t ePlug i n ._convertM iddots(div ,   bull))   ;   //   bull   231                         while   (
t h i s ._convertM iddots(div ,   bull))   ;   //   bull
252     232  
253                    cont ent = div. innerHTML;   233                         content =  div.innerH TML;
254                }   234                    }
255     235  
256                // Repla ce all hea ders with  strong and  fix some  other issu es   236                    // R eplace all  headers w ith strong  and fix s ome other  issues
257                 if   (t
i nyMCE .getParam( "paste_con vert_heade rs_to_stro ng",   false))   {
  237                     if   (t h i s.editor .getParam( "paste_con vert_heade rs_to_stro ng",   false))   {
258                    cont ent = cont ent.replac e(/<h[1-6] >&nbsp;<\/ h[1-6]>/gi , '<p>&nbs p;&nbsp;</ p>');   238                         content =  content.re place(/<h[ 1-6]>&nbsp ;<\/h[1-6] >/gi, '<p> &nbsp;&nbs p;</p>');
259                    cont ent = cont ent.replac e(/<h[1-6] >/gi, '<p> <b>');   239                         content =  content.re place(/<h[ 1-6]>/gi,  '<p><b>');
260                    cont ent = cont ent.replac e(/<\/h[1- 6]>/gi, '< /b></p>');   240                         content =  content.re place(/<\/ h[1-6]>/gi , '</b></p >');
261                    cont ent = cont ent.replac e(/<b>&nbs p;<\/b>/gi , '<b>&nbs p;&nbsp;</ b>');   241                         content =  content.re place(/<b> &nbsp;<\/b >/gi, '<b> &nbsp;&nbs p;</b>');
262                    cont ent = cont ent.replac e(/^(&nbsp ;)*/gi, '' );   242                         content =  content.re place(/^(& nbsp;)*/gi , '');
263                }   243                    }
264     244  
265                content  = content. replace(/- -list--/gi , ""); //  Remove --l ist--   245                    cont ent = cont ent.replac e(/--list- -/gi, "");  // Remove  --list--
266     246  
267                 if   ( (cb   =   tinyMCE .getParam( " paste_inse rt_word_co ntent_call back ",   "") )   !=   "" )   247                     if   ( ed .getParam( ' paste_inse rt_word_co ntent_call back ' )
)
268                     content   =   e v al
(
c
b   +   "( 'after',   content) ") ;
  248                         content   =   e d.execC al lback ( 'paste_ins ert_word_c ontent_ c all b ack',   'after',   content)
;
269     249  
270                // Inser t cleaned  content   250                    // I nsert clea ned conten t
271                 t
i nyMCE .execComma nd("mceIns ertContent ",   false,   content);
  251                     t h i s.editor .execComma nd("mceIns ertContent ",   false,   content);
    252  
    253                    if ( this.edito r.getParam ('paste_fo rce_cleanu p_wordpast e', true))  {
    254                         var ed = t his.editor ;
272     255  
273                if (tiny MCE.getPar am('paste_ force_clea nup_wordpa ste', true ))   256                         window.set Timeout(fu nction() {
274                     window.set Timeout('t inyMCE.exe cCommand(" mceCleanup ");' ,   1);   //   Do   normal   cleanup   detached   from   this   thread   257                             ed.exe cCommand(" mceCleanup ");
    258                         } ,   1);   //   Do   normal   cleanup   detached   from   this   thread
    259                    }
275           }   260                }
276       },   261           },
277     262  
278       _reEsc ape : func tion(s) {   263           _r eEscape :  function(s ) {
279           va r l = "?.\ \*[](){}+^ $:";   264                var l =  "?.\\*[]() {}+^$:";
280           va r o = "";   265                var o =  "";
281     266  
282           fo r (var i=0 ; i<s.leng th; i++) {   267                for (var  i=0; i<s. length; i+ +) {
283                var c =  s.charAt(i );   268                    var  c = s.char At(i);
284     269  
285                if (l.in dexOf(c) ! = -1)   270                    if ( l.indexOf( c) != -1)
286                    o +=  '\\' + c;   271                         o += '\\'  + c;
287                else   272                    else
288                    o +=  c;   273                         o += c;
289           }   274                }
290     275  
291           re turn o;   276                return o ;
292       },   277           },
293     278  
294       _conve rtMiddots  : function (div, sear ch, class_ name) {   279           _c onvertMidd ots : func tion(div,  search, cl ass_name)  {
295            var  
mdot   =   String.fro mCharCode( 183)
;
  280                 var   ed   =   this.edito r,   mdot   =   String.fro mCharCode( 183) ,   bull   =   String.fro mCharCode( 8226) ;
296           va r bull = S tring.from CharCode(8 226);   281                var node s, prevul,  i, p, ul,  li, np, c p, li;
297     282  
298            var   nodes   =   div.getEle mentsByTag Name("p");   283                
nodes   =   div.getEle mentsByTag Name("p");
299           va r prevul;   284                 for   (
i=0;   i<nodes.le ngth;   i++)   {
300            for   ( var   i=0;   i<nodes.le ngth;   i++)   {   285                    
p   =   nodes[i];
301                 var   p   =   nodes[i];    
302     286  
303                // Is mi ddot   287                    // I s middot
304                if (p.in nerHTML.in dexOf(sear ch) == 0)  {   288                    if ( p.innerHTM L.indexOf( search) ==  0) {
305                     var   ul   =  
do cu m ent .create Element ("ul");
  289                        
ul   =   ed. do
m
.create
("ul");
306     290  
307                    if ( class_name )   291                         if (class_ name)
308                         ul.classNa me = class _name;   292                             ul.cla ssName = c lass_name;
309     293  
310                    // A dd the fir st one   294                         // Add the  first one
311                     var   li   =  
do cu m ent .create Element ("li");
  295                        
li   =   ed. do
m
.create
("li");
312                    li.i nnerHTML =  p.innerHT ML.replace (new RegEx p('' + mdo t + '|' +  bull + '|- -list--|&n bsp;', "gi "), '');   296                         li.innerHT ML = p.inn erHTML.rep lace(new R egExp('' +  mdot + '| ' + bull +  '|--list- -|&nbsp;',  "gi"), '' );
313                    ul.a ppendChild (li);   297                         ul.appendC hild(li);
314     298  
315                    // A dd the res t   299                         // Add the  rest
316                     var   np   =   p.nextSibl ing;   300                        
np   =   p.nextSibl ing;
317                    whil e (np) {   301                         while (np)  {
318                         // If the  node is wh itespace,  then   302                             // If  the node i s whitespa ce, then
319                         // ignore  it and con tinue on.   303                             // ign ore it and  continue  on.
320                         if (np.nod eType == 3  && new Re gExp('^\\s $', 'm').t est(np.nod eValue)) {   304                             if (np .nodeType  == 3 && ne w RegExp(' ^\\s$', 'm ').test(np .nodeValue )) {
321                                 np  = np.next Sibling;   305                                      np = np. nextSiblin g;
322                                 co ntinue;   306                                      continue ;
323                         }   307                             }
324     308  
325                         if (search  == mdot)  {   309                             if (se arch == md ot) {
326                                 if  (np.nodeT ype == 1 & & new RegE xp('^o(\\s +|&nbsp;)' ).test(np. innerHTML) ) {   310                                      if (np.n odeType ==  1 && new  RegExp('^o (\\s+|&nbs p;)').test (np.innerH TML)) {
327                                          // S econd leve l of nesti ng   311                                               // Second  level of n esting
328                                          if ( !prevul) {   312                                               if (!prevu l) {
329                                                   prevul  = ul;   313                                                       pr evul = ul;
330                                                    ul   =  
do cu m ent .create Element ("ul");
  314                                                        ul   =   ed. do
m
.create
("ul");
331                                                   prevul .appendChi ld(ul);   315                                                       pr evul.appen dChild(ul) ;
332                                          }   316                                               }
333                                          np.i nnerHTML =  np.innerH TML.replac e(/^o/, '' );   317                                               np.innerHT ML = np.in nerHTML.re place(/^o/ , '');
334                                 }  else {   318                                      } else {
335                                          // P op the sta ck if we'r e going ba ck up to t he first l evel   319                                               // Pop the  stack if  we're goin g back up  to the fir st level
336                                          if ( prevul) {   320                                               if (prevul ) {
337                                                   ul = p revul;   321                                                       ul  = prevul;
338                                                   prevul  = null;   322                                                       pr evul = nul l;
339                                          }   323                                               }
340                                          // N ot element  or middot  paragraph   324                                               // Not ele ment or mi ddot parag raph
341                                          if ( np.nodeTyp e != 1 ||  np.innerHT ML.indexOf (search) ! = 0)   325                                               if (np.nod eType != 1  || np.inn erHTML.ind exOf(searc h) != 0)
342                                                   break;   326                                                       br eak;
343                                 }   327                                      }
344                         } else {   328                             } else  {
345                                 //  Not eleme nt or midd ot paragra ph   329                                      // Not e lement or  middot par agraph
346                                 if  (np.nodeT ype != 1 | | np.inner HTML.index Of(search)  != 0)   330                                      if (np.n odeType !=  1 || np.i nnerHTML.i ndexOf(sea rch) != 0)
347                                          brea k;   331                                               break;
348                             }   332                                 }
349     333  
350                         var   cp   =   np.nextSib ling;   334                             
cp   =   np.nextSib ling;
351                         var   li   =  
do cu m ent .create Element ("li");
  335                             
li   =   ed. do
m
.create
("li");
352                         li.innerHT ML = np.in nerHTML.re place(new  RegExp(''  + mdot + ' |' + bull  + '|--list --|&nbsp;' , "gi"), ' ');   336                             li.inn erHTML = n p.innerHTM L.replace( new RegExp ('' + mdot  + '|' + b ull + '|-- list--|&nb sp;', "gi" ), '');
353                         np.parentN ode.remove Child(np);   337                             np.par entNode.re moveChild( np);
354                         ul.appendC hild(li);   338                             ul.app endChild(l i);
355                         np = cp;   339                             np = c p;
356                    }   340                         }
357     341  
358                    p.pa rentNode.r eplaceChil d(ul, p);   342                         p.parentNo de.replace Child(ul,  p);
359     343  
360                    retu rn true;   344                         return tru e;
361                }   345                    }
362           }   346                }
363     347  
364           re turn false ;   348                return f alse;
365       },   349           },
366     350  
367       _clipb oardHTML :  function( ) {   351           _c lipboardHT ML : funct ion() {
368           va r div = do cument.get ElementByI d('_TinyMC E_clipboar dHTML');   352                var div  = document .getElemen tById('_Ti nyMCE_clip boardHTML' );
369     353  
370           if  (!div) {   354                if (!div ) {
371                var div  = document .createEle ment('DIV' );   355                    var  div = docu ment.creat eElement(' DIV');
372                div.id =  '_TinyMCE _clipboard HTML';   356                    div. id = '_Tin yMCE_clipb oardHTML';
373     357  
374                with (di v.style) {   358                    with  (div.styl e) {
375                    visi bility = ' hidden';   359                         visibility  = 'hidden ';
376                    over flow = 'hi dden';   360                         overflow =  'hidden';
377                    posi tion = 'ab solute';   361                         position =  'absolute ';
378                    widt h = 1;   362                         width = 1;
379                    heig ht = 1;   363                         height = 1 ;
380                }   364                    }
381     365  
382                document .body.appe ndChild(di v);   366                    docu ment.body. appendChil d(div);
383           }   367                }
384     368  
385           di v.innerHTM L = '';   369                div.inne rHTML = '' ;
386           va r rng = do cument.bod y.createTe xtRange();   370                var rng  = document .body.crea teTextRang e();
387           rn g.moveToEl ementText( div);   371                rng.move ToElementT ext(div);
388           rn g.execComm and('Paste ');   372                rng.exec Command('P aste');
389           va r html = d iv.innerHT ML;   373                var html  = div.inn erHTML;
390           di v.innerHTM L = '';   374                div.inne rHTML = '' ;
391           re turn html;   375                return h tml;
392       }   376           }
393   }
;
  377        } ) ;
394     378  
395   tiny MCE . add Plugin
( " paste " ,   T iny MCE_ PastePlugi n);
  379       // Reg ister plug in
    380        tiny mce .
Plugin Manager.ad d ( ' paste ' ,   t iny mce.plugin s. PastePlugi n);
    381   })();