Fix replaceNonBreakingSpace() to not modify the linear model

It was replacing spaces with  s in its copy of a slice of linmod
data, but the copy was a shallow copy, so when modifying annotated
spaces it would modify the actual data. Fixed by detecting this case and
cloning the character's array before modifying it.

Change-Id: Ic96ed34605a302af18f274a0faa6d0f650f5b771
This commit is contained in:
Catrope 2012-08-10 15:39:57 -07:00
parent a0fa371481
commit 5d974ed1e1

View file

@ -207,6 +207,8 @@ ve.ce.TextNode.prototype.getHtml = function () {
function replaceWithNonBreakingSpace( index, data ) {
if ( ve.isArray( data[index] ) ) {
// Don't modify the original array, clone it first
data[index] = data[index].slice( 0 );
data[index][0] = ' ';
} else {
data[index] = ' ';