8
0
Pārlūkot izejas kodu

Fixed: remove _range property from json object returned by `AttributeDelta#toJSON`.

Szymon Cofalik 8 gadi atpakaļ
vecāks
revīzija
f8b65d4adb

+ 11 - 0
packages/ckeditor5-engine/src/model/delta/attributedelta.js

@@ -90,6 +90,17 @@ export default class AttributeDelta extends Delta {
 	/**
 	 * @inheritDoc
 	 */
+	toJSON() {
+		const json = super.toJSON();
+
+		delete json._range;
+
+		return json;
+	}
+
+	/**
+	 * @inheritDoc
+	 */
 	static get className() {
 		return 'engine.model.delta.AttributeDelta';
 	}

+ 7 - 0
packages/ckeditor5-engine/tests/model/delta/attributedelta.js

@@ -13,6 +13,7 @@ import Element from '../../../src/model/element';
 import AttributeDelta from '../../../src/model/delta/attributedelta';
 import { RootAttributeDelta } from '../../../src/model/delta/attributedelta';
 import AttributeOperation from '../../../src/model/operation/attributeoperation';
+import { jsonParseStringify } from '../../../tests/model/_utils/utils';
 
 describe( 'Batch', () => {
 	let batch, doc, root;
@@ -507,6 +508,12 @@ describe( 'AttributeDelta', () => {
 	it( 'should provide proper className', () => {
 		expect( AttributeDelta.className ).to.equal( 'engine.model.delta.AttributeDelta' );
 	} );
+
+	it( 'should not have _range property when converted to JSON', () => {
+		const json = jsonParseStringify( delta );
+
+		expect( json ).not.to.have.property( '_range' );
+	} );
 } );
 
 describe( 'RootAttributeDelta', () => {