Merge pull request #1709 from ether/keep-list-order-on-paste

When you paste into a numbered list, keep some integrity
This commit is contained in:
John McLear 2013-04-11 09:07:22 -07:00
commit f9d23767f8
2 changed files with 79 additions and 21 deletions

View file

@ -104,7 +104,6 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
if (listType)
{
listType = listType[1];
start = start?'start="'+Security.escapeHTMLAttribute(start[1])+'"':'';
if (listType)
{
if(listType.indexOf("number") < 0)
@ -114,7 +113,14 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
}
else
{
preHtml = '<ol '+start+' class="list-' + Security.escapeHTMLAttribute(listType) + '"><li>';
if(start){ // is it a start of a list with more than one item in?
if(start[1] == 1){ // if its the first one at this level?
lineClass = lineClass + " " + "list-start-" + listType; // Add start class to DIV node
}
preHtml = '<ol start='+start[1]+' class="list-' + Security.escapeHTMLAttribute(listType) + '"><li>';
}else{
preHtml = '<ol class="list-' + Security.escapeHTMLAttribute(listType) + '"><li>'; // Handles pasted contents into existing lists
}
postHtml = '</li></ol>';
}
}