Forum closed. New forum available at http://community.wymeditor.org/

wym optimization

Discuss features, code, contributions, ideas, suggestions, ...
For bugs, patches and feature requests, please post on the Trac:
http://trac.wymeditor.org/

wym optimization

Postby djko on Wed Feb 21, 2007 10:35 pm

i think it is possible to optimize wym. At now it is imossible to edit large texts becouse of code like this:
Code: Select all
   if(evt.keyCode==13 && !evt.shiftKey) //RETURN key
   {
      //cleanup <br><br> between paragraphs
      nodes=editor().childNodes;
      for(var x=0;x<nodes.length;x++)
      {
         if(nodes.item(x).nodeName.toLowerCase()=="br") editor().removeChild(nodes.item(x));
      }
   }


this works pretty well, but browser do not check all nodes.
Code: Select all
   if(evt.keyCode==13 && !evt.shiftKey) //RETURN key
   {
      //cleanup <br><br> between paragraphs
      nodes=editor().childNodes;
ifbr=getSelectedContainer().previousSibling.previousSibling;
if(ifbr.nodeName.toLowerCase()=="br") editor.removeChild(ifbr);
}


also the function getCleanHTML(), it counts every char in edited text!!!..., it can be done in other way, using getSelectedContainer().innerHTML(getSelectedContainer().innerHTML=getCleanHTML(getSelectedContainer().innerHTML)), i.e. lets suppose that all changes were made in current container. Of course there are problem after pasting text, i think that only way to solve it is using str.replace method, but this is not DOM ideology:(

hope this will help to make wym better:)
djko
 
Posts: 1
Joined: Wed Feb 21, 2007 3:01 pm

Postby jfh on Mon Mar 19, 2007 11:33 am

Hi djko,

Thanks for your suggestions.
We're currently implementing a Selection API which will help us to catch events and better control the generated code.

We'll then see if we still need this kind of cleanup routines.
We keep your ideas in mind.

Cheers,
User avatar
jfh
Site Admin
 
Posts: 370
Joined: Sat Sep 23, 2006 8:43 pm
Location: Belgium


Return to Developers

Who is online

Users browsing this forum: No registered users and 2 guests