浏览代码

Aligned code to changes in Selection API.

Maciej Bukowski 7 年之前
父节点
当前提交
a073f3c8ab
共有 2 个文件被更改,包括 3 次插入5 次删除
  1. 1 1
      packages/ckeditor5-typing/src/deletecommand.js
  2. 2 4
      packages/ckeditor5-typing/tests/input.js

+ 1 - 1
packages/ckeditor5-typing/src/deletecommand.js

@@ -67,7 +67,7 @@ export default class DeleteCommand extends Command {
 		model.enqueueChange( this._buffer.batch, writer => {
 			this._buffer.lock();
 
-			const selection = Selection.createFromSelection( doc.selection );
+			const selection = new Selection( doc.selection );
 
 			// Do not replace the whole selected content if selection was collapsed.
 			// This prevents such situation:

+ 2 - 4
packages/ckeditor5-typing/tests/input.js

@@ -994,8 +994,7 @@ describe( 'Input feature', () => {
 
 			const paragraph = viewRoot.getChild( 0 );
 			const strong = paragraph.getChild( 0 );
-			const viewSelection = new ViewSelection();
-			viewSelection.setTo( paragraph, 0 );
+			const viewSelection = new ViewSelection( paragraph, 0 );
 
 			// Simulate mutations and DOM change.
 			domRoot.childNodes[ 0 ].innerHTML = '<b>textx</b>';
@@ -1019,8 +1018,7 @@ describe( 'Input feature', () => {
 
 			const paragraph = viewRoot.getChild( 0 );
 			const strong = paragraph.getChild( 0 );
-			const viewSelection = new ViewSelection();
-			viewSelection.setTo( paragraph );
+			const viewSelection = new ViewSelection( paragraph );
 
 			// Simulate mutations and DOM change.
 			domRoot.childNodes[ 0 ].innerHTML = '<strong>Foo bar </strong><b>apple</b>';