|
|
@@ -8,8 +8,6 @@
|
|
|
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
|
|
|
import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
|
|
|
|
|
|
-import Element from '@ckeditor/ckeditor5-engine/src/model/element';
|
|
|
-import Text from '@ckeditor/ckeditor5-engine/src/model/text';
|
|
|
import Position from '@ckeditor/ckeditor5-engine/src/model/position';
|
|
|
import Range from '@ckeditor/ckeditor5-engine/src/model/range';
|
|
|
|
|
|
@@ -52,18 +50,17 @@ function wait( delay ) {
|
|
|
}
|
|
|
|
|
|
function startExternalInsert( editor ) {
|
|
|
- const document = editor.document;
|
|
|
- const bath = document.batch( 'transparent' );
|
|
|
+ const model = editor.model;
|
|
|
|
|
|
function type( path, text ) {
|
|
|
return new Promise( resolve => {
|
|
|
- let position = new Position( document.getRoot(), path );
|
|
|
+ let position = new Position( model.document.getRoot(), path );
|
|
|
let index = 0;
|
|
|
|
|
|
function typing() {
|
|
|
wait( 40 ).then( () => {
|
|
|
- document.enqueueChanges( () => {
|
|
|
- bath.insert( position, new Text( text[ index ] ) );
|
|
|
+ model.enqueueChange( 'transparent', writer => {
|
|
|
+ writer.insertText( text[ index ], position );
|
|
|
position = position.getShiftedBy( 1 );
|
|
|
|
|
|
const nextLetter = text[ ++index ];
|
|
|
@@ -84,8 +81,8 @@ function startExternalInsert( editor ) {
|
|
|
|
|
|
function insertNewLine( path ) {
|
|
|
return wait( 200 ).then( () => {
|
|
|
- document.enqueueChanges( () => {
|
|
|
- bath.insert( new Position( document.getRoot(), path ), new Element( 'paragraph' ) );
|
|
|
+ model.enqueueChange( 'transparent', writer => {
|
|
|
+ writer.insertElement( 'paragraph', new Position( model.document.getRoot(), path ) );
|
|
|
} );
|
|
|
|
|
|
return Promise.resolve();
|
|
|
@@ -105,12 +102,11 @@ function startExternalInsert( editor ) {
|
|
|
}
|
|
|
|
|
|
function startExternalDelete( editor ) {
|
|
|
- const document = editor.document;
|
|
|
- const bath = document.batch( 'transparent' );
|
|
|
+ const model = editor.model;
|
|
|
|
|
|
wait( 3000 ).then( () => {
|
|
|
- document.enqueueChanges( () => {
|
|
|
- bath.remove( Range.createFromPositionAndShift( new Position( document.getRoot(), [ 1 ] ), 1 ) );
|
|
|
+ model.enqueueChange( 'transparent', writer => {
|
|
|
+ writer.remove( Range.createFromPositionAndShift( new Position( model.document.getRoot(), [ 1 ] ), 1 ) );
|
|
|
} );
|
|
|
} );
|
|
|
}
|