Opened 14 years ago

Last modified 10 years ago

#7927 closed Bug

bbcode and js event problem — at Version 1

Reported by: zleaf Owned by:
Priority: Normal Milestone:
Component: General Version: 3.6
Keywords: Cc:

Description (last modified by Jakub Ś)

for example: after paste a image in ckeditor in bbcode mode, (the image is like :

<img src="http://cksource.com/forums/images/smilies/icon_e_biggrin.gif" onclick="alert('abc')">

), then click the View Source button, error occur...

here's my way to fix this problem, hoping the official way

      function purge(d){
         var a=d.attributes,i,l,n;
         if(a){
            l=a.length;
            for(i=0;i<l;i+=1){
               n=a[i].name;
               if(typeof d[n]==='function'){
                  d[n]=null;
               }
            }
         }
         a=d.childNodes;
         if(a){
            l=a.length;
            for(i=0;i<l;i+=1){
               purge(d.childNodes[i]);
            }
         }
      }
      editor.on( 'insertHtml', function(data){
         var t=document.createElement('div');
         document.body.appendChild(t);
         t.innerHTML = data.data;
         purge(t);
         data.data = t.innerHTML;
         document.body.removeChild(t);
      });

Change History (1)

comment:1 Changed 14 years ago by Jakub Ś

Description: modified (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy