if clozing on a word boundary, ensure it's preserved

This commit is contained in:
Damien Elmes 2011-04-22 06:59:40 +09:00
parent 6af10e4d01
commit 6f8a3c5216

View file

@ -124,7 +124,12 @@ function wrap(front, back) {
span.appendChild(content); span.appendChild(content);
s.removeAllRanges(); s.removeAllRanges();
s.addRange(r); s.addRange(r);
setFormat('inserthtml', front + span.innerHTML + back); var new_ = front + span.innerHTML + back;
var f = currentField.innerHTML;
if (f.length && f[f.length-1] === " ") {
new_ = " " + new_;
}
setFormat('inserthtml', new_);
}; };
function setFields(fields, focusTo) { function setFields(fields, focusTo) {