diff --git a/mozilla/editor/ui/dialogs/content/EdConvertToTable.js b/mozilla/editor/ui/dialogs/content/EdConvertToTable.js
index 9d40a9ead19..c415411c82b 100644
--- a/mozilla/editor/ui/dialogs/content/EdConvertToTable.js
+++ b/mozilla/editor/ui/dialogs/content/EdConvertToTable.js
@@ -39,13 +39,11 @@ function Startup()
dialog.sepRadioGroup = document.getElementById("SepRadioGroup");
dialog.sepCharacterInput = document.getElementById("SepCharacterInput");
dialog.deleteSepCharacter = document.getElementById("DeleteSepCharacter");
-
+ dialog.collapseSpaces = document.getElementById("CollapseSpaces");
+
// We persist the user's separator character
dialog.sepCharacterInput.value = dialog.sepRadioGroup.getAttribute("character");
- // Always default to deleting the separator character
- dialog.deleteSepCharacter.checked = true;
-
gIndex = dialog.sepRadioGroup.getAttribute("index");
switch (gIndex)
@@ -62,7 +60,7 @@ function Startup()
break;
}
- // Set initial enable state on character input
+ // Set initial enable state on character input and "collapse" checkbox
SelectCharacter(gIndex);
SetTextboxFocus(dialog.sepRadioGroup);
@@ -78,8 +76,8 @@ function InputSepCharacter()
if (str.length > 1)
str.slice(0,1);
- // We can never allow tag delimeters for separator character
- if (str == "<" || str == ">")
+ // We can never allow tag or entity delimeters for separator character
+ if (str == "<" || str == ">" || str == "&" || str == ";" || str == " ")
str = "";
dialog.sepCharacterInput.value = str;
@@ -89,6 +87,7 @@ function SelectCharacter(radioGroupIndex)
{
gIndex = radioGroupIndex;
SetElementEnabledById("SepCharacterInput", gIndex == gOtherIndex);
+ SetElementEnabledById("CollapseSpaces", gIndex == gSpaceIndex);
}
function onOK()
@@ -129,7 +128,8 @@ function onOK()
str = str.replace(/(
)+$/, "");
// Reduce multiple internal
to just 1
- str = str.replace(/(
)+/g, "
");
+ // TODO: Maybe add a checkbox to let user decide
+ //str = str.replace(/(
)+/g, "
");
// Trim leading and trailing spaces
str = str.replace(/^\s+|\s+$/, "");
@@ -209,9 +209,6 @@ function onOK()
if (dialog.deleteSepCharacter.checked)
{
replaceString = "";
- // Replace one or more adjacent spaces
- if (sepCharacter == " ")
- sepCharacter += "\+";
}
else
{
@@ -219,11 +216,26 @@ function onOK()
// so include it at start of string to replace
replaceString = sepCharacter;
}
+
replaceString += "