rem: replaceString += " <td>";  var pattern = new RegExp("\\" + sepCharacter, "g");  str = str.replace(pattern, replaceString); 
add: replaceString += "<td>";  if (sepCharacter.length > 0) { var pattern = new RegExp("\\" + sepCharacter, "g"); str = str.replace(pattern, replaceString); }   searchStart = 0; var stackIndex = 0; do { start = str.indexOf("<", searchStart); end = start + 1; if (start >= 0 && str.charAt(end) == ">") {  str = str.slice(0, end) + stack[stackIndex++] + str.slice(end); } searchStart = end;  } while (start >= 0); 
context: function onOK(){  // 1 = OutputSelectionOnly, 1024 = OutputLFLineBreak  // 256 = OutputEncodeEntities  var str = editorShell.GetContentsAs("text/html", 1+1024);  // Replace nbsp with spaces:  str = str.replace(/\u00a0/g, " ");  // Trim trailing <p> or <br>  str = str.replace(/\s*<br>\s*$/, "");  str = str.replace(/\s*<p>\s*$/, "");  // Trim leading and trailing spaces  str = str.replace(/^\s+/, "");  str = str.replace(/\s+$/, "");  // Trim whitespace adjacent to <p> and <br> tags  str = str.replace(/\s+<p>\s+/g, "<br>");  str = str.replace(/\s+<br>\s+/g, "<br>");  var sepCharacter = "";  switch ( gIndex )  {    case gCommaIndex:      sepCharacter = ",";      break;    case gSpaceIndex:      sepCharacter = " ";      break;    case gOtherIndex:      sepCharacter = dialog.sepCharacterInput.value.slice(0,1);      break;  }  if (sepCharacter.length == 0)  {    ShowInputErrorMessage(editorShell.GetString("NoSeparatorCharacter"));    SetTextboxFocus(dialog.sepCharacterInput);    return false;  }  // Replace separator characters with table cells  var replaceString;  if (dialog.deleteSepCharacter.checked)  {    replaceString = "";    // Replace one or more adjacent spaces    if (sepCharacter == " ")      sepCharacter += "+";   }    else  {    // Don't delete separator character,    //  so include it at start of string to replace    replaceString = sepCharacter;  }  replaceString += " <td>";   var pattern = new RegExp("\\" + sepCharacter, "g");  //pattern.global = true;  str = str.replace(pattern, replaceString);  // End table row and start another for each br or p  str = str.replace(/\s*<br>\s*/g, "</tr>\n<tr><td>");  // Add the table tags and the opening and closing tr/td tags  str = "<table border=\"1\">\n<tr><td>" + str + "</tr>\n</table>\n";  editorShell.BeginBatchChanges();  editorShell.InsertSource(str);    // Get the table just inserted  var selection = editorShell.editorSelection;  editorShell.NormalizeTable(null);  editorShell.EndBatchChanges();  // Save persisted attributes  dialog.sepRadioGroup.setAttribute("index", gIndex);  if (gIndex == gOtherIndex)    dialog.sepRadioGroup.setAttribute("character", sepCharacter);  SaveWindowLocation();  return true;}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/49ed470966bccd670c5d9e9ba48ea7cea3573666/EdConvertToTable.js/clean/editor/ui/dialogs/content/EdConvertToTable.js