mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 03:08:42 +00:00
(bug 42937) Removing copy/pasted link annotations removes the original as well
Basically a copy should be a deep copy, so this was a blatant mistake. Change-Id: I702fb425783293c4ddde8b9ac568dfe6abc8f782
This commit is contained in:
parent
50f89a675e
commit
29cdbe0ea5
|
@ -12,21 +12,33 @@
|
||||||
* @abstract
|
* @abstract
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ve.Node}
|
* @extends {ve.Node}
|
||||||
* @param {Array} data Balanced sliced data
|
* @param {Array} data Balanced sliced data (will be deep copied internally)
|
||||||
* @param {ve.Range} [range] Original context within data
|
* @param {ve.Range} [range] Original context within data
|
||||||
*/
|
*/
|
||||||
ve.dm.DocumentSlice = function VeDmDocumentSlice( data, range ) {
|
ve.dm.DocumentSlice = function VeDmDocumentSlice( data, range ) {
|
||||||
// Properties
|
// Properties
|
||||||
this.data = data;
|
this.data = ve.copyArray( data );
|
||||||
this.range = range || new ve.Range( 0, data.length );
|
this.range = range || new ve.Range( 0, data.length );
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a deep copy the sliced data.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @returns {Array} Document data
|
||||||
|
*/
|
||||||
ve.dm.DocumentSlice.prototype.getData = function () {
|
ve.dm.DocumentSlice.prototype.getData = function () {
|
||||||
return this.data.slice( this.range.start, this.range.end );
|
return this.data.slice( this.range.start, this.range.end );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a balanced version of the sliced data.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @returns {Array} Document data
|
||||||
|
*/
|
||||||
ve.dm.DocumentSlice.prototype.getBalancedData = function () {
|
ve.dm.DocumentSlice.prototype.getBalancedData = function () {
|
||||||
return this.data.slice( 0 );
|
return this.data.slice( 0 );
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue