Problem with Indenting and lists:Text pasted from Word document

Last post 07-21-2010, 3:29 PM by mreric. 12 replies.
Sort Posts: Previous Next
  •  04-18-2005, 11:37 AM 5824

    Problem with Indenting and lists:Text pasted from Word document

    I am having a problem with Indenting and Lists.

    I can not get the selected text to indent by itself.  If I select text, and hit the indent or list (ordered or unordered) button(s), the entire section indents, not just the selection (a line).

    The Image below shows the text I had before indenting.
     
    After indenting:
     
     
     
    Also, I have another problem:
     
    Cute Editor doesn't always prompt  for cleaning the code when pasting from Word. It works in my local m/c but diesn't work on our qa m/c. both have the same properties set.
     
    Please advice.
  •  04-18-2005, 11:53 AM 5825 in reply to 5824

    Re: Problem with Indenting and lists:Text pasted from Word document

    I have noticed the same problem. It's forcing the insert of a paragraph to seperate the sections. I believe that should happen when you double space, am I right?
  •  04-18-2005, 12:17 PM 5826 in reply to 5825

    Re: Problem with Indenting and lists:Text pasted from Word document

    It may be text separated by <br>.

    Please test it:

    http://cutesoft.net/example/oncarriagereturn.aspx
     
    This is not a Cute Editor issue. I'll explain it this afternoon.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-18-2005, 12:23 PM 5827 in reply to 5824

    Re: Problem with Indenting and lists:Text pasted from Word document

     praveen wrote:
     
    Cute Editor doesn't always prompt  for cleaning the code when pasting from Word. It works in my local m/c but diesn't work on our qa m/c. both have the same properties set.
     
    Please advice.
     

    When you copy from the word, if html content in clipboard is quite messy, Cute Editor will promt for cleaning the code.
     
    If the HTML content is normal, Cute Editor will paste the code directly into the editing area.

     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-18-2005, 5:23 PM 5843 in reply to 5825

    Re: Problem with Indenting and lists:Text pasted from Word document

    Even if you type some really lenghty text and hit Enter at intervals and make it look like a paragraph.Put cursor at the beginning of the second line and press Insert Unordered List button. The First two lines will be indented where it was suppose to indent only the second line.
     
    Sample Text: Paste this sample text in word doc and paste it and try indenting. 

    This department’s business continuity plan is organized into 2 major areas:
    • The first section of this document contains information about the plan and its major components.
       
    • The Appendix section of the plan supports the major components of the plan and is the staging area for all “detailed” information that will be used by the various teams when utilizing this plan in a disaster situation

    It's really messy..any clue on this behavior?

  •  04-18-2005, 6:32 PM 5852 in reply to 5843

    Re: Problem with Indenting and lists:Text pasted from Word document

    I think I get it. I have the seperator set in the webconfig for <br>. If I use <div> or <p> it will work better for lists.
     
    Whats the best in your opinion?
  •  04-19-2005, 11:59 AM 5901 in reply to 5852

    Re: Problem with Indenting and lists:Text pasted from Word document

    Which web.config? Can you please give me the location of the config file to set the separator? I still have the same problem..is there any soltuion for it?

  •  04-19-2005, 12:15 PM 5902 in reply to 5901

    Re: Problem with Indenting and lists:Text pasted from Word document

    praveen,

    jhoelz uses the DNN3. He set the editor properties through DotNetNuke web.config.





    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-19-2005, 4:06 PM 5924 in reply to 5902

    Re: Problem with Indenting and lists:Text pasted from Word document

    oops! I still didn't get the solution for my question.
    Adam how to solve this issue? We are having lot of problems with this formatting issues of the text pasted from word documents.Please advice asap.
  •  04-19-2005, 5:30 PM 5927 in reply to 5924

    Re: Problem with Indenting and lists:Text pasted from Word document

    This is not an online Eidtor issue. It's about HTML List Rules.
     

    First let's make a test.

     

    Type the following HTML code into your FrontPage:

     

    test<br/>

    test<br/>

    test<br/>

    test<br/>

    test<br/>

    test<br/>

    test<br/>

     

    Select the first line and click the order list.

     

    You will find out FrontPage has the same behavior as Cute Editor.

     

    The <br> tag is a special HTML element, not a Block-level element like <div>, <p>

     

    Like other editors, Cute Editor implements the IE MSHTML Editing Platform.

     

    One of the general rules for what happens when you click on a list toolbar button:

    For selected paragraphs that are not list items, make each paragraph a list item.

     

    It's a bit tricky when intervening <br> element. The users may want the editor automatically remove <br> elements; And also want the editor add a list item between each <br>...

     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-20-2005, 10:41 AM 5955 in reply to 5927

    Re: Problem with Indenting and lists:Text pasted from Word document

    Thanks Adam.
     
    But I am just curious whether CuteEditor is going to take care of this issue?
  •  07-20-2010, 6:20 PM 62640 in reply to 5955

    Re: Problem with Indenting and lists:Text pasted from Word document

    This is still an issue and I really needed this so I wrote something that overwrites the list commands.  Works pretty well i think although i'm sure i can improve on it since its a little bit of a hack. :)
     
    So .. we all know for most users, BR is going to be the preferred break element as it's a lot more intuitive for users that don't know HTML standards .. and I DO think it should be implemented or at least an option do have this behavior.  Let me know if this ever does :)  With that said, you can use this .. works ok for me.
     
    ------------------------------
    function CuteEditor_OnCommand(editor,command,ui,value)   
     {   
        if (command=="InsertUnorderedList"){
            
            var selectedText = getSelectedHTML(editor);
            
            if (selectedText!=""){        
                editor.PasteHTML("<ul><li>"+selectedText+"</li></ul>");        
            } else{
            
                //create some temp text
                var tempTEXT="‰";
                
                //lets insert some temp text where our cursor is
                editor.PasteHTML(tempTEXT);
                
                //put our new html into a var and define some other vars
                var editorText=editor.getHTML();
                var editorTextToBR="";
                var startOfText="";
                var endOfText="";
                
                //get the index of the pasted text and use that to where we are entering the bullet
                var cursorPos=editorText.indexOf(tempTEXT, 0);
                
                //Lets find the index of the next breaking character BR/P/DIV in that order
                var nextBRPos=getNextBRPos(editorText,cursorPos);

                //lets define the start of the text, start of the text to the temp char
                startOfText=editorText.substring(0,cursorPos);
                
                //lets define whats going onto the bullet            
                editorTextToBR=editorText.substring(cursorPos,nextBRPos).replace(tempTEXT,"");
                
                //lets define the rest of the document text starting from after the bullet text                      
                endOfText=editorText.substring(nextBRPos,editorText.length);
                
                //lets now put all 3 components together and set our text
                editor.setHTML(startOfText+"<ul><li>"+editorTextToBR+"</li></ul>"+endOfText);
          }        
          return true;
       } else if (command=="InsertOrderedList"){
            
            var selectedText = getSelectedHTML(editor);
            
            if (selectedText!=""){        
                editor.PasteHTML("<ol><li>"+selectedText+"</li></ol>");        
            } else{
            
                //create some temp text
                var tempTEXT="‰";
                
                //lets insert some temp text where our cursor is
                editor.PasteHTML(tempTEXT);
                
                //put our new html into a var and define some other vars
                var editorText=editor.getHTML();
                var editorTextToBR="";
                var startOfText="";
                var endOfText="";
                
                //get the index of the pasted text and use that to where we are entering the bullet
                var cursorPos=editorText.indexOf(tempTEXT, 0);
                
                //Lets find the index of the next breaking character BR/P/DIV in that order
                var nextBRPos=getNextBRPos(editorText,cursorPos);

                //lets define the start of the text, start of the text to the temp char
                startOfText=editorText.substring(0,cursorPos);
                
                //lets define whats going onto the bullet            
                editorTextToBR=editorText.substring(cursorPos,nextBRPos).replace(tempTEXT,"");
                
                //lets define the rest of the document text starting from after the bullet text                      
                endOfText=editorText.substring(nextBRPos,editorText.length);
                
                //lets now put all 3 components together and set our text
                editor.setHTML(startOfText+"<ol><li>"+editorTextToBR+"</li></ol>"+endOfText);
          }        
          return true;
       }
    }

    function getNextBRPos(myText,startingAtPos){
        
        //lets find the index of the next paragraph
        //break whatever it is
        //and return it's position
        var posBR = myText.indexOf("<br />", startingAtPos);    //get the index of the next BR
        var posP = myText.indexOf("</p>", startingAtPos);       //get the index of the next P
        var posDIV = myText.indexOf("</div>", startingAtPos);   //get the index of the next DIV
        
        if (posBR>0){return posBR;}
        else if(posP>0){return posP;}
        else if(posDIV>0){return posDIV;}
        else{return myText.length;}
    }
     ------------------------------
     
    Cheers
  •  07-21-2010, 3:29 PM 62660 in reply to 62640

    Re: Problem with Indenting and lists:Text pasted from Word document

    Made it better :)  You can now highlight and each line ending with a BR will get bulleted.
     
    function CuteEditor_OnCommand(editor,command,ui,value)   
     {   
        if (command=="InsertUnorderedList"){
            
            var selectedText = getSelectedHTML(editor);
            
            if (selectedText!=""){
                  
                //Lets create a regEx to find all BR tags
                var myRegEx = new RegExp("<[Bb][Rr][^>]*>");
                
                //Split all rows into an array
                var splitString=selectedText.split(myRegEx);
                var newString="";
                var x;
                
                //Lets create the Bullet list
                newString="<ul>";
                for (x in splitString){newString+="<li>"+splitString[x]+"</li>";}
                newString+="</ul>";
                
                //Lets paste er back
                editor.PasteHTML(newString);
                     
            } else{
            
                //create some temp text
                var tempTEXT="‰";
                
                //lets insert some temp text where our cursor is
                editor.PasteHTML(tempTEXT);
                
                //put our new html into a var and define some other vars
                var editorText=editor.getHTML();
                var editorTextToBR="";
                var startOfText="";
                var endOfText="";
                
                //get the index of the pasted text and use that to where we are entering the bullet
                var cursorPos=editorText.indexOf(tempTEXT, 0);
                
                //Lets find the index of the next breaking character BR/P/DIV in that order
                var nextBRPos=getNextBRPos(editorText,cursorPos);

                //lets define the start of the text, start of the text to the temp char
                startOfText=editorText.substring(0,cursorPos);
                
                //lets define whats going onto the bullet            
                editorTextToBR=editorText.substring(cursorPos,nextBRPos).replace(tempTEXT,"");
                
                //lets define the rest of the document text starting from after the bullet text                      
                endOfText=editorText.substring(nextBRPos,editorText.length);
                
                //lets now put all 3 components together and set our text
                editor.setHTML(startOfText+"<ul><li>"+editorTextToBR+"</li></ul>"+endOfText);
     
          }        
          return true;
       } else if (command=="InsertOrderedList"){
            
            var selectedText = getSelectedHTML(editor);
            
            if (selectedText!=""){
                    
                //Lets create a regEx to find all BR tags
                var myRegEx = new RegExp("<[Bb][Rr][^>]*>");
                
                //Split all rows into an array
                var splitString=selectedText.split(myRegEx);
                var newString="";
                var x;
                
                //Lets create the Bullet list
                newString="<ol>";
                for (x in splitString){newString+="<li>"+splitString[x]+"</li>";}
                newString+="</ol>";
                
                //Lets paste er back
                editor.PasteHTML(newString);
                        
            } else{
            
                //create some temp text
                var tempTEXT="‰";
                
                //lets insert some temp text where our cursor is
                editor.PasteHTML(tempTEXT);
                
                //put our new html into a var and define some other vars
                var editorText=editor.getHTML();
                var editorTextToBR="";
                var startOfText="";
                var endOfText="";
                
                //get the index of the pasted text and use that to where we are entering the bullet
                var cursorPos=editorText.indexOf(tempTEXT, 0);
                
                //Lets find the index of the next breaking character BR/P/DIV in that order
                var nextBRPos=getNextBRPos(editorText,cursorPos);

                //lets define the start of the text, start of the text to the temp char
                startOfText=editorText.substring(0,cursorPos);
                
                //lets define whats going onto the bullet            
                editorTextToBR=editorText.substring(cursorPos,nextBRPos).replace(tempTEXT,"");
                
                //lets define the rest of the document text starting from after the bullet text                      
                endOfText=editorText.substring(nextBRPos,editorText.length);
                
                //lets now put all 3 components together and set our text
                editor.setHTML(startOfText+"<ol><li>"+editorTextToBR+"</li></ol>"+endOfText);           

          }        
          return true;
       }
    }

    function getNextBRPos(myText,startingAtPos){
        
        //lets find the index of the next paragraph
        //break whatever it is
        //and return it's position
        var posBR = myText.indexOf("<br />", startingAtPos);    //get the index of the next BR
        var posP = myText.indexOf("</p>", startingAtPos);       //get the index of the next P
        var posDIV = myText.indexOf("</div>", startingAtPos);   //get the index of the next DIV
        
        if (posBR>0){return posBR;}
        else if(posP>0){return posP;}
        else if(posDIV>0){return posDIV;}
        else{return myText.length;}
    }
View as RSS news feed in XML