Strip last character from selection if blank

SVN revision: 1805
This commit is contained in:
Stefan Ritt 2007-03-01 21:51:18 +00:00
parent d89b2dd71e
commit 6701a08c86

View File

@ -6,7 +6,10 @@ function getSelection(text)
rng.colapse; rng.colapse;
return rng.text; return rng.text;
} else if (browser == 'Mozilla') } else if (browser == 'Mozilla')
return text.value.substring(text.selectionStart, text.selectionEnd); if (text.selectionEnd > 0 && text.value.charAt(text.selectionEnd-1) == ' ')
return text.value.substring(text.selectionStart, text.selectionEnd-1);
else
return text.value.substring(text.selectionStart, text.selectionEnd);
else else
return ""; return "";
} }
@ -28,6 +31,8 @@ function replaceSelection(doc, text, newSelection, cursorPos)
} else if (browser == 'Mozilla') { } else if (browser == 'Mozilla') {
start = text.selectionStart; start = text.selectionStart;
stop = text.selectionEnd; stop = text.selectionEnd;
if (text.selectionEnd > 0 && text.value.charAt(text.selectionEnd-1) == ' ')
stop--;
end = text.textLength; end = text.textLength;
endtext = text.value.substring(stop, end); endtext = text.value.substring(stop, end);
starttext = text.value.substring(0, start); starttext = text.value.substring(0, start);
@ -68,6 +73,8 @@ function elcode1(text, tag, value, selection)
pos = value.length; pos = value.length;
else if (tag == 'LIST') else if (tag == 'LIST')
pos = 11; pos = 11;
else if (tag == 'TABLE')
pos = 19;
else if (value == '') else if (value == '')
pos = tag.length + 2; pos = tag.length + 2;
else else