Ver código fonte

Removed circular imports.

Maciej Bukowski 8 anos atrás
pai
commit
216a511eff

+ 2 - 2
packages/ckeditor5-engine/src/model/documentselection.js

@@ -10,6 +10,7 @@
 import mix from '@ckeditor/ckeditor5-utils/src/mix';
 import mix from '@ckeditor/ckeditor5-utils/src/mix';
 import EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin';
 import EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin';
 
 
+import Selection from './selection';
 import Position from './position';
 import Position from './position';
 import LiveRange from './liverange';
 import LiveRange from './liverange';
 import Text from './text';
 import Text from './text';
@@ -18,8 +19,6 @@ import toMap from '@ckeditor/ckeditor5-utils/src/tomap';
 import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 import log from '@ckeditor/ckeditor5-utils/src/log';
 import log from '@ckeditor/ckeditor5-utils/src/log';
 
 
-import Selection from './selection';
-
 const attrOpTypes = new Set(
 const attrOpTypes = new Set(
 	[ 'addAttribute', 'removeAttribute', 'changeAttribute', 'addRootAttribute', 'removeRootAttribute', 'changeRootAttribute' ]
 	[ 'addAttribute', 'removeAttribute', 'changeAttribute', 'addRootAttribute', 'removeRootAttribute', 'changeRootAttribute' ]
 );
 );
@@ -411,6 +410,7 @@ mix( DocumentSelection, EmitterMixin );
 //
 //
 // @extends module:engine/model/selection~Selection
 // @extends module:engine/model/selection~Selection
 //
 //
+
 class LiveSelection extends Selection {
 class LiveSelection extends Selection {
 	// Creates an empty live selection for given {@link module:engine/model/document~Document}.
 	// Creates an empty live selection for given {@link module:engine/model/document~Document}.
 	// @param {module:engine/model/document~Document} doc Document which owns this selection.
 	// @param {module:engine/model/document~Document} doc Document which owns this selection.

+ 1 - 2
packages/ckeditor5-engine/src/model/selection.js

@@ -14,7 +14,6 @@ import EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin';
 import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 import mix from '@ckeditor/ckeditor5-utils/src/mix';
 import mix from '@ckeditor/ckeditor5-utils/src/mix';
 import isIterable from '@ckeditor/ckeditor5-utils/src/isiterable';
 import isIterable from '@ckeditor/ckeditor5-utils/src/isiterable';
-import DocumentSelection from './documentselection';
 
 
 /**
 /**
  * `Selection` is a group of {@link module:engine/model/range~Range ranges} which has a direction specified by
  * `Selection` is a group of {@link module:engine/model/range~Range ranges} which has a direction specified by
@@ -304,7 +303,7 @@ export default class Selection {
 			this._setRanges( [] );
 			this._setRanges( [] );
 		} else if ( selectable instanceof Selection ) {
 		} else if ( selectable instanceof Selection ) {
 			this._setRanges( selectable.getRanges(), selectable.isBackward );
 			this._setRanges( selectable.getRanges(), selectable.isBackward );
-		} else if ( selectable instanceof DocumentSelection ) {
+		} else if ( selectable._selection && selectable._selection instanceof Selection ) {
 			this._setRanges( selectable.getRanges(), selectable.isBackward );
 			this._setRanges( selectable.getRanges(), selectable.isBackward );
 		} else if ( selectable instanceof Range ) {
 		} else if ( selectable instanceof Range ) {
 			this._setRanges( [ selectable ], backwardSelectionOrOffset );
 			this._setRanges( [ selectable ], backwardSelectionOrOffset );