mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
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:
parent
a0fa371481
commit
5d974ed1e1
|
@ -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] = ' ';
|
||||
|
|
Loading…
Reference in a new issue